aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2013-08-18 23:13:51 -0500
committerTed Gould <ted@gould.cx>2013-08-18 23:13:51 -0500
commit2673fba29a0f3bd090dc3a8dc0002d91ebf401a1 (patch)
tree02ceabd6b4515731057d2057628512417311a303
parent341152a55798c18a4116f6940bbe6a3aaf28355c (diff)
downloadayatana-indicator-messages-2673fba29a0f3bd090dc3a8dc0002d91ebf401a1.tar.gz
ayatana-indicator-messages-2673fba29a0f3bd090dc3a8dc0002d91ebf401a1.tar.bz2
ayatana-indicator-messages-2673fba29a0f3bd090dc3a8dc0002d91ebf401a1.zip
Starting to regen the draw attention flag from the source actions
-rw-r--r--src/im-application-list.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c
index 5884048..8078582 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -137,6 +137,47 @@ im_application_list_update_draws_attention (ImApplicationList *list)
g_action_group_change_action_state (main_actions, "messages", state);
}
+/* Check a source action to see if it draws */
+static gboolean
+app_source_action_check_draw (Application * app, const gchar * action_name)
+{
+
+ return FALSE;
+}
+
+/* Check a message action to see if it draws */
+static gboolean
+app_message_action_check_draw (Application * app, const gchar * action_name)
+{
+
+ return FALSE;
+}
+
+/* Regenerate the draw attention flag based on the sources and messages
+ that we have in the action groups */
+static void
+app_check_draw_attention (Application * app)
+{
+ gchar **source_actions = NULL;
+ gchar **message_actions = NULL;
+ gchar **it;
+
+ source_actions = g_action_group_list_actions (G_ACTION_GROUP (app->source_actions));
+ for (it = source_actions; *it && !app->draws_attention; it++)
+ app->draws_attention = app_source_action_check_draw (app, *it);
+
+ message_actions = g_action_group_list_actions (G_ACTION_GROUP (app->message_actions));
+ for (it = message_actions; *it; it++)
+ app->draws_attention = app_message_action_check_draw (app, *it);
+
+ g_strfreev (source_actions);
+ g_strfreev (message_actions);
+
+ return;
+}
+
+/* Remove a source from an application, signal up and update the status
+ of the draws attention flag. */
static void
im_application_list_source_removed (Application *app,
const gchar *id)
@@ -145,6 +186,12 @@ im_application_list_source_removed (Application *app,
g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, id);
+ if (app->draws_attention)
+ {
+ app->draws_attention = FALSE;
+ app_check_draw_attention(app);
+ }
+
im_application_list_update_draws_attention (app->list);
}
@@ -263,6 +310,8 @@ im_application_list_remove_all (GSimpleAction *action,
gchar **message_actions;
gchar **it;
+ app->draws_attention = FALSE;
+
source_actions = g_action_group_list_actions (G_ACTION_GROUP (app->source_actions));
for (it = source_actions; *it; it++)
im_application_list_source_removed (app, *it);
@@ -281,8 +330,6 @@ im_application_list_remove_all (GSimpleAction *action,
g_strfreev (source_actions);
g_strfreev (message_actions);
-
- app->draws_attention = FALSE;
}
im_application_list_update_draws_attention (list);