aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog11
-rw-r--r--src/im-application-list.c68
-rw-r--r--src/im-phone-menu.c4
-rw-r--r--src/im-phone-menu.h1
4 files changed, 68 insertions, 16 deletions
diff --git a/debian/changelog b/debian/changelog
index a1a6b2d..a769e52 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+indicator-messages (12.10.6-0ubuntu1phablet4) quantal; urgency=low
+
+ [Lars Uebernickel]
+ * Add the concept of actions to messages
+ * Stop using IndicatorService
+ * Reverse order of messages
+ * Expose symbolic application icon
+ * Change icon when there are any messages in the menu
+
+ -- Lars Uebernickel <lars.uebernickel@ubuntu.com> Tue, 04 Dec 2012 21:10:26 +0000
+
indicator-messages (12.10.6-0ubuntu1phablet3) quantal; urgency=low
[Lars Uebernickel]
diff --git a/src/im-application-list.c b/src/im-application-list.c
index da78813..5a7f768 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -131,6 +131,47 @@ im_application_list_source_activated (GSimpleAction *action,
im_application_list_source_removed (app, source_id);
}
+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,
+ gpointer user_data)
+{
+ 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;
+}
+
+static void
+im_application_list_update_draws_attention (ImApplicationList *list)
+{
+ const gchar *icon_name;
+ GVariant *state;
+ GActionGroup *main_actions;
+
+ if (g_hash_table_find (list->applications, application_draws_attention, NULL))
+ icon_name = "indicator-messages-new";
+ else
+ icon_name = "indicator-messages";
+
+ main_actions = g_action_muxer_get_group (list->muxer, NULL);
+ state = g_variant_new ("(sssb)", "", icon_name, "Messages", TRUE);
+ g_action_group_change_action_state (main_actions, "messages", state);
+}
+
static void
im_application_list_message_removed (Application *app,
const gchar *id)
@@ -138,6 +179,8 @@ im_application_list_message_removed (Application *app,
g_simple_action_group_remove (app->message_actions, id);
g_action_muxer_remove (app->message_sub_actions, id);
+ im_application_list_update_draws_attention (app->list);
+
g_signal_emit (app->list, signals[MESSAGE_REMOVED], 0, app->id, id);
}
@@ -302,8 +345,7 @@ im_application_list_class_init (ImApplicationListClass *klass)
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE,
- 11,
- G_TYPE_STRING,
+ 10,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -369,8 +411,13 @@ im_application_list_canonical_id (const gchar *id)
{
gchar *str;
gchar *p;
+ int len;
+
+ len = strlen (id);
+ if (g_str_has_suffix (id, ".desktop"))
+ len -= 8;
- str = g_strndup (id, strlen (id) - g_str_has_suffix (id, ".desktop") ? 7 : 0);
+ str = g_strndup (id, len);
for (p = str; *p; p++)
{
@@ -578,7 +625,6 @@ im_application_list_message_added (Application *app,
GSimpleAction *action;
GIcon *app_icon;
gchar *app_iconstr = NULL;
- gchar *symbolic_app_iconstr = NULL;
GVariant *actions = NULL;
g_variant_get (message, "(&s&s&s&s&sxaa{sv}b)",
@@ -586,10 +632,7 @@ im_application_list_message_added (Application *app,
app_icon = g_app_info_get_icon (G_APP_INFO (app->info));
if (app_icon)
- {
- app_iconstr = g_icon_to_string (app_icon);
- symbolic_app_iconstr = get_symbolic_app_icon_string (app_icon);
- }
+ app_iconstr = get_symbolic_app_icon_string (app_icon);
action = g_simple_action_new (id, G_VARIANT_TYPE_BOOLEAN);
g_signal_connect (action, "activate", G_CALLBACK (im_application_list_message_activated), app);
@@ -661,13 +704,14 @@ im_application_list_message_added (Application *app,
g_object_unref (action_group);
}
+ im_application_list_update_draws_attention (app->list);
+
g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
- app->id, app_iconstr, symbolic_app_iconstr, id,
- iconstr, title, subtitle, body, actions, time, draws_attention);
+ app->id, app_iconstr, id, iconstr, title,
+ subtitle, body, actions, time, draws_attention);
g_variant_iter_free (action_iter);
g_free (app_iconstr);
- g_free (symbolic_app_iconstr);
g_object_unref (action);
}
@@ -727,6 +771,8 @@ im_application_list_unset_remote (Application *app)
g_action_muxer_insert (app->actions, "msg", G_ACTION_GROUP (app->message_actions));
g_action_muxer_insert (app->actions, "msg-actions", G_ACTION_GROUP (app->message_sub_actions));
+ im_application_list_update_draws_attention (app->list);
+
if (was_running)
g_signal_emit (app->list, signals[APP_STOPPED], 0, app->id);
}
diff --git a/src/im-phone-menu.c b/src/im-phone-menu.c
index 51467ba..ed28023 100644
--- a/src/im-phone-menu.c
+++ b/src/im-phone-menu.c
@@ -146,7 +146,6 @@ void
im_phone_menu_add_message (ImPhoneMenu *menu,
const gchar *app_id,
const gchar *app_icon,
- const gchar *symbolic_app_icon,
const gchar *id,
const gchar *iconstr,
const gchar *title,
@@ -184,9 +183,6 @@ im_phone_menu_add_message (ImPhoneMenu *menu,
if (app_icon)
g_menu_item_set_attribute (item, "x-canonical-app-icon", "s", app_icon);
- if (symbolic_app_icon)
- g_menu_item_set_attribute (item, "x-canonical-app-icon-symbolic", "s", symbolic_app_icon);
-
g_menu_prepend_item (menu->message_section, item);
g_free (action_name);
diff --git a/src/im-phone-menu.h b/src/im-phone-menu.h
index f78e06f..84908e2 100644
--- a/src/im-phone-menu.h
+++ b/src/im-phone-menu.h
@@ -40,7 +40,6 @@ GMenuModel * im_phone_menu_get_model (ImPhoneMenu *men
void im_phone_menu_add_message (ImPhoneMenu *menu,
const gchar *app_id,
const gchar *app_icon,
- const gchar *symbolic_app_icon,
const gchar *id,
const gchar *iconstr,
const gchar *title,