aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2013-08-16 09:55:54 -0500
committerTed Gould <ted@gould.cx>2013-08-16 09:55:54 -0500
commit4c8c9dc742282e4bf63c2931c61dff5b89ea5cb9 (patch)
tree2444cd24eb4a700c4344bdf593532341ca6c1911
parent201482b9190f616031e1db01a648d3d943f6fa5f (diff)
downloadayatana-indicator-messages-4c8c9dc742282e4bf63c2931c61dff5b89ea5cb9.tar.gz
ayatana-indicator-messages-4c8c9dc742282e4bf63c2931c61dff5b89ea5cb9.tar.bz2
ayatana-indicator-messages-4c8c9dc742282e4bf63c2931c61dff5b89ea5cb9.zip
Stop removing sources, just set them to no longer draw attention
-rw-r--r--src/im-application-list.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c
index d9426f9..2acb3d9 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -245,6 +245,53 @@ im_application_list_sub_message_activated (GSimpleAction *action,
im_application_list_message_removed (app, message_id);
}
+/* If a source has a draw_attention state set, this clears it so that it
+ doesn't get calculated to draw attention */
+static void
+im_application_list_source_clear_attention (Application * app,
+ gchar * source_name)
+{
+ GVariant * action_value = NULL;
+ GVariant * action_state = g_action_group_get_action_state(G_ACTION_GROUP(app->source_actions), source_name);
+
+ /* If it doesn't draw attention, we're done */
+ action_value = g_variant_get_child_value(action_state, 3);
+ if (!g_variant_get_boolean(action_value))
+ {
+ g_variant_unref(action_value);
+ g_variant_unref(action_state);
+ return;
+ }
+
+ g_variant_unref(action_value);
+
+ /* We need to build a new state without the draw attention */
+ GVariantBuilder new_state_builder;
+ g_variant_builder_init(&new_state_builder, G_VARIANT_TYPE_TUPLE);
+
+ /* Count */
+ action_value = g_variant_get_child_value(action_state, 0);
+ g_variant_builder_add_value(&new_state_builder, action_value);
+ g_variant_unref(action_value);
+
+ /* Time */
+ action_value = g_variant_get_child_value(action_state, 1);
+ g_variant_builder_add_value(&new_state_builder, action_value);
+ g_variant_unref(action_value);
+
+ /* String */
+ action_value = g_variant_get_child_value(action_state, 2);
+ g_variant_builder_add_value(&new_state_builder, action_value);
+ g_variant_unref(action_value);
+
+ /* Draws Attention */
+ g_variant_builder_add_value(&new_state_builder, g_variant_new_boolean(FALSE));
+
+ g_action_group_change_action_state(G_ACTION_GROUP(app->source_actions), source_name, g_variant_builder_end(&new_state_builder));
+
+ g_variant_unref(action_state);
+ return;
+}
static void
im_application_list_remove_all (GSimpleAction *action,
@@ -266,7 +313,7 @@ im_application_list_remove_all (GSimpleAction *action,
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);
+ im_application_list_source_clear_attention (app, *it);
message_actions = g_action_group_list_actions (G_ACTION_GROUP (app->message_actions));
for (it = message_actions; *it; it++)
@@ -279,6 +326,8 @@ 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);