~indicator-applet-developers/ubuntu/precise/indicator-appmenu/upstream

« back to all changes in this revision

Viewing changes to src/hudmenumodelcollector.c

  • Committer: Ted Gould
  • Date: 2012-03-21 15:16:13 UTC
  • mfrom: (196.1.19 ubuntu)
  • Revision ID: ted@gould.cx-20120321151613-gxggsyo6wk03ywnc
Sync with U. Desktop

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
 
62
62
  gchar *desktop_file;
63
63
  GPtrArray *items;
 
64
  gint use_count;
64
65
};
65
66
 
66
 
 
67
67
typedef struct
68
68
{
69
69
  HudItem parent_instance;
329
329
}
330
330
 
331
331
static void
 
332
hud_menu_model_collector_use (HudSource *source)
 
333
{
 
334
  HudMenuModelCollector *collector = HUD_MENU_MODEL_COLLECTOR (source);
 
335
 
 
336
  collector->use_count++;
 
337
}
 
338
 
 
339
static void
 
340
hud_menu_model_collector_unuse (HudSource *source)
 
341
{
 
342
  HudMenuModelCollector *collector = HUD_MENU_MODEL_COLLECTOR (source);
 
343
 
 
344
  collector->use_count--;
 
345
}
 
346
 
 
347
static void
332
348
hud_menu_model_collector_search (HudSource   *source,
333
349
                                 GPtrArray   *results_array,
334
350
                                 const gchar *search_string)
381
397
static void
382
398
hud_menu_model_collector_iface_init (HudSourceInterface *iface)
383
399
{
 
400
  iface->use = hud_menu_model_collector_use;
 
401
  iface->unuse = hud_menu_model_collector_unuse;
384
402
  iface->search = hud_menu_model_collector_search;
385
403
}
386
404
 
393
411
/**
394
412
 * hud_menu_model_collector_get:
395
413
 * @window: a #BamfWindow
 
414
 * @desktop_file: the desktop file of the application of @window
396
415
 *
397
416
 * If the given @window has #GMenuModel-style menus then returns a
398
417
 * collector for them, otherwise returns %NULL.
399
418
 *
 
419
 * @desktop_file is used for usage tracking.
 
420
 *
400
421
 * Returns: a #HudMenuModelCollector, or %NULL
401
422
 **/
402
423
HudMenuModelCollector *
403
 
hud_menu_model_collector_get (BamfWindow *window)
 
424
hud_menu_model_collector_get (BamfWindow  *window,
 
425
                              const gchar *desktop_file)
404
426
{
405
427
  HudMenuModelCollector *collector;
406
428
  gchar *unique_bus_name;
443
465
  if (window_object_path)
444
466
    collector->window = g_dbus_action_group_get (session, unique_bus_name, window_object_path);
445
467
 
 
468
  collector->desktop_file = g_strdup (desktop_file);
 
469
 
446
470
  /* when the action groups change, we could end up having items
447
471
   * enabled/disabled.  how to deal with that?
448
472
   */