Code cleanup

This commit is contained in:
Pierre Pronchery 2013-11-21 02:30:56 +01:00
parent 0cecb4055e
commit 6ef13c1f12

View File

@ -30,13 +30,12 @@
#include "../config.h" #include "../config.h"
#define _(string) gettext(string) #define _(string) gettext(string)
/* constants */ #ifndef PROGNAME
#ifdef PACKAGE # define PROGNAME "panel-test"
# undef PACKAGE
#endif #endif
#define PACKAGE "panel-test"
#include "helper.c" #include "helper.c"
/* constants */
#ifndef PREFIX #ifndef PREFIX
# define PREFIX "/usr/local" # define PREFIX "/usr/local"
#endif #endif
@ -76,7 +75,7 @@ static int _test(GtkIconSize iconsize, char * applets[])
GdkRectangle rect; GdkRectangle rect;
if((panel.config = config_new()) == NULL) if((panel.config = config_new()) == NULL)
return error_print(PACKAGE); return error_print(PROGNAME);
if(gtk_icon_size_lookup(iconsize, &rect.width, &rect.height) == TRUE) if(gtk_icon_size_lookup(iconsize, &rect.width, &rect.height) == TRUE)
top.height = rect.height; top.height = rect.height;
else else
@ -84,7 +83,7 @@ static int _test(GtkIconSize iconsize, char * applets[])
panel.top = ⊤ panel.top = ⊤
if((filename = _config_get_filename()) != NULL if((filename = _config_get_filename()) != NULL
&& config_load(panel.config, filename) != 0) && config_load(panel.config, filename) != 0)
error_print(PACKAGE); error_print(PROGNAME);
free(filename); free(filename);
panel.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); panel.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(panel.window), "delete-event", G_CALLBACK( g_signal_connect(G_OBJECT(panel.window), "delete-event", G_CALLBACK(
@ -97,7 +96,7 @@ static int _test(GtkIconSize iconsize, char * applets[])
if((plugin = plugin_new(LIBDIR, "Panel", "applets", applets[i])) if((plugin = plugin_new(LIBDIR, "Panel", "applets", applets[i]))
== NULL) == NULL)
{ {
error_print(PACKAGE); error_print(PROGNAME);
continue; continue;
} }
if((pad = plugin_lookup(plugin, "applet")) == NULL) if((pad = plugin_lookup(plugin, "applet")) == NULL)
@ -134,9 +133,9 @@ static int _test(GtkIconSize iconsize, char * applets[])
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
fputs(_("Usage: panel-test [-L|-S|-X|-x] applet...\n" fprintf(stderr, _("Usage: %s [-L|-S|-X|-x] applet...\n"
" panel-test -l\n" " %s -l\n"
" -l Lists the plug-ins available\n"), stderr); " -l Lists the plug-ins available\n"), PROGNAME, PROGNAME);
return 1; return 1;
} }