HudSource

HudSource — a source of HudResults

Synopsis

                    HudSource;
struct              HudSourceInterface;
void                hud_source_changed                  (HudSource *source);
void                hud_source_search                   (HudSource *source,
                                                         GPtrArray *results_array,
                                                         HudTokenList *search_tokens);

Object Hierarchy

  GInterface
   +----HudSource

Prerequisites

HudSource requires GObject.

Known Implementations

HudSource is implemented by HudAppIndicatorSource, HudDbusmenuCollector, HudIndicatorSource, HudMenuModelCollector, HudSourceList and HudWindowSource.

Signals

  "changed"                                        : Run Last

Description

A HudSource is a very simple interface with only two APIs.

First, a HudSource may be searched, with a string. The search results in a list of HudResults being returned. This is hud_source_search().

Second, a HudSource has a simple "changed" signal that is emitted whenever the result of calling hud_source_search() may have changed.

A HudSource is stateless with respect to active queries.

FUTURE DIRECTIONS:

HudSource should probably have an API to indicate if there is an active query in progress. There are two reasons for this. First is because the implementations could be more lazy with respect to watching for changes. Second is because dbusmenu has a concept of if a menu is being shown or not and some applications may find this information to be useful.

It may also make sense to handle queries in a more stateful way, possibly replacing the "change" signal with something capable of expressing more fine-grained changes (eg: a single item was added or removed).

Details

HudSource

typedef struct _HudSource HudSource;

This is an opaque structure type.


struct HudSourceInterface

struct HudSourceInterface {
  GTypeInterface g_iface;

  void (* use)    (HudSource    *source);
  void (* unuse)  (HudSource    *source);
  void (* search) (HudSource    *source,
                   GPtrArray    *results_array,
                   HudTokenList *search_tokens);
};

This is the interface vtable for HudSource.

GTypeInterface g_iface;

the GTypeInterface

use ()

unuse ()

search ()

virtual function pointer for hud_source_search()

hud_source_changed ()

void                hud_source_changed                  (HudSource *source);

Signals that source may have changed (ie: emits the "changed" signal).

This function should only ever be called by implementations of HudSource.

source :

a HudSource

hud_source_search ()

void                hud_source_search                   (HudSource *source,
                                                         GPtrArray *results_array,
                                                         HudTokenList *search_tokens);

Searches for HudItems in source that potentially match search_string and creates HudResults for them, appending them to results_array.

source will emit a ::changed signal if the results of calling this function may have changed, at which point you should call it again.

source :

a HudSource

results_array :

array to append results to. [element-type HudResult]

search_string :

the search string

Signal Details

The "changed" signal

void                user_function                      (HudSource *source,
                                                        gpointer   user_data)      : Run Last

Indicates that the HudSource may have changed. After this signal, calls to hud_source_search() may return different results than they did before.

source :

a HudSource

user_data :

user data set when the signal handler was connected.