~larsu/indicator-messages/set-status-return-value

« back to all changes in this revision

Viewing changes to libmessaging-menu/messaging-menu-app.c

  • Committer: Tarmac
  • Author(s): Lars Uebernickel
  • Date: 2013-09-09 14:32:02 UTC
  • mfrom: (375.2.6 use-gicon-serialize)
  • Revision ID: tarmac-20130909143202-iip1qcm9w2mcqq6w
Use g_icon_serialize() instead of g_icon_to_string().

Approved by Charles Kerr, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
source_to_variant (Source *source)
174
174
{
175
175
  GVariant *v;
176
 
  gchar *iconstr;
177
 
 
178
 
  iconstr = source->icon ? g_icon_to_string (source->icon) : NULL;
179
 
 
180
 
  v = g_variant_new ("(sssuxsb)", source->id,
181
 
                                  source->label,
182
 
                                  iconstr ? iconstr : "",
183
 
                                  source->count,
184
 
                                  source->time,
185
 
                                  source->string ? source->string : "",
186
 
                                  source->draws_attention);
187
 
 
188
 
  g_free (iconstr);
 
176
  GVariant *serialized_icon;
 
177
  GVariantBuilder builder;
 
178
 
 
179
  serialized_icon = source->icon ? g_icon_serialize (source->icon) : NULL;
 
180
  g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
 
181
  if (serialized_icon)
 
182
    {
 
183
      g_variant_builder_add (&builder, "v", serialized_icon);
 
184
      g_variant_unref (serialized_icon);
 
185
    }
 
186
 
 
187
  v = g_variant_new ("(ssavuxsb)", source->id,
 
188
                                   source->label,
 
189
                                   &builder,
 
190
                                   source->count,
 
191
                                   source->time,
 
192
                                   source->string ? source->string : "",
 
193
                                   source->draws_attention);
189
194
 
190
195
  return v;
191
196
}
459
464
  GVariantBuilder builder;
460
465
  GList *it;
461
466
 
462
 
  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sssuxsb)"));
 
467
  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ssavuxsb)"));
463
468
 
464
469
  for (it = app->sources; it; it = it->next)
465
470
    g_variant_builder_add_value (&builder, source_to_variant (it->data));
533
538
  GHashTableIter iter;
534
539
  MessagingMenuMessage *message;
535
540
 
536
 
  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sssssxaa{sv}b)"));
 
541
  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(savsssxaa{sv}b)"));
537
542
 
538
543
  g_hash_table_iter_init (&iter, app->messages);
539
544
  while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &message))