Added a trick to be able to handle two panels at once (probably temporary)
This commit is contained in:
parent
a2900bfafb
commit
aa7f0ccd30
|
@ -27,7 +27,9 @@ typedef struct _Panel Panel;
|
||||||
|
|
||||||
typedef enum _PanelPosition
|
typedef enum _PanelPosition
|
||||||
{
|
{
|
||||||
PANEL_POSITION_TOP, PANEL_POSITION_BOTTOM
|
PANEL_POSITION_BOTH,
|
||||||
|
PANEL_POSITION_BOTTOM,
|
||||||
|
PANEL_POSITION_TOP
|
||||||
} PanelPosition;
|
} PanelPosition;
|
||||||
|
|
||||||
typedef struct _PanelPrefs
|
typedef struct _PanelPrefs
|
||||||
|
|
35
src/main.c
35
src/main.c
|
@ -44,12 +44,13 @@
|
||||||
/* usage */
|
/* usage */
|
||||||
static int _usage(void)
|
static int _usage(void)
|
||||||
{
|
{
|
||||||
fputs(_("Usage: panel [-m monitor][-BsSTx]\n"
|
fputs(_("Usage: panel [-m monitor][-bBsStx]\n"
|
||||||
" -B Place the panel at the bottom of the screen (default)\n"
|
" -B Place the panel at both top and bottom of the screen\n"
|
||||||
|
" -b Place the panel only at the bottom of the screen\n"
|
||||||
" -m Monitor to use (default: 0)\n"
|
" -m Monitor to use (default: 0)\n"
|
||||||
" -s Use icons the size of a small toolbar\n"
|
" -s Use icons the size of a small toolbar\n"
|
||||||
" -S Use icons the size of a large toolbar (default)\n"
|
" -S Use icons the size of a large toolbar (default)\n"
|
||||||
" -T Place the panel at the top of the screen\n"
|
" -t Place the panel only at the top of the screen\n"
|
||||||
" -x Use icons the size of menus\n"), stderr);
|
" -x Use icons the size of menus\n"), stderr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,8 @@ static void _main_sigchld(int signum);
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
int o;
|
int o;
|
||||||
Panel * panel;
|
Panel * panel1 = NULL;
|
||||||
|
Panel * panel2 = NULL;
|
||||||
PanelPrefs prefs;
|
PanelPrefs prefs;
|
||||||
char * p;
|
char * p;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
@ -72,11 +74,14 @@ int main(int argc, char * argv[])
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
memset(&prefs, 0, sizeof(prefs));
|
memset(&prefs, 0, sizeof(prefs));
|
||||||
prefs.iconsize = PANEL_ICON_SIZE_LARGE;
|
prefs.iconsize = PANEL_ICON_SIZE_LARGE;
|
||||||
prefs.position = PANEL_POSITION_BOTTOM;
|
prefs.position = PANEL_POSITION_BOTH;
|
||||||
while((o = getopt(argc, argv, "Bm:sSTx")) != -1)
|
while((o = getopt(argc, argv, "bBm:sStx")) != -1)
|
||||||
switch(o)
|
switch(o)
|
||||||
{
|
{
|
||||||
case 'B':
|
case 'B':
|
||||||
|
prefs.position = PANEL_POSITION_BOTH;
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
prefs.position = PANEL_POSITION_BOTTOM;
|
prefs.position = PANEL_POSITION_BOTTOM;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
|
@ -90,7 +95,7 @@ int main(int argc, char * argv[])
|
||||||
case 'S':
|
case 'S':
|
||||||
prefs.iconsize = PANEL_ICON_SIZE_LARGE;
|
prefs.iconsize = PANEL_ICON_SIZE_LARGE;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 't':
|
||||||
prefs.position = PANEL_POSITION_TOP;
|
prefs.position = PANEL_POSITION_TOP;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
|
@ -101,15 +106,25 @@ int main(int argc, char * argv[])
|
||||||
}
|
}
|
||||||
if(optind != argc)
|
if(optind != argc)
|
||||||
return _usage();
|
return _usage();
|
||||||
if((panel = panel_new(&prefs)) == NULL)
|
if(prefs.position == PANEL_POSITION_BOTH)
|
||||||
|
{
|
||||||
|
prefs.position = PANEL_POSITION_TOP;
|
||||||
|
if((panel1 = panel_new(&prefs)) == NULL)
|
||||||
|
return 2;
|
||||||
|
prefs.position = PANEL_POSITION_BOTTOM;
|
||||||
|
}
|
||||||
|
if((panel2 = panel_new(&prefs)) == NULL)
|
||||||
return 2;
|
return 2;
|
||||||
sa.sa_handler = _main_sigchld;
|
sa.sa_handler = _main_sigchld;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
if(sigaction(SIGCHLD, &sa, NULL) == -1)
|
if(sigaction(SIGCHLD, &sa, NULL) == -1)
|
||||||
panel_error(panel, "sigaction", 0);
|
panel_error(NULL, "sigaction", 0);
|
||||||
gtk_main();
|
gtk_main();
|
||||||
panel_delete(panel);
|
if(panel1 != NULL)
|
||||||
|
panel_delete(panel1);
|
||||||
|
if(panel2 != NULL)
|
||||||
|
panel_delete(panel2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user