aboutsummaryrefslogtreecommitdiff
path: root/src/im-application-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/im-application-list.c')
-rw-r--r--src/im-application-list.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c
index bbe4be3..96ef5fd 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -467,7 +467,7 @@ im_application_list_class_init (ImApplicationListClass *klass)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
- G_TYPE_STRING);
+ G_TYPE_VARIANT);
signals[SOURCE_CHANGED] = g_signal_new ("source-changed",
IM_TYPE_APPLICATION_LIST,
@@ -505,7 +505,7 @@ im_application_list_class_init (ImApplicationListClass *klass)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
- G_TYPE_STRING,
+ G_TYPE_VARIANT,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -768,16 +768,20 @@ im_application_list_source_added (Application *app,
{
const gchar *id;
const gchar *label;
- const gchar *iconstr;
+ GVariant *maybe_serialized_icon;
guint32 count;
gint64 time;
const gchar *string;
gboolean draws_attention;
+ GVariant *serialized_icon = NULL;
GVariant *state;
GSimpleAction *action;
- g_variant_get (source, "(&s&s&sux&sb)",
- &id, &label, &iconstr, &count, &time, &string, &draws_attention);
+ g_variant_get (source, "(&s&s@avux&sb)",
+ &id, &label, &maybe_serialized_icon, &count, &time, &string, &draws_attention);
+
+ if (g_variant_n_children (maybe_serialized_icon) == 1)
+ g_variant_get_child (maybe_serialized_icon, 0, "v", &serialized_icon);
state = g_variant_new ("(uxsb)", count, time, string, draws_attention);
action = g_simple_action_new_stateful (id, G_VARIANT_TYPE_BOOLEAN, state);
@@ -785,7 +789,7 @@ im_application_list_source_added (Application *app,
g_action_map_add_action (G_ACTION_MAP(app->source_actions), G_ACTION (action));
- g_signal_emit (app->list, signals[SOURCE_ADDED], 0, app->id, id, label, iconstr);
+ g_signal_emit (app->list, signals[SOURCE_ADDED], 0, app->id, id, label, serialized_icon);
if (draws_attention)
app->draws_attention = TRUE;
@@ -793,6 +797,9 @@ im_application_list_source_added (Application *app,
im_application_list_update_draws_attention (app->list);
g_object_unref (action);
+ if (serialized_icon)
+ g_variant_unref (serialized_icon);
+ g_variant_unref (maybe_serialized_icon);
}
static void
@@ -801,25 +808,33 @@ im_application_list_source_changed (Application *app,
{
const gchar *id;
const gchar *label;
- const gchar *iconstr;
+ GVariant *maybe_serialized_icon;
guint32 count;
gint64 time;
const gchar *string;
gboolean draws_attention;
+ GVariant *serialized_icon = NULL;
gboolean visible;
- g_variant_get (source, "(&s&s&sux&sb)",
- &id, &label, &iconstr, &count, &time, &string, &draws_attention);
+ g_variant_get (source, "(&s&s@avux&sb)",
+ &id, &label, &maybe_serialized_icon, &count, &time, &string, &draws_attention);
+
+ if (g_variant_n_children (maybe_serialized_icon) == 1)
+ g_variant_get_child (maybe_serialized_icon, 0, "v", &serialized_icon);
g_action_group_change_action_state (G_ACTION_GROUP (app->source_actions), id,
g_variant_new ("(uxsb)", count, time, string, draws_attention));
visible = count > 0;
- g_signal_emit (app->list, signals[SOURCE_CHANGED], 0, app->id, id, label, iconstr, visible);
+ g_signal_emit (app->list, signals[SOURCE_CHANGED], 0, app->id, id, label, serialized_icon, visible);
app->draws_attention = visible && draws_attention;
im_application_list_update_draws_attention (app->list);
+
+ if (serialized_icon)
+ g_variant_unref (serialized_icon);
+ g_variant_unref (maybe_serialized_icon);
}
static void
@@ -885,20 +900,24 @@ im_application_list_message_added (Application *app,
GVariant *message)
{
const gchar *id;
- const gchar *iconstr;
+ GVariant *maybe_serialized_icon;
const gchar *title;
const gchar *subtitle;
const gchar *body;
gint64 time;
GVariantIter *action_iter;
gboolean draws_attention;
+ GVariant *serialized_icon = NULL;
GSimpleAction *action;
GIcon *app_icon;
gchar *app_iconstr = NULL;
GVariant *actions = NULL;
- g_variant_get (message, "(&s&s&s&s&sxaa{sv}b)",
- &id, &iconstr, &title, &subtitle, &body, &time, &action_iter, &draws_attention);
+ g_variant_get (message, "(&s@av&s&s&sxaa{sv}b)",
+ &id, &maybe_serialized_icon, &title, &subtitle, &body, &time, &action_iter, &draws_attention);
+
+ if (g_variant_n_children (maybe_serialized_icon) == 1)
+ serialized_icon = g_variant_get_child_value (maybe_serialized_icon, 0);
app_icon = g_app_info_get_icon (G_APP_INFO (app->info));
if (app_icon)
@@ -981,12 +1000,15 @@ im_application_list_message_added (Application *app,
im_application_list_update_draws_attention (app->list);
g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
- app->id, app_iconstr, id, iconstr, title,
+ app->id, app_iconstr, id, serialized_icon, title,
subtitle, body, actions, time, draws_attention);
g_variant_iter_free (action_iter);
g_free (app_iconstr);
g_object_unref (action);
+ if (serialized_icon)
+ g_object_unref (serialized_icon);
+ g_variant_unref (maybe_serialized_icon);
}
static void