Now able to test applets in notification mode as well

This commit is contained in:
Pierre Pronchery 2014-05-16 21:00:18 +02:00
parent 0097dcfc72
commit 78ee7f6b48

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2011-2013 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2011-2014 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Panel */ /* This file is part of DeforaOS Desktop Panel */
/* This program is free software: you can redistribute it and/or modify /* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -52,20 +52,19 @@
/* private */ /* private */
/* prototypes */ /* prototypes */
static int _test(GtkIconSize iconsize, char * applets[]); static int _test(PanelAppletType type, GtkIconSize iconsize, char * applets[]);
static int _usage(void); static int _usage(void);
/* functions */ /* functions */
/* test */ /* test */
static int _test(GtkIconSize iconsize, char * applets[]) static int _test(PanelAppletType type, GtkIconSize iconsize, char * applets[])
{ {
Panel panel; Panel panel;
size_t i; size_t i;
_panel_init(&panel, PANEL_WINDOW_POSITION_MANAGED, _panel_init(&panel, PANEL_WINDOW_POSITION_MANAGED, type, iconsize);
PANEL_APPLET_TYPE_NORMAL, iconsize);
_panel_set_title(&panel, "Applet tester"); _panel_set_title(&panel, "Applet tester");
for(i = 0; applets[i] != NULL; i++) for(i = 0; applets[i] != NULL; i++)
if(_panel_append(&panel, PANEL_POSITION_TOP, applets[i]) != 0) if(_panel_append(&panel, PANEL_POSITION_TOP, applets[i]) != 0)
@ -80,7 +79,7 @@ static int _test(GtkIconSize iconsize, char * applets[])
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
fputs("Usage: " PROGNAME " [-L|-S|-X|-x] applet...\n" fputs("Usage: " PROGNAME " [-L|-S|-X|-x][-n] applet...\n"
" " PROGNAME " -l\n" " " PROGNAME " -l\n"
" -l Lists the plug-ins available\n", stderr); " -l Lists the plug-ins available\n", stderr);
return 1; return 1;
@ -92,6 +91,7 @@ static int _usage(void)
/* main */ /* main */
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
PanelAppletType type = PANEL_APPLET_TYPE_NORMAL;
GtkIconSize iconsize = GTK_ICON_SIZE_LARGE_TOOLBAR; GtkIconSize iconsize = GTK_ICON_SIZE_LARGE_TOOLBAR;
GtkIconSize huge; GtkIconSize huge;
int o; int o;
@ -104,7 +104,7 @@ int main(int argc, char * argv[])
if((huge = gtk_icon_size_from_name("panel-huge")) if((huge = gtk_icon_size_from_name("panel-huge"))
== GTK_ICON_SIZE_INVALID) == GTK_ICON_SIZE_INVALID)
huge = gtk_icon_size_register("panel-huge", 64, 64); huge = gtk_icon_size_register("panel-huge", 64, 64);
while((o = getopt(argc, argv, "LlSXx")) != -1) while((o = getopt(argc, argv, "LlnSXx")) != -1)
switch(o) switch(o)
{ {
case 'L': case 'L':
@ -112,6 +112,9 @@ int main(int argc, char * argv[])
break; break;
case 'l': case 'l':
return _applet_list(); return _applet_list();
case 'n':
type = PANEL_APPLET_TYPE_NOTIFICATION;
break;
case 'S': case 'S':
iconsize = GTK_ICON_SIZE_SMALL_TOOLBAR; iconsize = GTK_ICON_SIZE_SMALL_TOOLBAR;
break; break;
@ -126,6 +129,6 @@ int main(int argc, char * argv[])
} }
if(optind == argc) if(optind == argc)
return _usage(); return _usage();
_test(iconsize, &argv[optind]); _test(type, iconsize, &argv[optind]);
return 0; return 0;
} }