aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2013-08-16 09:24:22 -0500
committerTed Gould <ted@gould.cx>2013-08-16 09:24:22 -0500
commitb0626bc33d3ec1b0580869045c1b2c5ff295d05c (patch)
tree1a4935a912bfb64903520f597f970ad7fd067e32 /src
parent3b9907270084a6bd9edb72206ecaa34312370f09 (diff)
downloadayatana-indicator-messages-b0626bc33d3ec1b0580869045c1b2c5ff295d05c.tar.gz
ayatana-indicator-messages-b0626bc33d3ec1b0580869045c1b2c5ff295d05c.tar.bz2
ayatana-indicator-messages-b0626bc33d3ec1b0580869045c1b2c5ff295d05c.zip
Making it so that we cache the draw attention state in the app
Diffstat (limited to 'src')
-rw-r--r--src/im-application-list.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c
index aaa1c38..2be470e 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -70,6 +70,7 @@ typedef struct
GSimpleActionGroup *message_actions;
GActionMuxer *message_sub_actions;
GCancellable *cancellable;
+ gboolean draws_attention;
} Application;
@@ -109,19 +110,6 @@ application_free (gpointer data)
g_slice_free (Application, app);
}
-static guint
-g_action_group_get_n_actions (GActionGroup *group)
-{
- guint len;
- gchar **actions;
-
- actions = g_action_group_list_actions (group);
- len = g_strv_length (actions);
-
- g_strfreev (actions);
- return len;
-}
-
static gboolean
application_draws_attention (gpointer key,
gpointer value,
@@ -129,8 +117,7 @@ application_draws_attention (gpointer key,
{
Application *app = value;
- return (g_action_group_get_n_actions (G_ACTION_GROUP (app->source_actions)) +
- g_action_group_get_n_actions (G_ACTION_GROUP (app->message_actions))) > 0;
+ return app->draws_attention;
}
static void
@@ -558,6 +545,7 @@ im_application_list_add (ImApplicationList *list,
app->source_actions = g_simple_action_group_new ();
app->message_actions = g_simple_action_group_new ();
app->message_sub_actions = g_action_muxer_new ();
+ app->draws_attention = FALSE;
actions = g_simple_action_group_new ();
@@ -641,6 +629,9 @@ im_application_list_source_added (Application *app,
g_signal_emit (app->list, signals[SOURCE_ADDED], 0, app->id, id, label, iconstr);
+ if (draws_attention)
+ app->draws_attention = TRUE;
+
im_application_list_update_draws_attention (app->list);
g_object_unref (action);