ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00596
[Branch ~indicator-applet-developers/indicator-applet/applet] Rev 333: Updating to libindicator 0.3.0 loader interface.
Merge authors:
Ted Gould (ted)
Related merge proposals:
https://code.launchpad.net/~ted/indicator-applet/indicator-update/+merge/14460
proposed by: Ted Gould (ted)
review: Approve - Robert Collins (lifeless)
------------------------------------------------------------
revno: 333 [merge]
committer: Ted Gould <ted@xxxxxxxxxxxxx>
branch nick: applet
timestamp: Thu 2009-11-05 08:32:21 -0600
message:
Updating to libindicator 0.3.0 loader interface.
modified:
configure.ac
src-session/applet-main.c
src/applet-main.c
--
lp:indicator-applet
https://code.launchpad.net/~indicator-applet-developers/indicator-applet/applet
Your team ayatana-commits is subscribed to branch lp:indicator-applet.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-applet/applet/+edit-subscription.
=== modified file 'configure.ac'
--- configure.ac 2009-10-26 19:39:01 +0000
+++ configure.ac 2009-11-04 19:35:11 +0000
@@ -28,7 +28,7 @@
GTK_REQUIRED_VERSION=2.12
PANEL_REQUIRED_VERSION=2.0.0
DBUS_REQUIRED_VERSION=0.76
-INDICATOR_REQUIRED_VERSION=0.1.0
+INDICATOR_REQUIRED_VERSION=0.3.0
PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
libpanelapplet-2.0 >= $PANEL_REQUIRED_VERSION
=== modified file 'src-session/applet-main.c'
--- src-session/applet-main.c 2009-10-26 19:52:45 +0000
+++ src-session/applet-main.c 2009-11-04 20:11:42 +0000
@@ -23,7 +23,7 @@
#include <config.h>
#include <panel-applet.h>
-#include "libindicator/indicator.h"
+#include "libindicator/indicator-object.h"
static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data);
@@ -59,57 +59,35 @@
g_debug("Loading Module: %s", name);
gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
- GModule * module = g_module_open(fullpath,
- G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+ IndicatorObject * io = indicator_object_new_from_file(fullpath);
g_free(fullpath);
- g_return_val_if_fail(module != NULL, FALSE);
-
- 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 = 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 = 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 = 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;
- }
-
- 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);
- }
- gtk_container_add(GTK_CONTAINER(menuitem), hbox);
- gtk_widget_show(hbox);
-
- if (lmenu != NULL) {
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(lmenu));
- }
-
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- gtk_widget_show(menuitem);
+
+ GList * entries = indicator_object_get_entries(io);
+ GList * entry = NULL;
+
+ for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+ IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+
+ GtkWidget * menuitem = gtk_menu_item_new();
+ GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
+ if (entrydata->image != NULL) {
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->image), FALSE, FALSE, 0);
+ }
+ if (entrydata->label != NULL) {
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->label), FALSE, FALSE, 0);
+ }
+ gtk_container_add(GTK_CONTAINER(menuitem), hbox);
+ gtk_widget_show(hbox);
+
+ if (entrydata->menu != NULL) {
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entrydata->menu));
+ }
+
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+ gtk_widget_show(menuitem);
+ }
+
+ g_list_free(entries);
return TRUE;
}
=== modified file 'src/applet-main.c'
--- src/applet-main.c 2009-10-26 19:52:45 +0000
+++ src/applet-main.c 2009-11-04 20:11:04 +0000
@@ -23,7 +23,7 @@
#include <config.h>
#include <panel-applet.h>
-#include "libindicator/indicator.h"
+#include "libindicator/indicator-object.h"
static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data);
@@ -59,57 +59,35 @@
g_debug("Loading Module: %s", name);
gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
- GModule * module = g_module_open(fullpath,
- G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+ IndicatorObject * io = indicator_object_new_from_file(fullpath);
g_free(fullpath);
- g_return_val_if_fail(module != NULL, FALSE);
-
- 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 = 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 = 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 = 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;
- }
-
- 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);
- }
- gtk_container_add(GTK_CONTAINER(menuitem), hbox);
- gtk_widget_show(hbox);
-
- if (lmenu != NULL) {
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(lmenu));
- }
-
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- gtk_widget_show(menuitem);
+
+ GList * entries = indicator_object_get_entries(io);
+ GList * entry = NULL;
+
+ for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+ IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+
+ GtkWidget * menuitem = gtk_menu_item_new();
+ GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
+ if (entrydata->image != NULL) {
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->image), FALSE, FALSE, 0);
+ }
+ if (entrydata->label != NULL) {
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->label), FALSE, FALSE, 0);
+ }
+ gtk_container_add(GTK_CONTAINER(menuitem), hbox);
+ gtk_widget_show(hbox);
+
+ if (entrydata->menu != NULL) {
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entrydata->menu));
+ }
+
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+ gtk_widget_show(menuitem);
+ }
+
+ g_list_free(entries);
return TRUE;
}