aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-custom.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-11-06 14:02:38 -0600
committerTed Gould <ted@canonical.com>2009-11-06 14:02:38 -0600
commitfaef47fd05128981c33057236dca7bedab9dd639 (patch)
treed14d5707d673170a77e58c96f884eb2263c6343d /src/indicator-custom.c
parent463ca24ae82ecadaf319a42dc903301afa2c9b2b (diff)
downloadayatana-indicator-application-faef47fd05128981c33057236dca7bedab9dd639.tar.gz
ayatana-indicator-application-faef47fd05128981c33057236dca7bedab9dd639.tar.bz2
ayatana-indicator-application-faef47fd05128981c33057236dca7bedab9dd639.zip
Fleshing out the application added stuff
Diffstat (limited to 'src/indicator-custom.c')
-rw-r--r--src/indicator-custom.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/indicator-custom.c b/src/indicator-custom.c
index f9577fb..7cb9142 100644
--- a/src/indicator-custom.c
+++ b/src/indicator-custom.c
@@ -2,9 +2,11 @@
/* G Stuff */
#include <glib.h>
#include <glib-object.h>
+#include <gtk/gtk.h>
/* DBus Stuff */
#include <dbus/dbus-glib.h>
+#include <libdbusmenu-gtk/menu.h>
/* Indicator Stuff */
#include <libindicator/indicator.h>
@@ -226,10 +228,23 @@ get_entries (IndicatorObject * io)
return retval;
}
+/* Here we respond to new applications by building up the
+ ApplicationEntry and signaling the indicator host that
+ we've got a new indicator. */
static void
application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, IndicatorCustom * custom)
{
+ IndicatorCustomPrivate * priv = INDICATOR_CUSTOM_GET_PRIVATE(custom);
+ ApplicationEntry * app = g_new(ApplicationEntry, 1);
+
+ app->position = position;
+ app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU));
+ app->entry.label = NULL;
+ app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject));
+
+ priv->applications = g_list_prepend(priv->applications, app);
+ g_signal_emit(G_OBJECT(custom), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, &(app->entry), TRUE);
return;
}
@@ -240,6 +255,8 @@ application_removed (DBusGProxy * proxy, gint position , IndicatorCustom * custo
return;
}
+/* This repsonds to the list of applications that the service
+ has and calls application_added on each one of them. */
static void
get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata)
{