Back to index

indicator-appmenu  12.10.0
Defines | Typedefs | Functions
hudappmenuregistrar.h File Reference
#include <glib-object.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define HUD_TYPE_APP_MENU_REGISTRAR   (hud_app_menu_registrar_get_type ())
#define HUD_APP_MENU_REGISTRAR(inst)
#define HUD_IS_APP_MENU_REGISTRAR(inst)

Typedefs

typedef struct _HudAppMenuRegistrar
typedef void(* HudAppMenuRegistrarObserverFunc )(HudAppMenuRegistrar *registrar, guint xid, const gchar *bus_name, const gchar *object_path, gpointer user_data)

Functions

GType hud_app_menu_registrar_get_type (void)
HudAppMenuRegistrar * hud_app_menu_registrar_get (void)
 hud_app_menu_registrar_get:
void hud_app_menu_registrar_add_observer (HudAppMenuRegistrar *registrar, guint xid, HudAppMenuRegistrarObserverFunc callback, gpointer user_data)
 HudAppMenuRegistrarObserverFunc: : the #HudAppMenuRegistrar : the xid that we are notifying about : the bus name for the dbusmenu, or NULL : the object path for the dbusmenu, or NULL : the data pointer.
void hud_app_menu_registrar_remove_observer (HudAppMenuRegistrar *registrar, guint xid, HudAppMenuRegistrarObserverFunc callback, gpointer user_data)
 hud_app_menu_registrar_remove_observer: : the #HudAppMenuRegistrar : the xid to begin observing : a HudAppMenuRegistrarObserverFunc : user data for

Define Documentation

#define HUD_APP_MENU_REGISTRAR (   inst)
Value:
(G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
                                                             HUD_TYPE_APP_MENU_REGISTRAR,                            \
                                                             HudAppMenuRegistrar))

Definition at line 25 of file hudappmenuregistrar.h.

#define HUD_IS_APP_MENU_REGISTRAR (   inst)
Value:
(G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
                                                             HUD_TYPE_APP_MENU_REGISTRAR))

Definition at line 28 of file hudappmenuregistrar.h.

Definition at line 24 of file hudappmenuregistrar.h.


Typedef Documentation

typedef struct _HudAppMenuRegistrar

Definition at line 31 of file hudappmenuregistrar.h.

typedef void(* HudAppMenuRegistrarObserverFunc)(HudAppMenuRegistrar *registrar, guint xid, const gchar *bus_name, const gchar *object_path, gpointer user_data)

Definition at line 37 of file hudappmenuregistrar.h.


Function Documentation

void hud_app_menu_registrar_add_observer ( HudAppMenuRegistrar *  registrar,
guint  xid,
HudAppMenuRegistrarObserverFunc  callback,
gpointer  user_data 
)

HudAppMenuRegistrarObserverFunc: : the #HudAppMenuRegistrar : the xid that we are notifying about : the bus name for the dbusmenu, or NULL : the object path for the dbusmenu, or NULL : the data pointer.

Notifies about the initial values for or changes to the bus name and object path at which to find the dbusmenu for .

You should pass the values of and to dbusmenu_client_new() to get started.

If no menu is available then and will both be given as NULL. hud_app_menu_registrar_add_observer: : the #HudAppMenuRegistrar : the xid to begin observing : a HudAppMenuRegistrarObserverFunc : user data for

Begins observing .

will be called exactly once before the function returns with a set of initial values (the bus name and object path at which to find the menu for the window).

If the location of the menu for changes (including being created or destroyed) then will be called each time an update is required.

It is possible that the values are not initially known because they have not yet been retreived from the registrar or because the registrar is not running. In this case, NULL values will be provided initially and will be invoked again when the real values are known.

Call hud_app_menu_registrar_remove_observer() to when you are no longer interested in .

Definition at line 418 of file hudappmenuregistrar.c.

{
  HudAppMenuRegistrarObserver *observer;
  HudAppMenuRegistrarWindow *window;

  g_return_if_fail (xid != 0);
  g_return_if_fail (callback != NULL);
  g_return_if_fail (!registrar->notifying);

  g_debug ("observer added for xid %u (%p)", xid, user_data);

  observer = g_slice_new (HudAppMenuRegistrarObserver);
  observer->callback = callback;
  observer->user_data = user_data;

  window = hud_app_menu_registrar_get_window (registrar, xid);
  window->observers = g_slist_prepend (window->observers, observer);

  /* send the first update */
  (* callback) (registrar, xid, window->bus_name, window->object_path, user_data);
}

Here is the call graph for this function:

Here is the caller graph for this function:

HudAppMenuRegistrar* hud_app_menu_registrar_get ( void  )

hud_app_menu_registrar_get:

Gets the singleton instance of #HudAppMenuRegistrar.

Returns: (transfer none): the instance

Definition at line 499 of file hudappmenuregistrar.c.

{
  static HudAppMenuRegistrar *singleton;

  if (!singleton)
    singleton = g_object_new (HUD_TYPE_APP_MENU_REGISTRAR, NULL);

  return singleton;
}

Here is the caller graph for this function:

void hud_app_menu_registrar_remove_observer ( HudAppMenuRegistrar *  registrar,
guint  xid,
HudAppMenuRegistrarObserverFunc  callback,
gpointer  user_data 
)

hud_app_menu_registrar_remove_observer: : the #HudAppMenuRegistrar : the xid to begin observing : a HudAppMenuRegistrarObserverFunc : user data for

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

and must be exactly equal to the values passed to that function.

One call does not remove all instances of and . You need to call this function the same number of times that you called hud_app_menu_registrar_add_observer().

Definition at line 461 of file hudappmenuregistrar.c.

{
  HudAppMenuRegistrarWindow *window;
  GSList **node;

  g_return_if_fail (xid != 0);
  g_return_if_fail (callback != NULL);
  g_return_if_fail (!registrar->notifying);

  g_debug ("observer removed for xid %u (%p)", xid, user_data);

  window = hud_app_menu_registrar_get_window (registrar, xid);
  for (node = &window->observers; *node; node = &(*node)->next)
    {
      HudAppMenuRegistrarObserver *observer = (*node)->data;

      if (observer->callback == callback && observer->user_data == user_data)
        {
          g_slice_free (HudAppMenuRegistrarObserver, observer);
          *node = g_slist_delete_link (*node, *node);
          break;
        }
    }

  hud_app_menu_registrar_possibly_free_window (registrar, window);
}

Here is the call graph for this function:

Here is the caller graph for this function: