From 2d584dcfd80215829c4f2f4a02cf8f7dcb09dd49 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Mar 2010 15:42:54 -0500 Subject: Comments and formatting. --- src/indicator-messages.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 988d9d6..a289127 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -75,6 +75,7 @@ static GtkMenu * get_menu (IndicatorObject * io); G_DEFINE_TYPE (IndicatorMessages, indicator_messages, INDICATOR_OBJECT_TYPE); +/* Initialize the one-timers */ static void indicator_messages_class_init (IndicatorMessagesClass *klass) { @@ -91,26 +92,37 @@ indicator_messages_class_init (IndicatorMessagesClass *klass) return; } +/* Build up our per-instance variables */ static void indicator_messages_init (IndicatorMessages *self) { + + return; } +/* Unref stuff */ static void indicator_messages_dispose (GObject *object) { -G_OBJECT_CLASS (indicator_messages_parent_class)->dispose (object); + + G_OBJECT_CLASS (indicator_messages_parent_class)->dispose (object); + return; } +/* Destory all memory users */ static void indicator_messages_finalize (GObject *object) { -G_OBJECT_CLASS (indicator_messages_parent_class)->finalize (object); + + G_OBJECT_CLASS (indicator_messages_parent_class)->finalize (object); + return; } /* Functions */ + +/* Called everytime the attention changes in the service. */ static void attention_changed_cb (DBusGProxy * proxy, gboolean dot, gpointer userdata) { @@ -122,6 +134,7 @@ attention_changed_cb (DBusGProxy * proxy, gboolean dot, gpointer userdata) return; } +/* Change the icon to whether it should be visible or not */ static void icon_changed_cb (DBusGProxy * proxy, gboolean hidden, gpointer userdata) { @@ -133,6 +146,7 @@ icon_changed_cb (DBusGProxy * proxy, gboolean hidden, gpointer userdata) return; } +/* Whether we can send the watch signal to the service */ static void watch_cb (DBusGProxy * proxy, GError * error, gpointer userdata) { @@ -143,6 +157,7 @@ watch_cb (DBusGProxy * proxy, GError * error, gpointer userdata) return; } +/* Callback from getting the attention status from the service. */ static void attention_cb (DBusGProxy * proxy, gboolean dot, GError * error, gpointer userdata) { @@ -155,6 +170,7 @@ attention_cb (DBusGProxy * proxy, gboolean dot, GError * error, gpointer userdat return attention_changed_cb(proxy, dot, userdata); } +/* Change from getting the icon visibility from the service */ static void icon_cb (DBusGProxy * proxy, gboolean hidden, GError * error, gpointer userdata) { @@ -167,6 +183,7 @@ icon_cb (DBusGProxy * proxy, gboolean hidden, GError * error, gpointer userdata) return icon_changed_cb(proxy, hidden, userdata); } +/* Sets up all the icon information in the proxy. */ static gboolean setup_icon_proxy (gpointer userdata) { @@ -422,6 +439,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm return TRUE; } +/* Builds the main image icon using the libindicator helper. */ static GtkImage * get_icon (IndicatorObject * io) { @@ -431,6 +449,7 @@ get_icon (IndicatorObject * io) return GTK_IMAGE(main_image); } +/* Builds the menu for the indicator */ static GtkMenu * get_menu (IndicatorObject * io) { -- cgit v1.2.3 From 7b473d8b95d78be20e16ae0e167a8a3612ea5ba5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Mar 2010 17:18:23 -0500 Subject: Switching over to using an indicator service manager instead of setting up the proxies by hand. --- src/indicator-messages.c | 64 ++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/indicator-messages.c b/src/indicator-messages.c index a289127..3713204 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -32,6 +32,7 @@ with this program. If not, see . #include #include #include +#include #include "dbus-data.h" #include "messages-service-client.h" @@ -52,6 +53,7 @@ struct _IndicatorMessagesClass { struct _IndicatorMessages { IndicatorObject parent; + IndicatorServiceManager * service; }; GType indicator_messages_get_type (void); @@ -72,6 +74,9 @@ static void indicator_messages_dispose (GObject *object); static void indicator_messages_finalize (GObject *object); static GtkImage * get_icon (IndicatorObject * io); static GtkMenu * get_menu (IndicatorObject * io); +static void connection_change (IndicatorServiceManager * sm, + gboolean connected, + gpointer user_data); G_DEFINE_TYPE (IndicatorMessages, indicator_messages, INDICATOR_OBJECT_TYPE); @@ -96,6 +101,12 @@ indicator_messages_class_init (IndicatorMessagesClass *klass) static void indicator_messages_init (IndicatorMessages *self) { + /* Default values */ + self->service = NULL; + + /* Complex stuff */ + self->service = indicator_service_manager_new_version(INDICATOR_MESSAGES_DBUS_NAME, 1); + g_signal_connect(self->service, INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_change), self); return; } @@ -104,6 +115,13 @@ indicator_messages_init (IndicatorMessages *self) static void indicator_messages_dispose (GObject *object) { + IndicatorMessages * self = INDICATOR_MESSAGES(object); + g_return_if_fail(self != NULL); + + if (self->service != NULL) { + g_object_unref(self->service); + self->service = NULL; + } G_OBJECT_CLASS (indicator_messages_parent_class)->dispose (object); return; @@ -146,17 +164,6 @@ icon_changed_cb (DBusGProxy * proxy, gboolean hidden, gpointer userdata) return; } -/* Whether we can send the watch signal to the service */ -static void -watch_cb (DBusGProxy * proxy, GError * error, gpointer userdata) -{ - if (error != NULL) { - g_warning("Watch failed! %s", error->message); - g_error_free(error); - } - return; -} - /* Callback from getting the attention status from the service. */ static void attention_cb (DBusGProxy * proxy, gboolean dot, GError * error, gpointer userdata) @@ -184,13 +191,17 @@ icon_cb (DBusGProxy * proxy, gboolean hidden, GError * error, gpointer userdata) } /* Sets up all the icon information in the proxy. */ -static gboolean -setup_icon_proxy (gpointer userdata) +static void +connection_change (IndicatorServiceManager * sm, gboolean connected, gpointer user_data) { + if (!connected) { + return; + } + DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); if (connection == NULL) { g_warning("Unable to get session bus"); - return FALSE; /* TRUE? */ + return; } icon_proxy = dbus_g_proxy_new_for_name(connection, @@ -199,11 +210,9 @@ setup_icon_proxy (gpointer userdata) INDICATOR_MESSAGES_DBUS_SERVICE_INTERFACE); if (icon_proxy == NULL) { g_warning("Unable to get messages service interface."); - return FALSE; + return; } - org_ayatana_indicator_messages_service_watch_async(icon_proxy, watch_cb, NULL); - dbus_g_proxy_add_signal(icon_proxy, "AttentionChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); dbus_g_proxy_connect_signal(icon_proxy, "AttentionChanged", @@ -221,7 +230,7 @@ setup_icon_proxy (gpointer userdata) org_ayatana_indicator_messages_service_attention_requested_async(icon_proxy, attention_cb, NULL); org_ayatana_indicator_messages_service_icon_shown_async(icon_proxy, icon_cb, NULL); - return FALSE; + return; } /* Sets the icon when it changes. */ @@ -453,27 +462,8 @@ get_icon (IndicatorObject * io) static GtkMenu * get_menu (IndicatorObject * io) { - guint returnval = 0; - GError * error = NULL; - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - - if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &returnval, &error)) { - g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); - g_error_free(error); - return NULL; - } - - if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { - g_error("Return value isn't indicative of success: %d", returnval); - return NULL; - } - indicator_right_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - g_idle_add(setup_icon_proxy, NULL); - DbusmenuGtkMenu * menu = dbusmenu_gtkmenu_new(INDICATOR_MESSAGES_DBUS_NAME, INDICATOR_MESSAGES_DBUS_OBJECT); DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu); -- cgit v1.2.3 From 4bb479d48b2b630ad5d3c172aac6456af77f2f6d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Mar 2010 17:37:15 -0500 Subject: Making the service into an indicator service. --- src/messages-service.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/messages-service.c b/src/messages-service.c index bc3e9e8..f751d77 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -27,6 +27,7 @@ with this program. If not, see . #include #include #include +#include #include #include @@ -41,7 +42,8 @@ with this program. If not, see . #include "messages-service-dbus.h" #include "seen-db.h" -static IndicateListener * listener; +static IndicatorService * service = NULL; +static IndicateListener * listener = NULL; static GList * serverList = NULL; static GList * launcherList = NULL; @@ -1395,6 +1397,14 @@ build_launchers (gpointer data) return FALSE; } +static void +service_shutdown (IndicatorService * service, gpointer user_data) +{ + g_warning("Shutting down service!"); + g_main_loop_quit(mainloop); + return; +} + /* Oh, if you don't know what main() is for we really shouldn't be talking. */ int @@ -1402,20 +1412,8 @@ main (int argc, char ** argv) { g_type_init(); - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - GError * error = NULL; - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } + service = indicator_service_new_version(INDICATOR_MESSAGES_DBUS_NAME, 1); + g_signal_connect(service, INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_shutdown), NULL); /* Setting up i18n and gettext. Apparently, we need all of these. */ -- cgit v1.2.3 From 6d6020686cd9a583a99650f1da0062ccc86584fe Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 09:35:22 -0500 Subject: Putting in a timeout to clear the icon if there were messages waiting when we lost the service. --- src/indicator-messages.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 3713204..34dfb1a 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -190,11 +190,33 @@ icon_cb (DBusGProxy * proxy, gboolean hidden, GError * error, gpointer userdata) return icon_changed_cb(proxy, hidden, userdata); } +static guint connection_drop_timeout = 0; + +/* Resets the icon to not having messages if we can't get a good + answer on it from the service. */ +static gboolean +connection_drop_cb (gpointer user_data) +{ + if (main_image != NULL) { + indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages"); + } + connection_drop_timeout = 0; + return FALSE; +} + /* Sets up all the icon information in the proxy. */ static void connection_change (IndicatorServiceManager * sm, gboolean connected, gpointer user_data) { + if (connection_drop_timeout != 0) { + g_source_remove(connection_drop_timeout); + connection_drop_timeout = 0; + } + if (!connected) { + /* Ensure that we're not saying there are messages + when we don't have a connection. */ + connection_drop_timeout = g_timeout_add(400, connection_drop_cb, NULL); return; } -- cgit v1.2.3 From 70f017d277336642bada8ca2b2ff514105ab6ea2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 09:38:30 -0500 Subject: Making it so that we don't build two icon_proxies ever. --- src/indicator-messages.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 34dfb1a..48b9abf 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -226,28 +226,30 @@ connection_change (IndicatorServiceManager * sm, gboolean connected, gpointer us return; } - icon_proxy = dbus_g_proxy_new_for_name(connection, - INDICATOR_MESSAGES_DBUS_NAME, - INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT, - INDICATOR_MESSAGES_DBUS_SERVICE_INTERFACE); if (icon_proxy == NULL) { - g_warning("Unable to get messages service interface."); - return; + icon_proxy = dbus_g_proxy_new_for_name(connection, + INDICATOR_MESSAGES_DBUS_NAME, + INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT, + INDICATOR_MESSAGES_DBUS_SERVICE_INTERFACE); + if (icon_proxy == NULL) { + g_warning("Unable to get messages service interface."); + return; + } + + dbus_g_proxy_add_signal(icon_proxy, "AttentionChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(icon_proxy, + "AttentionChanged", + G_CALLBACK(attention_changed_cb), + NULL, + NULL); + + dbus_g_proxy_add_signal(icon_proxy, "IconChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(icon_proxy, + "IconChanged", + G_CALLBACK(icon_changed_cb), + NULL, + NULL); } - - dbus_g_proxy_add_signal(icon_proxy, "AttentionChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(icon_proxy, - "AttentionChanged", - G_CALLBACK(attention_changed_cb), - NULL, - NULL); - - dbus_g_proxy_add_signal(icon_proxy, "IconChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(icon_proxy, - "IconChanged", - G_CALLBACK(icon_changed_cb), - NULL, - NULL); org_ayatana_indicator_messages_service_attention_requested_async(icon_proxy, attention_cb, NULL); org_ayatana_indicator_messages_service_icon_shown_async(icon_proxy, icon_cb, NULL); -- cgit v1.2.3 From ee6bc3c94baf3d985de68e4f6ca1c2d30ab8d811 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 17:22:19 -0500 Subject: Build the separator after checking to see which entry to use. That way we've always got one. --- src/messages-service.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/messages-service.c b/src/messages-service.c index f751d77..8321406 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -562,10 +562,6 @@ server_added (IndicateListener * listener, IndicateListenerServer * server, gcha sl_item->attention = FALSE; sl_item->count = 0; - /* Build a separator */ - sl_item->separator = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(sl_item->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); - /* Incase we got an indicator first */ GList * alreadythere = g_list_find_custom(serverList, sl_item, serverList_equal); if (alreadythere != NULL) { @@ -579,6 +575,10 @@ server_added (IndicateListener * listener, IndicateListenerServer * server, gcha serverList = g_list_insert_sorted(serverList, sl_item, serverList_sort); } + /* Build a separator */ + sl_item->separator = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(sl_item->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); + /* Connect the signals up to the menu item */ g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_COUNT_CHANGED, G_CALLBACK(server_count_changed), sl_item); g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_NAME_CHANGED, G_CALLBACK(server_name_changed), menushell); -- cgit v1.2.3 From b8013ea21382428e7b4fcd3b7cf874dd01bee941 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 21:58:45 -0500 Subject: Make the visibility of indictor items and separators follow the visibility of the application item. --- src/messages-service.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/messages-service.c b/src/messages-service.c index 8321406..515e8b3 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -904,6 +904,13 @@ resort_menu (DbusmenuMenuitem * menushell) if (imi->menuitem != NULL) { g_debug("\tMoving indicator on %s id %d to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(imi->server), INDICATE_LISTENER_INDICATOR_ID(imi->indicator), position); + + if (si->menuitem == NULL || !dbusmenu_menuitem_property_get_bool(DBUSMENU_MENUITEM(si->menuitem), DBUSMENU_MENUITEM_PROP_VISIBLE)) { + dbusmenu_menuitem_property_set_bool(imi->menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + } else { + dbusmenu_menuitem_property_set_bool(imi->menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + } + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(imi->menuitem), position); position++; } @@ -912,10 +919,17 @@ resort_menu (DbusmenuMenuitem * menushell) /* Lastly putting the separator in */ if (si->separator != NULL) { g_debug("\tMoving app %s separator to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(si->server), position); + + if (si->menuitem == NULL || !dbusmenu_menuitem_property_get_bool(DBUSMENU_MENUITEM(si->menuitem), DBUSMENU_MENUITEM_PROP_VISIBLE)) { + dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + /* Note, this isn't the last if we can't see it */ + } else { + dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + last_separator = si->separator; + } + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(si->separator), position); - dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); position++; - last_separator = si->separator; } } -- cgit v1.2.3 From e82a10312f3996dcaa312fb3f4e813c13561e992 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 22:13:41 -0500 Subject: Ensuring that the visibility property is set on the application entries. --- src/app-menu-item.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/app-menu-item.c b/src/app-menu-item.c index 87423c0..03f4833 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -128,6 +128,8 @@ app_menu_item_init (AppMenuItem *self) priv->root = NULL; priv->shortcuts = NULL; + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + return; } -- cgit v1.2.3 From 36901661f757e0980f5bfca0d01da53cfdf32da2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 30 Mar 2010 22:25:19 -0500 Subject: Making application items default to invisible, and only become visible if they get a valid desktop file. --- src/app-menu-item.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/app-menu-item.c b/src/app-menu-item.c index 03f4833..ef30333 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -128,7 +128,7 @@ app_menu_item_init (AppMenuItem *self) priv->root = NULL; priv->shortcuts = NULL; - dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); return; } @@ -319,6 +319,8 @@ desktop_cb (IndicateListener * listener, IndicateListenerServer * server, gchar priv->desktop = g_strdup(value); + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + update_label(self); const gchar * def_icon = get_default_icon(priv->desktop); -- cgit v1.2.3 From 59518d6b4119b0a3bd8cce7ab4c1a139b7b1a652 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 31 Mar 2010 00:15:22 -0500 Subject: Fixing a mixed up signal name. Small memory leak. --- src/indicator-messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 48b9abf..70d5aa0 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -467,7 +467,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent); g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(indicator_prop_change_cb), mi_data); - g_signal_connect(G_OBJECT(newitem), "destroyed", G_CALLBACK(g_free), mi_data); + g_signal_connect(G_OBJECT(newitem), "destroy", G_CALLBACK(g_free), mi_data); return TRUE; } -- cgit v1.2.3 From 6d2cbc37090e80472aa3a5719d681d8ba786c505 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 31 Mar 2010 00:18:11 -0500 Subject: Actually, more correctly, that should be a weak ref. --- src/indicator-messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 70d5aa0..d0794cb 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -467,7 +467,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent); g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(indicator_prop_change_cb), mi_data); - g_signal_connect(G_OBJECT(newitem), "destroy", G_CALLBACK(g_free), mi_data); + g_object_weak_ref(G_OBJECT(newitem), (GWeakNotify)g_free, mi_data); return TRUE; } -- cgit v1.2.3 From 9c8c6c5bc337a6453c6a9ad2b0f3d02af5860e7e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 31 Mar 2010 00:24:02 -0500 Subject: Dropping a useless warning --- src/indicator-messages.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/indicator-messages.c b/src/indicator-messages.c index d0794cb..f47eccd 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -384,8 +384,6 @@ indicator_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, i g_object_unref(resized_pixbuf); } } - } else { - g_warning("Indicator Item property '%s' unknown", prop); } return; -- cgit v1.2.3 From 3dcc91b1d7d8f8c5cb9e713eeab8c7fcf2437e30 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 31 Mar 2010 09:54:24 -0500 Subject: We only want to increment the position if we didn't find an entry --- src/messages-service.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/messages-service.c b/src/messages-service.c index 515e8b3..88da0e0 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -794,15 +794,16 @@ menushell_foreach_cb (DbusmenuMenuitem * data_mi, gpointer data_ms) { if (msl->found) return; - msl->position++; - if (!IS_APP_MENU_ITEM(data_mi)) { + msl->position++; return; } AppMenuItem * appmenu = APP_MENU_ITEM(data_mi); if (!g_strcmp0(INDICATE_LISTENER_SERVER_DBUS_NAME((IndicateListenerServer*)msl->server), INDICATE_LISTENER_SERVER_DBUS_NAME(app_menu_item_get_server(appmenu)))) { msl->found = TRUE; + } else { + msl->position++; } return; -- cgit v1.2.3