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 From 18397c82725b7cee22bf82b0539a4fb36dd49fe9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Apr 2009 17:08:17 -0500 Subject: Turning versions into a function and adding a name symbol. Not yet used though. --- src/applet-main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/applet-main.c b/src/applet-main.c index 74d948a..f979beb 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -80,9 +80,12 @@ 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_version_t lget_version; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_VERSION_S, (gpointer *)(&lget_version)), FALSE); + if (!INDICATOR_VERSION_CHECK(lget_version())) { + g_warning("Indicator using API version '%s' we're expecting '%s'", lget_version(), INDICATOR_VERSION); + return FALSE; + } get_label_t lget_label; g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_label)), FALSE); -- cgit v1.2.3 From d075aeec9ff17ffa5847d06246854689236d3876 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Apr 2009 22:02:05 -0500 Subject: Oops, cut and paste error, pulling up the wrong symbols --- src/applet-main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/applet-main.c b/src/applet-main.c index f979beb..1f538ae 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -80,31 +80,32 @@ load_module (const gchar * name, GtkWidget * menu) g_free(fullpath); g_return_val_if_fail(module != NULL, FALSE); - get_version_t lget_version; + get_version_t lget_version = NULL; g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_VERSION_S, (gpointer *)(&lget_version)), FALSE); if (!INDICATOR_VERSION_CHECK(lget_version())) { g_warning("Indicator using API version '%s' we're expecting '%s'", lget_version(), INDICATOR_VERSION); return FALSE; } - get_label_t lget_label; + get_label_t lget_label = NULL; 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); + get_icon_t lget_icon = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_ICON_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); + get_menu_t lget_menu = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_MENU_S, (gpointer *)(&lget_menu)), FALSE); g_return_val_if_fail(lget_menu != NULL, FALSE); GtkMenu * lmenu = lget_menu(); 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. */ + g_warning("No label or icon. Odd."); return FALSE; } -- cgit v1.2.3 From 2f6ccdfe4ee4d5c30123edcea9fcd4c4d54d8ea7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Apr 2009 22:06:00 -0500 Subject: Slipping in the hbox --- src/applet-main.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/applet-main.c b/src/applet-main.c index 1f538ae..7f3a210 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -117,12 +117,15 @@ load_module (const gchar * name, GtkWidget * menu) if (label != NULL) { gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0); } + gtk_container_add(GTK_CONTAINER(menuitem), hbox); + gtk_widget_show(hbox); if (menu != NULL) { gtk_menu_shell_append(GTK_MENU_SHELL(menuitem), GTK_WIDGET(lmenu)); } gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + gtk_widget_show(menuitem); return TRUE; } -- cgit v1.2.3 From c292100a3d95aac71c7cb943cbd3df9a204c0a70 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Apr 2009 23:44:06 -0500 Subject: Get the submenu set right. --- src/applet-main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/applet-main.c b/src/applet-main.c index 7f3a210..7c39d6d 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -120,8 +120,8 @@ load_module (const gchar * name, GtkWidget * menu) gtk_container_add(GTK_CONTAINER(menuitem), hbox); gtk_widget_show(hbox); - if (menu != NULL) { - gtk_menu_shell_append(GTK_MENU_SHELL(menuitem), GTK_WIDGET(lmenu)); + if (lmenu != NULL) { + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(lmenu)); } gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); -- cgit v1.2.3 From 89235a43e3b1af7f57d1fdbc87021ea49e1d5d05 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 29 Apr 2009 10:11:21 -0500 Subject: Patch from Niel Patel to close the directory after opening it. --- src/applet-main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/applet-main.c b/src/applet-main.c index 310cfe9..535a6ae 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -251,6 +251,7 @@ applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data) if (load_module(name, menubar)) indicators_loaded++; } + g_dir_close (dir); } if (indicators_loaded == 0) { -- cgit v1.2.3 From 63dad6a7ff9cebb6d55d19d8d4233a171100a320 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 8 Jun 2009 09:31:48 -0500 Subject: Patch from Mark Trompell to make suffix checking better. --- src/applet-main.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/applet-main.c b/src/applet-main.c index fca71a7..2aa03ee 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -62,16 +62,10 @@ load_module (const gchar * name, GtkWidget * menu) g_debug("Looking at Module: %s", name); g_return_val_if_fail(name != NULL, FALSE); - guint suffix_len = strlen(G_MODULE_SUFFIX); - guint name_len = strlen(name); - - g_return_val_if_fail(name_len > suffix_len, FALSE); - - int i; - for (i = 0; i < suffix_len; i++) { - if (name[(name_len - suffix_len) + i] != (G_MODULE_SUFFIX)[i]) - return FALSE; + if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) { + return FALSE; } + g_debug("Loading Module: %s", name); gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL); -- cgit v1.2.3 From 8850baa192b65b5b9b4985cab9a08aacb5fed9d1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 4 Aug 2009 00:01:06 +0100 Subject: A bunch of distcheck fixes to clean things up --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 02b70c1..97af739 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,6 +6,7 @@ indicator_applet_CFLAGS = \ -DG_LOG_DOMAIN=\""Indicator-Applet"\" \ -DDATADIR=\""$(datadir)"\" \ -DINDICATOR_DIR=\""$(libdir)/indicators/2"\" \ + -I$(srcdir)/.. \ $(APPLET_CFLAGS) indicator_applet_SOURCES = \ -- cgit v1.2.3