From b0626bc33d3ec1b0580869045c1b2c5ff295d05c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 16 Aug 2013 09:24:22 -0500 Subject: Making it so that we cache the draw attention state in the app --- src/im-application-list.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src') 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); -- cgit v1.2.3