From d496d7ad4557d8bd09030c47140210a666612a92 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 2 Nov 2009 20:08:07 -0600 Subject: We've got a service manager. Now we'll start ourselves up! --- src/indicator-custom.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 1a09a9a..d9763ea 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -1,9 +1,20 @@ -#include "libindicator/indicator.h" +#include +#include +#include "dbus-shared.h" INDICATOR_SET_VERSION INDICATOR_SET_NAME("indicator-custom") +IndicatorServiceManager * sm = NULL; + +void +connected (IndicatorServiceManager * sm, gboolean connected, gpointer not_used) +{ + + return; +} + GtkLabel * get_label (void) { @@ -24,5 +35,8 @@ get_menu (void) gtk_menu_shell_append(GTK_MENU_SHELL(main_menu), loading_item); gtk_widget_show(GTK_WIDGET(loading_item)); + sm = indicator_service_manager_new(INDICATOR_CUSTOM_DBUS_ADDR); + g_signal_connect(G_OBJECT(sm), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connected), NULL); + return main_menu; } -- cgit v1.2.3 From 7532947d4aabdee70733903cdd861a7c305ca987 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 10:09:08 -0600 Subject: Migrating over to the libindicator 0.3.0 API. --- src/indicator-custom.c | 116 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 19 deletions(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index d9763ea..8528a52 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -1,42 +1,120 @@ +#include +#include + #include +#include #include #include "dbus-shared.h" + +#define INDICATOR_CUSTOM_TYPE (indicator_custom_get_type ()) +#define INDICATOR_CUSTOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_CUSTOM_TYPE, IndicatorCustom)) +#define INDICATOR_CUSTOM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_CUSTOM_TYPE, IndicatorCustomClass)) +#define IS_INDICATOR_CUSTOM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_CUSTOM_TYPE)) +#define IS_INDICATOR_CUSTOM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_CUSTOM_TYPE)) +#define INDICATOR_CUSTOM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_CUSTOM_TYPE, IndicatorCustomClass)) + +typedef struct _IndicatorCustom IndicatorCustom; +typedef struct _IndicatorCustomClass IndicatorCustomClass; + +struct _IndicatorCustomClass { + IndicatorObjectClass parent_class; +}; + +struct _IndicatorCustom { + IndicatorObject parent; +}; + +GType indicator_custom_get_type (void); + INDICATOR_SET_VERSION -INDICATOR_SET_NAME("indicator-custom") +INDICATOR_SET_TYPE(INDICATOR_CUSTOM_TYPE) -IndicatorServiceManager * sm = NULL; -void -connected (IndicatorServiceManager * sm, gboolean connected, gpointer not_used) +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +typedef struct _IndicatorCustomPrivate IndicatorCustomPrivate; + +struct _IndicatorCustomPrivate { + IndicatorServiceManager * sm; +}; + +#define INDICATOR_CUSTOM_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_CUSTOM_TYPE, IndicatorCustomPrivate)) + +static void indicator_custom_class_init (IndicatorCustomClass *klass); +static void indicator_custom_init (IndicatorCustom *self); +static void indicator_custom_dispose (GObject *object); +static void indicator_custom_finalize (GObject *object); +GList * get_entries (IndicatorObject * io); +void connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * custom); + +G_DEFINE_TYPE (IndicatorCustom, indicator_custom, INDICATOR_OBJECT_TYPE); + +static void +indicator_custom_class_init (IndicatorCustomClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (IndicatorCustomPrivate)); + + object_class->dispose = indicator_custom_dispose; + object_class->finalize = indicator_custom_finalize; + + IndicatorObjectClass * io_class = INDICATOR_OBJECT_CLASS(klass); + + io_class->get_entries = get_entries; return; } -GtkLabel * -get_label (void) +static void +indicator_custom_init (IndicatorCustom *self) { - return NULL; + IndicatorCustomPrivate * priv = INDICATOR_CUSTOM_GET_PRIVATE(self); + + priv->sm = indicator_service_manager_new(INDICATOR_CUSTOM_DBUS_ADDR); + g_signal_connect(G_OBJECT(priv->sm), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connected), self); + + return; +} + +static void +indicator_custom_dispose (GObject *object) +{ + IndicatorCustomPrivate * priv = INDICATOR_CUSTOM_GET_PRIVATE(object); + + if (priv->sm != NULL) { + g_object_unref(priv->sm); + priv->sm = NULL; + } + + G_OBJECT_CLASS (indicator_custom_parent_class)->dispose (object); + return; } -GtkImage * -get_icon (void) +static void +indicator_custom_finalize (GObject *object) { - return GTK_IMAGE(gtk_image_new()); + + G_OBJECT_CLASS (indicator_custom_parent_class)->finalize (object); + return; } -GtkMenu * -get_menu (void) +void +connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * custom) { - GtkMenu * main_menu = GTK_MENU(gtk_menu_new()); - GtkWidget * loading_item = gtk_menu_item_new_with_label("Loading..."); - gtk_menu_shell_append(GTK_MENU_SHELL(main_menu), loading_item); - gtk_widget_show(GTK_WIDGET(loading_item)); - sm = indicator_service_manager_new(INDICATOR_CUSTOM_DBUS_ADDR); - g_signal_connect(G_OBJECT(sm), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connected), NULL); + return; +} + +GList * +get_entries (IndicatorObject * io) +{ - return main_menu; + return NULL; } -- cgit v1.2.3 From 10d1d2e0357629c137fa04c5436ab385eb46848b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 12:25:29 -0600 Subject: Fleshing out connected to start bringing up the proxy. --- src/indicator-custom.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 8528a52..86eeffc 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -2,6 +2,8 @@ #include #include +#include + #include #include #include @@ -41,6 +43,8 @@ typedef struct _IndicatorCustomPrivate IndicatorCustomPrivate; struct _IndicatorCustomPrivate { IndicatorServiceManager * sm; + DBusGConnection * bus; + DBusGProxy * service_proxy; }; #define INDICATOR_CUSTOM_GET_PRIVATE(o) \ @@ -77,9 +81,14 @@ indicator_custom_init (IndicatorCustom *self) { IndicatorCustomPrivate * priv = INDICATOR_CUSTOM_GET_PRIVATE(self); + /* These are built in the connection phase */ + priv->bus = NULL; + priv->service_proxy = NULL; + priv->sm = indicator_service_manager_new(INDICATOR_CUSTOM_DBUS_ADDR); g_signal_connect(G_OBJECT(priv->sm), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connected), self); + return; } @@ -93,6 +102,16 @@ indicator_custom_dispose (GObject *object) priv->sm = NULL; } + if (priv->bus != NULL) { + /* We're not incrementing the ref count on this one. */ + priv->bus = NULL; + } + + if (priv->service_proxy != NULL) { + g_object_unref(G_OBJECT(priv->service_proxy)); + priv->service_proxy = NULL; + } + G_OBJECT_CLASS (indicator_custom_parent_class)->dispose (object); return; } @@ -108,6 +127,26 @@ indicator_custom_finalize (GObject *object) void connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * custom) { + IndicatorCustomPrivate * priv = INDICATOR_CUSTOM_GET_PRIVATE(custom); + g_debug("Connected to Custom Indicator Service."); + + GError * error = NULL; + + if (priv->bus == NULL) { + priv->bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + + if (error != NULL) { + g_error("Unable to get session bus: %s", error->message); + g_error_free(error); + return; + } + } + + priv->service_proxy = dbus_g_proxy_new_for_name_owner(priv->bus, + INDICATOR_CUSTOM_DBUS_ADDR, + INDICATOR_CUSTOM_DBUS_OBJ, + INDICATOR_CUSTOM_DBUS_IFACE, + &error); return; } -- cgit v1.2.3 From 349af660b77122a3a8609b09fe0012abf666e4b8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 12:56:54 -0600 Subject: Hooking up to the proxy. Let's do this! --- src/indicator-custom.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 86eeffc..669bafd 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -1,14 +1,19 @@ +/* G Stuff */ #include #include +/* DBus Stuff */ #include +/* Indicator Stuff */ #include #include #include -#include "dbus-shared.h" +/* Local Stuff */ +#include "dbus-shared.h" +#include "custom-service-client.h" #define INDICATOR_CUSTOM_TYPE (indicator_custom_get_type ()) #define INDICATOR_CUSTOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_CUSTOM_TYPE, IndicatorCustom)) @@ -54,8 +59,11 @@ static void indicator_custom_class_init (IndicatorCustomClass *klass); static void indicator_custom_init (IndicatorCustom *self); static void indicator_custom_dispose (GObject *object); static void indicator_custom_finalize (GObject *object); -GList * get_entries (IndicatorObject * io); -void connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * custom); +static GList * get_entries (IndicatorObject * io); +static void connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * custom); +static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, IndicatorCustom * custom); +static void application_removed (DBusGProxy * proxy, gint position , IndicatorCustom * custom); +static void get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata); G_DEFINE_TYPE (IndicatorCustom, indicator_custom, INDICATOR_OBJECT_TYPE); @@ -132,6 +140,7 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c GError * error = NULL; + /* Grab the session bus */ if (priv->bus == NULL) { priv->bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); @@ -142,18 +151,69 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c } } + /* Build the service proxy */ priv->service_proxy = dbus_g_proxy_new_for_name_owner(priv->bus, INDICATOR_CUSTOM_DBUS_ADDR, INDICATOR_CUSTOM_DBUS_OBJ, INDICATOR_CUSTOM_DBUS_IFACE, &error); + /* Set up proxy signals */ + dbus_g_proxy_add_signal(priv->service_proxy, + "ApplicationAdded", + G_TYPE_STRING, + G_TYPE_INT, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_NONE); + dbus_g_proxy_add_signal(priv->service_proxy, + "ApplicationRemoved", + G_TYPE_INT, + G_TYPE_NONE); + + dbus_g_proxy_connect_signal(priv->service_proxy, + "ApplicationAdded", + G_CALLBACK(application_added), + custom, + NULL /* Disconnection Signal */); + dbus_g_proxy_connect_signal(priv->service_proxy, + "ApplicationRemoved", + G_CALLBACK(application_removed), + custom, + NULL /* Disconnection Signal */); + + /* Query it for existing applications */ + org_ayatana_indicator_custom_service_get_applications_async(priv->service_proxy, + get_applications, + custom); + return; } -GList * +static GList * get_entries (IndicatorObject * io) { return NULL; } + +static void +application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, IndicatorCustom * custom) +{ + + return; +} + +static void +application_removed (DBusGProxy * proxy, gint position , IndicatorCustom * custom) +{ + + return; +} + +static void +get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata) +{ + + return; +} -- cgit v1.2.3 From 1dc8a8af930e8802cb578673da6bde792619b9c8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 13:32:21 -0600 Subject: Making for a list of applications that we can build and destroy at will. --- src/indicator-custom.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 669bafd..d520948 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -44,12 +44,17 @@ INDICATOR_SET_TYPE(INDICATOR_CUSTOM_TYPE) #endif typedef struct _IndicatorCustomPrivate IndicatorCustomPrivate; - -struct _IndicatorCustomPrivate -{ +struct _IndicatorCustomPrivate { IndicatorServiceManager * sm; DBusGConnection * bus; DBusGProxy * service_proxy; + GList * applications; +}; + +typedef struct _ApplicationEntry ApplicationEntry; +struct _ApplicationEntry { + guint position; + IndicatorObjectEntry entry; }; #define INDICATOR_CUSTOM_GET_PRIVATE(o) \ @@ -96,6 +101,7 @@ indicator_custom_init (IndicatorCustom *self) priv->sm = indicator_service_manager_new(INDICATOR_CUSTOM_DBUS_ADDR); g_signal_connect(G_OBJECT(priv->sm), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connected), self); + priv->applications = NULL; return; } @@ -105,6 +111,12 @@ indicator_custom_dispose (GObject *object) { IndicatorCustomPrivate * priv = INDICATOR_CUSTOM_GET_PRIVATE(object); + while (priv->applications != NULL) { + application_removed(priv->service_proxy, + ((ApplicationEntry *)priv->applications->data)->position, + INDICATOR_CUSTOM(object)); + } + if (priv->sm != NULL) { g_object_unref(priv->sm); priv->sm = NULL; -- cgit v1.2.3 From 463ca24ae82ecadaf319a42dc903301afa2c9b2b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 13:38:09 -0600 Subject: Fleshing out get_entries --- src/indicator-custom.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index d520948..f9577fb 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -202,11 +202,28 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c return; } +/* Goes through the list of applications that we're maintaining and + pulls out the IndicatorObjectEntry and returns that in a list + for the caller. */ static GList * get_entries (IndicatorObject * io) { + g_return_val_if_fail(IS_INDICATOR_CUSTOM(io), NULL); - return NULL; + IndicatorCustomPrivate * priv = INDICATOR_CUSTOM_GET_PRIVATE(io); + GList * retval = NULL; + GList * apppointer = NULL; + + for (apppointer = priv->applications; apppointer != NULL; apppointer = g_list_next(apppointer)) { + IndicatorObjectEntry * entry = &(((ApplicationEntry *)apppointer->data)->entry); + retval = g_list_prepend(retval, entry); + } + + if (retval != NULL) { + retval = g_list_reverse(retval); + } + + return retval; } static void -- cgit v1.2.3 From faef47fd05128981c33057236dca7bedab9dd639 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 14:02:38 -0600 Subject: Fleshing out the application added stuff --- src/indicator-custom.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/indicator-custom.c') 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 #include +#include /* DBus Stuff */ #include +#include /* Indicator Stuff */ #include @@ -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) { -- cgit v1.2.3 From f7cfd25bc2cf4696a579d8b7374666ee5e6bb3b3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 23 Nov 2009 11:44:29 -0600 Subject: Adding a remove function and switching to the position in the list being the position. --- src/indicator-custom.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 7cb9142..3bd2aa9 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -55,7 +55,6 @@ struct _IndicatorCustomPrivate { typedef struct _ApplicationEntry ApplicationEntry; struct _ApplicationEntry { - guint position; IndicatorObjectEntry entry; }; @@ -115,7 +114,7 @@ indicator_custom_dispose (GObject *object) while (priv->applications != NULL) { application_removed(priv->service_proxy, - ((ApplicationEntry *)priv->applications->data)->position, + 0, INDICATOR_CUSTOM(object)); } @@ -237,20 +236,44 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co 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); + priv->applications = g_list_insert(priv->applications, app, position); + /* TODO: Need to deal with position here somehow */ g_signal_emit(G_OBJECT(custom), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, &(app->entry), TRUE); return; } +/* This removes the application from the list and free's all + of the memory associated with it. */ static void -application_removed (DBusGProxy * proxy, gint position , IndicatorCustom * custom) +application_removed (DBusGProxy * proxy, gint position, IndicatorCustom * custom) { + IndicatorCustomPrivate * priv = INDICATOR_CUSTOM_GET_PRIVATE(custom); + ApplicationEntry * app = (ApplicationEntry *)g_list_nth_data(priv->applications, position); + + if (app == NULL) { + g_warning("Unable to find application at position: %d", position); + return; + } + + priv->applications = g_list_remove(priv->applications, app); + g_signal_emit(G_OBJECT(custom), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE); + + if (app->entry.image != NULL) { + g_object_unref(G_OBJECT(app->entry.image)); + } + if (app->entry.label != NULL) { + g_warning("Odd, an application indicator with a label?"); + g_object_unref(G_OBJECT(app->entry.label)); + } + if (app->entry.menu != NULL) { + g_object_unref(G_OBJECT(app->entry.menu)); + } + g_free(app); return; } -- cgit v1.2.3 From 25d690a42cb12ca9136932d7ace759bbe4185f86 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 23 Nov 2009 16:35:45 -0600 Subject: Registering marshallers for DBus in the indicator. --- src/indicator-custom.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 3bd2aa9..53e2269 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -16,6 +16,7 @@ /* Local Stuff */ #include "dbus-shared.h" #include "custom-service-client.h" +#include "custom-service-marshal.h" #define INDICATOR_CUSTOM_TYPE (indicator_custom_get_type ()) #define INDICATOR_CUSTOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_CUSTOM_TYPE, IndicatorCustom)) @@ -87,6 +88,10 @@ indicator_custom_class_init (IndicatorCustomClass *klass) io_class->get_entries = get_entries; + /* Register the marshallers for the dbus signals */ + dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__INT, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_object_register_marshaller(_custom_service_marshal_VOID__STRING_INT_STRING_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + return; } @@ -184,6 +189,7 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c G_TYPE_INT, G_TYPE_NONE); + /* Connect to them */ dbus_g_proxy_connect_signal(priv->service_proxy, "ApplicationAdded", G_CALLBACK(application_added), -- cgit v1.2.3 From 756b6c9aa6b03489fb47b2ecc82944df0fd54bad Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 23 Nov 2009 16:51:01 -0600 Subject: Forgot return types. --- src/indicator-custom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 53e2269..a32db80 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -89,8 +89,8 @@ indicator_custom_class_init (IndicatorCustomClass *klass) io_class->get_entries = get_entries; /* Register the marshallers for the dbus signals */ - dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__INT, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_object_register_marshaller(_custom_service_marshal_VOID__STRING_INT_STRING_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__INT, G_TYPE_NONE, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_object_register_marshaller(_custom_service_marshal_VOID__STRING_INT_STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); return; } -- cgit v1.2.3 From f0b58f56e4495d5a499fe165f1a7c48aac11e5ef Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 23 Nov 2009 17:33:26 -0600 Subject: Moving the registration of the marshallers until after the proxy. Odd that I'd have to do this, but let's try. --- src/indicator-custom.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index a32db80..e505e7a 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -88,10 +88,6 @@ indicator_custom_class_init (IndicatorCustomClass *klass) io_class->get_entries = get_entries; - /* Register the marshallers for the dbus signals */ - dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__INT, G_TYPE_NONE, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_object_register_marshaller(_custom_service_marshal_VOID__STRING_INT_STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - return; } @@ -176,6 +172,10 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c INDICATOR_CUSTOM_DBUS_IFACE, &error); + /* Register the marshallers for the dbus signals */ + dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__INT, G_TYPE_NONE, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_object_register_marshaller(_custom_service_marshal_VOID__STRING_INT_STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + /* Set up proxy signals */ dbus_g_proxy_add_signal(priv->service_proxy, "ApplicationAdded", -- cgit v1.2.3 From 6caead9f4b7ac3ec6347a83eb69979add5db8632 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 23 Nov 2009 17:38:00 -0600 Subject: I really shouldn't have to register marshalers. Srsly. --- src/indicator-custom.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index e505e7a..964d8aa 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -172,11 +172,8 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c INDICATOR_CUSTOM_DBUS_IFACE, &error); - /* Register the marshallers for the dbus signals */ - dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__INT, G_TYPE_NONE, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_object_register_marshaller(_custom_service_marshal_VOID__STRING_INT_STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - /* Set up proxy signals */ + g_debug("Setup proxy signals"); dbus_g_proxy_add_signal(priv->service_proxy, "ApplicationAdded", G_TYPE_STRING, @@ -190,6 +187,7 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c G_TYPE_NONE); /* Connect to them */ + g_debug("Connect to them."); dbus_g_proxy_connect_signal(priv->service_proxy, "ApplicationAdded", G_CALLBACK(application_added), @@ -202,6 +200,7 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c NULL /* Disconnection Signal */); /* Query it for existing applications */ + g_debug("Request current apps"); org_ayatana_indicator_custom_service_get_applications_async(priv->service_proxy, get_applications, custom); -- cgit v1.2.3 From c8faaf3f5490dc8b516b6944432d1de8f05248cc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 24 Nov 2009 11:23:21 -0600 Subject: Fixing Marshallers so that everything is happy-happy. --- src/indicator-custom.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 964d8aa..56f1032 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -88,6 +88,14 @@ indicator_custom_class_init (IndicatorCustomClass *klass) io_class->get_entries = get_entries; + dbus_g_object_register_marshaller(_custom_service_marshal_VOID__STRING_INT_STRING_STRING, + G_TYPE_NONE, + G_TYPE_STRING, + G_TYPE_INT, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_INVALID); + return; } @@ -180,11 +188,11 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_NONE); + G_TYPE_INVALID); dbus_g_proxy_add_signal(priv->service_proxy, "ApplicationRemoved", G_TYPE_INT, - G_TYPE_NONE); + G_TYPE_INVALID); /* Connect to them */ g_debug("Connect to them."); -- cgit v1.2.3 From ce09817718cd7fd41b55c3ec1476f7ebe8834b46 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 24 Nov 2009 14:06:05 -0600 Subject: Showing the icon. Now we can put things up in the menu! Finally. --- src/indicator-custom.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/indicator-custom.c') diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 56f1032..da89c30 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -246,6 +246,7 @@ get_entries (IndicatorObject * io) static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, IndicatorCustom * custom) { + g_debug("Building new application entry: %s with icon: %s", dbusaddress, iconname); IndicatorCustomPrivate * priv = INDICATOR_CUSTOM_GET_PRIVATE(custom); ApplicationEntry * app = g_new(ApplicationEntry, 1); @@ -253,6 +254,8 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co app->entry.label = NULL; app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); + gtk_widget_show(GTK_WIDGET(app->entry.image)); + priv->applications = g_list_insert(priv->applications, app, position); /* TODO: Need to deal with position here somehow */ -- cgit v1.2.3