DbusmenuMenuitem

## DbusmenuMenuitem DbusmenuMenuitem — A lowlevel represenation of a menuitem |

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #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_REALIZED
    #define             DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID
    #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_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
                        DbusmenuMenuitem;
    void                (*dbusmenu_menuitem_about_to_show_cb)
                                                            (DbusmenuMenuitem *mi,
                                                             gpointer user_data);
    void                (*dbusmenu_menuitem_buildxml_slot_t)
                                                            (DbusmenuMenuitem *mi,
                                                             GPtrArray *stringarray);
                        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_value
                                                            (DbusmenuMenuitem *mi,
                                                             const gchar *property,
                                                             const GValue *value);
    gboolean            dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem *mi,
                                                             const gchar *property,
                                                             const gboolean value);
    gboolean            dbusmenu_menuitem_property_set_int  (DbusmenuMenuitem *mi,
                                                             const gchar *property,
                                                             const gint value);
    const gchar *       dbusmenu_menuitem_property_get      (DbusmenuMenuitem *mi,
                                                             const gchar *property);
    const GValue *      dbusmenu_menuitem_property_get_value
                                                            (DbusmenuMenuitem *mi,
                                                             const gchar *property);
    gboolean            dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem *mi,
                                                             const gchar *property);
    gint                dbusmenu_menuitem_property_get_int  (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 (funcDbusmenuMenuitem * mi, gpointer data) (),
                                                             gpointer data);
    void                dbusmenu_menuitem_handle_event      (DbusmenuMenuitem *mi,
                                                             const gchar *name,
                                                             const GValue *value,
                                                             guint timestamp);
    void                dbusmenu_menuitem_send_about_to_show
                                                            (DbusmenuMenuitem *mi,
                                                             dbusmenu_menuitem_about_to_show_cb cb,
                                                             gpointer cb_data);

## Object Hierarchy

      GObject
       +----DbusmenuMenuitem
             +----DbusmenuClientMenuitem
             +----DbusmenuMenuitemProxy

## Properties

      "id"                       gint                  : Read / Write / Construct Only

## Signals

      "child-added"                                    : Run Last
      "child-moved"                                    : Run Last
      "child-removed"                                  : Run Last
      "item-activated"                                 : Run Last
      "property-changed"                               : Run Last
      "realized"                                       : Run Last

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

## Details

### DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED

    #define DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED    "property-changed"

### DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED

    #define DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED      "item-activated"

### DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED

    #define DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED         "child-added"

### DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED

    #define DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED       "child-removed"

### DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED

    #define DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED         "child-moved"

### DBUSMENU_MENUITEM_SIGNAL_REALIZED

    #define DBUSMENU_MENUITEM_SIGNAL_REALIZED            "realized"

### DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID

    #define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID         (g_signal_lookup(DBUSMENU_MENUITEM_SIGNAL_REALIZED, DBUSMENU_TYPE_MENUITEM))

### DBUSMENU_MENUITEM_PROP_TYPE

    #define DBUSMENU_MENUITEM_PROP_TYPE                  "type"

### DBUSMENU_MENUITEM_PROP_VISIBLE

    #define DBUSMENU_MENUITEM_PROP_VISIBLE               "visible"

### DBUSMENU_MENUITEM_PROP_ENABLED

    #define DBUSMENU_MENUITEM_PROP_ENABLED               "enabled"

### DBUSMENU_MENUITEM_PROP_LABEL

    #define DBUSMENU_MENUITEM_PROP_LABEL                 "label"

### DBUSMENU_MENUITEM_PROP_ICON_NAME

    #define DBUSMENU_MENUITEM_PROP_ICON_NAME             "icon-name"

### DBUSMENU_MENUITEM_PROP_ICON_DATA

    #define DBUSMENU_MENUITEM_PROP_ICON_DATA             "icon-data"

### DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE

    #define DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE           "toggle-type"

### DBUSMENU_MENUITEM_PROP_TOGGLE_STATE

    #define DBUSMENU_MENUITEM_PROP_TOGGLE_STATE          "toggle-state"

### DBUSMENU_MENUITEM_TOGGLE_CHECK

    #define DBUSMENU_MENUITEM_TOGGLE_CHECK               "checkmark"

### DBUSMENU_MENUITEM_TOGGLE_RADIO

    #define DBUSMENU_MENUITEM_TOGGLE_RADIO               "radio"

### DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED

    #define DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED     0

### DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED

    #define DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED       1

### DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN

    #define DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN       -1

### DBUSMENU_MENUITEM_ICON_NAME_BLANK

    #define DBUSMENU_MENUITEM_ICON_NAME_BLANK            "blank-icon"

### DbusmenuMenuitem

    typedef struct _DbusmenuMenuitem DbusmenuMenuitem;

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.

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

`mi` : | Menu item that should be shown
`user_data` : | Extra user data sent with the function. closure

### dbusmenu_menuitem_buildxml_slot_t ()

    void                (*dbusmenu_menuitem_buildxml_slot_t)
                                                            (DbusmenuMenuitem *mi,
                                                             GPtrArray *stringarray);

This is the function that is called to represent this menu item as an XML fragment. Should call it's own children.

`mi` : | Menu item that should be built from. in.
`stringarray` : | An array of strings that can be combined into an XML file.. inout. transfer none. array. element-type utf8.

### DbusmenuMenuitemClass

    typedef struct {
    	GObjectClass parent_class;

    	/* Signals */
    	void (*property_changed) (gchar * property, GValue * 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_buildxml_slot_t buildxml;
    	void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp);
    	void (*send_about_to_show) (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data);

    	void (*reserved1) (void);
    	/* void (*reserved2) (void); */
    	/* void (*reserved3) (void); */
    	/* void (*reserved4) (void); -- realized, realloc when bumping lib version */
    } DbusmenuMenuitemClass;

GObjectClass `parent_class`; |
`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_buildxml_slot_t `buildxml`; | Virtual function that appends the strings required to represent this menu item in the menu XML file.
`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.
`reserved1` () | Reserved for future use.

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

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

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

`mi` : | The DbusmenuMenuitem to query.
Returns : | A GList of pointers to DbusmenuMenuitem objects.

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

`mi` : | The DbusmenMenuitem to take the children from.
Returns : | A GList of pointers to DbusmenuMenuitem objects.

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

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

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

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

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

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

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

`mi` : |
`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.

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

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

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

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

`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_value ()

    gboolean            dbusmenu_menuitem_property_set_value
                                                            (DbusmenuMenuitem *mi,
                                                             const gchar *property,
                                                             const GValue *value);

`mi` : |
`property` : |
`value` : |
Returns : |

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

`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_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.

`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      (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.

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

### dbusmenu_menuitem_property_get_value ()

    const GValue *      dbusmenu_menuitem_property_get_value
                                                            (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.

`mi` : | The DbusmenuMenuitem to look for the property on.
`property` : | The property to grab.
Returns : | A GValue for the property.

### dbusmenu_menuitem_property_get_bool ()

    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.

`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_int ()

    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.

`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_exist ()

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

`mi` : |
`property` : |
Returns : |

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

`mi` : | DbusmenuMenuitem to list the properties on
Returns : | A list of strings or NULL if there are none.

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

`mi` : | DbusmenuMenuitem that we're interested in the properties of
Returns : | A brand new GHashTable that contains all of the properties that are on this DbusmenuMenuitem `mi`.

### dbusmenu_menuitem_property_remove ()

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

Removes a property from the menuitem.

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

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

`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 (funcDbusmenuMenuitem * 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.

`mi` : | The DbusmenItem to start from
`data` : | User data to pass to the function. closure

### dbusmenu_menuitem_handle_event ()

    void                dbusmenu_menuitem_handle_event      (DbusmenuMenuitem *mi,
                                                             const gchar *name,
                                                             const GValue *value,
                                                             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.

`mi` : | The DbusmenuMenuitem to send the signal on.
`name` : | The name of the signal
`value` : | 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,
                                                             dbusmenu_menuitem_about_to_show_cb cb,
                                                             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.

`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

## Property Details

### The `"id"` property

      "id"                       gint                  : Read / Write / Construct Only

This is a unique indentifier for the menu item.

Allowed values: [G_MAXULONG,30000]

Default value: -1

## Signal Details

### The `"child-added"` signal

    void                user_function                      (DbusmenuMenuitem *arg0,
                                                            GObject          *arg1,
                                                            guint             arg2,
                                                            gpointer          user_data)      : Run Last

Signaled when the child menuitem has been added to the parent.

`arg0` : | The DbusmenuMenuitem which is the parent.
`arg1` : | The DbusmenuMenuitem which is the child.
`arg2` : | The position that the child is being added in.
`user_data` : | user data set when the signal handler was connected.

### The `"child-moved"` signal

    void                user_function                      (DbusmenuMenuitem *arg0,
                                                            GObject          *arg1,
                                                            guint             arg2,
                                                            guint             arg3,
                                                            gpointer          user_data)      : Run Last

Signaled when the child menuitem has had it's location in the list change.

`arg0` : | The DbusmenuMenuitem which is the parent.
`arg1` : | The DbusmenuMenuitem which is the child.
`arg2` : | The position that the child is being moved to.
`arg3` : | The position that the child is was in.
`user_data` : | user data set when the signal handler was connected.

### The `"child-removed"` signal

    void                user_function                      (DbusmenuMenuitem *arg0,
                                                            GObject          *arg1,
                                                            gpointer          user_data)      : Run Last

Signaled when the child menuitem has been requested to be removed from the parent. This signal is called when it has been removed from the list but not yet had g_object_unref called on it.

`arg0` : | The DbusmenuMenuitem which was the parent.
`arg1` : | The DbusmenuMenuitem which was the child.
`user_data` : | user data set when the signal handler was connected.

### The `"item-activated"` signal

    void                user_function                      (DbusmenuMenuitem *arg0,
                                                            guint             arg1,
                                                            gpointer          user_data)      : Run Last

Emitted on the objects on the server side when they are signaled on the client side.

`arg0` : | The DbusmenuMenuitem object.
`arg1` : | The timestamp of when it was activated
`user_data` : | user data set when the signal handler was connected.

### The `"property-changed"` signal

    void                user_function                      (DbusmenuMenuitem *arg0,
                                                            gchar            *arg1,
                                                            gpointer          arg2,
                                                            gpointer          user_data)      : Run Last

Emitted everytime a property on a menuitem is either updated or added.

`arg0` : | The DbusmenuMenuitem object.
`arg1` : | The name of the property that changed
`arg2` : | The new value of the property
`user_data` : | user data set when the signal handler was connected.

### The `"realized"` signal

    void                user_function                      (DbusmenuMenuitem *arg0,
                                                            gpointer          user_data)      : Run Last

Emitted when the initial request for properties is complete on the item. If there is a type handler configured for the "type" parameter that will be executed before this is signaled.

`arg0` : | The DbusmenuMenuitem object.
`user_data` : | user data set when the signal handler was connected.