~desrt/indicator-appmenu/hud-rewrite-wip

« back to all changes in this revision

Viewing changes to src/hudmenumodelcollector.c

  • Committer: Ryan Lortie
  • Date: 2012-03-23 15:35:01 UTC
  • Revision ID: desrt@desrt.ca-20120323153501-oz0obzu1uk54q30j
Add back the icons

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
  GDBusActionGroup *window;
61
61
 
62
62
  gchar *desktop_file;
 
63
  gchar *icon;
63
64
  GPtrArray *items;
64
65
  gint use_count;
65
66
};
119
120
static HudItem *
120
121
hud_model_item_new (HudStringList      *tokens,
121
122
                    const gchar        *desktop_file,
 
123
                    const gchar        *icon,
122
124
                    GRemoteActionGroup *action_group,
123
125
                    const gchar        *action_name,
124
126
                    GVariant           *target)
125
127
{
126
128
  HudModelItem *item;
127
129
 
128
 
  item = hud_item_construct (hud_model_item_get_type (), tokens, desktop_file, TRUE);
 
130
  item = hud_item_construct (hud_model_item_get_type (), tokens, desktop_file, icon, TRUE);
129
131
  item->group = g_object_ref (action_group);
130
132
  item->action_name = g_strdup (action_name);
131
133
  item->target = target ? g_variant_ref_sink (target) : NULL;
263
265
              target = g_menu_model_get_item_attribute_value (model, i, G_MENU_ATTRIBUTE_TARGET, NULL);
264
266
 
265
267
              /* XXX: todo: target */
266
 
              item = hud_model_item_new (tokens, collector->desktop_file,
 
268
              item = hud_model_item_new (tokens, collector->desktop_file, collector->icon,
267
269
                                         G_REMOTE_ACTION_GROUP (action_group),
268
270
                                         value + 4, target);
269
271
              g_ptr_array_add (collector->items, item);
381
383
  g_clear_object (&collector->window);
382
384
 
383
385
  g_free (collector->desktop_file);
 
386
  g_free (collector->icon);
384
387
 
385
388
  g_ptr_array_unref (collector->items);
386
389
 
412
415
 * hud_menu_model_collector_get:
413
416
 * @window: a #BamfWindow
414
417
 * @desktop_file: the desktop file of the application of @window
 
418
 * @icon: the application icon's name
415
419
 *
416
420
 * If the given @window has #GMenuModel-style menus then returns a
417
421
 * collector for them, otherwise returns %NULL.
422
426
 **/
423
427
HudMenuModelCollector *
424
428
hud_menu_model_collector_get (BamfWindow  *window,
425
 
                              const gchar *desktop_file)
 
429
                              const gchar *desktop_file,
 
430
                              const gchar *icon)
426
431
{
427
432
  HudMenuModelCollector *collector;
428
433
  gchar *unique_bus_name;
466
471
    collector->window = g_dbus_action_group_get (session, unique_bus_name, window_object_path);
467
472
 
468
473
  collector->desktop_file = g_strdup (desktop_file);
 
474
  collector->icon = g_strdup (icon);
469
475
 
470
476
  /* when the action groups change, we could end up having items
471
477
   * enabled/disabled.  how to deal with that?