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
Required Methods§
Sourcefn child_add_position(&self, child: &impl IsA<Menuitem>, position: u32) -> bool
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.
Sourcefn child_append(&self, child: &impl IsA<Menuitem>) -> bool
fn child_append(&self, child: &impl IsA<Menuitem>) -> bool
Sourcefn child_delete(&self, child: &impl IsA<Menuitem>) -> bool
fn child_delete(&self, child: &impl IsA<Menuitem>) -> bool
Sourcefn child_find(&self, id: i32) -> Option<Menuitem>
fn child_find(&self, id: i32) -> Option<Menuitem>
Sourcefn child_prepend(&self, child: &impl IsA<Menuitem>) -> bool
fn child_prepend(&self, child: &impl IsA<Menuitem>) -> bool
Sourcefn find_id(&self, id: i32) -> Option<Menuitem>
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
.
Sourcefn position_realized(&self, parent: &impl IsA<Menuitem>) -> u32
fn position_realized(&self, parent: &impl IsA<Menuitem>) -> u32
Sourcefn handle_event(&self, name: &str, variant: &Variant, timestamp: u32)
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
Sourcefn properties_list(&self) -> Vec<GString>
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.
Sourcefn property_exist(&self, property: &str) -> bool
fn property_exist(&self, property: &str) -> bool
Sourcefn property_get(&self, property: &str) -> Option<GString>
fn property_get(&self, property: &str) -> Option<GString>
Sourcefn property_get_bool(&self, property: &str) -> bool
fn property_get_bool(&self, property: &str) -> bool
Sourcefn property_get_int(&self, property: &str) -> i32
fn property_get_int(&self, property: &str) -> i32
Sourcefn property_get_variant(&self, property: &str) -> Option<Variant>
fn property_get_variant(&self, property: &str) -> Option<Variant>
Sourcefn property_remove(&self, property: &str)
fn property_remove(&self, property: &str)
Sourcefn property_set(&self, property: &str, value: &str) -> bool
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.
Sourcefn property_set_bool(&self, property: &str, value: bool) -> bool
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.
Sourcefn property_set_byte_array(&self, property: &str, values: &[u8]) -> bool
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.
Sourcefn property_set_int(&self, property: &str, value: i32) -> bool
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.
Sourcefn property_set_variant(&self, property: &str, value: &Variant) -> bool
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.
Sourcefn set_parent(&self, parent: &impl IsA<Menuitem>) -> bool
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
Sourcefn set_root(&self, root: bool)
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
Sourcefn show_to_user(&self, timestamp: u32)
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
Sourcefn take_children(&self) -> Vec<Menuitem>
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.
Sourcefn unparent(&self) -> bool
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
Sourcefn connect_about_to_show<F: Fn(&Self) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId
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
Sourcefn connect_event<F: Fn(&Self, &str, &Variant, u32) -> bool + 'static>(
&self,
detail: Option<&str>,
f: F,
) -> SignalHandlerId
fn connect_event<F: Fn(&Self, &str, &Variant, u32) -> bool + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId
Sourcefn connect_item_activated<F: Fn(&Self, u32) + 'static>(
&self,
f: F,
) -> SignalHandlerId
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
Sourcefn connect_property_changed<F: Fn(&Self, &str, &Variant) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_property_changed<F: Fn(&Self, &str, &Variant) + 'static>( &self, f: F, ) -> SignalHandlerId
Sourcefn connect_realized<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
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.
Sourcefn connect_show_to_user<F: Fn(&Self, u32) + 'static>(
&self,
f: F,
) -> SignalHandlerId
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.