aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/im-application-list.c41
-rw-r--r--src/im-phone-menu.c4
-rw-r--r--src/im-phone-menu.h1
3 files changed, 43 insertions, 3 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c
index c41c858..77c0e47 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -302,7 +302,8 @@ im_application_list_class_init (ImApplicationListClass *klass)
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE,
- 10,
+ 11,
+ G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -535,6 +536,33 @@ im_application_list_sources_listed (GObject *source_object,
}
}
+static gchar *
+get_symbolic_app_icon_string (GIcon *icon)
+{
+ const gchar * const *names;
+ gchar *symbolic_name;
+ GIcon *symbolic_icon;
+ gchar *str;
+
+ if (!G_IS_THEMED_ICON (icon))
+ return NULL;
+
+ names = g_themed_icon_get_names (G_THEMED_ICON (icon));
+ if (!names || !names[0])
+ return NULL;
+
+ symbolic_icon = g_themed_icon_new_from_names ((gchar **) names, -1);
+
+ symbolic_name = g_strconcat (names[0], "-symbolic", NULL);
+ g_themed_icon_prepend_name (G_THEMED_ICON (symbolic_icon), symbolic_name);
+
+ str = g_icon_to_string (symbolic_icon);
+
+ g_free (symbolic_name);
+ g_object_unref (symbolic_icon);
+ return str;
+}
+
static void
im_application_list_message_added (Application *app,
GVariant *message)
@@ -550,13 +578,18 @@ im_application_list_message_added (Application *app,
GSimpleAction *action;
GIcon *app_icon;
gchar *app_iconstr;
+ gchar *symbolic_app_iconstr;
GVariant *actions = NULL;
g_variant_get (message, "(&s&s&s&s&sxaa{sv}b)",
&id, &iconstr, &title, &subtitle, &body, &time, &action_iter, &draws_attention);
app_icon = g_app_info_get_icon (G_APP_INFO (app->info));
- app_iconstr = app_icon ? g_icon_to_string (app_icon) : NULL;
+ if (app_icon)
+ {
+ app_iconstr = g_icon_to_string (app_icon);
+ symbolic_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);
@@ -629,10 +662,12 @@ im_application_list_message_added (Application *app,
}
g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
- app->id, app_iconstr, id, iconstr, title, subtitle, body, actions, time, draws_attention);
+ app->id, app_iconstr, symbolic_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);
}
diff --git a/src/im-phone-menu.c b/src/im-phone-menu.c
index ed28023..51467ba 100644
--- a/src/im-phone-menu.c
+++ b/src/im-phone-menu.c
@@ -146,6 +146,7 @@ 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,
@@ -183,6 +184,9 @@ 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 84908e2..f78e06f 100644
--- a/src/im-phone-menu.h
+++ b/src/im-phone-menu.h
@@ -40,6 +40,7 @@ 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,