Back to index

indicator-appmenu  12.10.0
Defines | Functions | Variables
hudsource.c File Reference
#include "hudsource.h"

Go to the source code of this file.

Defines

#define G_LOG_DOMAIN   "hudsource"

Functions

static void hud_source_default_init (HudSourceInterface *iface)
void hud_source_use (HudSource *source)
 hud_source_use: ; a #HudSource
void hud_source_unuse (HudSource *source)
 hud_source_unuse: ; a #HudSource
void hud_source_search (HudSource *source, GPtrArray *results_array, HudTokenList *search_string)
 hud_source_search: : a #HudSource : (element-type HudResult): array to append results to : the search string
void hud_source_changed (HudSource *source)
 hud_source_changed: : a #HudSource

Variables

static gulong hud_source_changed_signal
 SECTION:hudsource : HudSource : a source of #HudResults.

Define Documentation

#define G_LOG_DOMAIN   "hudsource"

Definition at line 19 of file hudsource.c.


Function Documentation

void hud_source_changed ( HudSource *  source)

hud_source_changed: : a #HudSource

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

This function should only ever be called by implementations of

HudSource.

Definition at line 168 of file hudsource.c.

{
  g_debug ("%s %p changed", G_OBJECT_TYPE_NAME (source), source);

  g_signal_emit (source, hud_source_changed_signal, 0);
}

Here is the caller graph for this function:

static void hud_source_default_init ( HudSourceInterface *  iface) [static]

HudSource::changed: : a #HudSource

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

Definition at line 73 of file hudsource.c.

{
  hud_source_changed_signal = g_signal_new ("changed", HUD_TYPE_SOURCE, G_SIGNAL_RUN_LAST, 0, NULL,
                                            NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
void hud_source_search ( HudSource *  source,
GPtrArray *  results_array,
HudTokenList *  search_string 
)

hud_source_search: : a #HudSource : (element-type HudResult): array to append results to : the search string

Searches for #HudItems in that potentially match and creates #HudResults for them, appending them to .

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

Definition at line 147 of file hudsource.c.

{
  g_debug ("search on %s %p", G_OBJECT_TYPE_NAME (source), source);

  HUD_SOURCE_GET_IFACE (source)
    ->search (source, results_array, search_string);
}

Here is the caller graph for this function:

void hud_source_unuse ( HudSource *  source)

hud_source_unuse: ; a #HudSource

Reverses the effect of a previous call to hud_source_use().

The source maintains a use count. You must call hud_source_unuse() for as many times as you called hud_source_use().

Definition at line 123 of file hudsource.c.

{
  g_return_if_fail (HUD_IS_SOURCE (source));

  g_debug ("unuse on %s %p", G_OBJECT_TYPE_NAME (source), source);

  HUD_SOURCE_GET_IFACE (source)
    ->unuse (source);
}

Here is the caller graph for this function:

void hud_source_use ( HudSource *  source)

hud_source_use: ; a #HudSource

Mark a #HudSource as "in use" (ie: actively being queried).

The source maintains a use count. You must call hud_source_unuse() for as many times as you called hud_source_use().

The source may not emit change signals unless it is marked as being used (although it is free to ignore this hint and emit them anyway). Some data in the source may also be out of date. It is therefore recommended that calls to hud_source_search() be preceeded by a call to this function.

Definition at line 103 of file hudsource.c.

{
  g_return_if_fail (HUD_IS_SOURCE (source));

  g_debug ("use on %s %p", G_OBJECT_TYPE_NAME (source), source);

  HUD_SOURCE_GET_IFACE (source)
    ->use (source);
}

Here is the caller graph for this function:


Variable Documentation

gulong hud_source_changed_signal [static]

SECTION:hudsource : HudSource : a source of #HudResults.

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). HudSource:

This is an opaque structure type. HudSourceInterface: : the #GTypeInterface : virtual function pointer for hud_source_search()

This is the interface vtable for #HudSource.

Definition at line 70 of file hudsource.c.