aboutsummaryrefslogtreecommitdiff
path: root/src/im-application-list.c
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-08-13 13:33:22 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-08-13 13:33:22 +0200
commita545cafca29ffcd2044cc69dc5e9871f9e21f0f8 (patch)
treede21311d684062be5f0efe28f2750a146945af83 /src/im-application-list.c
parent7877dfd936cbd8f95d07867ea89d7d1e9e730bff (diff)
downloadayatana-indicator-messages-a545cafca29ffcd2044cc69dc5e9871f9e21f0f8.tar.gz
ayatana-indicator-messages-a545cafca29ffcd2044cc69dc5e9871f9e21f0f8.tar.bz2
ayatana-indicator-messages-a545cafca29ffcd2044cc69dc5e9871f9e21f0f8.zip
application list: update draws-attention when necessary
Diffstat (limited to 'src/im-application-list.c')
-rw-r--r--src/im-application-list.c84
1 files changed, 47 insertions, 37 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c
index 95a9cd0..f87fcec 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -97,43 +97,6 @@ application_free (gpointer data)
g_slice_free (Application, app);
}
-static void
-im_application_list_source_removed (Application *app,
- const gchar *id)
-{
- g_simple_action_group_remove (app->source_actions, id);
-
- g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, id);
-}
-
-static void
-im_application_list_source_activated (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- Application *app = user_data;
- const gchar *source_id;
-
- source_id = g_action_get_name (G_ACTION (action));
-
- if (g_variant_get_boolean (parameter))
- {
- indicator_messages_application_call_activate_source (app->proxy,
- source_id,
- app->cancellable,
- NULL, NULL);
- }
- else
- {
- const gchar *sources[] = { source_id, NULL };
- const gchar *messages[] = { NULL };
- indicator_messages_application_call_dismiss (app->proxy, sources, messages,
- app->cancellable, NULL, NULL);
- }
-
- im_application_list_source_removed (app, source_id);
-}
-
static guint
g_action_group_get_n_actions (GActionGroup *group)
{
@@ -176,6 +139,45 @@ im_application_list_update_draws_attention (ImApplicationList *list)
}
static void
+im_application_list_source_removed (Application *app,
+ const gchar *id)
+{
+ g_simple_action_group_remove (app->source_actions, id);
+
+ g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, id);
+
+ im_application_list_update_draws_attention (app->list);
+}
+
+static void
+im_application_list_source_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ Application *app = user_data;
+ const gchar *source_id;
+
+ source_id = g_action_get_name (G_ACTION (action));
+
+ if (g_variant_get_boolean (parameter))
+ {
+ indicator_messages_application_call_activate_source (app->proxy,
+ source_id,
+ app->cancellable,
+ NULL, NULL);
+ }
+ else
+ {
+ const gchar *sources[] = { source_id, NULL };
+ const gchar *messages[] = { NULL };
+ indicator_messages_application_call_dismiss (app->proxy, sources, messages,
+ app->cancellable, NULL, NULL);
+ }
+
+ im_application_list_source_removed (app, source_id);
+}
+
+static void
im_application_list_message_removed (Application *app,
const gchar *id)
{
@@ -279,6 +281,8 @@ im_application_list_remove_all (GSimpleAction *action,
g_strfreev (source_actions);
g_strfreev (message_actions);
}
+
+ im_application_list_update_draws_attention (list);
}
static void
@@ -578,6 +582,8 @@ im_application_list_remove (ImApplicationList *list,
g_hash_table_remove (list->applications, id);
g_action_muxer_remove (list->muxer, id);
+
+ im_application_list_update_draws_attention (list);
}
}
@@ -607,6 +613,8 @@ im_application_list_source_added (Application *app,
g_signal_emit (app->list, signals[SOURCE_ADDED], 0, app->id, id, label, iconstr);
+ im_application_list_update_draws_attention (app->list);
+
g_object_unref (action);
}
@@ -629,6 +637,8 @@ im_application_list_source_changed (Application *app,
g_variant_new ("(uxsb)", count, time, string, draws_attention));
g_signal_emit (app->list, signals[SOURCE_CHANGED], 0, app->id, id, label, iconstr);
+
+ im_application_list_update_draws_attention (app->list);
}
static void