aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app-section.c7
-rw-r--r--src/indicator-messages.c27
2 files changed, 26 insertions, 8 deletions
diff --git a/src/app-section.c b/src/app-section.c
index d4bc3dd..bed1302 100644
--- a/src/app-section.c
+++ b/src/app-section.c
@@ -683,16 +683,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/indicator-messages.c b/src/indicator-messages.c
index 714a962..942e46f 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);
@@ -173,7 +177,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);
@@ -197,6 +204,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,
@@ -324,3 +333,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);
+}