Skip to main content

gtk/auto/
builder.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::Application;
6use glib::{
7    prelude::*,
8    signal::{connect_raw, SignalHandlerId},
9    translate::*,
10};
11use std::{boxed::Box as Box_, fmt, mem::transmute, ptr};
12
13glib::wrapper! {
14    /// A GtkBuilder is an auxiliary object that reads textual descriptions
15    /// of a user interface and instantiates the described objects. To create
16    /// a GtkBuilder from a user interface description, call
17    /// `gtk_builder_new_from_file()`, [`from_resource()`][Self::from_resource()] or
18    /// [`from_string()`][Self::from_string()].
19    ///
20    /// In the (unusual) case that you want to add user interface
21    /// descriptions from multiple sources to the same GtkBuilder you can
22    /// call [`new()`][Self::new()] to get an empty builder and populate it by
23    /// (multiple) calls to `gtk_builder_add_from_file()`,
24    /// [`BuilderExtManual::add_from_resource()`][crate::prelude::BuilderExtManual::add_from_resource()] or [`BuilderExtManual::add_from_string()`][crate::prelude::BuilderExtManual::add_from_string()].
25    ///
26    /// A GtkBuilder holds a reference to all objects that it has constructed
27    /// and drops these references when it is finalized. This finalization can
28    /// cause the destruction of non-widget objects or widgets which are not
29    /// contained in a toplevel window. For toplevel windows constructed by a
30    /// builder, it is the responsibility of the user to call `gtk_widget_destroy()`
31    /// to get rid of them and all the widgets they contain.
32    ///
33    /// The functions `gtk_builder_get_object()` and [`BuilderExt::objects()`][crate::prelude::BuilderExt::objects()]
34    /// can be used to access the widgets in the interface by the names assigned
35    /// to them inside the UI description. Toplevel windows returned by these
36    /// functions will stay around until the user explicitly destroys them
37    /// with `gtk_widget_destroy()`. Other widgets will either be part of a
38    /// larger hierarchy constructed by the builder (in which case you should
39    /// not have to worry about their lifecycle), or without a parent, in which
40    /// case they have to be added to some container to make use of them.
41    /// Non-widget objects need to be reffed with `g_object_ref()` to keep them
42    /// beyond the lifespan of the builder.
43    ///
44    /// The function `gtk_builder_connect_signals()` and variants thereof can be
45    /// used to connect handlers to the named signals in the description.
46    ///
47    /// # GtkBuilder UI Definitions # {`BUILDER`-UI}
48    ///
49    /// GtkBuilder parses textual descriptions of user interfaces which are
50    /// specified in an XML format which can be roughly described by the
51    /// RELAX NG schema below. We refer to these descriptions as “GtkBuilder
52    /// UI definitions” or just “UI definitions” if the context is clear.
53    /// Do not confuse GtkBuilder UI Definitions with
54    /// [GtkUIManager UI Definitions][XML-UI], which are more limited in scope.
55    /// It is common to use `.ui` as the filename extension for files containing
56    /// GtkBuilder UI definitions.
57    ///
58    /// [RELAX NG Compact Syntax](https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkbuilder.rnc)
59    ///
60    /// The toplevel element is ``<interface>``. It optionally takes a “domain”
61    /// attribute, which will make the builder look for translated strings
62    /// using `dgettext()` in the domain specified. This can also be done by
63    /// calling [`BuilderExt::set_translation_domain()`][crate::prelude::BuilderExt::set_translation_domain()] on the builder.
64    /// Objects are described by ``<object>`` elements, which can contain
65    /// ``<property>`` elements to set properties, ``<signal>`` elements which
66    /// connect signals to handlers, and ``<child>`` elements, which describe
67    /// child objects (most often widgets inside a container, but also e.g.
68    /// actions in an action group, or columns in a tree model). A ``<child>``
69    /// element contains an ``<object>`` element which describes the child object.
70    /// The target toolkit version(s) are described by ``<requires>`` elements,
71    /// the “lib” attribute specifies the widget library in question (currently
72    /// the only supported value is “gtk+”) and the “version” attribute specifies
73    /// the target version in the form ``<major>`.`<minor>``. The builder will error
74    /// out if the version requirements are not met.
75    ///
76    /// Typically, the specific kind of object represented by an ``<object>``
77    /// element is specified by the “class” attribute. If the type has not
78    /// been loaded yet, GTK+ tries to find the ``get_type()`` function from the
79    /// class name by applying heuristics. This works in most cases, but if
80    /// necessary, it is possible to specify the name of the `get_type()` function
81    /// explictly with the "type-func" attribute. As a special case, GtkBuilder
82    /// allows to use an object that has been constructed by a `GtkUIManager` in
83    /// another part of the UI definition by specifying the id of the `GtkUIManager`
84    /// in the “constructor” attribute and the name of the object in the “id”
85    /// attribute.
86    ///
87    /// Objects may be given a name with the “id” attribute, which allows the
88    /// application to retrieve them from the builder with `gtk_builder_get_object()`.
89    /// An id is also necessary to use the object as property value in other
90    /// parts of the UI definition. GTK+ reserves ids starting and ending
91    /// with `___` (3 underscores) for its own purposes.
92    ///
93    /// Setting properties of objects is pretty straightforward with the
94    /// ``<property>`` element: the “name” attribute specifies the name of the
95    /// property, and the content of the element specifies the value.
96    /// If the “translatable” attribute is set to a true value, GTK+ uses
97    /// `gettext()` (or `dgettext()` if the builder has a translation domain set)
98    /// to find a translation for the value. This happens before the value
99    /// is parsed, so it can be used for properties of any type, but it is
100    /// probably most useful for string properties. It is also possible to
101    /// specify a context to disambiguate short strings, and comments which
102    /// may help the translators.
103    ///
104    /// GtkBuilder can parse textual representations for the most common
105    /// property types: characters, strings, integers, floating-point numbers,
106    /// booleans (strings like “TRUE”, “t”, “yes”, “y”, “1” are interpreted
107    /// as [`true`], strings like “FALSE”, “f”, “no”, “n”, “0” are interpreted
108    /// as [`false`]), enumerations (can be specified by their name, nick or
109    /// integer value), flags (can be specified by their name, nick, integer
110    /// value, optionally combined with “|”, e.g. “GTK_VISIBLE|GTK_REALIZED”)
111    /// and colors (in a format understood by [`gdk::RGBA::parse()`][crate::gdk::RGBA::parse()]).
112    ///
113    /// GVariants can be specified in the format understood by `g_variant_parse()`,
114    /// and pixbufs can be specified as a filename of an image file to load.
115    ///
116    /// Objects can be referred to by their name and by default refer to
117    /// objects declared in the local xml fragment and objects exposed via
118    /// [`BuilderExt::expose_object()`][crate::prelude::BuilderExt::expose_object()]. In general, GtkBuilder allows forward
119    /// references to objects — declared in the local xml; an object doesn’t
120    /// have to be constructed before it can be referred to. The exception
121    /// to this rule is that an object has to be constructed before it can
122    /// be used as the value of a construct-only property.
123    ///
124    /// It is also possible to bind a property value to another object's
125    /// property value using the attributes
126    /// "bind-source" to specify the source object of the binding,
127    /// "bind-property" to specify the source property and optionally
128    /// "bind-flags" to specify the binding flags.
129    /// Internally builder implements this using GBinding objects.
130    /// For more information see [`ObjectExt::bind_property()`][crate::glib::prelude::ObjectExt::bind_property()]
131    ///
132    /// Signal handlers are set up with the ``<signal>`` element. The “name”
133    /// attribute specifies the name of the signal, and the “handler” attribute
134    /// specifies the function to connect to the signal. By default, GTK+ tries
135    /// to find the handler using `g_module_symbol()`, but this can be changed by
136    /// passing a custom `GtkBuilderConnectFunc` to
137    /// [`BuilderExtManual::connect_signals_full()`][crate::prelude::BuilderExtManual::connect_signals_full()]. The remaining attributes, “after”,
138    /// “swapped” and “object”, have the same meaning as the corresponding
139    /// parameters of the `g_signal_connect_object()` or
140    /// `g_signal_connect_data()` functions. A “last_modification_time”
141    /// attribute is also allowed, but it does not have a meaning to the
142    /// builder.
143    ///
144    /// Sometimes it is necessary to refer to widgets which have implicitly
145    /// been constructed by GTK+ as part of a composite widget, to set
146    /// properties on them or to add further children (e.g. the `vbox` of
147    /// a [`Dialog`][crate::Dialog]). This can be achieved by setting the “internal-child”
148    /// property of the ``<child>`` element to a true value. Note that GtkBuilder
149    /// still requires an ``<object>`` element for the internal child, even if it
150    /// has already been constructed.
151    ///
152    /// A number of widgets have different places where a child can be added
153    /// (e.g. tabs vs. page content in notebooks). This can be reflected in
154    /// a UI definition by specifying the “type” attribute on a ``<child>``
155    /// The possible values for the “type” attribute are described in the
156    /// sections describing the widget-specific portions of UI definitions.
157    ///
158    /// # A GtkBuilder UI Definition
159    ///
160    ///
161    ///
162    /// **⚠️ The following code is in xml ⚠️**
163    ///
164    /// ```xml
165    /// <interface>
166    ///   <object class="GtkDialog" id="dialog1">
167    ///     <child internal-child="vbox">
168    ///       <object class="GtkBox" id="vbox1">
169    ///         <property name="border-width">10</property>
170    ///         <child internal-child="action_area">
171    ///           <object class="GtkButtonBox" id="hbuttonbox1">
172    ///             <property name="border-width">20</property>
173    ///             <child>
174    ///               <object class="GtkButton" id="ok_button">
175    ///                 <property name="label">gtk-ok</property>
176    ///                 <property name="use-stock">TRUE</property>
177    ///                 <signal name="clicked" handler="ok_button_clicked"/>
178    ///               </object>
179    ///             </child>
180    ///           </object>
181    ///         </child>
182    ///       </object>
183    ///     </child>
184    ///   </object>
185    /// </interface>
186    /// ```
187    ///
188    /// Beyond this general structure, several object classes define their
189    /// own XML DTD fragments for filling in the ANY placeholders in the DTD
190    /// above. Note that a custom element in a ``<child>`` element gets parsed by
191    /// the custom tag handler of the parent object, while a custom element in
192    /// an ``<object>`` element gets parsed by the custom tag handler of the object.
193    ///
194    /// These XML fragments are explained in the documentation of the
195    /// respective objects.
196    ///
197    /// Additionally, since 3.10 a special ``<template>`` tag has been added
198    /// to the format allowing one to define a widget class’s components.
199    /// See the [GtkWidget documentation][composite-templates] for details.
200    ///
201    /// ## Properties
202    ///
203    ///
204    /// #### `translation-domain`
205    ///  The translation domain used when translating property values that
206    /// have been marked as translatable in interface descriptions.
207    /// If the translation domain is [`None`], [`Builder`][crate::Builder] uses `gettext()`,
208    /// otherwise `g_dgettext()`.
209    ///
210    /// Readable | Writeable
211    ///
212    /// # Implements
213    ///
214    /// [`BuilderExt`][trait@crate::prelude::BuilderExt], [`trait@glib::ObjectExt`], [`BuilderExtManual`][trait@crate::prelude::BuilderExtManual]
215    #[doc(alias = "GtkBuilder")]
216    pub struct Builder(Object<ffi::GtkBuilder, ffi::GtkBuilderClass>);
217
218    match fn {
219        type_ => || ffi::gtk_builder_get_type(),
220    }
221}
222
223impl Builder {
224    pub const NONE: Option<&'static Builder> = None;
225
226    /// Creates a new empty builder object.
227    ///
228    /// This function is only useful if you intend to make multiple calls
229    /// to `gtk_builder_add_from_file()`, [`BuilderExtManual::add_from_resource()`][crate::prelude::BuilderExtManual::add_from_resource()]
230    /// or [`BuilderExtManual::add_from_string()`][crate::prelude::BuilderExtManual::add_from_string()] in order to merge multiple UI
231    /// descriptions into a single builder.
232    ///
233    /// Most users will probably want to use `gtk_builder_new_from_file()`,
234    /// [`from_resource()`][Self::from_resource()] or [`from_string()`][Self::from_string()].
235    ///
236    /// # Returns
237    ///
238    /// a new (empty) [`Builder`][crate::Builder] object
239    #[doc(alias = "gtk_builder_new")]
240    pub fn new() -> Builder {
241        assert_initialized_main_thread!();
242        unsafe { from_glib_full(ffi::gtk_builder_new()) }
243    }
244
245    /// Builds the [GtkBuilder UI definition][BUILDER-UI]
246    /// at `resource_path`.
247    ///
248    /// If there is an error locating the resource or parsing the
249    /// description, then the program will be aborted.
250    /// ## `resource_path`
251    /// a `GResource` resource path
252    ///
253    /// # Returns
254    ///
255    /// a [`Builder`][crate::Builder] containing the described interface
256    #[doc(alias = "gtk_builder_new_from_resource")]
257    #[doc(alias = "new_from_resource")]
258    pub fn from_resource(resource_path: &str) -> Builder {
259        assert_initialized_main_thread!();
260        unsafe {
261            from_glib_full(ffi::gtk_builder_new_from_resource(
262                resource_path.to_glib_none().0,
263            ))
264        }
265    }
266
267    /// Builds the user interface described by `string` (in the
268    /// [GtkBuilder UI definition][BUILDER-UI] format).
269    ///
270    /// If `string` is [`None`]-terminated, then `length` should be -1.
271    /// If `length` is not -1, then it is the length of `string`.
272    ///
273    /// If there is an error parsing `string` then the program will be
274    /// aborted. You should not attempt to parse user interface description
275    /// from untrusted sources.
276    /// ## `string`
277    /// a user interface (XML) description
278    /// ## `length`
279    /// the length of `string`, or -1
280    ///
281    /// # Returns
282    ///
283    /// a [`Builder`][crate::Builder] containing the interface described by `string`
284    #[doc(alias = "gtk_builder_new_from_string")]
285    #[doc(alias = "new_from_string")]
286    pub fn from_string(string: &str) -> Builder {
287        assert_initialized_main_thread!();
288        let length = string.len() as _;
289        unsafe {
290            from_glib_full(ffi::gtk_builder_new_from_string(
291                string.to_glib_none().0,
292                length,
293            ))
294        }
295    }
296}
297
298impl Default for Builder {
299    fn default() -> Self {
300        Self::new()
301    }
302}
303
304mod sealed {
305    pub trait Sealed {}
306    impl<T: super::IsA<super::Builder>> Sealed for T {}
307}
308
309/// Trait containing all [`struct@Builder`] methods.
310///
311/// # Implementors
312///
313/// [`Builder`][struct@crate::Builder]
314pub trait BuilderExt: IsA<Builder> + sealed::Sealed + 'static {
315    //#[doc(alias = "gtk_builder_add_callback_symbol")]
316    //fn add_callback_symbol<P: FnOnce() + 'static>(&self, callback_name: &str, callback_symbol: P) {
317    //    unsafe { TODO: call ffi:gtk_builder_add_callback_symbol() }
318    //}
319
320    //#[doc(alias = "gtk_builder_add_callback_symbols")]
321    //fn add_callback_symbols<P: FnOnce() + 'static>(&self, first_callback_name: &str, first_callback_symbol: P, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
322    //    unsafe { TODO: call ffi:gtk_builder_add_callback_symbols() }
323    //}
324
325    //#[doc(alias = "gtk_builder_connect_signals")]
326    //fn connect_signals(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
327    //    unsafe { TODO: call ffi:gtk_builder_connect_signals() }
328    //}
329
330    /// Add `object` to the `self` object pool so it can be referenced just like any
331    /// other object built by builder.
332    /// ## `name`
333    /// the name of the object exposed to the builder
334    /// ## `object`
335    /// the object to expose
336    #[doc(alias = "gtk_builder_expose_object")]
337    fn expose_object(&self, name: &str, object: &impl IsA<glib::Object>) {
338        unsafe {
339            ffi::gtk_builder_expose_object(
340                self.as_ref().to_glib_none().0,
341                name.to_glib_none().0,
342                object.as_ref().to_glib_none().0,
343            );
344        }
345    }
346
347    /// Gets the [`Application`][crate::Application] associated with the builder.
348    ///
349    /// The [`Application`][crate::Application] is used for creating action proxies as requested
350    /// from XML that the builder is loading.
351    ///
352    /// By default, the builder uses the default application: the one from
353    /// [`gio::Application::default()`][crate::gio::Application::default()]. If you want to use another application
354    /// for constructing proxies, use [`set_application()`][Self::set_application()].
355    ///
356    /// # Returns
357    ///
358    /// the application being used by the builder,
359    ///  or [`None`]
360    #[doc(alias = "gtk_builder_get_application")]
361    #[doc(alias = "get_application")]
362    fn application(&self) -> Option<Application> {
363        unsafe {
364            from_glib_none(ffi::gtk_builder_get_application(
365                self.as_ref().to_glib_none().0,
366            ))
367        }
368    }
369
370    /// Gets all objects that have been constructed by `self`. Note that
371    /// this function does not increment the reference counts of the returned
372    /// objects.
373    ///
374    /// # Returns
375    ///
376    /// a newly-allocated `GSList` containing all the objects
377    ///  constructed by the [`Builder`][crate::Builder] instance. It should be freed by
378    ///  `g_slist_free()`
379    #[doc(alias = "gtk_builder_get_objects")]
380    #[doc(alias = "get_objects")]
381    fn objects(&self) -> Vec<glib::Object> {
382        unsafe {
383            FromGlibPtrContainer::from_glib_container(ffi::gtk_builder_get_objects(
384                self.as_ref().to_glib_none().0,
385            ))
386        }
387    }
388
389    /// Gets the translation domain of `self`.
390    ///
391    /// # Returns
392    ///
393    /// the translation domain. This string is owned
394    /// by the builder object and must not be modified or freed.
395    #[doc(alias = "gtk_builder_get_translation_domain")]
396    #[doc(alias = "get_translation_domain")]
397    fn translation_domain(&self) -> Option<glib::GString> {
398        unsafe {
399            from_glib_none(ffi::gtk_builder_get_translation_domain(
400                self.as_ref().to_glib_none().0,
401            ))
402        }
403    }
404
405    /// Looks up a type by name, using the virtual function that
406    /// [`Builder`][crate::Builder] has for that purpose. This is mainly used when
407    /// implementing the [`Buildable`][crate::Buildable] interface on a type.
408    /// ## `type_name`
409    /// type name to lookup
410    ///
411    /// # Returns
412    ///
413    /// the `GType` found for `type_name` or `G_TYPE_INVALID`
414    ///  if no type was found
415    #[doc(alias = "gtk_builder_get_type_from_name")]
416    #[doc(alias = "get_type_from_name")]
417    fn type_from_name(&self, type_name: &str) -> glib::types::Type {
418        unsafe {
419            from_glib(ffi::gtk_builder_get_type_from_name(
420                self.as_ref().to_glib_none().0,
421                type_name.to_glib_none().0,
422            ))
423        }
424    }
425
426    //#[doc(alias = "gtk_builder_lookup_callback_symbol")]
427    //fn lookup_callback_symbol(&self, callback_name: &str) -> Option<Box_<dyn Fn() + 'static>> {
428    //    unsafe { TODO: call ffi:gtk_builder_lookup_callback_symbol() }
429    //}
430
431    /// Sets the application associated with `self`.
432    ///
433    /// You only need this function if there is more than one [`gio::Application`][crate::gio::Application]
434    /// in your process. `application` cannot be [`None`].
435    /// ## `application`
436    /// a [`Application`][crate::Application]
437    #[doc(alias = "gtk_builder_set_application")]
438    fn set_application(&self, application: &impl IsA<Application>) {
439        unsafe {
440            ffi::gtk_builder_set_application(
441                self.as_ref().to_glib_none().0,
442                application.as_ref().to_glib_none().0,
443            );
444        }
445    }
446
447    /// Sets the translation domain of `self`.
448    /// See [`translation-domain`][struct@crate::Builder#translation-domain].
449    /// ## `domain`
450    /// the translation domain or [`None`]
451    #[doc(alias = "gtk_builder_set_translation_domain")]
452    fn set_translation_domain(&self, domain: Option<&str>) {
453        unsafe {
454            ffi::gtk_builder_set_translation_domain(
455                self.as_ref().to_glib_none().0,
456                domain.to_glib_none().0,
457            );
458        }
459    }
460
461    /// This function demarshals a value from a string. This function
462    /// calls [`glib::Value::init()`][crate::glib::Value::init()] on the `value` argument, so it need not be
463    /// initialised beforehand.
464    ///
465    /// This function can handle char, uchar, boolean, int, uint, long,
466    /// ulong, enum, flags, float, double, string, `GdkColor`, [`gdk::RGBA`][crate::gdk::RGBA] and
467    /// [`Adjustment`][crate::Adjustment] type values. Support for [`Widget`][crate::Widget] type values is
468    /// still to come.
469    ///
470    /// Upon errors [`false`] will be returned and `error` will be assigned a
471    /// [`glib::Error`][crate::glib::Error] from the `GTK_BUILDER_ERROR` domain.
472    /// ## `pspec`
473    /// the [`glib::ParamSpec`][crate::glib::ParamSpec] for the property
474    /// ## `string`
475    /// the string representation of the value
476    ///
477    /// # Returns
478    ///
479    /// [`true`] on success
480    ///
481    /// ## `value`
482    /// the [`glib::Value`][crate::glib::Value] to store the result in
483    #[doc(alias = "gtk_builder_value_from_string")]
484    fn value_from_string(
485        &self,
486        pspec: impl AsRef<glib::ParamSpec>,
487        string: &str,
488    ) -> Result<glib::Value, glib::Error> {
489        unsafe {
490            let mut value = glib::Value::uninitialized();
491            let mut error = ptr::null_mut();
492            let is_ok = ffi::gtk_builder_value_from_string(
493                self.as_ref().to_glib_none().0,
494                pspec.as_ref().to_glib_none().0,
495                string.to_glib_none().0,
496                value.to_glib_none_mut().0,
497                &mut error,
498            );
499            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
500            if error.is_null() {
501                Ok(value)
502            } else {
503                Err(from_glib_full(error))
504            }
505        }
506    }
507
508    /// Like [`value_from_string()`][Self::value_from_string()], this function demarshals
509    /// a value from a string, but takes a `GType` instead of [`glib::ParamSpec`][crate::glib::ParamSpec].
510    /// This function calls [`glib::Value::init()`][crate::glib::Value::init()] on the `value` argument, so it
511    /// need not be initialised beforehand.
512    ///
513    /// Upon errors [`false`] will be returned and `error` will be assigned a
514    /// [`glib::Error`][crate::glib::Error] from the `GTK_BUILDER_ERROR` domain.
515    /// ## `type_`
516    /// the `GType` of the value
517    /// ## `string`
518    /// the string representation of the value
519    ///
520    /// # Returns
521    ///
522    /// [`true`] on success
523    ///
524    /// ## `value`
525    /// the [`glib::Value`][crate::glib::Value] to store the result in
526    #[doc(alias = "gtk_builder_value_from_string_type")]
527    fn value_from_string_type(
528        &self,
529        type_: glib::types::Type,
530        string: &str,
531    ) -> Result<glib::Value, glib::Error> {
532        unsafe {
533            let mut value = glib::Value::uninitialized();
534            let mut error = ptr::null_mut();
535            let is_ok = ffi::gtk_builder_value_from_string_type(
536                self.as_ref().to_glib_none().0,
537                type_.into_glib(),
538                string.to_glib_none().0,
539                value.to_glib_none_mut().0,
540                &mut error,
541            );
542            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
543            if error.is_null() {
544                Ok(value)
545            } else {
546                Err(from_glib_full(error))
547            }
548        }
549    }
550
551    #[doc(alias = "translation-domain")]
552    fn connect_translation_domain_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
553        unsafe extern "C" fn notify_translation_domain_trampoline<
554            P: IsA<Builder>,
555            F: Fn(&P) + 'static,
556        >(
557            this: *mut ffi::GtkBuilder,
558            _param_spec: glib::ffi::gpointer,
559            f: glib::ffi::gpointer,
560        ) {
561            let f: &F = &*(f as *const F);
562            f(Builder::from_glib_borrow(this).unsafe_cast_ref())
563        }
564        unsafe {
565            let f: Box_<F> = Box_::new(f);
566            connect_raw(
567                self.as_ptr() as *mut _,
568                b"notify::translation-domain\0".as_ptr() as *const _,
569                Some(transmute::<_, unsafe extern "C" fn()>(
570                    notify_translation_domain_trampoline::<Self, F> as *const (),
571                )),
572                Box_::into_raw(f),
573            )
574        }
575    }
576}
577
578impl<O: IsA<Builder>> BuilderExt for O {}
579
580impl fmt::Display for Builder {
581    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
582        f.write_str("Builder")
583    }
584}