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(-) 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 314754fe25afd90caa38581d3e9e0d2c1cf43b70 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 24 Nov 2009 13:03:56 -0600 Subject: Building a little more of a menu item for testing. --- example/simple-client.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/example/simple-client.c b/example/simple-client.c index 1c29647..f1f53e1 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -20,7 +20,14 @@ main (int argc, char ** argv) custom_indicator_set_attention_icon(ci, "indicator-messages-new"); DbusmenuMenuitem * root = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(root, "label", "Root"); + + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, "Item 1"); + dbusmenu_menuitem_child_append(root, item); + + item = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, "Item 2"); + dbusmenu_menuitem_child_append(root, item); DbusmenuServer * menuservice = dbusmenu_server_new ("/need/a/menu/path"); dbusmenu_server_set_root(menuservice, root); -- cgit v1.2.3 From 254386fc933403d7b4ab559d6c9aa5dfb1234492 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 24 Nov 2009 13:04:41 -0600 Subject: Ignoring the marshallers --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index 0a09d4f..ca8d63a 100644 --- a/.bzrignore +++ b/.bzrignore @@ -35,3 +35,4 @@ tests/test-simple-app example/.deps example/.libs example/simple-client +src/libcustom_la-custom-service-marshal.lo -- 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(+) 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 From 4b23fc39d2fed996dd651d101dc1fb0a5b76d8f0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 24 Nov 2009 15:17:03 -0600 Subject: Woot, basic remove support. Causes warnings, but it works. --- src/custom-service-appstore.c | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/custom-service-appstore.c b/src/custom-service-appstore.c index fdb227a..bdf8ffb 100644 --- a/src/custom-service-appstore.c +++ b/src/custom-service-appstore.c @@ -168,6 +168,51 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err return; } +/* A simple global function for dealing with freeing the information + in an Application structure */ +static void +application_free (Application * app) +{ + if (app == NULL) return; + + if (app->dbus_name != NULL) { + g_free(app->dbus_name); + } + if (app->dbus_object != NULL) { + g_free(app->dbus_object); + } + + g_free(app); + return; +} + +/* Gets called when the proxy is destroyed, which is usually when it + drops off of the bus. */ +static void +application_removed_cb (DBusGProxy * proxy, gpointer userdata) +{ + Application * app = (Application *)userdata; + CustomServiceAppstore * appstore = app->appstore; + CustomServiceAppstorePrivate * priv = CUSTOM_SERVICE_APPSTORE_GET_PRIVATE(appstore); + + GList * applistitem = g_list_find(priv->applications, app); + if (applistitem == NULL) { + g_warning("Removing an application that isn't in the application list?"); + return; + } + + gint position = g_list_position(priv->applications, applistitem); + + g_signal_emit(G_OBJECT(appstore), + signals[APPLICATION_REMOVED], 0, + position, TRUE); + + priv->applications = g_list_remove(priv->applications, app); + + application_free(app); + return; +} + /* Adding a new NotificationItem object from DBus in to the appstore. First, we need to get the information on it though. */ @@ -204,6 +249,9 @@ custom_service_appstore_application_add (CustomServiceAppstore * appstore, const g_free(app); return; } + + /* We've got it, let's watch it for destruction */ + g_signal_connect(G_OBJECT(app->dbus_proxy), "destroy", G_CALLBACK(application_removed_cb), app); /* Grab the property proxy interface */ app->prop_proxy = dbus_g_proxy_new_for_name_owner(priv->bus, -- cgit v1.2.3