#[repr(transparent)]pub struct Builder { /* private fields */ }
Expand description
A GtkBuilder is an auxiliary object that reads textual descriptions
of a user interface and instantiates the described objects. To create
a GtkBuilder from a user interface description, call
gtk_builder_new_from_file()
, from_resource()
or
from_string()
.
In the (unusual) case that you want to add user interface
descriptions from multiple sources to the same GtkBuilder you can
call new()
to get an empty builder and populate it by
(multiple) calls to gtk_builder_add_from_file()
,
BuilderExtManual::add_from_resource()
or BuilderExtManual::add_from_string()
.
A GtkBuilder holds a reference to all objects that it has constructed
and drops these references when it is finalized. This finalization can
cause the destruction of non-widget objects or widgets which are not
contained in a toplevel window. For toplevel windows constructed by a
builder, it is the responsibility of the user to call gtk_widget_destroy()
to get rid of them and all the widgets they contain.
The functions gtk_builder_get_object()
and BuilderExt::objects()
can be used to access the widgets in the interface by the names assigned
to them inside the UI description. Toplevel windows returned by these
functions will stay around until the user explicitly destroys them
with gtk_widget_destroy()
. Other widgets will either be part of a
larger hierarchy constructed by the builder (in which case you should
not have to worry about their lifecycle), or without a parent, in which
case they have to be added to some container to make use of them.
Non-widget objects need to be reffed with g_object_ref()
to keep them
beyond the lifespan of the builder.
The function gtk_builder_connect_signals()
and variants thereof can be
used to connect handlers to the named signals in the description.
GtkBuilder UI Definitions # {BUILDER
-UI}
GtkBuilder parses textual descriptions of user interfaces which are
specified in an XML format which can be roughly described by the
RELAX NG schema below. We refer to these descriptions as “GtkBuilder
UI definitions” or just “UI definitions” if the context is clear.
Do not confuse GtkBuilder UI Definitions with
[GtkUIManager UI Definitions][XML-UI], which are more limited in scope.
It is common to use .ui
as the filename extension for files containing
GtkBuilder UI definitions.
The toplevel element is <interface>
. It optionally takes a “domain”
attribute, which will make the builder look for translated strings
using dgettext()
in the domain specified. This can also be done by
calling BuilderExt::set_translation_domain()
on the builder.
Objects are described by <object>
elements, which can contain
<property>
elements to set properties, <signal>
elements which
connect signals to handlers, and <child>
elements, which describe
child objects (most often widgets inside a container, but also e.g.
actions in an action group, or columns in a tree model). A <child>
element contains an <object>
element which describes the child object.
The target toolkit version(s) are described by <requires>
elements,
the “lib” attribute specifies the widget library in question (currently
the only supported value is “gtk+”) and the “version” attribute specifies
the target version in the form <major>`.`<minor>
. The builder will error
out if the version requirements are not met.
Typically, the specific kind of object represented by an <object>
element is specified by the “class” attribute. If the type has not
been loaded yet, GTK+ tries to find the get_type()
function from the
class name by applying heuristics. This works in most cases, but if
necessary, it is possible to specify the name of the get_type()
function
explictly with the “type-func” attribute. As a special case, GtkBuilder
allows to use an object that has been constructed by a GtkUIManager
in
another part of the UI definition by specifying the id of the GtkUIManager
in the “constructor” attribute and the name of the object in the “id”
attribute.
Objects may be given a name with the “id” attribute, which allows the
application to retrieve them from the builder with gtk_builder_get_object()
.
An id is also necessary to use the object as property value in other
parts of the UI definition. GTK+ reserves ids starting and ending
with ___
(3 underscores) for its own purposes.
Setting properties of objects is pretty straightforward with the
<property>
element: the “name” attribute specifies the name of the
property, and the content of the element specifies the value.
If the “translatable” attribute is set to a true value, GTK+ uses
gettext()
(or dgettext()
if the builder has a translation domain set)
to find a translation for the value. This happens before the value
is parsed, so it can be used for properties of any type, but it is
probably most useful for string properties. It is also possible to
specify a context to disambiguate short strings, and comments which
may help the translators.
GtkBuilder can parse textual representations for the most common
property types: characters, strings, integers, floating-point numbers,
booleans (strings like “TRUE”, “t”, “yes”, “y”, “1” are interpreted
as true
, strings like “FALSE”, “f”, “no”, “n”, “0” are interpreted
as false
), enumerations (can be specified by their name, nick or
integer value), flags (can be specified by their name, nick, integer
value, optionally combined with “|”, e.g. “GTK_VISIBLE|GTK_REALIZED”)
and colors (in a format understood by gdk::RGBA::parse()
).
GVariants can be specified in the format understood by g_variant_parse()
,
and pixbufs can be specified as a filename of an image file to load.
Objects can be referred to by their name and by default refer to
objects declared in the local xml fragment and objects exposed via
BuilderExt::expose_object()
. In general, GtkBuilder allows forward
references to objects — declared in the local xml; an object doesn’t
have to be constructed before it can be referred to. The exception
to this rule is that an object has to be constructed before it can
be used as the value of a construct-only property.
It is also possible to bind a property value to another object’s
property value using the attributes
“bind-source” to specify the source object of the binding,
“bind-property” to specify the source property and optionally
“bind-flags” to specify the binding flags.
Internally builder implements this using GBinding objects.
For more information see [ObjectExtManual::bind_property()
][crate::glib::prelude::ObjectExtManual::bind_property()]
Signal handlers are set up with the <signal>
element. The “name”
attribute specifies the name of the signal, and the “handler” attribute
specifies the function to connect to the signal. By default, GTK+ tries
to find the handler using g_module_symbol()
, but this can be changed by
passing a custom GtkBuilderConnectFunc
to
[BuilderExtManual::connect_signals_full()
][crate::prelude::BuilderExtManual::connect_signals_full()]. The remaining attributes, “after”,
“swapped” and “object”, have the same meaning as the corresponding
parameters of the g_signal_connect_object()
or
g_signal_connect_data()
functions. A “last_modification_time”
attribute is also allowed, but it does not have a meaning to the
builder.
Sometimes it is necessary to refer to widgets which have implicitly
been constructed by GTK+ as part of a composite widget, to set
properties on them or to add further children (e.g. the vbox
of
a Dialog
). This can be achieved by setting the “internal-child”
property of the <child>
element to a true value. Note that GtkBuilder
still requires an <object>
element for the internal child, even if it
has already been constructed.
A number of widgets have different places where a child can be added
(e.g. tabs vs. page content in notebooks). This can be reflected in
a UI definition by specifying the “type” attribute on a <child>
The possible values for the “type” attribute are described in the
sections describing the widget-specific portions of UI definitions.
A GtkBuilder UI Definition
⚠️ The following code is in xml ⚠️
<interface>
<object class="GtkDialog" id="dialog1">
<child internal-child="vbox">
<object class="GtkBox" id="vbox1">
<property name="border-width">10</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="hbuttonbox1">
<property name="border-width">20</property>
<child>
<object class="GtkButton" id="ok_button">
<property name="label">gtk-ok</property>
<property name="use-stock">TRUE</property>
<signal name="clicked" handler="ok_button_clicked"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>
Beyond this general structure, several object classes define their
own XML DTD fragments for filling in the ANY placeholders in the DTD
above. Note that a custom element in a <child>
element gets parsed by
the custom tag handler of the parent object, while a custom element in
an <object>
element gets parsed by the custom tag handler of the object.
These XML fragments are explained in the documentation of the respective objects.
Additionally, since 3.10 a special <template>
tag has been added
to the format allowing one to define a widget class’s components.
See the [GtkWidget documentation][composite-templates] for details.
Implements
Implementations
sourceimpl Builder
impl Builder
pub const NONE: Option<&'static Builder> = None
sourcepub fn new() -> Builder
pub fn new() -> Builder
Creates a new empty builder object.
This function is only useful if you intend to make multiple calls
to gtk_builder_add_from_file()
, BuilderExtManual::add_from_resource()
or BuilderExtManual::add_from_string()
in order to merge multiple UI
descriptions into a single builder.
Most users will probably want to use gtk_builder_new_from_file()
,
from_resource()
or from_string()
.
Returns
a new (empty) Builder
object
sourcepub fn from_resource(resource_path: &str) -> Builder
pub fn from_resource(resource_path: &str) -> Builder
Builds the [GtkBuilder UI definition][BUILDER-UI]
at resource_path
.
If there is an error locating the resource or parsing the description, then the program will be aborted.
resource_path
a GResource
resource path
Returns
a Builder
containing the described interface
sourcepub fn from_string(string: &str) -> Builder
pub fn from_string(string: &str) -> Builder
Builds the user interface described by string
(in the
[GtkBuilder UI definition][BUILDER-UI] format).
If string
is None
-terminated, then length
should be -1.
If length
is not -1, then it is the length of string
.
If there is an error parsing string
then the program will be
aborted. You should not attempt to parse user interface description
from untrusted sources.
string
a user interface (XML) description
length
the length of string
, or -1
Returns
a Builder
containing the interface described by string
Trait Implementations
sourceimpl Ord for Builder
impl Ord for Builder
sourceimpl ParentClassIs for Builder
impl ParentClassIs for Builder
sourceimpl<OT: ObjectType> PartialEq<OT> for Builder
impl<OT: ObjectType> PartialEq<OT> for Builder
sourceimpl<OT: ObjectType> PartialOrd<OT> for Builder
impl<OT: ObjectType> PartialOrd<OT> for Builder
sourcefn partial_cmp(&self, other: &OT) -> Option<Ordering>
fn partial_cmp(&self, other: &OT) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl StaticType for Builder
impl StaticType for Builder
sourcefn static_type() -> Type
fn static_type() -> Type
Returns the type identifier of Self
.
impl Eq for Builder
Auto Trait Implementations
impl RefUnwindSafe for Builder
impl !Send for Builder
impl !Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Cast for T where
T: ObjectType,
impl<T> Cast for T where
T: ObjectType,
sourcefn upcast<T>(self) -> T where
T: ObjectType,
Self: IsA<T>,
fn upcast<T>(self) -> T where
T: ObjectType,
Self: IsA<T>,
Upcasts an object to a superclass or interface T
. Read more
sourcefn upcast_ref<T>(&self) -> &T where
T: ObjectType,
Self: IsA<T>,
fn upcast_ref<T>(&self) -> &T where
T: ObjectType,
Self: IsA<T>,
Upcasts an object to a reference of its superclass or interface T
. Read more
sourcefn downcast<T>(self) -> Result<T, Self> where
T: ObjectType,
Self: CanDowncast<T>,
fn downcast<T>(self) -> Result<T, Self> where
T: ObjectType,
Self: CanDowncast<T>,
Tries to downcast to a subclass or interface implementor T
. Read more
sourcefn downcast_ref<T>(&self) -> Option<&T> where
T: ObjectType,
Self: CanDowncast<T>,
fn downcast_ref<T>(&self) -> Option<&T> where
T: ObjectType,
Self: CanDowncast<T>,
Tries to downcast to a reference of its subclass or interface implementor T
. Read more
sourcefn dynamic_cast<T>(self) -> Result<T, Self> where
T: ObjectType,
fn dynamic_cast<T>(self) -> Result<T, Self> where
T: ObjectType,
Tries to cast to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
sourcefn dynamic_cast_ref<T>(&self) -> Option<&T> where
T: ObjectType,
fn dynamic_cast_ref<T>(&self) -> Option<&T> where
T: ObjectType,
Tries to cast to reference to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
sourceunsafe fn unsafe_cast<T>(self) -> T where
T: ObjectType,
unsafe fn unsafe_cast<T>(self) -> T where
T: ObjectType,
Casts to T
unconditionally. Read more
sourceunsafe fn unsafe_cast_ref<T>(&self) -> &T where
T: ObjectType,
unsafe fn unsafe_cast_ref<T>(&self) -> &T where
T: ObjectType,
Casts to &T
unconditionally. Read more
sourceimpl<U> IsSubclassableExt for U where
U: IsClass + ParentClassIs,
impl<U> IsSubclassableExt for U where
U: IsClass + ParentClassIs,
fn parent_class_init<T>(class: &mut Class<U>) where
T: ObjectSubclass,
<U as ParentClassIs>::Parent: IsSubclassable<T>,
fn parent_instance_init<T>(instance: &mut InitializingObject<T>) where
T: ObjectSubclass,
<U as ParentClassIs>::Parent: IsSubclassable<T>,
sourceimpl<T> ObjectExt for T where
T: ObjectType,
impl<T> ObjectExt for T where
T: ObjectType,
sourcefn is<U>(&self) -> bool where
U: StaticType,
fn is<U>(&self) -> bool where
U: StaticType,
Returns true
if the object is an instance of (can be cast to) T
.
sourcefn object_class(&self) -> &Class<Object>
fn object_class(&self) -> &Class<Object>
Returns the ObjectClass
of the object. Read more
sourcefn class_of<U>(&self) -> Option<&Class<U>> where
U: IsClass,
fn class_of<U>(&self) -> Option<&Class<U>> where
U: IsClass,
Returns the class of the object in the given type T
. Read more
sourcefn interface<U>(&self) -> Option<InterfaceRef<'_, U>> where
U: IsInterface,
fn interface<U>(&self) -> Option<InterfaceRef<'_, U>> where
U: IsInterface,
Returns the interface T
of the object. Read more
sourcefn try_set_property<V>(
&self,
property_name: &str,
value: V
) -> Result<(), BoolError> where
V: ToValue,
fn try_set_property<V>(
&self,
property_name: &str,
value: V
) -> Result<(), BoolError> where
V: ToValue,
Similar to Self::set_property
but fails instead of panicking.
sourcefn set_property<V>(&self, property_name: &str, value: V) where
V: ToValue,
fn set_property<V>(&self, property_name: &str, value: V) where
V: ToValue,
Sets the property property_name
of the object to value value
. Read more
sourcefn try_set_property_from_value(
&self,
property_name: &str,
value: &Value
) -> Result<(), BoolError>
fn try_set_property_from_value(
&self,
property_name: &str,
value: &Value
) -> Result<(), BoolError>
Similar to Self::set_property
but fails instead of panicking.
sourcefn set_property_from_value(&self, property_name: &str, value: &Value)
fn set_property_from_value(&self, property_name: &str, value: &Value)
Sets the property property_name
of the object to value value
. Read more
sourcefn try_set_properties(
&self,
property_values: &[(&str, &dyn ToValue)]
) -> Result<(), BoolError>
fn try_set_properties(
&self,
property_values: &[(&str, &dyn ToValue)]
) -> Result<(), BoolError>
Similar to Self::set_properties
but fails instead of panicking.
sourcefn set_properties(&self, property_values: &[(&str, &dyn ToValue)])
fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])
Sets multiple properties of the object at once. Read more
sourcefn try_set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
fn try_set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
Similar to Self::set_properties_from_value
but fails instead of panicking.
sourcefn set_properties_from_value(&self, property_values: &[(&str, Value)])
fn set_properties_from_value(&self, property_values: &[(&str, Value)])
Sets multiple properties of the object at once. Read more
sourcefn try_property<V>(&self, property_name: &str) -> Result<V, BoolError> where
V: 'static + for<'b> FromValue<'b>,
fn try_property<V>(&self, property_name: &str) -> Result<V, BoolError> where
V: 'static + for<'b> FromValue<'b>,
Similar to Self::property
but fails instead of panicking.
sourcefn property<V>(&self, property_name: &str) -> V where
V: 'static + for<'b> FromValue<'b>,
fn property<V>(&self, property_name: &str) -> V where
V: 'static + for<'b> FromValue<'b>,
Gets the property property_name
of the object and cast it to the type V. Read more
sourcefn try_property_value(&self, property_name: &str) -> Result<Value, BoolError>
fn try_property_value(&self, property_name: &str) -> Result<Value, BoolError>
Similar to Self::property_value
but fails instead of panicking.
sourcefn property_value(&self, property_name: &str) -> Value
fn property_value(&self, property_name: &str) -> Value
Gets the property property_name
of the object. Read more
sourcefn has_property(&self, property_name: &str, type_: Option<Type>) -> bool
fn has_property(&self, property_name: &str, type_: Option<Type>) -> bool
Check if the object has a property property_name
of the given type_
. Read more
sourcefn property_type(&self, property_name: &str) -> Option<Type>
fn property_type(&self, property_name: &str) -> Option<Type>
Get the type of the property property_name
of this object. Read more
sourcefn find_property(&self, property_name: &str) -> Option<ParamSpec>
fn find_property(&self, property_name: &str) -> Option<ParamSpec>
Get the ParamSpec
of the property property_name
of this object.
sourcefn list_properties(&self) -> PtrSlice<ParamSpec>
fn list_properties(&self) -> PtrSlice<ParamSpec>
Return all ParamSpec
of the properties of this object.
sourcefn freeze_notify(&self) -> PropertyNotificationFreezeGuard
fn freeze_notify(&self) -> PropertyNotificationFreezeGuard
Freeze all property notifications until the return guard object is dropped. Read more
sourceunsafe fn set_qdata<QD>(&self, key: Quark, value: QD) where
QD: 'static,
unsafe fn set_qdata<QD>(&self, key: Quark, value: QD) where
QD: 'static,
Set arbitrary data on this object with the given key
. Read more
sourceunsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>> where
QD: 'static,
unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>> where
QD: 'static,
Return previously set arbitrary data of this object with the given key
. Read more
sourceunsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD> where
QD: 'static,
unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD> where
QD: 'static,
Retrieve previously set arbitrary data of this object with the given key
. Read more
sourceunsafe fn set_data<QD>(&self, key: &str, value: QD) where
QD: 'static,
unsafe fn set_data<QD>(&self, key: &str, value: QD) where
QD: 'static,
Set arbitrary data on this object with the given key
. Read more
sourceunsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>> where
QD: 'static,
unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>> where
QD: 'static,
Return previously set arbitrary data of this object with the given key
. Read more
sourceunsafe fn steal_data<QD>(&self, key: &str) -> Option<QD> where
QD: 'static,
unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD> where
QD: 'static,
Retrieve previously set arbitrary data of this object with the given key
. Read more
sourcefn block_signal(&self, handler_id: &SignalHandlerId)
fn block_signal(&self, handler_id: &SignalHandlerId)
Block a given signal handler. Read more
sourcefn unblock_signal(&self, handler_id: &SignalHandlerId)
fn unblock_signal(&self, handler_id: &SignalHandlerId)
Unblock a given signal handler.
sourcefn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)
fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)
Stop emission of the currently emitted signal.
sourcefn stop_signal_emission_by_name(&self, signal_name: &str)
fn stop_signal_emission_by_name(&self, signal_name: &str)
Stop emission of the currently emitted signal by the (possibly detailed) signal name.
sourcefn try_connect<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
fn try_connect<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
Similar to Self::connect
but fails instead of panicking.
sourcefn connect<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerId where
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
fn connect<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerId where
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
Connect to the signal signal_name
on this object. Read more
sourcefn try_connect_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
fn try_connect_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
Similar to Self::connect_id
but fails instead of panicking.
sourcefn connect_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerId where
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
fn connect_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerId where
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
Connect to the signal signal_id
on this object. Read more
sourcefn try_connect_local<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: 'static + Fn(&[Value]) -> Option<Value>,
fn try_connect_local<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: 'static + Fn(&[Value]) -> Option<Value>,
Similar to Self::connect_local
but fails instead of panicking.
sourcefn connect_local<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerId where
F: 'static + Fn(&[Value]) -> Option<Value>,
fn connect_local<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerId where
F: 'static + Fn(&[Value]) -> Option<Value>,
Connect to the signal signal_name
on this object. Read more
sourcefn try_connect_local_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: 'static + Fn(&[Value]) -> Option<Value>,
fn try_connect_local_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: 'static + Fn(&[Value]) -> Option<Value>,
Similar to Self::connect_local_id
but fails instead of panicking.
sourcefn connect_local_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerId where
F: 'static + Fn(&[Value]) -> Option<Value>,
fn connect_local_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerId where
F: 'static + Fn(&[Value]) -> Option<Value>,
Connect to the signal signal_id
on this object. Read more
sourceunsafe fn try_connect_unsafe<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value>,
unsafe fn try_connect_unsafe<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value>,
Similar to Self::connect_unsafe
but fails instead of panicking.
sourceunsafe fn connect_unsafe<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerId where
F: Fn(&[Value]) -> Option<Value>,
unsafe fn connect_unsafe<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerId where
F: Fn(&[Value]) -> Option<Value>,
Connect to the signal signal_name
on this object. Read more
sourceunsafe fn try_connect_unsafe_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value>,
unsafe fn try_connect_unsafe_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value>,
Similar to Self::connect_unsafe_id
but fails instead of panicking.
sourcefn try_connect_closure(
&self,
signal_name: &str,
after: bool,
closure: RustClosure
) -> Result<SignalHandlerId, BoolError>
fn try_connect_closure(
&self,
signal_name: &str,
after: bool,
closure: RustClosure
) -> Result<SignalHandlerId, BoolError>
Similar to Self::connect_closure
but fails instead of panicking.
sourcefn connect_closure(
&self,
signal_name: &str,
after: bool,
closure: RustClosure
) -> SignalHandlerId
fn connect_closure(
&self,
signal_name: &str,
after: bool,
closure: RustClosure
) -> SignalHandlerId
Connect a closure to the signal signal_name
on this object. Read more
sourcefn try_connect_closure_id(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
closure: RustClosure
) -> Result<SignalHandlerId, BoolError>
fn try_connect_closure_id(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
closure: RustClosure
) -> Result<SignalHandlerId, BoolError>
Similar to Self::connect_closure_id
but fails instead of panicking.
sourcefn connect_closure_id(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
closure: RustClosure
) -> SignalHandlerId
fn connect_closure_id(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
closure: RustClosure
) -> SignalHandlerId
Connect a closure to the signal signal_id
on this object. Read more
sourcefn watch_closure(&self, closure: &impl AsRef<Closure>)
fn watch_closure(&self, closure: &impl AsRef<Closure>)
Limits the lifetime of closure
to the lifetime of the object. When
the object’s reference count drops to zero, the closure will be
invalidated. An invalidated closure will ignore any calls to
Closure::invoke
. Read more
sourceunsafe fn connect_unsafe_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerId where
F: Fn(&[Value]) -> Option<Value>,
unsafe fn connect_unsafe_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerId where
F: Fn(&[Value]) -> Option<Value>,
Connect to the signal signal_id
on this object. Read more
sourcefn try_emit<R>(
&self,
signal_id: SignalId,
args: &[&dyn ToValue]
) -> Result<R, BoolError> where
R: TryFromClosureReturnValue,
fn try_emit<R>(
&self,
signal_id: SignalId,
args: &[&dyn ToValue]
) -> Result<R, BoolError> where
R: TryFromClosureReturnValue,
Similar to Self::emit
but fails instead of panicking.
sourcefn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> R where
R: TryFromClosureReturnValue,
fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> R where
R: TryFromClosureReturnValue,
Emit signal by signal id. Read more
sourcefn try_emit_with_values(
&self,
signal_id: SignalId,
args: &[Value]
) -> Result<Option<Value>, BoolError>
fn try_emit_with_values(
&self,
signal_id: SignalId,
args: &[Value]
) -> Result<Option<Value>, BoolError>
Similar to Self::emit_with_values
but fails instead of panicking.
sourcefn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>
fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>
Same as Self::emit
but takes Value
for the arguments.
sourcefn try_emit_by_name<R>(
&self,
signal_name: &str,
args: &[&dyn ToValue]
) -> Result<R, BoolError> where
R: TryFromClosureReturnValue,
fn try_emit_by_name<R>(
&self,
signal_name: &str,
args: &[&dyn ToValue]
) -> Result<R, BoolError> where
R: TryFromClosureReturnValue,
Similar to Self::emit_by_name
but fails instead of panicking.
sourcefn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> R where
R: TryFromClosureReturnValue,
fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> R where
R: TryFromClosureReturnValue,
Emit signal by its name. Read more
sourcefn try_emit_by_name_with_values(
&self,
signal_name: &str,
args: &[Value]
) -> Result<Option<Value>, BoolError>
fn try_emit_by_name_with_values(
&self,
signal_name: &str,
args: &[Value]
) -> Result<Option<Value>, BoolError>
Similar to Self::emit_by_name_with_values
but fails instead of panicking.
sourcefn emit_by_name_with_values(
&self,
signal_name: &str,
args: &[Value]
) -> Option<Value>
fn emit_by_name_with_values(
&self,
signal_name: &str,
args: &[Value]
) -> Option<Value>
Emit signal by its name. Read more
sourcefn try_emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue]
) -> Result<R, BoolError> where
R: TryFromClosureReturnValue,
fn try_emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue]
) -> Result<R, BoolError> where
R: TryFromClosureReturnValue,
Similar to Self::emit_with_details
but fails instead of panicking.
sourcefn emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue]
) -> R where
R: TryFromClosureReturnValue,
fn emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue]
) -> R where
R: TryFromClosureReturnValue,
Emit signal by signal id with details. Read more
sourcefn try_emit_with_details_and_values(
&self,
signal_id: SignalId,
details: Quark,
args: &[Value]
) -> Result<Option<Value>, BoolError>
fn try_emit_with_details_and_values(
&self,
signal_id: SignalId,
details: Quark,
args: &[Value]
) -> Result<Option<Value>, BoolError>
Similar to Self::emit_with_details_and_values
but fails instead of panicking.
sourcefn emit_with_details_and_values(
&self,
signal_id: SignalId,
details: Quark,
args: &[Value]
) -> Option<Value>
fn emit_with_details_and_values(
&self,
signal_id: SignalId,
details: Quark,
args: &[Value]
) -> Option<Value>
Emit signal by signal id with details. Read more
sourcefn disconnect(&self, handler_id: SignalHandlerId)
fn disconnect(&self, handler_id: SignalHandlerId)
Disconnect a previously connected signal handler.
sourcefn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
Connect to the notify
signal of the object. Read more
sourcefn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
Connect to the notify
signal of the object. Read more
sourceunsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
Connect to the notify
signal of the object. Read more
sourcefn notify(&self, property_name: &str)
fn notify(&self, property_name: &str)
Notify that the given property has changed its value. Read more
sourcefn notify_by_pspec(&self, pspec: &ParamSpec)
fn notify_by_pspec(&self, pspec: &ParamSpec)
Notify that the given property has changed its value. Read more
sourcefn bind_property<O>(
&'a self,
source_property: &'a str,
target: &'a O,
target_property: &'a str
) -> BindingBuilder<'a> where
O: ObjectType,
fn bind_property<O>(
&'a self,
source_property: &'a str,
target: &'a O,
target_property: &'a str
) -> BindingBuilder<'a> where
O: ObjectType,
Bind property source_property
on this object to the target_property
on the target
object. Read more
sourceimpl<T> StaticTypeExt for T where
T: StaticType,
impl<T> StaticTypeExt for T where
T: StaticType,
sourcefn ensure_type()
fn ensure_type()
Ensures that the type has been registered with the type system.
sourceimpl<T> ToClosureReturnValue for T where
T: ToValue,
impl<T> ToClosureReturnValue for T where
T: ToValue,
fn to_closure_return_value(&self) -> Option<Value>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more