DbusmenuMenuitem

DbusmenuMenuitem — A lowlevel represenation of a menuitem

Stability Level

Unstable, unless otherwise indicated

Functions

void (*dbusmenu_menuitem_about_to_show_cb) ()
GVariant * (*dbusmenu_menuitem_buildvariant_slot_t) ()
DbusmenuMenuitem * dbusmenu_menuitem_new ()
DbusmenuMenuitem * dbusmenu_menuitem_new_with_id ()
gint dbusmenu_menuitem_get_id ()
GList * dbusmenu_menuitem_get_children ()
GList * dbusmenu_menuitem_take_children ()
guint dbusmenu_menuitem_get_position ()
guint dbusmenu_menuitem_get_position_realized ()
gboolean dbusmenu_menuitem_child_append ()
gboolean dbusmenu_menuitem_child_prepend ()
gboolean dbusmenu_menuitem_child_delete ()
gboolean dbusmenu_menuitem_child_add_position ()
gboolean dbusmenu_menuitem_child_reorder ()
DbusmenuMenuitem * dbusmenu_menuitem_child_find ()
DbusmenuMenuitem * dbusmenu_menuitem_find_id ()
gboolean dbusmenu_menuitem_property_set ()
gboolean dbusmenu_menuitem_property_set_bool ()
gboolean dbusmenu_menuitem_property_set_byte_array ()
gboolean dbusmenu_menuitem_property_set_int ()
gboolean dbusmenu_menuitem_property_set_variant ()
const gchar * dbusmenu_menuitem_property_get ()
gboolean dbusmenu_menuitem_property_get_bool ()
const guchar * dbusmenu_menuitem_property_get_byte_array ()
gint dbusmenu_menuitem_property_get_int ()
GVariant * dbusmenu_menuitem_property_get_variant ()
gboolean dbusmenu_menuitem_property_exist ()
GList * dbusmenu_menuitem_properties_list ()
GHashTable * dbusmenu_menuitem_properties_copy ()
void dbusmenu_menuitem_property_remove ()
void dbusmenu_menuitem_set_root ()
gboolean dbusmenu_menuitem_get_root ()
void dbusmenu_menuitem_foreach ()
void dbusmenu_menuitem_handle_event ()
void dbusmenu_menuitem_send_about_to_show ()
void dbusmenu_menuitem_show_to_user ()
DbusmenuMenuitem * dbusmenu_menuitem_get_parent ()
gboolean dbusmenu_menuitem_set_parent ()
gboolean dbusmenu_menuitem_unparent ()

Types and Values

#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
struct DbusmenuMenuitemClass

Includes

#include <libdbusmenu-glib/menuitem.h>

Description

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 its 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.

Functions

dbusmenu_menuitem_about_to_show_cb ()

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.

Parameters

mi

Menu item that should be shown

 

user_data

Extra user data sent with the function.

[closure]

dbusmenu_menuitem_buildvariant_slot_t ()

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 its own children.

Parameters

mi

Menu item that should be built from.

[in]

properties

A list of properties that should be the only ones in the resulting variant structure.

[allow-none]

Returns

A variant representing this item and its children.

[transfer full]


dbusmenu_menuitem_new ()

DbusmenuMenuitem *
dbusmenu_menuitem_new (void);

Create a new DbusmenuMenuitem with all default values.

Returns

A newly allocated DbusmenuMenuitem.


dbusmenu_menuitem_new_with_id ()

DbusmenuMenuitem *
dbusmenu_menuitem_new_with_id (gint id);

This creates a blank DbusmenuMenuitem with a specific ID.

Parameters

id

ID to use for this menuitem

 

Returns

A newly allocated DbusmenuMenuitem.


dbusmenu_menuitem_get_id ()

gint
dbusmenu_menuitem_get_id (DbusmenuMenuitem *mi);

Gets the unique ID for mi .

Parameters

mi

The DbusmenuMenuitem to query.

 

Returns

The ID of the mi .


dbusmenu_menuitem_get_children ()

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.

Parameters

mi

The DbusmenuMenuitem to query.

 

Returns

A GList of pointers to DbusmenuMenuitem objects.

[transfer none][element-type Dbusmenu.Menuitem]


dbusmenu_menuitem_take_children ()

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.

Parameters

mi

The DbusmenMenuitem to take the children from.

 

Returns

A GList of pointers to DbusmenuMenuitem objects.

[transfer full][element-type Dbusmenu.Menuitem]


dbusmenu_menuitem_get_position ()

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.

Parameters

mi

The DbusmenuMenuitem to find the position of

 

parent

The DbusmenuMenuitem who's children contain mi

 

Returns

The position of mi in the children of parent .


dbusmenu_menuitem_get_position_realized ()

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.

Parameters

mi

The DbusmenuMenuitem to find the position of

 

parent

The DbusmenuMenuitem who's children contain mi

 

Returns

The position of mi in the realized children of parent .


dbusmenu_menuitem_child_append ()

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.

Parameters

mi

The DbusmenuMenuitem which will become a new parent

 

child

The DbusmenMenuitem that will be a child

 

Returns

Whether the child has been added successfully.


dbusmenu_menuitem_child_prepend ()

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.

Parameters

mi

The DbusmenuMenuitem which will become a new parent

 

child

The DbusmenMenuitem that will be a child

 

Returns

Whether the child has been added successfully.


dbusmenu_menuitem_child_delete ()

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 .

Parameters

mi

The DbusmenuMenuitem which has child as a child

 

child

The child DbusmenuMenuitem that you want to no longer be a child of mi .

 

Returns

If we were able to delete child .


dbusmenu_menuitem_child_add_position ()

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.

Parameters

mi

The DbusmenuMenuitem that we're adding the child child to.

 

child

The DbusmenuMenuitem to make a child of mi .

 

position

Where in mi object's list of chidren child should be placed.

 

Returns

Whether child was added successfully.


dbusmenu_menuitem_child_reorder ()

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.

Parameters

mi

The DbusmenuMenuitem that has children needing realignment

 

child

The DbusmenuMenuitem that is a child needing to be moved

 

position

The position in the list to place it in

 

Returns

Whether the move was successful.


dbusmenu_menuitem_child_find ()

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.

Parameters

mi

The DbusmenuMenuitem who's children to look on

 

id

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]


dbusmenu_menuitem_find_id ()

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.

Parameters

mi

DbusmenuMenuitem at the top of the tree to search

 

id

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]


dbusmenu_menuitem_property_set ()

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.

Parameters

mi

The DbusmenuMenuitem to set the property on.

 

property

Name of the property to set.

 

value

The value of the property.

 

Returns

A boolean representing if the property value was set.


dbusmenu_menuitem_property_set_bool ()

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.

Parameters

mi

The DbusmenuMenuitem to set the property on.

 

property

Name of the property to set.

 

value

The value of the property.

 

Returns

A boolean representing if the property value was set.


dbusmenu_menuitem_property_set_byte_array ()

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.

Parameters

mi

The DbusmenuMenuitem to set the property on.

 

property

Name of the property to set.

 

value

The byte array.

 

nelements

The number of elements in the byte array.

 

Returns

A boolean representing if the property value was set.


dbusmenu_menuitem_property_set_int ()

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.

Parameters

mi

The DbusmenuMenuitem to set the property on.

 

property

Name of the property to set.

 

value

The value of the property.

 

Returns

A boolean representing if the property value was set.


dbusmenu_menuitem_property_set_variant ()

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.

Parameters

mi

The DbusmenuMenuitem to set the property on.

 

property

Name of the property to set.

 

value

The value of the property.

 

Returns

A boolean representing if the property value was set.


dbusmenu_menuitem_property_get ()

const gchar *
dbusmenu_menuitem_property_get (const 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.

Parameters

mi

The DbusmenuMenuitem to look for the property on.

 

property

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]


dbusmenu_menuitem_property_get_bool ()

gboolean
dbusmenu_menuitem_property_get_bool (const 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.

Parameters

mi

The DbusmenuMenuitem to look for the property on.

 

property

The property to grab.

 

Returns

The value of the property or FALSE.


dbusmenu_menuitem_property_get_byte_array ()

const guchar *
dbusmenu_menuitem_property_get_byte_array
                               (const 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.

Parameters

mi

The DbusmenuMenuitem to look for the property on.

 

property

The property to grab.

 

nelements

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]


dbusmenu_menuitem_property_get_int ()

gint
dbusmenu_menuitem_property_get_int (const 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.

Parameters

mi

The DbusmenuMenuitem to look for the property on.

 

property

The property to grab.

 

Returns

The value of the property or zero.


dbusmenu_menuitem_property_get_variant ()

GVariant *
dbusmenu_menuitem_property_get_variant
                               (const 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.

Parameters

mi

The DbusmenuMenuitem to look for the property on.

 

property

The property to grab.

 

Returns

A GVariant for the property.

[transfer none]


dbusmenu_menuitem_property_exist ()

gboolean
dbusmenu_menuitem_property_exist (const DbusmenuMenuitem *mi,
                                  const gchar *property);

Checkes to see if a particular property exists on mi and returns TRUE if so.

Parameters

mi

The DbusmenuMenuitem to look for the property on.

 

property

The property to look for.

 

Returns

A boolean checking to see if the property is available


dbusmenu_menuitem_properties_list ()

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.

Parameters

mi

DbusmenuMenuitem to list the properties on

 

Returns

A list of strings or NULL if there are none.

[transfer container][element-type utf8]


dbusmenu_menuitem_properties_copy ()

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.

Parameters

mi

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]


dbusmenu_menuitem_property_remove ()

void
dbusmenu_menuitem_property_remove (DbusmenuMenuitem *mi,
                                   const gchar *property);

Removes a property from the menuitem.

Parameters

mi

The DbusmenuMenuitem to remove the property on.

 

property

The property to look for.

 

dbusmenu_menuitem_set_root ()

void
dbusmenu_menuitem_set_root (DbusmenuMenuitem *mi,
                            gboolean root);

This function sets the internal value of whether this is a root node or not.

Parameters

mi

DbusmenuMenuitem to set whether it's root

 

root

Whether mi is a root node or not

 

dbusmenu_menuitem_get_root ()

gboolean
dbusmenu_menuitem_get_root (DbusmenuMenuitem *mi);

This function returns the internal value of whether this is a root node or not.

Parameters

mi

DbusmenuMenuitem to see whether it's root

 

Returns

TRUE if this is a root node


dbusmenu_menuitem_foreach ()

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.

Parameters

mi

The DbusmenItem to start from

 

func

Function to call on every node in the tree

 

data

User data to pass to the function.

[closure]

dbusmenu_menuitem_handle_event ()

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.

Parameters

mi

The DbusmenuMenuitem to send the signal on.

 

name

The name of the signal

 

variant

A value that could be set for the event

 

timestamp

The timestamp of when the event happened

 

dbusmenu_menuitem_send_about_to_show ()

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.

Parameters

mi

The DbusmenuMenuitem to send the signal on.

 

cb

Callback to call when the call has returned.

 

cb_data

Data to pass to the callback.

[closure]

dbusmenu_menuitem_show_to_user ()

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.

Parameters

mi

DbusmenuMenuitem to show

 

timestamp

The time that the user requested it to be shown

 

dbusmenu_menuitem_get_parent ()

DbusmenuMenuitem *
dbusmenu_menuitem_get_parent (DbusmenuMenuitem *mi);

This function looks up the parent of mi

Parameters

mi

The DbusmenuMenuitem for which to inspect the parent

 

Returns

The parent of this menu item.

[transfer none]


dbusmenu_menuitem_set_parent ()

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

Parameters

mi

The DbusmenuMenuitem for which to set the parent

 

parent

The new parent DbusmenuMenuitem

 

Returns

Whether the parent was set successfully


dbusmenu_menuitem_unparent ()

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

Parameters

mi

The DbusmenuMenuitem to unparent

 

Returns

Whether the menu item was unparented successfully

Types and Values

DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED

#define DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED    "property-changed"

String to attach to signal “property-changed”


DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED

#define DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED      "item-activated"

String to attach to signal “item-activated”


DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED

#define DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED         "child-added"

String to attach to signal “child-added”


DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED

#define DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED       "child-removed"

String to attach to signal “child-removed”


DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED

#define DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED         "child-moved"

String to attach to signal “child-moved”


DBUSMENU_MENUITEM_SIGNAL_EVENT

#define DBUSMENU_MENUITEM_SIGNAL_EVENT               "event"

String to attach to signal “event”


DBUSMENU_MENUITEM_SIGNAL_REALIZED

#define DBUSMENU_MENUITEM_SIGNAL_REALIZED            "realized"

String to attach to signal “realized”


DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID

#define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID         (g_signal_lookup(DBUSMENU_MENUITEM_SIGNAL_REALIZED, DBUSMENU_TYPE_MENUITEM))

ID to attach to signal “realized”


DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW

#define DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW       "about-to-show"

String to attach to signal “about-to-show”


DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER

#define DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER        "show-to-user"

String to attach to signal “show-to-user”


DBUSMENU_MENUITEM_PROP_TYPE

#define DBUSMENU_MENUITEM_PROP_TYPE                  "type"

DbusmenuMenuitem property used to represent what type of menuitem this object represents. Type: G_VARIANT_TYPE_STRING.


DBUSMENU_MENUITEM_PROP_VISIBLE

#define DBUSMENU_MENUITEM_PROP_VISIBLE               "visible"

DbusmenuMenuitem property used to represent whether the menuitem should be shown or not. Type: G_VARIANT_TYPE_BOOLEAN.


DBUSMENU_MENUITEM_PROP_ENABLED

#define DBUSMENU_MENUITEM_PROP_ENABLED               "enabled"

DbusmenuMenuitem property used to represent whether the menuitem is clickable or not. Type: G_VARIANT_TYPE_BOOLEAN.


DBUSMENU_MENUITEM_PROP_LABEL

#define DBUSMENU_MENUITEM_PROP_LABEL                 "label"

DbusmenuMenuitem property used for the text on the menu item. Type: G_VARIANT_TYPE_STRING


DBUSMENU_MENUITEM_PROP_ICON_NAME

#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


DBUSMENU_MENUITEM_PROP_ICON_DATA

#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()


DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE

#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


DBUSMENU_MENUITEM_PROP_TOGGLE_STATE

#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


DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY

#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


DBUSMENU_MENUITEM_PROP_SHORTCUT

#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()


DBUSMENU_MENUITEM_PROP_DISPOSITION

#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


DBUSMENU_MENUITEM_PROP_ACCESSIBLE_DESC

#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


DBUSMENU_MENUITEM_TOGGLE_CHECK

#define DBUSMENU_MENUITEM_TOGGLE_CHECK               "checkmark"

Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE to be a standard check mark item.


DBUSMENU_MENUITEM_TOGGLE_RADIO

#define DBUSMENU_MENUITEM_TOGGLE_RADIO               "radio"

Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE to be a standard radio item.


DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED

#define DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED     0

Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's toggle item is empty.


DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED

#define DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED       1

Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's toggle item is filled.


DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN

#define DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN       -1

Used to set DBUSMENU_MENUITEM_PROP_TOGGLE_STATE so that the menu's toggle item is undecided.


DBUSMENU_MENUITEM_ICON_NAME_BLANK

#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.


DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU

#define DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU      "submenu"

Used in DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY to have the subitems displayed as a submenu.


DBUSMENU_MENUITEM_SHORTCUT_ALT

#define DBUSMENU_MENUITEM_SHORTCUT_ALT               "Alt"

Used in DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the alternate key.


DBUSMENU_MENUITEM_SHORTCUT_CONTROL

#define DBUSMENU_MENUITEM_SHORTCUT_CONTROL           "Control"

Used in DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the control key.


DBUSMENU_MENUITEM_SHORTCUT_SHIFT

#define DBUSMENU_MENUITEM_SHORTCUT_SHIFT             "Shift"

Used in DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the shift key.


DBUSMENU_MENUITEM_SHORTCUT_SUPER

#define DBUSMENU_MENUITEM_SHORTCUT_SUPER             "Super"

Used in DBUSMENU_MENUITEM_PROP_SHORTCUT to represent the super key.


DBUSMENU_MENUITEM_DISPOSITION_NORMAL

#define DBUSMENU_MENUITEM_DISPOSITION_NORMAL         "normal"

Used in DBUSMENU_MENUITEM_PROP_DISPOSITION to have a menu item displayed in the normal manner. Default value.


DBUSMENU_MENUITEM_DISPOSITION_INFORMATIVE

#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.


DBUSMENU_MENUITEM_DISPOSITION_WARNING

#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.


DBUSMENU_MENUITEM_DISPOSITION_ALERT

#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.


DBUSMENU_MENUITEM_EVENT_ACTIVATED

#define DBUSMENU_MENUITEM_EVENT_ACTIVATED            "clicked"

String for the event identifier when a menu item is clicked on by the user.


DBUSMENU_MENUITEM_EVENT_CLOSED

#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.


DBUSMENU_MENUITEM_EVENT_OPENED

#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

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.

Members

GObject parent;

Parent object

 

DbusmenuMenuitemPrivate *priv;

Private data

 

struct DbusmenuMenuitemClass

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, dbusmenu_menuitem_about_to_show_cb cb, 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.

Members

property_changed ()

Slot for “property-changed”.

 

item_activated ()

Slot for “item-activated”.

 

child_added ()

Slot for “child-added”.

 

child_removed ()

Slot for “child-removed”.

 

child_moved ()

Slot for “child-moved”.

 

realized ()

Slot for “realized”.

 

dbusmenu_menuitem_buildvariant_slot_t buildvariant;

Virtual function that appends the strings required to represent this menu item in the menu variant.

 

handle_event ()

This function is to override how events are handled by subclasses. Look at dbusmenu_menuitem_handle_event for lots of good information.

 

send_about_to_show ()

Virtual function that notifies server that the client is about to show a menu.

 

show_to_user ()

Slot for “show-to-user”.

 

about_to_show ()

Slot for “about-to-show”.

 

event ()

Slot for “event”.

 

reserved1 ()

Reserved for future use.

 

reserved2 ()

Reserved for future use.

 

reserved3 ()

Reserved for future use.

 

reserved4 ()

Reserved for future use.

 

reserved5 ()

Reserved for future use.