Merge lp:~larsu/indicator-messages/use-gicon-serialize into lp:~indicator-applet-developers/indicator-messages/trunk.13.10

Proposed by Lars Karlitski
Status: Merged
Approved by: Charles Kerr
Approved revision: 381
Merged at revision: 377
Proposed branch: lp:~larsu/indicator-messages/use-gicon-serialize
Merge into: lp:~indicator-applet-developers/indicator-messages/trunk.13.10
Diff against target: 678 lines (+124/-216)
11 files modified
common/com.canonical.indicator.messages.application.xml (+5/-5)
libmessaging-menu/messaging-menu-app.c (+20/-15)
libmessaging-menu/messaging-menu-message.c (+13/-16)
src/Makefile.am (+0/-2)
src/gmenuutils.c (+0/-87)
src/gmenuutils.h (+0/-38)
src/im-application-list.c (+59/-36)
src/im-desktop-menu.c (+15/-8)
src/im-phone-menu.c (+10/-6)
src/im-phone-menu.h (+2/-2)
src/messages-service.c (+0/-1)
To merge this branch: bzr merge lp:~larsu/indicator-messages/use-gicon-serialize
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+184266@code.launchpad.net

Commit message

Use g_icon_serialize() instead of g_icon_to_string()

Description of the change

Use g_icon_serialize() instead of g_icon_to_string()

This patch also does some general cleanup of the icon-related code. Hope it didn't get to complex to review.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

Works For Me in manual testing.

As an aside, we really need to increase lcov coverage in this package. It's not practical to manually test all the ways an icon change can occur, so I haven't done so for this review.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'common/com.canonical.indicator.messages.application.xml'
2--- common/com.canonical.indicator.messages.application.xml 2013-08-20 10:39:46 +0000
3+++ common/com.canonical.indicator.messages.application.xml 2013-09-06 10:29:59 +0000
4@@ -2,10 +2,10 @@
5 <node name="/">
6 <interface name="com.canonical.indicator.messages.application">
7 <method name="ListSources">
8- <arg type="a(sssuxsb)" name="sources" direction="out" />
9+ <arg type="a(ssavuxsb)" name="sources" direction="out" />
10 </method>
11 <method name="ListMessages">
12- <arg type="a(sssssxaa{sv}b)" name="message" direction="out" />
13+ <arg type="a(savsssxaa{sv}b)" name="message" direction="out" />
14 </method>
15 <method name="ActivateSource">
16 <arg type="s" name="source_id" direction="in" />
17@@ -21,16 +21,16 @@
18 </method>
19 <signal name="SourceAdded">
20 <arg type="u" name="position" direction="in" />
21- <arg type="(sssuxsb)" name="source" direction="in" />
22+ <arg type="(ssavuxsb)" name="source" direction="in" />
23 </signal>
24 <signal name="SourceChanged">
25- <arg type="(sssuxsb)" name="source" direction="in" />
26+ <arg type="(ssavuxsb)" name="source" direction="in" />
27 </signal>
28 <signal name="SourceRemoved">
29 <arg type="s" name="source_id" direction="in" />
30 </signal>
31 <signal name="MessageAdded">
32- <arg type="(sssssxaa{sv}b)" name="message" direction="in" />
33+ <arg type="(savsssxaa{sv}b)" name="message" direction="in" />
34 </signal>
35 <signal name="MessageRemoved">
36 <arg type="s" name="message_id" direction="in" />
37
38=== modified file 'libmessaging-menu/messaging-menu-app.c'
39--- libmessaging-menu/messaging-menu-app.c 2013-08-20 10:38:10 +0000
40+++ libmessaging-menu/messaging-menu-app.c 2013-09-06 10:29:59 +0000
41@@ -173,19 +173,24 @@
42 source_to_variant (Source *source)
43 {
44 GVariant *v;
45- gchar *iconstr;
46-
47- iconstr = source->icon ? g_icon_to_string (source->icon) : NULL;
48-
49- v = g_variant_new ("(sssuxsb)", source->id,
50- source->label,
51- iconstr ? iconstr : "",
52- source->count,
53- source->time,
54- source->string ? source->string : "",
55- source->draws_attention);
56-
57- g_free (iconstr);
58+ GVariant *serialized_icon;
59+ GVariantBuilder builder;
60+
61+ serialized_icon = source->icon ? g_icon_serialize (source->icon) : NULL;
62+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
63+ if (serialized_icon)
64+ {
65+ g_variant_builder_add (&builder, "v", serialized_icon);
66+ g_variant_unref (serialized_icon);
67+ }
68+
69+ v = g_variant_new ("(ssavuxsb)", source->id,
70+ source->label,
71+ &builder,
72+ source->count,
73+ source->time,
74+ source->string ? source->string : "",
75+ source->draws_attention);
76
77 return v;
78 }
79@@ -459,7 +464,7 @@
80 GVariantBuilder builder;
81 GList *it;
82
83- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sssuxsb)"));
84+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ssavuxsb)"));
85
86 for (it = app->sources; it; it = it->next)
87 g_variant_builder_add_value (&builder, source_to_variant (it->data));
88@@ -533,7 +538,7 @@
89 GHashTableIter iter;
90 MessagingMenuMessage *message;
91
92- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sssssxaa{sv}b)"));
93+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(savsssxaa{sv}b)"));
94
95 g_hash_table_iter_init (&iter, app->messages);
96 while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &message))
97
98=== modified file 'libmessaging-menu/messaging-menu-message.c'
99--- libmessaging-menu/messaging-menu-message.c 2013-08-29 18:23:30 +0000
100+++ libmessaging-menu/messaging-menu-message.c 2013-09-06 10:29:59 +0000
101@@ -495,10 +495,10 @@
102 * _messaging_menu_message_to_variant:
103 * @msg: a #MessagingMenuMessage
104 *
105- * Serializes @msg to a #GVariant of the form (sssssxaa{sv}b):
106+ * Serializes @msg to a #GVariant of the form (savsssxaa{sv}b):
107 *
108 * id
109- * icon
110+ * icon (fake-maybe)
111 * title
112 * subtitle
113 * body
114@@ -513,25 +513,22 @@
115 {
116 GVariantBuilder builder;
117 GSList *it;
118+ GVariant *serialized_icon;
119+ GVariantBuilder icon_builder;
120
121 g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL);
122
123- g_variant_builder_init (&builder, G_VARIANT_TYPE ("(sssssxaa{sv}b)"));
124+ serialized_icon = msg->icon ? g_icon_serialize (msg->icon) : NULL;
125+ g_variant_builder_init (&icon_builder, G_VARIANT_TYPE ("av"));
126+ if (serialized_icon)
127+ {
128+ g_variant_builder_add (&icon_builder, "v", serialized_icon);
129+ g_variant_unref (serialized_icon);
130+ }
131
132+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("(savsssxaa{sv}b)"));
133 g_variant_builder_add (&builder, "s", msg->id);
134-
135- if (msg->icon)
136- {
137- gchar *iconstr;
138-
139- iconstr = g_icon_to_string (msg->icon);
140- g_variant_builder_add (&builder, "s", iconstr);
141-
142- g_free (iconstr);
143- }
144- else
145- g_variant_builder_add (&builder, "s", "");
146-
147+ g_variant_builder_add (&builder, "av", &icon_builder);
148 g_variant_builder_add (&builder, "s", msg->title ? msg->title : "");
149 g_variant_builder_add (&builder, "s", msg->subtitle ? msg->subtitle : "");
150 g_variant_builder_add (&builder, "s", msg->body ? msg->body : "");
151
152=== modified file 'src/Makefile.am'
153--- src/Makefile.am 2013-08-28 10:23:31 +0000
154+++ src/Makefile.am 2013-09-06 10:29:59 +0000
155@@ -10,8 +10,6 @@
156 gactionmuxer.h \
157 gsettingsstrv.c \
158 gsettingsstrv.h \
159- gmenuutils.c \
160- gmenuutils.h \
161 im-menu.c \
162 im-menu.h \
163 im-phone-menu.c \
164
165=== removed file 'src/gmenuutils.c'
166--- src/gmenuutils.c 2013-08-20 10:38:10 +0000
167+++ src/gmenuutils.c 1970-01-01 00:00:00 +0000
168@@ -1,87 +0,0 @@
169-/*
170- * Copyright 2012 Canonical Ltd.
171- *
172- * This program is free software: you can redistribute it and/or modify it
173- * under the terms of the GNU General Public License version 3, as published
174- * by the Free Software Foundation.
175- *
176- * This program is distributed in the hope that it will be useful, but
177- * WITHOUT ANY WARRANTY; without even the implied warranties of
178- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
179- * PURPOSE. See the GNU General Public License for more details.
180- *
181- * You should have received a copy of the GNU General Public License along
182- * with this program. If not, see <http://www.gnu.org/licenses/>.
183- *
184- * Authors:
185- * Lars Uebernickel <lars.uebernickel@canonical.com>
186- */
187-
188-#include "gmenuutils.h"
189-#include "dbus-data.h"
190-
191-/* g_menu_find_section:
192- * @menu: a #GMenu
193- * @section: the section to be found in @menu
194- *
195- * @Returns the index of the first menu item that is linked to #section, or -1
196- * if there's no such item.
197- */
198-int
199-g_menu_find_section (GMenu *menu,
200- GMenuModel *section)
201-{
202- GMenuModel *model = G_MENU_MODEL (menu);
203- int n_items;
204- int i;
205-
206- g_return_val_if_fail (G_IS_MENU_MODEL (section), -1);
207-
208- n_items = g_menu_model_get_n_items (model);
209- for (i = 0; i < n_items; i++)
210- {
211- GMenuModel *link;
212- gboolean found;
213-
214- link = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION);
215- found = section == link;
216-
217- g_object_unref (link);
218-
219- if (found)
220- return i;
221- }
222-
223- return -1;
224-}
225-
226-
227-void
228-g_menu_append_with_icon (GMenu *menu,
229- const gchar *label,
230- GIcon *icon,
231- const gchar *detailed_action)
232-{
233- gchar *iconstr;
234-
235- iconstr = g_icon_to_string (icon);
236- g_menu_append_with_icon_name (menu, label, iconstr, detailed_action);
237-
238- g_free (iconstr);
239-}
240-
241-void
242-g_menu_append_with_icon_name (GMenu *menu,
243- const gchar *label,
244- const gchar *icon_name,
245- const gchar *detailed_action)
246-{
247- GMenuItem *item;
248-
249- item = g_menu_item_new (label, detailed_action);
250- g_menu_item_set_attribute (item, "icon", "s", icon_name);
251-
252- g_menu_append_item (menu, item);
253-
254- g_object_unref (item);
255-}
256
257=== removed file 'src/gmenuutils.h'
258--- src/gmenuutils.h 2012-06-25 22:46:00 +0000
259+++ src/gmenuutils.h 1970-01-01 00:00:00 +0000
260@@ -1,38 +0,0 @@
261-/*
262- * Copyright 2012 Canonical Ltd.
263- *
264- * This program is free software: you can redistribute it and/or modify it
265- * under the terms of the GNU General Public License version 3, as published
266- * by the Free Software Foundation.
267- *
268- * This program is distributed in the hope that it will be useful, but
269- * WITHOUT ANY WARRANTY; without even the implied warranties of
270- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
271- * PURPOSE. See the GNU General Public License for more details.
272- *
273- * You should have received a copy of the GNU General Public License along
274- * with this program. If not, see <http://www.gnu.org/licenses/>.
275- *
276- * Authors:
277- * Lars Uebernickel <lars.uebernickel@canonical.com>
278- */
279-
280-#ifndef __G_MENU_UTILS_H__
281-#define __G_MENU_UTILS_H__
282-
283-#include <gio/gio.h>
284-
285-int g_menu_find_section (GMenu *menu,
286- GMenuModel *section);
287-
288-void g_menu_append_with_icon (GMenu *menu,
289- const gchar *label,
290- GIcon *icon,
291- const gchar *detailed_action);
292-
293-void g_menu_append_with_icon_name (GMenu *menu,
294- const gchar *label,
295- const gchar *icon_name,
296- const gchar *detailed_action);
297-
298-#endif
299
300=== modified file 'src/im-application-list.c'
301--- src/im-application-list.c 2013-09-02 11:10:05 +0000
302+++ src/im-application-list.c 2013-09-06 10:29:59 +0000
303@@ -161,6 +161,7 @@
304 const gchar *accessible_name;
305 const gchar *icon_name;
306 GIcon * icon;
307+ GVariant *serialized_icon;
308 GVariantBuilder builder;
309 GVariant *state;
310
311@@ -182,12 +183,13 @@
312 g_variant_builder_init(&builder, G_VARIANT_TYPE_DICTIONARY);
313
314 /* icon */
315- g_variant_builder_open(&builder, G_VARIANT_TYPE_DICT_ENTRY);
316- g_variant_builder_add_value(&builder, g_variant_new_string("icon"));
317 icon = g_themed_icon_new_with_default_fallbacks(icon_name);
318- g_variant_builder_add_value(&builder, g_variant_new_variant(g_icon_serialize(icon)));
319+ if ((serialized_icon = g_icon_serialize(icon)))
320+ {
321+ g_variant_builder_add (&builder, "{sv}", "icon", serialized_icon);
322+ g_variant_unref (serialized_icon);
323+ }
324 g_object_unref(icon);
325- g_variant_builder_close(&builder);
326
327 /* accessible description */
328 g_variant_builder_open(&builder, G_VARIANT_TYPE_DICT_ENTRY);
329@@ -467,7 +469,7 @@
330 G_TYPE_STRING,
331 G_TYPE_STRING,
332 G_TYPE_STRING,
333- G_TYPE_STRING);
334+ G_TYPE_VARIANT);
335
336 signals[SOURCE_CHANGED] = g_signal_new ("source-changed",
337 IM_TYPE_APPLICATION_LIST,
338@@ -503,9 +505,9 @@
339 G_TYPE_NONE,
340 10,
341 G_TYPE_STRING,
342- G_TYPE_STRING,
343- G_TYPE_STRING,
344- G_TYPE_STRING,
345+ G_TYPE_ICON,
346+ G_TYPE_STRING,
347+ G_TYPE_VARIANT,
348 G_TYPE_STRING,
349 G_TYPE_STRING,
350 G_TYPE_STRING,
351@@ -768,16 +770,20 @@
352 {
353 const gchar *id;
354 const gchar *label;
355- const gchar *iconstr;
356+ GVariant *maybe_serialized_icon;
357 guint32 count;
358 gint64 time;
359 const gchar *string;
360 gboolean draws_attention;
361+ GVariant *serialized_icon = NULL;
362 GVariant *state;
363 GSimpleAction *action;
364
365- g_variant_get (source, "(&s&s&sux&sb)",
366- &id, &label, &iconstr, &count, &time, &string, &draws_attention);
367+ g_variant_get (source, "(&s&s@avux&sb)",
368+ &id, &label, &maybe_serialized_icon, &count, &time, &string, &draws_attention);
369+
370+ if (g_variant_n_children (maybe_serialized_icon) == 1)
371+ g_variant_get_child (maybe_serialized_icon, 0, "v", &serialized_icon);
372
373 state = g_variant_new ("(uxsb)", count, time, string, draws_attention);
374 action = g_simple_action_new_stateful (id, G_VARIANT_TYPE_BOOLEAN, state);
375@@ -785,7 +791,7 @@
376
377 g_action_map_add_action (G_ACTION_MAP(app->source_actions), G_ACTION (action));
378
379- g_signal_emit (app->list, signals[SOURCE_ADDED], 0, app->id, id, label, iconstr);
380+ g_signal_emit (app->list, signals[SOURCE_ADDED], 0, app->id, id, label, serialized_icon);
381
382 if (draws_attention)
383 app->draws_attention = TRUE;
384@@ -793,6 +799,9 @@
385 im_application_list_update_draws_attention (app->list);
386
387 g_object_unref (action);
388+ if (serialized_icon)
389+ g_variant_unref (serialized_icon);
390+ g_variant_unref (maybe_serialized_icon);
391 }
392
393 static void
394@@ -801,25 +810,33 @@
395 {
396 const gchar *id;
397 const gchar *label;
398- const gchar *iconstr;
399+ GVariant *maybe_serialized_icon;
400 guint32 count;
401 gint64 time;
402 const gchar *string;
403 gboolean draws_attention;
404+ GVariant *serialized_icon = NULL;
405 gboolean visible;
406
407- g_variant_get (source, "(&s&s&sux&sb)",
408- &id, &label, &iconstr, &count, &time, &string, &draws_attention);
409+ g_variant_get (source, "(&s&s@avux&sb)",
410+ &id, &label, &maybe_serialized_icon, &count, &time, &string, &draws_attention);
411+
412+ if (g_variant_n_children (maybe_serialized_icon) == 1)
413+ g_variant_get_child (maybe_serialized_icon, 0, "v", &serialized_icon);
414
415 g_action_group_change_action_state (G_ACTION_GROUP (app->source_actions), id,
416 g_variant_new ("(uxsb)", count, time, string, draws_attention));
417
418 visible = count > 0;
419
420- g_signal_emit (app->list, signals[SOURCE_CHANGED], 0, app->id, id, label, iconstr, visible);
421+ g_signal_emit (app->list, signals[SOURCE_CHANGED], 0, app->id, id, label, serialized_icon, visible);
422
423 app->draws_attention = visible && draws_attention;
424 im_application_list_update_draws_attention (app->list);
425+
426+ if (serialized_icon)
427+ g_variant_unref (serialized_icon);
428+ g_variant_unref (maybe_serialized_icon);
429 }
430
431 static void
432@@ -853,31 +870,33 @@
433 }
434 }
435
436-static gchar *
437-get_symbolic_app_icon_string (GIcon *icon)
438+static GIcon *
439+get_symbolic_app_icon (GAppInfo *info)
440 {
441+ GIcon *icon;
442 const gchar * const *names;
443 gchar *symbolic_name;
444 GIcon *symbolic_icon;
445- gchar *str;
446+
447+ icon = g_app_info_get_icon (info);
448+ if (icon == NULL)
449+ return NULL;
450
451 if (!G_IS_THEMED_ICON (icon))
452- return NULL;
453+ return g_object_ref (icon);
454
455 names = g_themed_icon_get_names (G_THEMED_ICON (icon));
456 if (!names || !names[0])
457- return NULL;
458+ return g_object_ref (icon);
459+
460+ symbolic_name = g_strconcat (names[0], "-symbolic", NULL);
461
462 symbolic_icon = g_themed_icon_new_from_names ((gchar **) names, -1);
463-
464- symbolic_name = g_strconcat (names[0], "-symbolic", NULL);
465 g_themed_icon_prepend_name (G_THEMED_ICON (symbolic_icon), symbolic_name);
466
467- str = g_icon_to_string (symbolic_icon);
468-
469 g_free (symbolic_name);
470- g_object_unref (symbolic_icon);
471- return str;
472+
473+ return symbolic_icon;
474 }
475
476 static void
477@@ -885,24 +904,23 @@
478 GVariant *message)
479 {
480 const gchar *id;
481- const gchar *iconstr;
482+ GVariant *maybe_serialized_icon;
483 const gchar *title;
484 const gchar *subtitle;
485 const gchar *body;
486 gint64 time;
487 GVariantIter *action_iter;
488 gboolean draws_attention;
489+ GVariant *serialized_icon = NULL;
490 GSimpleAction *action;
491 GIcon *app_icon;
492- gchar *app_iconstr = NULL;
493 GVariant *actions = NULL;
494
495- g_variant_get (message, "(&s&s&s&s&sxaa{sv}b)",
496- &id, &iconstr, &title, &subtitle, &body, &time, &action_iter, &draws_attention);
497+ g_variant_get (message, "(&s@av&s&s&sxaa{sv}b)",
498+ &id, &maybe_serialized_icon, &title, &subtitle, &body, &time, &action_iter, &draws_attention);
499
500- app_icon = g_app_info_get_icon (G_APP_INFO (app->info));
501- if (app_icon)
502- app_iconstr = get_symbolic_app_icon_string (app_icon);
503+ if (g_variant_n_children (maybe_serialized_icon) == 1)
504+ serialized_icon = g_variant_get_child_value (maybe_serialized_icon, 0);
505
506 action = g_simple_action_new (id, G_VARIANT_TYPE_BOOLEAN);
507 g_object_set_qdata(G_OBJECT(action), message_action_draws_attention_quark(), GINT_TO_POINTER(draws_attention));
508@@ -980,13 +998,18 @@
509
510 im_application_list_update_draws_attention (app->list);
511
512+ app_icon = get_symbolic_app_icon (G_APP_INFO (app->info));
513+
514 g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
515- app->id, app_iconstr, id, iconstr, title,
516+ app->id, app_icon, id, serialized_icon, title,
517 subtitle, body, actions, time, draws_attention);
518
519 g_variant_iter_free (action_iter);
520- g_free (app_iconstr);
521 g_object_unref (action);
522+ if (serialized_icon)
523+ g_variant_unref (serialized_icon);
524+ g_variant_unref (maybe_serialized_icon);
525+ g_object_unref (app_icon);
526 }
527
528 static void
529
530=== modified file 'src/im-desktop-menu.c'
531--- src/im-desktop-menu.c 2013-08-27 10:35:02 +0000
532+++ src/im-desktop-menu.c 2013-09-06 10:29:59 +0000
533@@ -109,7 +109,7 @@
534 im_desktop_menu_source_section_insert_source (GMenu *source_section,
535 const gchar *source_id,
536 const gchar *label,
537- const gchar *icon,
538+ GVariant *serialized_icon,
539 gint pos)
540 {
541 GMenuItem *item;
542@@ -119,8 +119,8 @@
543 item = g_menu_item_new (label, NULL);
544 g_menu_item_set_action_and_target_value (item, action, NULL);
545 g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.source");
546- if (icon && *icon)
547- g_menu_item_set_attribute (item, "icon", "s", icon);
548+ if (serialized_icon)
549+ g_menu_item_set_attribute_value (item, "icon", serialized_icon);
550
551 if (pos >= 0)
552 g_menu_insert_item (source_section, pos, item);
553@@ -169,7 +169,7 @@
554 const gchar *app_id,
555 const gchar *source_id,
556 const gchar *label,
557- const gchar *icon,
558+ GVariant *serialized_icon,
559 gpointer user_data)
560 {
561 ImDesktopMenu *menu = user_data;
562@@ -178,7 +178,7 @@
563 source_section = g_hash_table_lookup (menu->source_sections, app_id);
564 g_return_if_fail (source_section != NULL);
565
566- im_desktop_menu_source_section_insert_source (source_section, source_id, label, icon, -1);
567+ im_desktop_menu_source_section_insert_source (source_section, source_id, label, serialized_icon, -1);
568 }
569
570 static void
571@@ -204,7 +204,7 @@
572 const gchar *app_id,
573 const gchar *source_id,
574 const gchar *label,
575- const gchar *icon,
576+ GVariant *serialized_icon,
577 gboolean visible,
578 gpointer user_data)
579 {
580@@ -221,7 +221,7 @@
581 g_menu_remove (section, pos);
582
583 if (visible)
584- im_desktop_menu_source_section_insert_source (section, source_id, label, icon, pos);
585+ im_desktop_menu_source_section_insert_source (section, source_id, label, serialized_icon, pos);
586 }
587
588 static void
589@@ -278,10 +278,17 @@
590 item = g_menu_item_new (NULL, NULL);
591
592 for (i = 0; i < G_N_ELEMENTS (status_items); i++) {
593+ GIcon *icon;
594+
595 g_menu_item_set_label (item, status_items[i].label);
596 g_menu_item_set_detailed_action (item, status_items[i].action);
597- g_menu_item_set_attribute (item, "icon", "s", status_items[i].icon_name);
598+
599+ icon = g_themed_icon_new (status_items[i].icon_name);
600+ g_menu_item_set_icon (item, icon);
601+
602 g_menu_append_item (menu, item);
603+
604+ g_object_unref (icon);
605 }
606
607 g_object_unref (item);
608
609=== modified file 'src/im-phone-menu.c'
610--- src/im-phone-menu.c 2013-08-28 10:42:08 +0000
611+++ src/im-phone-menu.c 2013-09-06 10:29:59 +0000
612@@ -151,9 +151,9 @@
613 void
614 im_phone_menu_add_message (ImPhoneMenu *menu,
615 const gchar *app_id,
616- const gchar *app_icon,
617+ GIcon *app_icon,
618 const gchar *id,
619- const gchar *iconstr,
620+ GVariant *serialized_icon,
621 const gchar *title,
622 const gchar *subtitle,
623 const gchar *body,
624@@ -164,6 +164,7 @@
625 gchar *action_name;
626 gint n_messages;
627 gint pos;
628+ GVariant *serialized_app_icon;
629
630 g_return_if_fail (IM_IS_PHONE_MENU (menu));
631 g_return_if_fail (app_id);
632@@ -179,11 +180,14 @@
633 g_menu_item_set_attribute (item, "x-canonical-text", "s", body);
634 g_menu_item_set_attribute (item, "x-canonical-time", "x", time);
635
636- if (iconstr)
637- g_menu_item_set_attribute (item, "icon", "s", iconstr);
638+ if (serialized_icon)
639+ g_menu_item_set_attribute_value (item, "icon", serialized_icon);
640
641- if (app_icon)
642- g_menu_item_set_attribute (item, "x-canonical-app-icon", "s", app_icon);
643+ if (app_icon && (serialized_app_icon = g_icon_serialize (app_icon)))
644+ {
645+ g_menu_item_set_attribute_value (item, "x-canonical-app-icon", serialized_app_icon);
646+ g_variant_unref (serialized_app_icon);
647+ }
648
649 if (actions)
650 g_menu_item_set_attribute (item, "x-canonical-message-actions", "v", actions);
651
652=== modified file 'src/im-phone-menu.h'
653--- src/im-phone-menu.h 2013-08-20 10:39:46 +0000
654+++ src/im-phone-menu.h 2013-09-06 10:29:59 +0000
655@@ -37,9 +37,9 @@
656
657 void im_phone_menu_add_message (ImPhoneMenu *menu,
658 const gchar *app_id,
659- const gchar *app_icon,
660+ GIcon *app_icon,
661 const gchar *id,
662- const gchar *iconstr,
663+ GVariant *serialized_icon,
664 const gchar *title,
665 const gchar *subtitle,
666 const gchar *body,
667
668=== modified file 'src/messages-service.c'
669--- src/messages-service.c 2013-08-21 16:40:00 +0000
670+++ src/messages-service.c 2013-09-06 10:29:59 +0000
671@@ -29,7 +29,6 @@
672
673 #include "dbus-data.h"
674 #include "gsettingsstrv.h"
675-#include "gmenuutils.h"
676 #include "indicator-messages-service.h"
677 #include "indicator-messages-application.h"
678 #include "im-phone-menu.h"

Subscribers

People subscribed via source and target branches