Fixed crash on startup
This commit is contained in:
parent
9b6a65d925
commit
f39d28029a
|
@ -38,11 +38,19 @@ typedef enum _WifiBrowserResponse
|
||||||
WBR_SAVE_CONFIGURATION
|
WBR_SAVE_CONFIGURATION
|
||||||
} WifiBrowserResponse;
|
} WifiBrowserResponse;
|
||||||
|
|
||||||
|
struct _Panel
|
||||||
|
{
|
||||||
|
Config * config;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static int _error(Panel * panel, char const * message, int ret);
|
static int _error(Panel * panel, char const * message, int ret);
|
||||||
static int _usage(void);
|
static int _usage(void);
|
||||||
|
|
||||||
|
static char const * _helper_config_get(Panel * panel, char const * section,
|
||||||
|
char const * variable);
|
||||||
|
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
static gboolean _wifibrowser_on_closex(gpointer data);
|
static gboolean _wifibrowser_on_closex(gpointer data);
|
||||||
static void _wifibrowser_on_response(GtkWidget * widget, gint arg1,
|
static void _wifibrowser_on_response(GtkWidget * widget, gint arg1,
|
||||||
|
@ -67,6 +75,17 @@ static int _usage(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* helpers */
|
||||||
|
/* helper_config_get */
|
||||||
|
static char const * _helper_config_get(Panel * panel, char const * section,
|
||||||
|
char const * variable)
|
||||||
|
{
|
||||||
|
if(panel->config == NULL)
|
||||||
|
return NULL;
|
||||||
|
return config_get(panel->config, section, variable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
/* wifibrowser_on_closex */
|
/* wifibrowser_on_closex */
|
||||||
static gboolean _wifibrowser_on_closex(gpointer data)
|
static gboolean _wifibrowser_on_closex(gpointer data)
|
||||||
|
@ -110,6 +129,7 @@ static void _wifibrowser_on_response(GtkWidget * widget, gint arg1,
|
||||||
/* main */
|
/* main */
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
|
Panel panel;
|
||||||
PanelAppletHelper helper;
|
PanelAppletHelper helper;
|
||||||
WPA * wpa;
|
WPA * wpa;
|
||||||
GtkWidget * window;
|
GtkWidget * window;
|
||||||
|
@ -119,10 +139,14 @@ int main(int argc, char * argv[])
|
||||||
GtkCellRenderer * renderer;
|
GtkCellRenderer * renderer;
|
||||||
GtkTreeViewColumn * column;
|
GtkTreeViewColumn * column;
|
||||||
|
|
||||||
|
panel.config = config_new();
|
||||||
|
/* FIXME load the configuration */
|
||||||
memset(&helper, 0, sizeof(helper));
|
memset(&helper, 0, sizeof(helper));
|
||||||
|
helper.panel = &panel;
|
||||||
helper.type = PANEL_APPLET_TYPE_NORMAL;
|
helper.type = PANEL_APPLET_TYPE_NORMAL;
|
||||||
helper.icon_size = GTK_ICON_SIZE_MENU;
|
helper.icon_size = GTK_ICON_SIZE_MENU;
|
||||||
helper.error = _error;
|
helper.error = _error;
|
||||||
|
helper.config_get = _helper_config_get;
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
if(optind != argc)
|
if(optind != argc)
|
||||||
return _usage();
|
return _usage();
|
||||||
|
@ -176,5 +200,7 @@ int main(int argc, char * argv[])
|
||||||
gtk_widget_show_all(window);
|
gtk_widget_show_all(window);
|
||||||
gtk_main();
|
gtk_main();
|
||||||
_wpa_destroy(wpa);
|
_wpa_destroy(wpa);
|
||||||
|
if(panel.config != NULL)
|
||||||
|
config_delete(panel.config);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user