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 
5 use crate::Align;
6 use crate::Application;
7 use crate::AssistantPageType;
8 use crate::Bin;
9 use crate::Buildable;
10 use crate::Container;
11 use crate::ResizeMode;
12 use crate::Widget;
13 use crate::Window;
14 use crate::WindowPosition;
15 use crate::WindowType;
16 use glib::object::Cast;
17 use glib::object::IsA;
18 use glib::object::ObjectExt;
19 use glib::signal::connect_raw;
20 use glib::signal::SignalHandlerId;
21 use glib::translate::*;
22 use glib::StaticType;
23 use glib::ToValue;
24 use std::boxed::Box as Box_;
25 use std::fmt;
26 use std::mem::transmute;
27 
28 glib::wrapper! {
29     #[doc(alias = "GtkAssistant")]
30     pub struct Assistant(Object<ffi::GtkAssistant, ffi::GtkAssistantClass>) @extends Window, Bin, Container, Widget, @implements Buildable;
31 
32     match fn {
33         type_ => || ffi::gtk_assistant_get_type(),
34     }
35 }
36 
37 impl Assistant {
38     #[doc(alias = "gtk_assistant_new")]
new() -> Assistant39     pub fn new() -> Assistant {
40         assert_initialized_main_thread!();
41         unsafe { Widget::from_glib_none(ffi::gtk_assistant_new()).unsafe_cast() }
42     }
43 
44     // rustdoc-stripper-ignore-next
45     /// Creates a new builder-pattern struct instance to construct [`Assistant`] objects.
46     ///
47     /// This method returns an instance of [`AssistantBuilder`] which can be used to create [`Assistant`] objects.
builder() -> AssistantBuilder48     pub fn builder() -> AssistantBuilder {
49         AssistantBuilder::default()
50     }
51 }
52 
53 impl Default for Assistant {
default() -> Self54     fn default() -> Self {
55         Self::new()
56     }
57 }
58 
59 #[derive(Clone, Default)]
60 // rustdoc-stripper-ignore-next
61 /// A [builder-pattern] type to construct [`Assistant`] objects.
62 ///
63 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
64 pub struct AssistantBuilder {
65     use_header_bar: Option<i32>,
66     accept_focus: Option<bool>,
67     application: Option<Application>,
68     attached_to: Option<Widget>,
69     decorated: Option<bool>,
70     default_height: Option<i32>,
71     default_width: Option<i32>,
72     deletable: Option<bool>,
73     destroy_with_parent: Option<bool>,
74     focus_on_map: Option<bool>,
75     focus_visible: Option<bool>,
76     gravity: Option<gdk::Gravity>,
77     hide_titlebar_when_maximized: Option<bool>,
78     icon: Option<gdk_pixbuf::Pixbuf>,
79     icon_name: Option<String>,
80     mnemonics_visible: Option<bool>,
81     modal: Option<bool>,
82     resizable: Option<bool>,
83     role: Option<String>,
84     screen: Option<gdk::Screen>,
85     skip_pager_hint: Option<bool>,
86     skip_taskbar_hint: Option<bool>,
87     startup_id: Option<String>,
88     title: Option<String>,
89     transient_for: Option<Window>,
90     type_: Option<WindowType>,
91     type_hint: Option<gdk::WindowTypeHint>,
92     urgency_hint: Option<bool>,
93     window_position: Option<WindowPosition>,
94     border_width: Option<u32>,
95     child: Option<Widget>,
96     resize_mode: Option<ResizeMode>,
97     app_paintable: Option<bool>,
98     can_default: Option<bool>,
99     can_focus: Option<bool>,
100     events: Option<gdk::EventMask>,
101     expand: Option<bool>,
102     #[cfg(any(feature = "v3_20", feature = "dox"))]
103     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
104     focus_on_click: Option<bool>,
105     halign: Option<Align>,
106     has_default: Option<bool>,
107     has_focus: Option<bool>,
108     has_tooltip: Option<bool>,
109     height_request: Option<i32>,
110     hexpand: Option<bool>,
111     hexpand_set: Option<bool>,
112     is_focus: Option<bool>,
113     margin: Option<i32>,
114     margin_bottom: Option<i32>,
115     margin_end: Option<i32>,
116     margin_start: Option<i32>,
117     margin_top: Option<i32>,
118     name: Option<String>,
119     no_show_all: Option<bool>,
120     opacity: Option<f64>,
121     parent: Option<Container>,
122     receives_default: Option<bool>,
123     sensitive: Option<bool>,
124     tooltip_markup: Option<String>,
125     tooltip_text: Option<String>,
126     valign: Option<Align>,
127     vexpand: Option<bool>,
128     vexpand_set: Option<bool>,
129     visible: Option<bool>,
130     width_request: Option<i32>,
131 }
132 
133 impl AssistantBuilder {
134     // rustdoc-stripper-ignore-next
135     /// Create a new [`AssistantBuilder`].
new() -> Self136     pub fn new() -> Self {
137         Self::default()
138     }
139 
140     // rustdoc-stripper-ignore-next
141     /// Build the [`Assistant`].
build(self) -> Assistant142     pub fn build(self) -> Assistant {
143         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
144         if let Some(ref use_header_bar) = self.use_header_bar {
145             properties.push(("use-header-bar", use_header_bar));
146         }
147         if let Some(ref accept_focus) = self.accept_focus {
148             properties.push(("accept-focus", accept_focus));
149         }
150         if let Some(ref application) = self.application {
151             properties.push(("application", application));
152         }
153         if let Some(ref attached_to) = self.attached_to {
154             properties.push(("attached-to", attached_to));
155         }
156         if let Some(ref decorated) = self.decorated {
157             properties.push(("decorated", decorated));
158         }
159         if let Some(ref default_height) = self.default_height {
160             properties.push(("default-height", default_height));
161         }
162         if let Some(ref default_width) = self.default_width {
163             properties.push(("default-width", default_width));
164         }
165         if let Some(ref deletable) = self.deletable {
166             properties.push(("deletable", deletable));
167         }
168         if let Some(ref destroy_with_parent) = self.destroy_with_parent {
169             properties.push(("destroy-with-parent", destroy_with_parent));
170         }
171         if let Some(ref focus_on_map) = self.focus_on_map {
172             properties.push(("focus-on-map", focus_on_map));
173         }
174         if let Some(ref focus_visible) = self.focus_visible {
175             properties.push(("focus-visible", focus_visible));
176         }
177         if let Some(ref gravity) = self.gravity {
178             properties.push(("gravity", gravity));
179         }
180         if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized {
181             properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized));
182         }
183         if let Some(ref icon) = self.icon {
184             properties.push(("icon", icon));
185         }
186         if let Some(ref icon_name) = self.icon_name {
187             properties.push(("icon-name", icon_name));
188         }
189         if let Some(ref mnemonics_visible) = self.mnemonics_visible {
190             properties.push(("mnemonics-visible", mnemonics_visible));
191         }
192         if let Some(ref modal) = self.modal {
193             properties.push(("modal", modal));
194         }
195         if let Some(ref resizable) = self.resizable {
196             properties.push(("resizable", resizable));
197         }
198         if let Some(ref role) = self.role {
199             properties.push(("role", role));
200         }
201         if let Some(ref screen) = self.screen {
202             properties.push(("screen", screen));
203         }
204         if let Some(ref skip_pager_hint) = self.skip_pager_hint {
205             properties.push(("skip-pager-hint", skip_pager_hint));
206         }
207         if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint {
208             properties.push(("skip-taskbar-hint", skip_taskbar_hint));
209         }
210         if let Some(ref startup_id) = self.startup_id {
211             properties.push(("startup-id", startup_id));
212         }
213         if let Some(ref title) = self.title {
214             properties.push(("title", title));
215         }
216         if let Some(ref transient_for) = self.transient_for {
217             properties.push(("transient-for", transient_for));
218         }
219         if let Some(ref type_) = self.type_ {
220             properties.push(("type", type_));
221         }
222         if let Some(ref type_hint) = self.type_hint {
223             properties.push(("type-hint", type_hint));
224         }
225         if let Some(ref urgency_hint) = self.urgency_hint {
226             properties.push(("urgency-hint", urgency_hint));
227         }
228         if let Some(ref window_position) = self.window_position {
229             properties.push(("window-position", window_position));
230         }
231         if let Some(ref border_width) = self.border_width {
232             properties.push(("border-width", border_width));
233         }
234         if let Some(ref child) = self.child {
235             properties.push(("child", child));
236         }
237         if let Some(ref resize_mode) = self.resize_mode {
238             properties.push(("resize-mode", resize_mode));
239         }
240         if let Some(ref app_paintable) = self.app_paintable {
241             properties.push(("app-paintable", app_paintable));
242         }
243         if let Some(ref can_default) = self.can_default {
244             properties.push(("can-default", can_default));
245         }
246         if let Some(ref can_focus) = self.can_focus {
247             properties.push(("can-focus", can_focus));
248         }
249         if let Some(ref events) = self.events {
250             properties.push(("events", events));
251         }
252         if let Some(ref expand) = self.expand {
253             properties.push(("expand", expand));
254         }
255         #[cfg(any(feature = "v3_20", feature = "dox"))]
256         if let Some(ref focus_on_click) = self.focus_on_click {
257             properties.push(("focus-on-click", focus_on_click));
258         }
259         if let Some(ref halign) = self.halign {
260             properties.push(("halign", halign));
261         }
262         if let Some(ref has_default) = self.has_default {
263             properties.push(("has-default", has_default));
264         }
265         if let Some(ref has_focus) = self.has_focus {
266             properties.push(("has-focus", has_focus));
267         }
268         if let Some(ref has_tooltip) = self.has_tooltip {
269             properties.push(("has-tooltip", has_tooltip));
270         }
271         if let Some(ref height_request) = self.height_request {
272             properties.push(("height-request", height_request));
273         }
274         if let Some(ref hexpand) = self.hexpand {
275             properties.push(("hexpand", hexpand));
276         }
277         if let Some(ref hexpand_set) = self.hexpand_set {
278             properties.push(("hexpand-set", hexpand_set));
279         }
280         if let Some(ref is_focus) = self.is_focus {
281             properties.push(("is-focus", is_focus));
282         }
283         if let Some(ref margin) = self.margin {
284             properties.push(("margin", margin));
285         }
286         if let Some(ref margin_bottom) = self.margin_bottom {
287             properties.push(("margin-bottom", margin_bottom));
288         }
289         if let Some(ref margin_end) = self.margin_end {
290             properties.push(("margin-end", margin_end));
291         }
292         if let Some(ref margin_start) = self.margin_start {
293             properties.push(("margin-start", margin_start));
294         }
295         if let Some(ref margin_top) = self.margin_top {
296             properties.push(("margin-top", margin_top));
297         }
298         if let Some(ref name) = self.name {
299             properties.push(("name", name));
300         }
301         if let Some(ref no_show_all) = self.no_show_all {
302             properties.push(("no-show-all", no_show_all));
303         }
304         if let Some(ref opacity) = self.opacity {
305             properties.push(("opacity", opacity));
306         }
307         if let Some(ref parent) = self.parent {
308             properties.push(("parent", parent));
309         }
310         if let Some(ref receives_default) = self.receives_default {
311             properties.push(("receives-default", receives_default));
312         }
313         if let Some(ref sensitive) = self.sensitive {
314             properties.push(("sensitive", sensitive));
315         }
316         if let Some(ref tooltip_markup) = self.tooltip_markup {
317             properties.push(("tooltip-markup", tooltip_markup));
318         }
319         if let Some(ref tooltip_text) = self.tooltip_text {
320             properties.push(("tooltip-text", tooltip_text));
321         }
322         if let Some(ref valign) = self.valign {
323             properties.push(("valign", valign));
324         }
325         if let Some(ref vexpand) = self.vexpand {
326             properties.push(("vexpand", vexpand));
327         }
328         if let Some(ref vexpand_set) = self.vexpand_set {
329             properties.push(("vexpand-set", vexpand_set));
330         }
331         if let Some(ref visible) = self.visible {
332             properties.push(("visible", visible));
333         }
334         if let Some(ref width_request) = self.width_request {
335             properties.push(("width-request", width_request));
336         }
337         glib::Object::new::<Assistant>(&properties)
338             .expect("Failed to create an instance of Assistant")
339     }
340 
use_header_bar(mut self, use_header_bar: i32) -> Self341     pub fn use_header_bar(mut self, use_header_bar: i32) -> Self {
342         self.use_header_bar = Some(use_header_bar);
343         self
344     }
345 
accept_focus(mut self, accept_focus: bool) -> Self346     pub fn accept_focus(mut self, accept_focus: bool) -> Self {
347         self.accept_focus = Some(accept_focus);
348         self
349     }
350 
application<P: IsA<Application>>(mut self, application: &P) -> Self351     pub fn application<P: IsA<Application>>(mut self, application: &P) -> Self {
352         self.application = Some(application.clone().upcast());
353         self
354     }
355 
attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self356     pub fn attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self {
357         self.attached_to = Some(attached_to.clone().upcast());
358         self
359     }
360 
decorated(mut self, decorated: bool) -> Self361     pub fn decorated(mut self, decorated: bool) -> Self {
362         self.decorated = Some(decorated);
363         self
364     }
365 
default_height(mut self, default_height: i32) -> Self366     pub fn default_height(mut self, default_height: i32) -> Self {
367         self.default_height = Some(default_height);
368         self
369     }
370 
default_width(mut self, default_width: i32) -> Self371     pub fn default_width(mut self, default_width: i32) -> Self {
372         self.default_width = Some(default_width);
373         self
374     }
375 
deletable(mut self, deletable: bool) -> Self376     pub fn deletable(mut self, deletable: bool) -> Self {
377         self.deletable = Some(deletable);
378         self
379     }
380 
destroy_with_parent(mut self, destroy_with_parent: bool) -> Self381     pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self {
382         self.destroy_with_parent = Some(destroy_with_parent);
383         self
384     }
385 
focus_on_map(mut self, focus_on_map: bool) -> Self386     pub fn focus_on_map(mut self, focus_on_map: bool) -> Self {
387         self.focus_on_map = Some(focus_on_map);
388         self
389     }
390 
focus_visible(mut self, focus_visible: bool) -> Self391     pub fn focus_visible(mut self, focus_visible: bool) -> Self {
392         self.focus_visible = Some(focus_visible);
393         self
394     }
395 
gravity(mut self, gravity: gdk::Gravity) -> Self396     pub fn gravity(mut self, gravity: gdk::Gravity) -> Self {
397         self.gravity = Some(gravity);
398         self
399     }
400 
hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self401     pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self {
402         self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized);
403         self
404     }
405 
icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self406     pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self {
407         self.icon = Some(icon.clone());
408         self
409     }
410 
icon_name(mut self, icon_name: &str) -> Self411     pub fn icon_name(mut self, icon_name: &str) -> Self {
412         self.icon_name = Some(icon_name.to_string());
413         self
414     }
415 
mnemonics_visible(mut self, mnemonics_visible: bool) -> Self416     pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self {
417         self.mnemonics_visible = Some(mnemonics_visible);
418         self
419     }
420 
modal(mut self, modal: bool) -> Self421     pub fn modal(mut self, modal: bool) -> Self {
422         self.modal = Some(modal);
423         self
424     }
425 
resizable(mut self, resizable: bool) -> Self426     pub fn resizable(mut self, resizable: bool) -> Self {
427         self.resizable = Some(resizable);
428         self
429     }
430 
role(mut self, role: &str) -> Self431     pub fn role(mut self, role: &str) -> Self {
432         self.role = Some(role.to_string());
433         self
434     }
435 
screen(mut self, screen: &gdk::Screen) -> Self436     pub fn screen(mut self, screen: &gdk::Screen) -> Self {
437         self.screen = Some(screen.clone());
438         self
439     }
440 
skip_pager_hint(mut self, skip_pager_hint: bool) -> Self441     pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self {
442         self.skip_pager_hint = Some(skip_pager_hint);
443         self
444     }
445 
skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self446     pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self {
447         self.skip_taskbar_hint = Some(skip_taskbar_hint);
448         self
449     }
450 
startup_id(mut self, startup_id: &str) -> Self451     pub fn startup_id(mut self, startup_id: &str) -> Self {
452         self.startup_id = Some(startup_id.to_string());
453         self
454     }
455 
title(mut self, title: &str) -> Self456     pub fn title(mut self, title: &str) -> Self {
457         self.title = Some(title.to_string());
458         self
459     }
460 
transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self461     pub fn transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self {
462         self.transient_for = Some(transient_for.clone().upcast());
463         self
464     }
465 
type_(mut self, type_: WindowType) -> Self466     pub fn type_(mut self, type_: WindowType) -> Self {
467         self.type_ = Some(type_);
468         self
469     }
470 
type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self471     pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self {
472         self.type_hint = Some(type_hint);
473         self
474     }
475 
urgency_hint(mut self, urgency_hint: bool) -> Self476     pub fn urgency_hint(mut self, urgency_hint: bool) -> Self {
477         self.urgency_hint = Some(urgency_hint);
478         self
479     }
480 
window_position(mut self, window_position: WindowPosition) -> Self481     pub fn window_position(mut self, window_position: WindowPosition) -> Self {
482         self.window_position = Some(window_position);
483         self
484     }
485 
border_width(mut self, border_width: u32) -> Self486     pub fn border_width(mut self, border_width: u32) -> Self {
487         self.border_width = Some(border_width);
488         self
489     }
490 
child<P: IsA<Widget>>(mut self, child: &P) -> Self491     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
492         self.child = Some(child.clone().upcast());
493         self
494     }
495 
resize_mode(mut self, resize_mode: ResizeMode) -> Self496     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
497         self.resize_mode = Some(resize_mode);
498         self
499     }
500 
app_paintable(mut self, app_paintable: bool) -> Self501     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
502         self.app_paintable = Some(app_paintable);
503         self
504     }
505 
can_default(mut self, can_default: bool) -> Self506     pub fn can_default(mut self, can_default: bool) -> Self {
507         self.can_default = Some(can_default);
508         self
509     }
510 
can_focus(mut self, can_focus: bool) -> Self511     pub fn can_focus(mut self, can_focus: bool) -> Self {
512         self.can_focus = Some(can_focus);
513         self
514     }
515 
events(mut self, events: gdk::EventMask) -> Self516     pub fn events(mut self, events: gdk::EventMask) -> Self {
517         self.events = Some(events);
518         self
519     }
520 
expand(mut self, expand: bool) -> Self521     pub fn expand(mut self, expand: bool) -> Self {
522         self.expand = Some(expand);
523         self
524     }
525 
526     #[cfg(any(feature = "v3_20", feature = "dox"))]
527     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self528     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
529         self.focus_on_click = Some(focus_on_click);
530         self
531     }
532 
halign(mut self, halign: Align) -> Self533     pub fn halign(mut self, halign: Align) -> Self {
534         self.halign = Some(halign);
535         self
536     }
537 
has_default(mut self, has_default: bool) -> Self538     pub fn has_default(mut self, has_default: bool) -> Self {
539         self.has_default = Some(has_default);
540         self
541     }
542 
has_focus(mut self, has_focus: bool) -> Self543     pub fn has_focus(mut self, has_focus: bool) -> Self {
544         self.has_focus = Some(has_focus);
545         self
546     }
547 
has_tooltip(mut self, has_tooltip: bool) -> Self548     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
549         self.has_tooltip = Some(has_tooltip);
550         self
551     }
552 
height_request(mut self, height_request: i32) -> Self553     pub fn height_request(mut self, height_request: i32) -> Self {
554         self.height_request = Some(height_request);
555         self
556     }
557 
hexpand(mut self, hexpand: bool) -> Self558     pub fn hexpand(mut self, hexpand: bool) -> Self {
559         self.hexpand = Some(hexpand);
560         self
561     }
562 
hexpand_set(mut self, hexpand_set: bool) -> Self563     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
564         self.hexpand_set = Some(hexpand_set);
565         self
566     }
567 
is_focus(mut self, is_focus: bool) -> Self568     pub fn is_focus(mut self, is_focus: bool) -> Self {
569         self.is_focus = Some(is_focus);
570         self
571     }
572 
margin(mut self, margin: i32) -> Self573     pub fn margin(mut self, margin: i32) -> Self {
574         self.margin = Some(margin);
575         self
576     }
577 
margin_bottom(mut self, margin_bottom: i32) -> Self578     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
579         self.margin_bottom = Some(margin_bottom);
580         self
581     }
582 
margin_end(mut self, margin_end: i32) -> Self583     pub fn margin_end(mut self, margin_end: i32) -> Self {
584         self.margin_end = Some(margin_end);
585         self
586     }
587 
margin_start(mut self, margin_start: i32) -> Self588     pub fn margin_start(mut self, margin_start: i32) -> Self {
589         self.margin_start = Some(margin_start);
590         self
591     }
592 
margin_top(mut self, margin_top: i32) -> Self593     pub fn margin_top(mut self, margin_top: i32) -> Self {
594         self.margin_top = Some(margin_top);
595         self
596     }
597 
name(mut self, name: &str) -> Self598     pub fn name(mut self, name: &str) -> Self {
599         self.name = Some(name.to_string());
600         self
601     }
602 
no_show_all(mut self, no_show_all: bool) -> Self603     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
604         self.no_show_all = Some(no_show_all);
605         self
606     }
607 
opacity(mut self, opacity: f64) -> Self608     pub fn opacity(mut self, opacity: f64) -> Self {
609         self.opacity = Some(opacity);
610         self
611     }
612 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self613     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
614         self.parent = Some(parent.clone().upcast());
615         self
616     }
617 
receives_default(mut self, receives_default: bool) -> Self618     pub fn receives_default(mut self, receives_default: bool) -> Self {
619         self.receives_default = Some(receives_default);
620         self
621     }
622 
sensitive(mut self, sensitive: bool) -> Self623     pub fn sensitive(mut self, sensitive: bool) -> Self {
624         self.sensitive = Some(sensitive);
625         self
626     }
627 
tooltip_markup(mut self, tooltip_markup: &str) -> Self628     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
629         self.tooltip_markup = Some(tooltip_markup.to_string());
630         self
631     }
632 
tooltip_text(mut self, tooltip_text: &str) -> Self633     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
634         self.tooltip_text = Some(tooltip_text.to_string());
635         self
636     }
637 
valign(mut self, valign: Align) -> Self638     pub fn valign(mut self, valign: Align) -> Self {
639         self.valign = Some(valign);
640         self
641     }
642 
vexpand(mut self, vexpand: bool) -> Self643     pub fn vexpand(mut self, vexpand: bool) -> Self {
644         self.vexpand = Some(vexpand);
645         self
646     }
647 
vexpand_set(mut self, vexpand_set: bool) -> Self648     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
649         self.vexpand_set = Some(vexpand_set);
650         self
651     }
652 
visible(mut self, visible: bool) -> Self653     pub fn visible(mut self, visible: bool) -> Self {
654         self.visible = Some(visible);
655         self
656     }
657 
width_request(mut self, width_request: i32) -> Self658     pub fn width_request(mut self, width_request: i32) -> Self {
659         self.width_request = Some(width_request);
660         self
661     }
662 }
663 
664 pub const NONE_ASSISTANT: Option<&Assistant> = None;
665 
666 pub trait AssistantExt: 'static {
667     #[doc(alias = "gtk_assistant_add_action_widget")]
add_action_widget<P: IsA<Widget>>(&self, child: &P)668     fn add_action_widget<P: IsA<Widget>>(&self, child: &P);
669 
670     #[doc(alias = "gtk_assistant_append_page")]
append_page<P: IsA<Widget>>(&self, page: &P) -> i32671     fn append_page<P: IsA<Widget>>(&self, page: &P) -> i32;
672 
673     #[doc(alias = "gtk_assistant_commit")]
commit(&self)674     fn commit(&self);
675 
676     #[doc(alias = "gtk_assistant_get_current_page")]
677     #[doc(alias = "get_current_page")]
current_page(&self) -> i32678     fn current_page(&self) -> i32;
679 
680     #[doc(alias = "gtk_assistant_get_n_pages")]
681     #[doc(alias = "get_n_pages")]
n_pages(&self) -> i32682     fn n_pages(&self) -> i32;
683 
684     #[doc(alias = "gtk_assistant_get_nth_page")]
685     #[doc(alias = "get_nth_page")]
nth_page(&self, page_num: i32) -> Option<Widget>686     fn nth_page(&self, page_num: i32) -> Option<Widget>;
687 
688     #[doc(alias = "gtk_assistant_get_page_complete")]
689     #[doc(alias = "get_page_complete")]
page_is_complete<P: IsA<Widget>>(&self, page: &P) -> bool690     fn page_is_complete<P: IsA<Widget>>(&self, page: &P) -> bool;
691 
692     #[doc(alias = "gtk_assistant_get_page_has_padding")]
693     #[doc(alias = "get_page_has_padding")]
page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool694     fn page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool;
695 
696     #[doc(alias = "gtk_assistant_get_page_title")]
697     #[doc(alias = "get_page_title")]
page_title<P: IsA<Widget>>(&self, page: &P) -> Option<glib::GString>698     fn page_title<P: IsA<Widget>>(&self, page: &P) -> Option<glib::GString>;
699 
700     #[doc(alias = "gtk_assistant_get_page_type")]
701     #[doc(alias = "get_page_type")]
page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType702     fn page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType;
703 
704     #[doc(alias = "gtk_assistant_insert_page")]
insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32705     fn insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32;
706 
707     #[doc(alias = "gtk_assistant_next_page")]
next_page(&self)708     fn next_page(&self);
709 
710     #[doc(alias = "gtk_assistant_prepend_page")]
prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32711     fn prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32;
712 
713     #[doc(alias = "gtk_assistant_previous_page")]
previous_page(&self)714     fn previous_page(&self);
715 
716     #[doc(alias = "gtk_assistant_remove_action_widget")]
remove_action_widget<P: IsA<Widget>>(&self, child: &P)717     fn remove_action_widget<P: IsA<Widget>>(&self, child: &P);
718 
719     #[doc(alias = "gtk_assistant_remove_page")]
remove_page(&self, page_num: i32)720     fn remove_page(&self, page_num: i32);
721 
722     #[doc(alias = "gtk_assistant_set_current_page")]
set_current_page(&self, page_num: i32)723     fn set_current_page(&self, page_num: i32);
724 
725     #[doc(alias = "gtk_assistant_set_forward_page_func")]
set_forward_page_func(&self, page_func: Option<Box_<dyn Fn(i32) -> i32 + 'static>>)726     fn set_forward_page_func(&self, page_func: Option<Box_<dyn Fn(i32) -> i32 + 'static>>);
727 
728     #[doc(alias = "gtk_assistant_set_page_complete")]
set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool)729     fn set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool);
730 
731     #[doc(alias = "gtk_assistant_set_page_has_padding")]
set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool)732     fn set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool);
733 
734     #[doc(alias = "gtk_assistant_set_page_title")]
set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str)735     fn set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str);
736 
737     #[doc(alias = "gtk_assistant_set_page_type")]
set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType)738     fn set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType);
739 
740     #[doc(alias = "gtk_assistant_update_buttons_state")]
update_buttons_state(&self)741     fn update_buttons_state(&self);
742 
743     #[doc(alias = "use-header-bar")]
use_header_bar(&self) -> i32744     fn use_header_bar(&self) -> i32;
745 
child_is_complete<T: IsA<Widget>>(&self, item: &T) -> bool746     fn child_is_complete<T: IsA<Widget>>(&self, item: &T) -> bool;
747 
set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool)748     fn set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool);
749 
750     #[doc(alias = "child.has-padding")]
child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool751     fn child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool;
752 
753     #[doc(alias = "child.has-padding")]
set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool)754     fn set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool);
755 
756     #[doc(alias = "child.page-type")]
child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType757     fn child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType;
758 
759     #[doc(alias = "child.page-type")]
set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType)760     fn set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType);
761 
child_title<T: IsA<Widget>>(&self, item: &T) -> Option<glib::GString>762     fn child_title<T: IsA<Widget>>(&self, item: &T) -> Option<glib::GString>;
763 
set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>)764     fn set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>);
765 
766     #[doc(alias = "apply")]
connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId767     fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
768 
769     #[doc(alias = "cancel")]
connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId770     fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
771 
772     #[doc(alias = "close")]
connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId773     fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
774 
775     #[doc(alias = "escape")]
connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId776     fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
777 
emit_escape(&self)778     fn emit_escape(&self);
779 
780     #[doc(alias = "prepare")]
connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId781     fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId;
782 }
783 
784 impl<O: IsA<Assistant>> AssistantExt for O {
add_action_widget<P: IsA<Widget>>(&self, child: &P)785     fn add_action_widget<P: IsA<Widget>>(&self, child: &P) {
786         unsafe {
787             ffi::gtk_assistant_add_action_widget(
788                 self.as_ref().to_glib_none().0,
789                 child.as_ref().to_glib_none().0,
790             );
791         }
792     }
793 
append_page<P: IsA<Widget>>(&self, page: &P) -> i32794     fn append_page<P: IsA<Widget>>(&self, page: &P) -> i32 {
795         unsafe {
796             ffi::gtk_assistant_append_page(
797                 self.as_ref().to_glib_none().0,
798                 page.as_ref().to_glib_none().0,
799             )
800         }
801     }
802 
commit(&self)803     fn commit(&self) {
804         unsafe {
805             ffi::gtk_assistant_commit(self.as_ref().to_glib_none().0);
806         }
807     }
808 
current_page(&self) -> i32809     fn current_page(&self) -> i32 {
810         unsafe { ffi::gtk_assistant_get_current_page(self.as_ref().to_glib_none().0) }
811     }
812 
n_pages(&self) -> i32813     fn n_pages(&self) -> i32 {
814         unsafe { ffi::gtk_assistant_get_n_pages(self.as_ref().to_glib_none().0) }
815     }
816 
nth_page(&self, page_num: i32) -> Option<Widget>817     fn nth_page(&self, page_num: i32) -> Option<Widget> {
818         unsafe {
819             from_glib_none(ffi::gtk_assistant_get_nth_page(
820                 self.as_ref().to_glib_none().0,
821                 page_num,
822             ))
823         }
824     }
825 
page_is_complete<P: IsA<Widget>>(&self, page: &P) -> bool826     fn page_is_complete<P: IsA<Widget>>(&self, page: &P) -> bool {
827         unsafe {
828             from_glib(ffi::gtk_assistant_get_page_complete(
829                 self.as_ref().to_glib_none().0,
830                 page.as_ref().to_glib_none().0,
831             ))
832         }
833     }
834 
page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool835     fn page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool {
836         unsafe {
837             from_glib(ffi::gtk_assistant_get_page_has_padding(
838                 self.as_ref().to_glib_none().0,
839                 page.as_ref().to_glib_none().0,
840             ))
841         }
842     }
843 
page_title<P: IsA<Widget>>(&self, page: &P) -> Option<glib::GString>844     fn page_title<P: IsA<Widget>>(&self, page: &P) -> Option<glib::GString> {
845         unsafe {
846             from_glib_none(ffi::gtk_assistant_get_page_title(
847                 self.as_ref().to_glib_none().0,
848                 page.as_ref().to_glib_none().0,
849             ))
850         }
851     }
852 
page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType853     fn page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType {
854         unsafe {
855             from_glib(ffi::gtk_assistant_get_page_type(
856                 self.as_ref().to_glib_none().0,
857                 page.as_ref().to_glib_none().0,
858             ))
859         }
860     }
861 
insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32862     fn insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32 {
863         unsafe {
864             ffi::gtk_assistant_insert_page(
865                 self.as_ref().to_glib_none().0,
866                 page.as_ref().to_glib_none().0,
867                 position,
868             )
869         }
870     }
871 
next_page(&self)872     fn next_page(&self) {
873         unsafe {
874             ffi::gtk_assistant_next_page(self.as_ref().to_glib_none().0);
875         }
876     }
877 
prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32878     fn prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32 {
879         unsafe {
880             ffi::gtk_assistant_prepend_page(
881                 self.as_ref().to_glib_none().0,
882                 page.as_ref().to_glib_none().0,
883             )
884         }
885     }
886 
previous_page(&self)887     fn previous_page(&self) {
888         unsafe {
889             ffi::gtk_assistant_previous_page(self.as_ref().to_glib_none().0);
890         }
891     }
892 
remove_action_widget<P: IsA<Widget>>(&self, child: &P)893     fn remove_action_widget<P: IsA<Widget>>(&self, child: &P) {
894         unsafe {
895             ffi::gtk_assistant_remove_action_widget(
896                 self.as_ref().to_glib_none().0,
897                 child.as_ref().to_glib_none().0,
898             );
899         }
900     }
901 
remove_page(&self, page_num: i32)902     fn remove_page(&self, page_num: i32) {
903         unsafe {
904             ffi::gtk_assistant_remove_page(self.as_ref().to_glib_none().0, page_num);
905         }
906     }
907 
set_current_page(&self, page_num: i32)908     fn set_current_page(&self, page_num: i32) {
909         unsafe {
910             ffi::gtk_assistant_set_current_page(self.as_ref().to_glib_none().0, page_num);
911         }
912     }
913 
set_forward_page_func(&self, page_func: Option<Box_<dyn Fn(i32) -> i32 + 'static>>)914     fn set_forward_page_func(&self, page_func: Option<Box_<dyn Fn(i32) -> i32 + 'static>>) {
915         let page_func_data: Box_<Option<Box_<dyn Fn(i32) -> i32 + 'static>>> = Box_::new(page_func);
916         unsafe extern "C" fn page_func_func(
917             current_page: libc::c_int,
918             data: glib::ffi::gpointer,
919         ) -> libc::c_int {
920             let callback: &Option<Box_<dyn Fn(i32) -> i32 + 'static>> = &*(data as *mut _);
921             let res = if let Some(ref callback) = *callback {
922                 callback(current_page)
923             } else {
924                 panic!("cannot get closure...")
925             };
926             res
927         }
928         let page_func = if page_func_data.is_some() {
929             Some(page_func_func as _)
930         } else {
931             None
932         };
933         unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
934             let _callback: Box_<Option<Box_<dyn Fn(i32) -> i32 + 'static>>> =
935                 Box_::from_raw(data as *mut _);
936         }
937         let destroy_call3 = Some(destroy_func as _);
938         let super_callback0: Box_<Option<Box_<dyn Fn(i32) -> i32 + 'static>>> = page_func_data;
939         unsafe {
940             ffi::gtk_assistant_set_forward_page_func(
941                 self.as_ref().to_glib_none().0,
942                 page_func,
943                 Box_::into_raw(super_callback0) as *mut _,
944                 destroy_call3,
945             );
946         }
947     }
948 
set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool)949     fn set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool) {
950         unsafe {
951             ffi::gtk_assistant_set_page_complete(
952                 self.as_ref().to_glib_none().0,
953                 page.as_ref().to_glib_none().0,
954                 complete.into_glib(),
955             );
956         }
957     }
958 
set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool)959     fn set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool) {
960         unsafe {
961             ffi::gtk_assistant_set_page_has_padding(
962                 self.as_ref().to_glib_none().0,
963                 page.as_ref().to_glib_none().0,
964                 has_padding.into_glib(),
965             );
966         }
967     }
968 
set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str)969     fn set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str) {
970         unsafe {
971             ffi::gtk_assistant_set_page_title(
972                 self.as_ref().to_glib_none().0,
973                 page.as_ref().to_glib_none().0,
974                 title.to_glib_none().0,
975             );
976         }
977     }
978 
set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType)979     fn set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType) {
980         unsafe {
981             ffi::gtk_assistant_set_page_type(
982                 self.as_ref().to_glib_none().0,
983                 page.as_ref().to_glib_none().0,
984                 type_.into_glib(),
985             );
986         }
987     }
988 
update_buttons_state(&self)989     fn update_buttons_state(&self) {
990         unsafe {
991             ffi::gtk_assistant_update_buttons_state(self.as_ref().to_glib_none().0);
992         }
993     }
994 
use_header_bar(&self) -> i32995     fn use_header_bar(&self) -> i32 {
996         unsafe {
997             let mut value = glib::Value::from_type(<i32 as StaticType>::static_type());
998             glib::gobject_ffi::g_object_get_property(
999                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
1000                 b"use-header-bar\0".as_ptr() as *const _,
1001                 value.to_glib_none_mut().0,
1002             );
1003             value
1004                 .get()
1005                 .expect("Return Value for property `use-header-bar` getter")
1006         }
1007     }
1008 
child_is_complete<T: IsA<Widget>>(&self, item: &T) -> bool1009     fn child_is_complete<T: IsA<Widget>>(&self, item: &T) -> bool {
1010         unsafe {
1011             let mut value = glib::Value::from_type(<bool as StaticType>::static_type());
1012             crate::ffi::gtk_container_child_get_property(
1013                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
1014                 item.to_glib_none().0 as *mut _,
1015                 b"complete\0".as_ptr() as *const _,
1016                 value.to_glib_none_mut().0,
1017             );
1018             value
1019                 .get()
1020                 .expect("Return Value for property `complete` getter")
1021         }
1022     }
1023 
set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool)1024     fn set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool) {
1025         unsafe {
1026             crate::ffi::gtk_container_child_set_property(
1027                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
1028                 item.to_glib_none().0 as *mut _,
1029                 b"complete\0".as_ptr() as *const _,
1030                 complete.to_value().to_glib_none().0,
1031             );
1032         }
1033     }
1034 
child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool1035     fn child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool {
1036         unsafe {
1037             let mut value = glib::Value::from_type(<bool as StaticType>::static_type());
1038             crate::ffi::gtk_container_child_get_property(
1039                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
1040                 item.to_glib_none().0 as *mut _,
1041                 b"has-padding\0".as_ptr() as *const _,
1042                 value.to_glib_none_mut().0,
1043             );
1044             value
1045                 .get()
1046                 .expect("Return Value for property `has-padding` getter")
1047         }
1048     }
1049 
set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool)1050     fn set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool) {
1051         unsafe {
1052             crate::ffi::gtk_container_child_set_property(
1053                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
1054                 item.to_glib_none().0 as *mut _,
1055                 b"has-padding\0".as_ptr() as *const _,
1056                 has_padding.to_value().to_glib_none().0,
1057             );
1058         }
1059     }
1060 
child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType1061     fn child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType {
1062         unsafe {
1063             let mut value =
1064                 glib::Value::from_type(<AssistantPageType as StaticType>::static_type());
1065             crate::ffi::gtk_container_child_get_property(
1066                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
1067                 item.to_glib_none().0 as *mut _,
1068                 b"page-type\0".as_ptr() as *const _,
1069                 value.to_glib_none_mut().0,
1070             );
1071             value
1072                 .get()
1073                 .expect("Return Value for property `page-type` getter")
1074         }
1075     }
1076 
set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType)1077     fn set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType) {
1078         unsafe {
1079             crate::ffi::gtk_container_child_set_property(
1080                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
1081                 item.to_glib_none().0 as *mut _,
1082                 b"page-type\0".as_ptr() as *const _,
1083                 page_type.to_value().to_glib_none().0,
1084             );
1085         }
1086     }
1087 
child_title<T: IsA<Widget>>(&self, item: &T) -> Option<glib::GString>1088     fn child_title<T: IsA<Widget>>(&self, item: &T) -> Option<glib::GString> {
1089         unsafe {
1090             let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type());
1091             crate::ffi::gtk_container_child_get_property(
1092                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
1093                 item.to_glib_none().0 as *mut _,
1094                 b"title\0".as_ptr() as *const _,
1095                 value.to_glib_none_mut().0,
1096             );
1097             value
1098                 .get()
1099                 .expect("Return Value for property `title` getter")
1100         }
1101     }
1102 
set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>)1103     fn set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>) {
1104         unsafe {
1105             crate::ffi::gtk_container_child_set_property(
1106                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
1107                 item.to_glib_none().0 as *mut _,
1108                 b"title\0".as_ptr() as *const _,
1109                 title.to_value().to_glib_none().0,
1110             );
1111         }
1112     }
1113 
connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1114     fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1115         unsafe extern "C" fn apply_trampoline<P: IsA<Assistant>, F: Fn(&P) + 'static>(
1116             this: *mut ffi::GtkAssistant,
1117             f: glib::ffi::gpointer,
1118         ) {
1119             let f: &F = &*(f as *const F);
1120             f(Assistant::from_glib_borrow(this).unsafe_cast_ref())
1121         }
1122         unsafe {
1123             let f: Box_<F> = Box_::new(f);
1124             connect_raw(
1125                 self.as_ptr() as *mut _,
1126                 b"apply\0".as_ptr() as *const _,
1127                 Some(transmute::<_, unsafe extern "C" fn()>(
1128                     apply_trampoline::<Self, F> as *const (),
1129                 )),
1130                 Box_::into_raw(f),
1131             )
1132         }
1133     }
1134 
connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1135     fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1136         unsafe extern "C" fn cancel_trampoline<P: IsA<Assistant>, F: Fn(&P) + 'static>(
1137             this: *mut ffi::GtkAssistant,
1138             f: glib::ffi::gpointer,
1139         ) {
1140             let f: &F = &*(f as *const F);
1141             f(Assistant::from_glib_borrow(this).unsafe_cast_ref())
1142         }
1143         unsafe {
1144             let f: Box_<F> = Box_::new(f);
1145             connect_raw(
1146                 self.as_ptr() as *mut _,
1147                 b"cancel\0".as_ptr() as *const _,
1148                 Some(transmute::<_, unsafe extern "C" fn()>(
1149                     cancel_trampoline::<Self, F> as *const (),
1150                 )),
1151                 Box_::into_raw(f),
1152             )
1153         }
1154     }
1155 
connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1156     fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1157         unsafe extern "C" fn close_trampoline<P: IsA<Assistant>, F: Fn(&P) + 'static>(
1158             this: *mut ffi::GtkAssistant,
1159             f: glib::ffi::gpointer,
1160         ) {
1161             let f: &F = &*(f as *const F);
1162             f(Assistant::from_glib_borrow(this).unsafe_cast_ref())
1163         }
1164         unsafe {
1165             let f: Box_<F> = Box_::new(f);
1166             connect_raw(
1167                 self.as_ptr() as *mut _,
1168                 b"close\0".as_ptr() as *const _,
1169                 Some(transmute::<_, unsafe extern "C" fn()>(
1170                     close_trampoline::<Self, F> as *const (),
1171                 )),
1172                 Box_::into_raw(f),
1173             )
1174         }
1175     }
1176 
connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1177     fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1178         unsafe extern "C" fn escape_trampoline<P: IsA<Assistant>, F: Fn(&P) + 'static>(
1179             this: *mut ffi::GtkAssistant,
1180             f: glib::ffi::gpointer,
1181         ) {
1182             let f: &F = &*(f as *const F);
1183             f(Assistant::from_glib_borrow(this).unsafe_cast_ref())
1184         }
1185         unsafe {
1186             let f: Box_<F> = Box_::new(f);
1187             connect_raw(
1188                 self.as_ptr() as *mut _,
1189                 b"escape\0".as_ptr() as *const _,
1190                 Some(transmute::<_, unsafe extern "C" fn()>(
1191                     escape_trampoline::<Self, F> as *const (),
1192                 )),
1193                 Box_::into_raw(f),
1194             )
1195         }
1196     }
1197 
emit_escape(&self)1198     fn emit_escape(&self) {
1199         let _ = unsafe {
1200             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
1201                 .emit_by_name("escape", &[])
1202                 .unwrap()
1203         };
1204     }
1205 
connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId1206     fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
1207         unsafe extern "C" fn prepare_trampoline<P: IsA<Assistant>, F: Fn(&P, &Widget) + 'static>(
1208             this: *mut ffi::GtkAssistant,
1209             page: *mut ffi::GtkWidget,
1210             f: glib::ffi::gpointer,
1211         ) {
1212             let f: &F = &*(f as *const F);
1213             f(
1214                 Assistant::from_glib_borrow(this).unsafe_cast_ref(),
1215                 &from_glib_borrow(page),
1216             )
1217         }
1218         unsafe {
1219             let f: Box_<F> = Box_::new(f);
1220             connect_raw(
1221                 self.as_ptr() as *mut _,
1222                 b"prepare\0".as_ptr() as *const _,
1223                 Some(transmute::<_, unsafe extern "C" fn()>(
1224                     prepare_trampoline::<Self, F> as *const (),
1225                 )),
1226                 Box_::into_raw(f),
1227             )
1228         }
1229     }
1230 }
1231 
1232 impl fmt::Display for Assistant {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1233     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1234         f.write_str("Assistant")
1235     }
1236 }
1237