libdbusmenu-glib Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#include <libdbusmenu-glib/menuitem.h> #define DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED #define DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED #define DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED #define DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED #define DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED #define DBUSMENU_MENUITEM_SIGNAL_EVENT #define DBUSMENU_MENUITEM_SIGNAL_REALIZED #define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID #define DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW #define DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER #define DBUSMENU_MENUITEM_PROP_TYPE #define DBUSMENU_MENUITEM_PROP_VISIBLE #define DBUSMENU_MENUITEM_PROP_ENABLED #define DBUSMENU_MENUITEM_PROP_LABEL #define DBUSMENU_MENUITEM_PROP_ICON_NAME #define DBUSMENU_MENUITEM_PROP_ICON_DATA #define DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE #define DBUSMENU_MENUITEM_PROP_TOGGLE_STATE #define DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY #define DBUSMENU_MENUITEM_PROP_SHORTCUT #define DBUSMENU_MENUITEM_PROP_DISPOSITION #define DBUSMENU_MENUITEM_PROP_ACCESSIBLE_DESC #define DBUSMENU_MENUITEM_TOGGLE_CHECK #define DBUSMENU_MENUITEM_TOGGLE_RADIO #define DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED #define DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED #define DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN #define DBUSMENU_MENUITEM_ICON_NAME_BLANK #define DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU #define DBUSMENU_MENUITEM_SHORTCUT_ALT #define DBUSMENU_MENUITEM_SHORTCUT_CONTROL #define DBUSMENU_MENUITEM_SHORTCUT_SHIFT #define DBUSMENU_MENUITEM_SHORTCUT_SUPER #define DBUSMENU_MENUITEM_DISPOSITION_NORMAL #define DBUSMENU_MENUITEM_DISPOSITION_INFORMATIVE #define DBUSMENU_MENUITEM_DISPOSITION_WARNING #define DBUSMENU_MENUITEM_DISPOSITION_ALERT #define DBUSMENU_MENUITEM_EVENT_ACTIVATED #define DBUSMENU_MENUITEM_EVENT_CLOSED #define DBUSMENU_MENUITEM_EVENT_OPENED struct DbusmenuMenuitem; void (*dbusmenu_menuitem_about_to_show_cb) (DbusmenuMenuitem *mi
,gpointer user_data
); GVariant * (*dbusmenu_menuitem_buildvariant_slot_t) (DbusmenuMenuitem *mi
,gchar **properties
); struct DbusmenuMenuitemClass; DbusmenuMenuitem * dbusmenu_menuitem_new (void
); DbusmenuMenuitem * dbusmenu_menuitem_new_with_id (gint id
); gint dbusmenu_menuitem_get_id (DbusmenuMenuitem *mi
); GList * dbusmenu_menuitem_get_children (DbusmenuMenuitem *mi
); GList * dbusmenu_menuitem_take_children (DbusmenuMenuitem *mi
); guint dbusmenu_menuitem_get_position (DbusmenuMenuitem *mi
,DbusmenuMenuitem *parent
); guint dbusmenu_menuitem_get_position_realized (DbusmenuMenuitem *mi
,DbusmenuMenuitem *parent
); gboolean dbusmenu_menuitem_child_append (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
); gboolean dbusmenu_menuitem_child_prepend (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
); gboolean dbusmenu_menuitem_child_delete (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
); gboolean dbusmenu_menuitem_child_add_position (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
,guint position
); gboolean dbusmenu_menuitem_child_reorder (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
,guint position
); DbusmenuMenuitem * dbusmenu_menuitem_child_find (DbusmenuMenuitem *mi
,gint id
); DbusmenuMenuitem * dbusmenu_menuitem_find_id (DbusmenuMenuitem *mi
,gint id
); gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem *mi
,const gchar *property
,const gchar *value
); gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem *mi
,const gchar *property
,const gboolean value
); gboolean dbusmenu_menuitem_property_set_byte_array (DbusmenuMenuitem *mi
,const gchar *property
,const guchar *value
,gsize nelements
); gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem *mi
,const gchar *property
,const gint value
); gboolean dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem *mi
,const gchar *property
,GVariant *value
); const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem *mi
,const gchar *property
); gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem *mi
,const gchar *property
); const guchar * dbusmenu_menuitem_property_get_byte_array (DbusmenuMenuitem *mi
,const gchar *property
,gsize *nelements
); gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem *mi
,const gchar *property
); GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem *mi
,const gchar *property
); gboolean dbusmenu_menuitem_property_exist (DbusmenuMenuitem *mi
,const gchar *property
); GList * dbusmenu_menuitem_properties_list (DbusmenuMenuitem *mi
); GHashTable * dbusmenu_menuitem_properties_copy (DbusmenuMenuitem *mi
); void dbusmenu_menuitem_property_remove (DbusmenuMenuitem *mi
,const gchar *property
); void dbusmenu_menuitem_set_root (DbusmenuMenuitem *mi
,gboolean root
); gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem *mi
); void dbusmenu_menuitem_foreach (DbusmenuMenuitem *mi
,void (*func) (DbusmenuMenuitem * mi, gpointer data)
,gpointer data
); void dbusmenu_menuitem_handle_event (DbusmenuMenuitem *mi
,const gchar *name
,GVariant *variant
,guint timestamp
); void dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem *mi
,void (*cb) (DbusmenuMenuitem * mi, gpointer user_data)
,gpointer cb_data
); void dbusmenu_menuitem_show_to_user (DbusmenuMenuitem *mi
,guint timestamp
); DbusmenuMenuitem * dbusmenu_menuitem_get_parent (DbusmenuMenuitem *mi
); gboolean dbusmenu_menuitem_set_parent (DbusmenuMenuitem *mi
,DbusmenuMenuitem *parent
); gboolean dbusmenu_menuitem_unparent (DbusmenuMenuitem *mi
);
A DbusmenuMenuitem is the lowest level of represenation of a single item in a menu. It gets created on the server side and copied over to the client side where it gets rendered. As the server starts to change it, and grow it, and do all kinds of fun stuff that information is transfered over DBus and the client updates it's understanding of the object model.
Most people using either the client or the server should be able to deal mostly with DbusmenuMenuitem objects. These are simple, but then they can be attached to more complex objects and handled appropriately.
#define DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED "property-changed"
String to attach to signal "property-changed"
#define DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED "item-activated"
String to attach to signal "item-activated"
#define DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED "child-added"
String to attach to signal "child-added"
#define DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED "child-removed"
String to attach to signal "child-removed"
#define DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED "child-moved"
String to attach to signal "child-moved"
#define DBUSMENU_MENUITEM_SIGNAL_EVENT "event"
String to attach to signal "event"
#define DBUSMENU_MENUITEM_SIGNAL_REALIZED "realized"
String to attach to signal "realized"
#define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID (g_signal_lookup(DBUSMENU_MENUITEM_SIGNAL_REALIZED, DBUSMENU_TYPE_MENUITEM))
ID to attach to signal "realized"
#define DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW "about-to-show"
String to attach to signal "about-to-show"
#define DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER "show-to-user"
String to attach to signal "show-to-user"
#define DBUSMENU_MENUITEM_PROP_TYPE "type"
DbusmenuMenuitem property used to represent what type of menuitem this object represents. Type: G_VARIANT_TYPE_STRING.
#define DBUSMENU_MENUITEM_PROP_VISIBLE "visible"
DbusmenuMenuitem property used to represent whether the menuitem should be shown or not. Type: G_VARIANT_TYPE_BOOLEAN.
#define DBUSMENU_MENUITEM_PROP_ENABLED "enabled"
DbusmenuMenuitem property used to represent whether the menuitem is clickable or not. Type: G_VARIANT_TYPE_BOOLEAN.
#define DBUSMENU_MENUITEM_PROP_LABEL "label"
DbusmenuMenuitem property used for the text on the menu item. Type: G_VARIANT_TYPE_STRING
#define DBUSMENU_MENUITEM_PROP_ICON_NAME "icon-name"
DbusmenuMenuitem property that is the name of the icon under the Freedesktop.org icon naming spec. Type: G_VARIANT_TYPE_STRING
#define DBUSMENU_MENUITEM_PROP_ICON_DATA "icon-data"
DbusmenuMenuitem property that is the raw data of a custom icon used in the application. Type: G_VARIANT_TYPE_VARIANT
It is recommended that this is not set directly but instead the
libdbusmenu-gtk library is used with the function dbusmenu_menuitem_property_set_image()
#define DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE "toggle-type"
DbusmenuMenuitem property that says what type of toggle entry should be shown in the menu. Should be either DBUSMENU_MENUITEM_TOGGLE_CHECK or DBUSMENU_MENUITEM_TOGGLE_RADIO. Type: G_VARIANT_TYPE_STRING
#define DBUSMENU_MENUITEM_PROP_TOGGLE_STATE "toggle-state"
DbusmenuMenuitem property that says what state a toggle entry should be shown as the menu. Should be either DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED or DBUSMENU_MENUITEM_TOGGLE_STATUE_UNKNOWN. Type: G_VARIANT_TYPE_INT32
#define DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY "children-display"
DbusmenuMenuitem property that tells how the children of this menuitem should be displayed. Most likely this will be unset or of the value DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU. Type: G_VARIANT_TYPE_STRING
#define DBUSMENU_MENUITEM_PROP_SHORTCUT "shortcut"
DbusmenuMenuitem property that is the entries that represent a shortcut to activate the menuitem. It is an array of arrays of strings. Type: G_VARIANT_TYPE_ARRAY
It is recommended that this is not set directly but instead the
libdbusmenu-gtk library is used with the function dbusmenu_menuitem_property_set_shortcut()
#define DBUSMENU_MENUITEM_PROP_DISPOSITION "disposition"
DbusmenuMenuitem property to tell what type of information that the menu item is displaying to the user. Type: G_VARIANT_TYPE_STRING
#define DBUSMENU_MENUITEM_PROP_ACCESSIBLE_DESC "accessible-desc"
DbusmenuMenuitem property used to provide a textual description of any information that the icon may convey. The contents of this property are passed through to assistive technologies such as the Orca screen reader. The contents of this property will not be visible in the menu item. If this property is set, Orca will use this property instead of the label property. Type: G_VARIANT_TYPE_STRING
#define DBUSMENU_MENUITEM_TOGGLE_CHECK "checkmark"
Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE to be a standard check mark item.
#define DBUSMENU_MENUITEM_TOGGLE_RADIO "radio"
Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE to be a standard radio item.
#define DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED 0
Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's toggle item is empty.
#define DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED 1
Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's toggle item is filled.
#define DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN -1
Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's toggle item is undecided.
#define DBUSMENU_MENUITEM_ICON_NAME_BLANK "blank-icon"
Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's toggle item is undecided.
#define DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU "submenu"
Used in DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY to have the subitems displayed as a submenu.
#define DBUSMENU_MENUITEM_SHORTCUT_ALT "Alt"
Used in DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the alternate key.
#define DBUSMENU_MENUITEM_SHORTCUT_CONTROL "Control"
Used in DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the control key.
#define DBUSMENU_MENUITEM_SHORTCUT_SHIFT "Shift"
Used in DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the shift key.
#define DBUSMENU_MENUITEM_SHORTCUT_SUPER "Super"
Used in DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the super key.
#define DBUSMENU_MENUITEM_DISPOSITION_NORMAL "normal"
Used in DBUSMENU_MENUITEM_PROP_DISPOSITION to have a menu item displayed in the normal manner. Default value.
#define DBUSMENU_MENUITEM_DISPOSITION_INFORMATIVE "informative"
Used in DBUSMENU_MENUITEM_PROP_DISPOSITION to have a menu item displayed in a way that conveys it's giving additional information to the user.
#define DBUSMENU_MENUITEM_DISPOSITION_WARNING "warning"
Used in DBUSMENU_MENUITEM_PROP_DISPOSITION to have a menu item displayed in a way that conveys it's giving a warning to the user.
#define DBUSMENU_MENUITEM_DISPOSITION_ALERT "alert"
Used in DBUSMENU_MENUITEM_PROP_DISPOSITION to have a menu item displayed in a way that conveys it's giving an alert to the user.
#define DBUSMENU_MENUITEM_EVENT_ACTIVATED "clicked"
String for the event identifier when a menu item is clicked on by the user.
#define DBUSMENU_MENUITEM_EVENT_CLOSED "closed"
String for the event identifier when a menu is closed and displayed to the user. Only valid for items that contain submenus.
#define DBUSMENU_MENUITEM_EVENT_OPENED "opened"
String for the event identifier when a menu is opened and displayed to the user. Only valid for items that contain submenus.
struct DbusmenuMenuitem { GObject parent; /*< Private >*/ DbusmenuMenuitemPrivate * priv; };
This is the GObject based object that represents a menu item. It gets created the same on both the client and the server side and libdbusmenu-glib does the work of making this object model appear on both sides of DBus. Simple really, though through updates and people coming on and off the bus it can lead to lots of fun complex scenarios.
GObject |
Parent object |
Private data |
void (*dbusmenu_menuitem_about_to_show_cb) (DbusmenuMenuitem *mi
,gpointer user_data
);
Callback prototype for a callback that is called when the menu should be shown.
|
Menu item that should be shown |
|
Extra user data sent with the function. [closure] |
GVariant * (*dbusmenu_menuitem_buildvariant_slot_t) (DbusmenuMenuitem *mi
,gchar **properties
);
This is the function that is called to represent this menu item as a variant. Should call it's own children.
|
Menu item that should be built from. [in] |
|
A list of properties that should be the only ones in the resulting variant structure. [allow-none] |
Returns : |
A variant representing this item and it's children. [transfer full] |
struct DbusmenuMenuitemClass { GObjectClass parent_class; /* Signals */ void (*property_changed) (gchar * property, GVariant * value); void (*item_activated) (guint timestamp); void (*child_added) (DbusmenuMenuitem * child, guint position); void (*child_removed) (DbusmenuMenuitem * child); void (*child_moved) (DbusmenuMenuitem * child, guint newpos, guint oldpos); void (*realized) (void); /* Virtual functions */ dbusmenu_menuitem_buildvariant_slot_t buildvariant; void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp); void (*send_about_to_show) (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data); gboolean (*about_to_show) (void); void (*event) (const gchar * name, GVariant * value, guint timestamp); /*< Private >*/ void (*reserved1) (void); void (*reserved2) (void); void (*reserved3) (void); void (*reserved4) (void); void (*reserved5) (void); };
Functions and signals that every menuitem should know something about.
GObjectClass |
Functions and signals from our parent |
Slot for "property-changed". | |
Slot for "item-activated". | |
Slot for "child-added". | |
Slot for "child-removed". | |
Slot for "child-moved". | |
Slot for "realized". | |
dbusmenu_menuitem_buildvariant_slot_t |
Virtual function that appends the strings required to represent this menu item in the menu variant. |
This function is to override how events are handled by subclasses. Look at dbusmenu_menuitem_handle_event for lots of good information. | |
Slot for "show-to-user". | |
Slot for "about-to-show". | |
Slot for "event". | |
Reserved for future use. | |
Reserved for future use. | |
Reserved for future use. | |
Reserved for future use. | |
Reserved for future use. |
DbusmenuMenuitem * dbusmenu_menuitem_new (void
);
Create a new DbusmenuMenuitem with all default values.
Returns : |
A newly allocated DbusmenuMenuitem. |
DbusmenuMenuitem * dbusmenu_menuitem_new_with_id (gint id
);
This creates a blank DbusmenuMenuitem with a specific ID.
|
ID to use for this menuitem |
Returns : |
A newly allocated DbusmenuMenuitem. |
gint dbusmenu_menuitem_get_id (DbusmenuMenuitem *mi
);
Gets the unique ID for mi
.
|
The DbusmenuMenuitem to query. |
Returns : |
The ID of the mi . |
GList * dbusmenu_menuitem_get_children (DbusmenuMenuitem *mi
);
Returns simply the list of children that this menu item has. The list is valid until another child related function is called, where it might be changed.
|
The DbusmenuMenuitem to query. |
Returns : |
A GList of pointers to DbusmenuMenuitem objects. [transfer none][element-type Dbusmenu.Menuitem] |
GList * dbusmenu_menuitem_take_children (DbusmenuMenuitem *mi
);
While the name sounds devious that's exactly what this function
does. It takes the list of children from the mi
and clears the
internal list. The calling function is now in charge of the ref's
on the children it has taken. A lot of responsibility involved
in taking children.
|
The DbusmenMenuitem to take the children from. |
Returns : |
A GList of pointers to DbusmenuMenuitem objects. [transfer full][element-type Dbusmenu.Menuitem] |
guint dbusmenu_menuitem_get_position (DbusmenuMenuitem *mi
,DbusmenuMenuitem *parent
);
This function returns the position of the menu item mi
in the children of parent
. It will return zero if the
menu item can't be found.
|
The DbusmenuMenuitem to find the position of |
|
The DbusmenuMenuitem who's children contain mi
|
Returns : |
The position of mi in the children of parent . |
guint dbusmenu_menuitem_get_position_realized (DbusmenuMenuitem *mi
,DbusmenuMenuitem *parent
);
This function is very similar to dbusmenu_menuitem_get_position except that it only counts in the children that have been realized.
|
The DbusmenuMenuitem to find the position of |
|
The DbusmenuMenuitem who's children contain mi
|
Returns : |
The position of mi in the realized children of parent . |
gboolean dbusmenu_menuitem_child_append (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
);
This function adds child
to the list of children on mi
at
the end of that list.
|
The DbusmenuMenuitem which will become a new parent |
|
The DbusmenMenuitem that will be a child |
Returns : |
Whether the child has been added successfully. |
gboolean dbusmenu_menuitem_child_prepend (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
);
This function adds child
to the list of children on mi
at
the beginning of that list.
|
The DbusmenuMenuitem which will become a new parent |
|
The DbusmenMenuitem that will be a child |
Returns : |
Whether the child has been added successfully. |
gboolean dbusmenu_menuitem_child_delete (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
);
This function removes child
from the children list of mi
. It does
not call g_object_unref on child
.
|
The DbusmenuMenuitem which has child as a child |
|
The child DbusmenuMenuitem that you want to no longer
be a child of mi . |
Returns : |
If we were able to delete child . |
gboolean dbusmenu_menuitem_child_add_position (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
,guint position
);
Puts child
in the list of children for mi
at the location
specified in position
. If there is not enough entires available
then child
will be placed at the end of the list.
|
The DbusmenuMenuitem that we're adding the child child to. |
|
The DbusmenuMenuitem to make a child of mi . |
|
Where in mi object's list of chidren child should be placed. |
Returns : |
Whether child was added successfully. |
gboolean dbusmenu_menuitem_child_reorder (DbusmenuMenuitem *mi
,DbusmenuMenuitem *child
,guint position
);
This function moves a child on the list of children. It is for a child that is already in the list, but simply needs a new location.
|
The DbusmenuMenuitem that has children needing realignment |
|
The DbusmenuMenuitem that is a child needing to be moved |
|
The position in the list to place it in |
Returns : |
Whether the move was successful. |
DbusmenuMenuitem * dbusmenu_menuitem_child_find (DbusmenuMenuitem *mi
,gint id
);
Search the children of mi
to find one with the ID of id
.
If it doesn't exist then we return NULL.
|
The DbusmenuMenuitem who's children to look on |
|
The ID of the child that we're looking for. |
Returns : |
The menu item with the ID id or NULL if it
can't be found. [transfer none]
|
DbusmenuMenuitem * dbusmenu_menuitem_find_id (DbusmenuMenuitem *mi
,gint id
);
This function searchs the whole tree of children that
are attached to mi
. This could be quite a few nodes, all
the way down the tree. It is a depth first search.
|
DbusmenuMenuitem at the top of the tree to search |
|
ID of the DbusmenuMenuitem to search for |
Returns : |
The DbusmenuMenuitem with the ID of id
or NULL if there isn't such a menu item in the tree
represented by mi . [transfer none]
|
gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem *mi
,const gchar *property
,const gchar *value
);
Takes the pair of property
and value
and places them as a
property on mi
. If a property already exists by that name,
then the value is set to the new value. If not, the property
is added. If the value is changed or the property was previously
unset then the signal "prop-changed" will be
emitted by this function.
|
The DbusmenuMenuitem to set the property on. |
|
Name of the property to set. |
|
The value of the property. |
Returns : |
A boolean representing if the property value was set. |
gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem *mi
,const gchar *property
,const gboolean value
);
Takes a boolean value
and sets it on property
as a
property on mi
. If a property already exists by that name,
then the value is set to the new value. If not, the property
is added. If the value is changed or the property was previously
unset then the signal "prop-changed" will be
emitted by this function.
|
The DbusmenuMenuitem to set the property on. |
|
Name of the property to set. |
|
The value of the property. |
Returns : |
A boolean representing if the property value was set. |
gboolean dbusmenu_menuitem_property_set_byte_array (DbusmenuMenuitem *mi
,const gchar *property
,const guchar *value
,gsize nelements
);
Takes a byte array value
and sets it on property
as a
property on mi
. If a property already exists by that name,
then the value is set to the new value. If not, the property
is added. If the value is changed or the property was previously
unset then the signal "prop-changed" will be
emitted by this function.
|
The DbusmenuMenuitem to set the property on. |
|
Name of the property to set. |
|
The byte array. |
|
The number of elements in the byte array. |
Returns : |
A boolean representing if the property value was set. |
gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem *mi
,const gchar *property
,const gint value
);
Takes a boolean value
and sets it on property
as a
property on mi
. If a property already exists by that name,
then the value is set to the new value. If not, the property
is added. If the value is changed or the property was previously
unset then the signal "prop-changed" will be
emitted by this function.
|
The DbusmenuMenuitem to set the property on. |
|
Name of the property to set. |
|
The value of the property. |
Returns : |
A boolean representing if the property value was set. |
gboolean dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem *mi
,const gchar *property
,GVariant *value
);
Takes the pair of property
and value
and places them as a
property on mi
. If a property already exists by that name,
then the value is set to the new value. If not, the property
is added. If the value is changed or the property was previously
unset then the signal "prop-changed" will be
emitted by this function.
|
The DbusmenuMenuitem to set the property on. |
|
Name of the property to set. |
|
The value of the property. |
Returns : |
A boolean representing if the property value was set. |
const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem *mi
,const gchar *property
);
Look up a property on mi
and return the value of it if
it exits. NULL will be returned if the property doesn't
exist.
|
The DbusmenuMenuitem to look for the property on. |
|
The property to grab. |
Returns : |
A string with the value of the property that shouldn't be free'd. Or NULL if the property is not set or is not a string. [transfer none] |
gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem *mi
,const gchar *property
);
Look up a property on mi
and return the value of it if
it exits. Returns FALSE if the property doesn't exist.
|
The DbusmenuMenuitem to look for the property on. |
|
The property to grab. |
Returns : |
The value of the property or FALSE. |
const guchar * dbusmenu_menuitem_property_get_byte_array (DbusmenuMenuitem *mi
,const gchar *property
,gsize *nelements
);
Look up a property on mi
and return the value of it if
it exits. NULL will be returned if the property doesn't
exist.
|
The DbusmenuMenuitem to look for the property on. |
|
The property to grab. |
|
A pointer to the location to store the number of items (out) |
Returns : |
A byte array with the value of the property that shouldn't be free'd. Or NULL if the property is not set or is not a byte array. [array length=nelements][element-type guint8][transfer none] |
gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem *mi
,const gchar *property
);
Look up a property on mi
and return the value of it if
it exits. Returns zero if the property doesn't exist.
|
The DbusmenuMenuitem to look for the property on. |
|
The property to grab. |
Returns : |
The value of the property or zero. |
GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem *mi
,const gchar *property
);
Look up a property on mi
and return the value of it if
it exits. NULL will be returned if the property doesn't
exist.
|
The DbusmenuMenuitem to look for the property on. |
|
The property to grab. |
Returns : |
A GVariant for the property. [transfer none] |
gboolean dbusmenu_menuitem_property_exist (DbusmenuMenuitem *mi
,const gchar *property
);
Checkes to see if a particular property exists on mi
and
returns TRUE if so.
|
The DbusmenuMenuitem to look for the property on. |
|
The property to look for. |
Returns : |
A boolean checking to see if the property is available |
GList * dbusmenu_menuitem_properties_list (DbusmenuMenuitem *mi
);
This functiong gets a list of the names of all the properties
that are set on this menu item. This data on the list is owned
by the menuitem but the list is not and should be freed using
g_list_free()
when the calling function is done with it.
|
DbusmenuMenuitem to list the properties on |
Returns : |
A list of strings or NULL if there are none. [transfer container][element-type utf8] |
GHashTable * dbusmenu_menuitem_properties_copy (DbusmenuMenuitem *mi
);
This function takes the properties of a DbusmenuMenuitem and puts them into a GHashTable that is referenced by the key of a string and has the value of a string. The hash table may not have any entries if there aren't any or there is an error in processing. It is the caller's responsibility to destroy the created GHashTable.
|
DbusmenuMenuitem that we're interested in the properties of |
Returns : |
A brand new GHashTable that contains all of
theroperties that are on this DbusmenuMenuitem mi . [transfer full]
|
void dbusmenu_menuitem_property_remove (DbusmenuMenuitem *mi
,const gchar *property
);
Removes a property from the menuitem.
|
The DbusmenuMenuitem to remove the property on. |
|
The property to look for. |
void dbusmenu_menuitem_set_root (DbusmenuMenuitem *mi
,gboolean root
);
This function sets the internal value of whether this is a root node or not.
|
DbusmenuMenuitem to set whether it's root |
|
Whether mi is a root node or not |
gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem *mi
);
This function returns the internal value of whether this is a root node or not.
|
DbusmenuMenuitem to see whether it's root |
Returns : |
TRUE if this is a root node |
void dbusmenu_menuitem_foreach (DbusmenuMenuitem *mi
,void (*func) (DbusmenuMenuitem * mi, gpointer data)
,gpointer data
);
This calls the function func
on this menu item and all
of the children of this item. And their children. And
their children. And... you get the point. It will get
called on the whole tree.
|
The DbusmenItem to start from |
|
Function to call on every node in the tree |
|
User data to pass to the function. [closure] |
void dbusmenu_menuitem_handle_event (DbusmenuMenuitem *mi
,const gchar *name
,GVariant *variant
,guint timestamp
);
This function is called to create an event. It is likely to be overrided by subclasses. The default menu item will respond to the activate signal and do:
Emits the "item-activate" signal on this menu item. Called by server objects when they get the appropriate DBus signals from the client.
If you subclass this function you should really think about calling the parent function unless you have a good reason not to.
|
The DbusmenuMenuitem to send the signal on. |
|
The name of the signal |
|
A value that could be set for the event |
|
The timestamp of when the event happened |
void dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem *mi
,void (*cb) (DbusmenuMenuitem * mi, gpointer user_data)
,gpointer cb_data
);
This function is used to send the even that the submenu of this item is about to be shown. Callers to this event should delay showing the menu until their callback is called if possible.
|
The DbusmenuMenuitem to send the signal on. |
|
Callback to call when the call has returned. |
|
Data to pass to the callback. [closure] |
void dbusmenu_menuitem_show_to_user (DbusmenuMenuitem *mi
,guint timestamp
);
Signals that this menu item should be shown to the user. If this is server side the server will then take it and send it over the bus.
|
DbusmenuMenuitem to show |
|
The time that the user requested it to be shown |
DbusmenuMenuitem * dbusmenu_menuitem_get_parent (DbusmenuMenuitem *mi
);
This function looks up the parent of mi
|
The DbusmenuMenuitem for which to inspect the parent |
Returns : |
The parent of this menu item. [transfer none] |
gboolean dbusmenu_menuitem_set_parent (DbusmenuMenuitem *mi
,DbusmenuMenuitem *parent
);
Sets the parent of mi
to parent
. If mi
already
has a parent, then this call will fail. The parent will
be set automatically when using the usual methods to add a
child menuitem, so this function should not normally be
called directly
|
The DbusmenuMenuitem for which to set the parent |
|
The new parent DbusmenuMenuitem |
Returns : |
Whether the parent was set successfully |
gboolean dbusmenu_menuitem_unparent (DbusmenuMenuitem *mi
);
Unparents the menu item mi
. If mi
doesn't have a
parent, then this call will fail. The menuitem will
be unparented automatically when using the usual methods
to delete a child menuitem, so this function should not
normally be called directly
|
The DbusmenuMenuitem to unparent |
Returns : |
Whether the menu item was unparented successfully |