Let the use choose a smaller panel if desired

This commit is contained in:
Pierre Pronchery 2010-01-21 12:23:41 +00:00
parent 271f0d3d79
commit 3071a3266f
3 changed files with 23 additions and 6 deletions

View File

@ -18,6 +18,8 @@
#ifndef PANEL_COMMON_H
# define PANEL_COMMON_H
# include <gtk/gtk.h>
/* Panel */
/* types */
@ -25,13 +27,15 @@ typedef struct _Panel Panel;
typedef struct _PanelPrefs
{
GtkIconSize iconsize;
int monitor;
} PanelPrefs;
/* constants */
#define PANEL_BORDER_WIDTH 4
#define PANEL_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
#define PANEL_ICON_SIZE_SMALL GTK_ICON_SIZE_SMALL_TOOLBAR
#define PANEL_ICON_SIZE_LARGE GTK_ICON_SIZE_LARGE_TOOLBAR
/* functions */

View File

@ -29,7 +29,10 @@
/* usage */
static int _usage(void)
{
fputs("Usage: " PACKAGE " [-m monitor]\n", stderr);
fputs("Usage: " PACKAGE " [-m monitor][-sS]\n"
" -m Monitor to use (default: 0)\n"
" -s Use smaller icons\n"
" -S Use larger icons (default)\n", stderr);
return 1;
}
@ -47,7 +50,8 @@ int main(int argc, char * argv[])
gtk_init(&argc, &argv);
memset(&prefs, 0, sizeof(prefs));
while((o = getopt(argc, argv, "m:")) != -1)
prefs.iconsize = PANEL_ICON_SIZE_LARGE;
while((o = getopt(argc, argv, "m:sS")) != -1)
switch(o)
{
case 'm':
@ -55,6 +59,12 @@ int main(int argc, char * argv[])
if(optarg[0] == '\0' || *p != '\0')
return _usage();
break;
case 's':
prefs.iconsize = PANEL_ICON_SIZE_SMALL;
break;
case 'S':
prefs.iconsize = PANEL_ICON_SIZE_LARGE;
break;
default:
return _usage();
}

View File

@ -88,11 +88,14 @@ Panel * panel_new(PanelPrefs * prefs)
}
panel->icon_width = 48;
panel->icon_height = 48;
gtk_icon_size_lookup(GTK_ICON_SIZE_LARGE_TOOLBAR, &panel->icon_width,
&panel->icon_height);
if(prefs->iconsize != PANEL_ICON_SIZE_SMALL)
prefs->iconsize = PANEL_ICON_SIZE_LARGE;
if(gtk_icon_size_lookup(prefs->iconsize, &panel->icon_width,
&panel->icon_height) != TRUE)
error_set_print(PACKAGE, 0, "Invalid panel size");
panel->helper.priv = panel;
panel->helper.error = _panel_helper_error;
panel->helper.icon_size = PANEL_ICON_SIZE;
panel->helper.icon_size = prefs->iconsize;
#ifndef EMBEDDED
panel->helper.logout_dialog = _panel_helper_logout_dialog;
#else