![]() |
![]() |
![]() |
hud-service Hacking Guide | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Prerequisites | Known Implementations | Signals |
HudSourceHudSource — a source of HudResults |
HudSource; struct HudSourceInterface; void hud_source_changed (HudSource *source
); void hud_source_search (HudSource *source
,GPtrArray *results_array
,HudTokenList *search_tokens
);
HudSource is implemented by HudAppIndicatorSource, HudDbusmenuCollector, HudIndicatorSource, HudMenuModelCollector, HudSourceList and HudWindowSource.
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).
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 |
the GTypeInterface |
virtual function pointer for hud_source_search()
|
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.
|
a HudSource |
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.
|
a HudSource |
|
array to append results to. [element-type HudResult] |
|
the search string |
"changed"
signalvoid 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.
|
a HudSource |
|
user data set when the signal handler was connected. |