libdbusmenu-glib Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#include <libdbusmenu-glib/client.h> #define DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED #define DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED #define DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM #define DBUSMENU_CLIENT_PROP_DBUS_NAME #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT #define DBUSMENU_CLIENT_TYPES_DEFAULT #define DBUSMENU_CLIENT_TYPES_SEPARATOR #define DBUSMENU_CLIENT_TYPES_IMAGE DbusmenuClient; DbusmenuClientClass; gboolean (*DbusmenuClientTypeHandler) (DbusmenuMenuitem *newitem
,DbusmenuMenuitem *parent
,DbusmenuClient *client
); DbusmenuClient * dbusmenu_client_new (const gchar *name
,const gchar *object
); DbusmenuMenuitem * dbusmenu_client_get_root (DbusmenuClient *client
); gboolean dbusmenu_client_add_type_handler (DbusmenuClient *client
,const gchar *type
,DbusmenuClientTypeHandler newfunc
); void dbusmenu_client_send_event (DbusmenuClient *client
,gint id
,const gchar *name
,const GValue *value
,guint timestamp
); void dbusmenu_client_send_about_to_show (DbusmenuClient *client
,gint id
,void (cbgpointer user_data) ()
,gpointer cb_data
);
The client exists as a mirror to the server. For most folks all they will do with a client is set it up to connect to a server and then watch as the menu items on their side of the bus change. This is all they should need to know about the client, that it magically makes their menuitems dance.
It does this by setting up signal watchers and adjusting the menuitems appropriately. Most users should watch the menu items and the signal "layout-changed" for larger events so that they can be optimized. It is possible with that signal that even the root node would change. If that doesn't happen the normal signals on the individual nodes should be enough for most users.
#define DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED "layout-updated"
typedef struct { GObject parent; } DbusmenuClient;
The client for a DbusmenuServer creating a shared object set of DbusmenuMenuitem objects.
typedef struct { GObjectClass parent_class; void (*layout_updated)(void); void (*root_changed) (DbusmenuMenuitem * newroot); void (*new_menuitem) (DbusmenuMenuitem * newitem); /* Reserved for future use */ void (*reserved1) (void); void (*reserved2) (void); void (*reserved3) (void); void (*reserved4) (void); } DbusmenuClientClass;
A simple class that takes all of the information from a DbusmenuServer over DBus and makes the same set of DbusmenuMenuitem objects appear on the other side.
GObjectClass |
GObjectClass |
Slot for "layout-updated". | |
Slot for "new-menuitem". | |
Reserved for future use. | |
Reserved for future use. | |
Reserved for future use. | |
Reserved for future use. |
gboolean (*DbusmenuClientTypeHandler) (DbusmenuMenuitem *newitem
,DbusmenuMenuitem *parent
,DbusmenuClient *client
);
|
|
|
|
|
|
Returns : |
DbusmenuClient * dbusmenu_client_new (const gchar *name
,const gchar *object
);
This function creates a new client that connects to a specific server on DBus. That server is at a specific location sharing a known object. The interface is assumed by the code to be the DBus menu interface. The newly created client will start sending out events as it syncs up with the server.
|
The DBus name for the server to connect to |
|
The object on the server to monitor |
Returns : |
A brand new DbusmenuClient |
DbusmenuMenuitem * dbusmenu_client_get_root (DbusmenuClient *client
);
Grabs the root node for the specified client client
. This
function may block. It will block if there is currently a
call to update the layout, it will block on that layout
updated and then return the newly updated layout. Chances
are that this update is in the queue for the mainloop as
it would have been requested some time ago, but in theory
it could block longer.
|
The DbusmenuClient to get the root node from |
Returns : |
A DbusmenuMenuitem representing the root of menu on the server. If there is no server or there is an error receiving its layout it'll return NULL. |
gboolean dbusmenu_client_add_type_handler (DbusmenuClient *client
,const gchar *type
,DbusmenuClientTypeHandler newfunc
);
This function connects into the type handling of the DbusmenuClient.
Every new menuitem that comes in immediately gets asked for it's
properties. When we get those properties we check the 'type'
property and look to see if it matches a handler that is known
by the client. If so, the newfunc
function is executed on that
DbusmenuMenuitem. If not, then the DbusmenuClient::new-menuitem
signal is sent.
In the future the known types will be sent to the server so that it can make choices about the menu item types availble.
|
Client where we're getting types coming in |
|
A text string that will be matched with the 'type' property on incoming menu items |
|
The function that will be executed with those new items when they come in. |
Returns : |
If registering the new type was successful. |
void dbusmenu_client_send_event (DbusmenuClient *client
,gint id
,const gchar *name
,const GValue *value
,guint timestamp
);
|
|
|
|
|
|
|
|
|
void dbusmenu_client_send_about_to_show (DbusmenuClient *client
,gint id
,void (cbgpointer user_data) ()
,gpointer cb_data
);
|
|
|
gpointer user_data:
gpointer user_data:
|
|