aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-21 14:49:57 -0500
committerTed Gould <ted@canonical.com>2009-04-21 14:49:57 -0500
commit4023d350d22120cd8405307f0e0465bdb95fbae6 (patch)
tree1937c009377b0ab59407cf3a353fcb453a66a700
parentb0c9eb5bd9000d8f743c6a72f3312a7df587f264 (diff)
downloadlibayatana-indicator-4023d350d22120cd8405307f0e0465bdb95fbae6.tar.gz
libayatana-indicator-4023d350d22120cd8405307f0e0465bdb95fbae6.tar.bz2
libayatana-indicator-4023d350d22120cd8405307f0e0465bdb95fbae6.zip
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.
-rw-r--r--libindicator/indicator.h9
-rw-r--r--src/applet-main.c19
2 files changed, 20 insertions, 8 deletions
diff --git a/libindicator/indicator.h b/libindicator/indicator.h
index 9afaa4f..daee3c8 100644
--- a/libindicator/indicator.h
+++ b/libindicator/indicator.h
@@ -5,13 +5,16 @@
#include <gtk/gtk.h>
#define INDICATOR_GET_LABEL_S "get_label"
-GtkLabel * get_label (void);
+typedef GtkLabel * (*get_label_t)(void);
+get_label_t get_label;
#define INDICATOR_GET_ICON_S "get_icon"
-GtkImage * get_icon (void);
+typedef GtkImage * (*get_icon_t) (void);
+get_icon_t get_icon;
#define INDICATOR_GET_MENU_S "get_menu"
-GtkMenu * get_menu (void);
+typedef GtkMenu * (*get_menu_t) (void);
+get_menu_t get_menu;
#endif /* __LIBINDICATOR_INDICATOR_H_SEEN__ */
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 <http://www.gnu.org/licenses/>.
#include <panel-applet.h>
#include <libgnomeui/gnome-ui-init.h>
-#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);