Trait MenuitemExt

Source
pub trait MenuitemExt: 'static {
Show 38 methods // Required methods fn child_add_position( &self, child: &impl IsA<Menuitem>, position: u32, ) -> bool; fn child_append(&self, child: &impl IsA<Menuitem>) -> bool; fn child_delete(&self, child: &impl IsA<Menuitem>) -> bool; fn child_find(&self, id: i32) -> Option<Menuitem>; fn child_prepend(&self, child: &impl IsA<Menuitem>) -> bool; fn child_reorder(&self, child: &impl IsA<Menuitem>, position: u32) -> bool; fn find_id(&self, id: i32) -> Option<Menuitem>; fn children(&self) -> Vec<Menuitem>; fn id(&self) -> i32; fn parent(&self) -> Option<Menuitem>; fn position(&self, parent: &impl IsA<Menuitem>) -> u32; fn position_realized(&self, parent: &impl IsA<Menuitem>) -> u32; fn is_root(&self) -> bool; fn handle_event(&self, name: &str, variant: &Variant, timestamp: u32); fn properties_list(&self) -> Vec<GString>; fn property_exist(&self, property: &str) -> bool; fn property_get(&self, property: &str) -> Option<GString>; fn property_get_bool(&self, property: &str) -> bool; fn property_get_byte_array(&self, property: &str) -> Vec<u8> ; fn property_get_int(&self, property: &str) -> i32; fn property_get_variant(&self, property: &str) -> Option<Variant>; fn property_remove(&self, property: &str); fn property_set(&self, property: &str, value: &str) -> bool; fn property_set_bool(&self, property: &str, value: bool) -> bool; fn property_set_byte_array(&self, property: &str, values: &[u8]) -> bool; fn property_set_int(&self, property: &str, value: i32) -> bool; fn property_set_variant(&self, property: &str, value: &Variant) -> bool; fn set_parent(&self, parent: &impl IsA<Menuitem>) -> bool; fn set_root(&self, root: bool); fn show_to_user(&self, timestamp: u32); fn take_children(&self) -> Vec<Menuitem>; fn unparent(&self) -> bool; fn connect_about_to_show<F: Fn(&Self) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId; fn connect_event<F: Fn(&Self, &str, &Variant, u32) -> bool + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId; fn connect_item_activated<F: Fn(&Self, u32) + 'static>( &self, f: F, ) -> SignalHandlerId; fn connect_property_changed<F: Fn(&Self, &str, &Variant) + 'static>( &self, f: F, ) -> SignalHandlerId; fn connect_realized<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_show_to_user<F: Fn(&Self, u32) + 'static>( &self, f: F, ) -> SignalHandlerId;
}
Expand description

Trait containing all Menuitem methods.

§Implementors

MenuitemProxy, Menuitem

Required Methods§

Source

fn child_add_position(&self, child: &impl IsA<Menuitem>, position: u32) -> bool

Puts child in the list of children for self at the location specified in position. If there is not enough entires available then child will be placed at the end of the list.

§child

The Menuitem to make a child of self.

§position

Where in self object’s list of chidren child should be placed.

§Returns

Whether child was added successfully.

Source

fn child_append(&self, child: &impl IsA<Menuitem>) -> bool

This function adds child to the list of children on self at the end of that list.

§child

The DbusmenMenuitem that will be a child

§Returns

Whether the child has been added successfully.

Source

fn child_delete(&self, child: &impl IsA<Menuitem>) -> bool

This function removes child from the children list of self. It does not call g_object_unref on child.

§child

The child Menuitem that you want to no longer be a child of self.

§Returns

If we were able to delete child.

Source

fn child_find(&self, id: i32) -> Option<Menuitem>

Search the children of self to find one with the ID of id. If it doesn’t exist then we return None.

§id

The ID of the child that we’re looking for.

§Returns

The menu item with the ID id or None if it can’t be found.

Source

fn child_prepend(&self, child: &impl IsA<Menuitem>) -> bool

This function adds child to the list of children on self at the beginning of that list.

§child

The DbusmenMenuitem that will be a child

§Returns

Whether the child has been added successfully.

Source

fn child_reorder(&self, child: &impl IsA<Menuitem>, position: u32) -> bool

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.

§child

The Menuitem that is a child needing to be moved

§position

The position in the list to place it in

§Returns

Whether the move was successful.

Source

fn find_id(&self, id: i32) -> Option<Menuitem>

This function searchs the whole tree of children that are attached to self. This could be quite a few nodes, all the way down the tree. It is a depth first search.

§id

ID of the Menuitem to search for

§Returns

The Menuitem with the ID of id or None if there isn’t such a menu item in the tree represented by self.

Source

fn children(&self) -> Vec<Menuitem>

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.

§Returns

A GList of pointers to Menuitem objects.

Source

fn id(&self) -> i32

Gets the unique ID for self.

§Returns

The ID of the self.

Source

fn parent(&self) -> Option<Menuitem>

This function looks up the parent of self

§Returns

The parent of this menu item

Source

fn position(&self, parent: &impl IsA<Menuitem>) -> u32

This function returns the position of the menu item self in the children of parent. It will return zero if the menu item can’t be found.

§parent

The Menuitem who’s children contain self

§Returns

The position of self in the children of parent.

Source

fn position_realized(&self, parent: &impl IsA<Menuitem>) -> u32

This function is very similar to dbusmenu_menuitem_get_position except that it only counts in the children that have been realized.

§parent

The Menuitem who’s children contain self

§Returns

The position of self in the realized children of parent.

Source

fn is_root(&self) -> bool

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

§Returns

true if this is a root node

Source

fn handle_event(&self, name: &str, variant: &Variant, timestamp: u32)

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.

§name

The name of the signal

§variant

A value that could be set for the event

§timestamp

The timestamp of when the event happened

Source

fn properties_list(&self) -> Vec<GString>

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.

§Returns

A list of strings or NULL if there are none.

Source

fn property_exist(&self, property: &str) -> bool

Checkes to see if a particular property exists on self and returns true if so.

§property

The property to look for.

§Returns

A boolean checking to see if the property is available

Source

fn property_get(&self, property: &str) -> Option<GString>

Look up a property on self and return the value of it if it exits. None will be returned if the property doesn’t exist.

§property

The property to grab.

§Returns

A string with the value of the property that shouldn’t be free’d. Or None if the property is not set or is not a string.

Source

fn property_get_bool(&self, property: &str) -> bool

Look up a property on self and return the value of it if it exits. Returns false if the property doesn’t exist.

§property

The property to grab.

§Returns

The value of the property or false.

Source

fn property_get_byte_array(&self, property: &str) -> Vec<u8>

Look up a property on self and return the value of it if it exits. None will be returned if the property doesn’t exist.

§property

The property to grab.

§Returns

A byte array with the value of the property that shouldn’t be free’d. Or None if the property is not set or is not a byte array.

Source

fn property_get_int(&self, property: &str) -> i32

Look up a property on self and return the value of it if it exits. Returns zero if the property doesn’t exist.

§property

The property to grab.

§Returns

The value of the property or zero.

Source

fn property_get_variant(&self, property: &str) -> Option<Variant>

Look up a property on self and return the value of it if it exits. None will be returned if the property doesn’t exist.

§property

The property to grab.

§Returns

A GVariant for the property.

Source

fn property_remove(&self, property: &str)

Removes a property from the menuitem.

§property

The property to look for.

Source

fn property_set(&self, property: &str, value: &str) -> bool

Takes the pair of property and value and places them as a property on self. 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.

§property

Name of the property to set.

§value

The value of the property.

§Returns

A boolean representing if the property value was set.

Source

fn property_set_bool(&self, property: &str, value: bool) -> bool

Takes a boolean value and sets it on property as a property on self. 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.

§property

Name of the property to set.

§value

The value of the property.

§Returns

A boolean representing if the property value was set.

Source

fn property_set_byte_array(&self, property: &str, values: &[u8]) -> bool

Takes a byte array value and sets it on property as a property on self. 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.

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

Source

fn property_set_int(&self, property: &str, value: i32) -> bool

Takes a boolean value and sets it on property as a property on self. 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.

§property

Name of the property to set.

§value

The value of the property.

§Returns

A boolean representing if the property value was set.

Source

fn property_set_variant(&self, property: &str, value: &Variant) -> bool

Takes the pair of property and value and places them as a property on self. 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.

§property

Name of the property to set.

§value

The value of the property.

§Returns

A boolean representing if the property value was set.

Source

fn set_parent(&self, parent: &impl IsA<Menuitem>) -> bool

Sets the parent of self to parent. If self 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

§parent

The new parent Menuitem

§Returns

Whether the parent was set successfully

Source

fn set_root(&self, root: bool)

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

§root

Whether self is a root node or not

Source

fn show_to_user(&self, timestamp: u32)

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.

§timestamp

The time that the user requested it to be shown

Source

fn take_children(&self) -> Vec<Menuitem>

While the name sounds devious that’s exactly what this function does. It takes the list of children from the self 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.

§Returns

A GList of pointers to Menuitem objects.

Source

fn unparent(&self) -> bool

Unparents the menu item self. If self 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

§Returns

Whether the menu item was unparented successfully

Source

fn connect_about_to_show<F: Fn(&Self) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted when the submenu for this item is about to be shown

Source

fn connect_event<F: Fn(&Self, &str, &Variant, u32) -> bool + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId

Emitted when an event is passed through. The event is signalled after handle_event is called.

§arg1

Name of the event

§arg2

Information passed along with the event

§arg3

X11 timestamp of when the event happened

Source

fn connect_item_activated<F: Fn(&Self, u32) + 'static>( &self, f: F, ) -> SignalHandlerId

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

§arg1

The timestamp of when it was activated

Source

fn connect_property_changed<F: Fn(&Self, &str, &Variant) + 'static>( &self, f: F, ) -> SignalHandlerId

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

§arg1

The name of the property that changed

§arg2

The new value of the property

Source

fn connect_realized<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

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.

Source

fn connect_show_to_user<F: Fn(&Self, u32) + 'static>( &self, f: F, ) -> SignalHandlerId

Signaled when the application would like the visualization of this menu item shown to the user. This usually requires going over the bus to get it done.

§arg1

Timestamp the event happened at

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§