diff options
author | Ted Gould <ted@canonical.com> | 2009-04-21 15:14:52 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-04-21 15:14:52 -0500 |
commit | 8c6656e5d6a05ad14fe41c12bc2d159c5b3e22ca (patch) | |
tree | 71e23fd506d2dbb61420c5cf701ffdc18bb2194c /src/applet-main.c | |
parent | ae2689289232bb1237f7d37e591fc8c610d069e1 (diff) | |
download | libayatana-indicator-8c6656e5d6a05ad14fe41c12bc2d159c5b3e22ca.tar.gz libayatana-indicator-8c6656e5d6a05ad14fe41c12bc2d159c5b3e22ca.tar.bz2 libayatana-indicator-8c6656e5d6a05ad14fe41c12bc2d159c5b3e22ca.zip |
Changing to an icon and a lable and building our own item
Diffstat (limited to 'src/applet-main.c')
-rw-r--r-- | src/applet-main.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/applet-main.c b/src/applet-main.c index e28009d..74d948a 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -87,17 +87,36 @@ load_module (const gchar * name, GtkWidget * menu) get_label_t lget_label; g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_label)), FALSE); g_return_val_if_fail(lget_label != NULL, FALSE); + GtkLabel * label = lget_label(); get_icon_t lget_icon; g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_icon)), FALSE); g_return_val_if_fail(lget_icon != NULL, FALSE); + GtkImage * icon = lget_icon(); get_menu_t lget_menu; g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_menu)), FALSE); g_return_val_if_fail(lget_menu != NULL, FALSE); + GtkMenu * lmenu = lget_menu(); - GtkWidget * menuitem = GTK_WIDGET(lget_menu()); - g_return_val_if_fail(GTK_MENU_ITEM(menuitem), FALSE); + if (label == NULL && icon == NULL) { + /* This is the case where there is nothing to display, + kinda odd that we'd have a module with nothing. */ + return FALSE; + } + + GtkWidget * menuitem = gtk_menu_item_new(); + GtkWidget * hbox = gtk_hbox_new(FALSE, 3); + if (icon != NULL) { + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(icon), FALSE, FALSE, 0); + } + if (label != NULL) { + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0); + } + + if (menu != NULL) { + gtk_menu_shell_append(GTK_MENU_SHELL(menuitem), GTK_WIDGET(lmenu)); + } gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |