HudDbusmenuCollector

HudDbusmenuCollector — a HudSource that collects HudItems from Dbusmenu

Synopsis

                    HudDbusmenuCollector;
HudDbusmenuCollector * hud_dbusmenu_collector_new_for_endpoint
                                                        (const gchar *application_id,
                                                         const gchar *prefix,
                                                         const gchar *icon,
                                                         guint penalty,
                                                         const gchar *bus_name,
                                                         const gchar *object_path);
HudDbusmenuCollector * hud_dbusmenu_collector_new_for_window
                                                        (BamfWindow *window,
                                                         const gchar *desktop_file,
                                                         const gchar *icon);
void                hud_dbusmenu_collector_set_prefix   (HudDbusmenuCollector *collector,
                                                         const gchar *prefix);

Object Hierarchy

  GObject
   +----HudDbusmenuCollector

Implemented Interfaces

HudDbusmenuCollector implements HudSource.

Description

The HudDbusmenuCollector collects menu items from a DbusmenuClient.

There are two modes of operation.

In the simple mode, the collector is created with a specified endpoint using hud_dbusmenu_collector_new_for_endpoint(). A DbusmenuClient is constructed using this endpoint and the collector constructs HudItems for the contents of the menu found there. This mode is intended for use with indicators.

For menus associated with application windows (ie: menubars), we must consult the AppMenu registrar in order to discover the endpoint to use. This second mode of the collector is used by calling hud_dbusmenu_collector_new_for_window().

Details

HudDbusmenuCollector

typedef struct _HudDbusmenuCollector HudDbusmenuCollector;

This is an opaque structure type.


hud_dbusmenu_collector_new_for_endpoint ()

HudDbusmenuCollector * hud_dbusmenu_collector_new_for_endpoint
                                                        (const gchar *application_id,
                                                         const gchar *prefix,
                                                         const gchar *icon,
                                                         guint penalty,
                                                         const gchar *bus_name,
                                                         const gchar *object_path);

Creates a new HudDbusmenuCollector for the specified endpoint.

Internally, a DbusmenuClient is created for this endpoint. Searches are performed against the contents of those menus.

This call is intended to be used for indicators.

If prefix is non-NULL (which, for indicators, it ought to be), then it is prefixed to every item created by the collector.

If penalty is non-zero then all results returned from the collector have their distance increased by a percentage equal to the penalty. This allows items from indicators to score lower than they would otherwise.

application_id :

a unique identifier for the application

prefix :

the title to prefix to all items

icon :

the icon for the appliction

penalty :

the penalty to apply to all results

bus_name :

a D-Bus bus name

object_path :

an object path at the destination given by bus_name

Returns :

a new HudDbusmenuCollector

hud_dbusmenu_collector_new_for_window ()

HudDbusmenuCollector * hud_dbusmenu_collector_new_for_window
                                                        (BamfWindow *window,
                                                         const gchar *desktop_file,
                                                         const gchar *icon);

Creates a new HudDbusmenuCollector for the endpoint indicated by the HudAppMenuRegistrar for window.

This call is intended to be used for application menus.

window :

a BamfWindow

Returns :

a new HudDbusmenuCollector

hud_dbusmenu_collector_set_prefix ()

void                hud_dbusmenu_collector_set_prefix   (HudDbusmenuCollector *collector,
                                                         const gchar *prefix);

Changes the prefix applied to all items of the collector.

This will involve destroying all of the items and recreating them (since each item's prefix has to be changed).

collector :

a HudDbusmenuCollector

prefix :

the new prefix to use