diff options
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | src/app-section.c | 7 | ||||
-rw-r--r-- | src/gmenuutils.c | 10 | ||||
-rw-r--r-- | src/indicator-messages.c | 30 | ||||
-rw-r--r-- | src/messages-service.c | 2 |
5 files changed, 40 insertions, 11 deletions
diff --git a/debian/changelog b/debian/changelog index 32ab45a..04ae3be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,7 +12,7 @@ indicator-messages (12.10.0-0ubuntu1) UNRELEASED; urgency=low * Updated packaging to dh9, current standards * Drop gtk2 build from the packaging since support for it was dropped in trunk, thanks Lars Uebernickel - * Backported fixes from trunk up to r291 + * Backported fixes from trunk up to r295 -- Sebastien Bacher <seb128@ubuntu.com> Tue, 21 Aug 2012 18:17:34 +0200 diff --git a/src/app-section.c b/src/app-section.c index 0487fbb..baae21f 100644 --- a/src/app-section.c +++ b/src/app-section.c @@ -678,16 +678,9 @@ action_removed (GActionGroup *group, gpointer user_data) { AppSection *self = user_data; - GVariant *state; - - state = g_action_group_get_action_state (group, action_name); - if (!state) - return; self->priv->draws_attention = any_action_draws_attention (group, action_name); g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DRAWS_ATTENTION]); - - g_variant_unref (state); } gboolean diff --git a/src/gmenuutils.c b/src/gmenuutils.c index f3ceba7..f63615b 100644 --- a/src/gmenuutils.c +++ b/src/gmenuutils.c @@ -40,7 +40,15 @@ g_menu_find_section (GMenu *menu, n_items = g_menu_model_get_n_items (model); for (i = 0; i < n_items; i++) { - if (section == g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION)) + GMenuModel *link; + gboolean found; + + link = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION); + found = section == link; + + g_object_unref (link); + + if (found) return i; } diff --git a/src/indicator-messages.c b/src/indicator-messages.c index b3166f5..4f5a012 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -90,6 +90,10 @@ static void menu_items_changed (GMenuModel *menu, gint removed, gint added, gpointer user_data); +static void messages_state_changed (GActionGroup *action_group, + gchar *action_name, + GVariant *value, + gpointer user_data); G_DEFINE_TYPE (IndicatorMessages, indicator_messages, INDICATOR_OBJECT_TYPE); @@ -118,8 +122,9 @@ indicator_messages_init (IndicatorMessages *self) g_signal_connect (self->service, "connection-change", G_CALLBACK (service_connection_changed), self); - self->menu_wrapper = g_object_ref_sink (g_menu_new ()); + self->menu_wrapper = g_menu_new (); self->gtkmenu = gtk_menu_new_from_model (G_MENU_MODEL (self->menu_wrapper)); + g_object_ref_sink (self->gtkmenu); self->image = g_object_ref_sink (gtk_image_new ()); @@ -171,7 +176,10 @@ static void service_connection_changed (IndicatorServiceManager *sm, GDBusConnection *bus; GError *error = NULL; - g_clear_object (&self->actions); + if (self->actions != NULL) { + g_signal_handlers_disconnect_by_func (self->actions, messages_state_changed, self); + g_clear_object (&self->actions); + } if (self->menu != NULL) { g_signal_handlers_disconnect_by_func (self->menu, menu_items_changed, self); g_clear_object (&self->menu); @@ -195,6 +203,8 @@ static void service_connection_changed (IndicatorServiceManager *sm, gtk_widget_insert_action_group (self->gtkmenu, get_name_hint (INDICATOR_OBJECT (self)), self->actions); + g_signal_connect (self->actions, "action-state-changed::messages", + G_CALLBACK (messages_state_changed), self); self->menu = G_MENU_MODEL (g_dbus_menu_model_get (bus, INDICATOR_MESSAGES_DBUS_NAME, @@ -322,3 +332,19 @@ menu_items_changed (GMenuModel *menu, update_menu (self); } } + +static void +messages_state_changed (GActionGroup *action_group, + gchar *action_name, + GVariant *value, + gpointer user_data) +{ + IndicatorMessages *self = user_data; + + g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN)); + + if (g_variant_get_boolean (value)) + gtk_image_set_from_icon_name (GTK_IMAGE (self->image), "indicator-messages-new", GTK_ICON_SIZE_MENU); + else + gtk_image_set_from_icon_name (GTK_IMAGE (self->image), "indicator-messages", GTK_ICON_SIZE_MENU); +} diff --git a/src/messages-service.c b/src/messages-service.c index db7a8d7..31d2a5b 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -134,6 +134,8 @@ uses_chat_status_changed (GObject *object, if (show_chat) g_menu_insert_section (menu, 0, NULL, chat_section); } + + g_object_unref (first_section); } static AppSection * |