From b0c9eb5bd9000d8f743c6a72f3312a7df587f264 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 21 Apr 2009 14:35:49 -0500 Subject: Moving the indicators directory to match libindicator --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 818bdd9..02b70c1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,7 +5,7 @@ libexec_PROGRAMS = \ indicator_applet_CFLAGS = \ -DG_LOG_DOMAIN=\""Indicator-Applet"\" \ -DDATADIR=\""$(datadir)"\" \ - -DINDICATOR_DIR=\""$(libdir)/indicators/1"\" \ + -DINDICATOR_DIR=\""$(libdir)/indicators/2"\" \ $(APPLET_CFLAGS) indicator_applet_SOURCES = \ -- cgit v1.2.3 From 4023d350d22120cd8405307f0e0465bdb95fbae6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 21 Apr 2009 14:49:57 -0500 Subject: Fixing and using the new indicator header. This will help to connect things together and make them actually work in a reasonably type safe way. --- src/applet-main.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/applet-main.c b/src/applet-main.c index 310cfe9..795c2fb 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -24,7 +24,8 @@ with this program. If not, see . #include #include -#define SYMBOL_NAME "get_menu_item" +#include "libindicator/indicator.h" + #define ICONS_DIR (DATADIR G_DIR_SEPARATOR_S "indicator-applet" G_DIR_SEPARATOR_S "icons") static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data); @@ -79,11 +80,19 @@ load_module (const gchar * name, GtkWidget * menu) g_free(fullpath); g_return_val_if_fail(module != NULL, FALSE); - GtkWidget * (*make_item)(void); - g_return_val_if_fail(g_module_symbol(module, SYMBOL_NAME, (gpointer *)(&make_item)), FALSE); - g_return_val_if_fail(make_item != NULL, FALSE); + 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); + + 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); + + 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); - GtkWidget * menuitem = make_item(); + GtkWidget * menuitem = GTK_WIDGET(lget_menu()); g_return_val_if_fail(GTK_MENU_ITEM(menuitem), FALSE); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); -- cgit v1.2.3 From ae2689289232bb1237f7d37e591fc8c610d069e1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 21 Apr 2009 15:01:19 -0500 Subject: Putting in and checking version information to ensure we all agree about the header version --- src/applet-main.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/applet-main.c b/src/applet-main.c index 795c2fb..e28009d 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -80,6 +80,10 @@ load_module (const gchar * name, GtkWidget * menu) g_free(fullpath); g_return_val_if_fail(module != NULL, FALSE); + gchar * version; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_VERSION_S, (gpointer *)(&version)), FALSE); + g_return_val_if_fail(INDICATOR_VERSION_CHECK(version), FALSE); + 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); -- cgit v1.2.3 From 8c6656e5d6a05ad14fe41c12bc2d159c5b3e22ca Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 21 Apr 2009 15:14:52 -0500 Subject: Changing to an icon and a lable and building our own item --- src/applet-main.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src') 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); -- cgit v1.2.3