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 gdk;
6 use gdk_pixbuf;
7 use glib;
8 use glib::object::Cast;
9 use glib::object::IsA;
10 use glib::object::ObjectExt;
11 use glib::signal::connect_raw;
12 use glib::signal::SignalHandlerId;
13 use glib::translate::*;
14 use glib::GString;
15 use glib::StaticType;
16 use glib::ToValue;
17 use glib::Value;
18 use glib_sys;
19 use gobject_sys;
20 use gtk_sys;
21 use std::boxed::Box as Box_;
22 use std::fmt;
23 use std::mem::transmute;
24 use Align;
25 use Application;
26 use AssistantPageType;
27 use Bin;
28 use Buildable;
29 use Container;
30 use ResizeMode;
31 use Widget;
32 use Window;
33 use WindowPosition;
34 use WindowType;
35 
36 glib_wrapper! {
37     pub struct Assistant(Object<gtk_sys::GtkAssistant, gtk_sys::GtkAssistantClass, AssistantClass>) @extends Window, Bin, Container, Widget, @implements Buildable;
38 
39     match fn {
40         get_type => || gtk_sys::gtk_assistant_get_type(),
41     }
42 }
43 
44 impl Assistant {
new() -> Assistant45     pub fn new() -> Assistant {
46         assert_initialized_main_thread!();
47         unsafe { Widget::from_glib_none(gtk_sys::gtk_assistant_new()).unsafe_cast() }
48     }
49 }
50 
51 impl Default for Assistant {
default() -> Self52     fn default() -> Self {
53         Self::new()
54     }
55 }
56 
57 #[derive(Clone, Default)]
58 pub struct AssistantBuilder {
59     use_header_bar: Option<i32>,
60     accept_focus: Option<bool>,
61     application: Option<Application>,
62     attached_to: Option<Widget>,
63     decorated: Option<bool>,
64     default_height: Option<i32>,
65     default_width: Option<i32>,
66     deletable: Option<bool>,
67     destroy_with_parent: Option<bool>,
68     focus_on_map: Option<bool>,
69     focus_visible: Option<bool>,
70     gravity: Option<gdk::Gravity>,
71     hide_titlebar_when_maximized: Option<bool>,
72     icon: Option<gdk_pixbuf::Pixbuf>,
73     icon_name: Option<String>,
74     mnemonics_visible: Option<bool>,
75     modal: Option<bool>,
76     resizable: Option<bool>,
77     role: Option<String>,
78     screen: Option<gdk::Screen>,
79     skip_pager_hint: Option<bool>,
80     skip_taskbar_hint: Option<bool>,
81     startup_id: Option<String>,
82     title: Option<String>,
83     transient_for: Option<Window>,
84     type_: Option<WindowType>,
85     type_hint: Option<gdk::WindowTypeHint>,
86     urgency_hint: Option<bool>,
87     window_position: Option<WindowPosition>,
88     border_width: Option<u32>,
89     child: Option<Widget>,
90     resize_mode: Option<ResizeMode>,
91     app_paintable: Option<bool>,
92     can_default: Option<bool>,
93     can_focus: Option<bool>,
94     events: Option<gdk::EventMask>,
95     expand: Option<bool>,
96     #[cfg(any(feature = "v3_20", feature = "dox"))]
97     focus_on_click: Option<bool>,
98     halign: Option<Align>,
99     has_default: Option<bool>,
100     has_focus: Option<bool>,
101     has_tooltip: Option<bool>,
102     height_request: Option<i32>,
103     hexpand: Option<bool>,
104     hexpand_set: Option<bool>,
105     is_focus: Option<bool>,
106     margin: Option<i32>,
107     margin_bottom: Option<i32>,
108     margin_end: Option<i32>,
109     margin_start: Option<i32>,
110     margin_top: Option<i32>,
111     name: Option<String>,
112     no_show_all: Option<bool>,
113     opacity: Option<f64>,
114     parent: Option<Container>,
115     receives_default: Option<bool>,
116     sensitive: Option<bool>,
117     tooltip_markup: Option<String>,
118     tooltip_text: Option<String>,
119     valign: Option<Align>,
120     vexpand: Option<bool>,
121     vexpand_set: Option<bool>,
122     visible: Option<bool>,
123     width_request: Option<i32>,
124 }
125 
126 impl AssistantBuilder {
new() -> Self127     pub fn new() -> Self {
128         Self::default()
129     }
130 
build(self) -> Assistant131     pub fn build(self) -> Assistant {
132         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
133         if let Some(ref use_header_bar) = self.use_header_bar {
134             properties.push(("use-header-bar", use_header_bar));
135         }
136         if let Some(ref accept_focus) = self.accept_focus {
137             properties.push(("accept-focus", accept_focus));
138         }
139         if let Some(ref application) = self.application {
140             properties.push(("application", application));
141         }
142         if let Some(ref attached_to) = self.attached_to {
143             properties.push(("attached-to", attached_to));
144         }
145         if let Some(ref decorated) = self.decorated {
146             properties.push(("decorated", decorated));
147         }
148         if let Some(ref default_height) = self.default_height {
149             properties.push(("default-height", default_height));
150         }
151         if let Some(ref default_width) = self.default_width {
152             properties.push(("default-width", default_width));
153         }
154         if let Some(ref deletable) = self.deletable {
155             properties.push(("deletable", deletable));
156         }
157         if let Some(ref destroy_with_parent) = self.destroy_with_parent {
158             properties.push(("destroy-with-parent", destroy_with_parent));
159         }
160         if let Some(ref focus_on_map) = self.focus_on_map {
161             properties.push(("focus-on-map", focus_on_map));
162         }
163         if let Some(ref focus_visible) = self.focus_visible {
164             properties.push(("focus-visible", focus_visible));
165         }
166         if let Some(ref gravity) = self.gravity {
167             properties.push(("gravity", gravity));
168         }
169         if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized {
170             properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized));
171         }
172         if let Some(ref icon) = self.icon {
173             properties.push(("icon", icon));
174         }
175         if let Some(ref icon_name) = self.icon_name {
176             properties.push(("icon-name", icon_name));
177         }
178         if let Some(ref mnemonics_visible) = self.mnemonics_visible {
179             properties.push(("mnemonics-visible", mnemonics_visible));
180         }
181         if let Some(ref modal) = self.modal {
182             properties.push(("modal", modal));
183         }
184         if let Some(ref resizable) = self.resizable {
185             properties.push(("resizable", resizable));
186         }
187         if let Some(ref role) = self.role {
188             properties.push(("role", role));
189         }
190         if let Some(ref screen) = self.screen {
191             properties.push(("screen", screen));
192         }
193         if let Some(ref skip_pager_hint) = self.skip_pager_hint {
194             properties.push(("skip-pager-hint", skip_pager_hint));
195         }
196         if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint {
197             properties.push(("skip-taskbar-hint", skip_taskbar_hint));
198         }
199         if let Some(ref startup_id) = self.startup_id {
200             properties.push(("startup-id", startup_id));
201         }
202         if let Some(ref title) = self.title {
203             properties.push(("title", title));
204         }
205         if let Some(ref transient_for) = self.transient_for {
206             properties.push(("transient-for", transient_for));
207         }
208         if let Some(ref type_) = self.type_ {
209             properties.push(("type", type_));
210         }
211         if let Some(ref type_hint) = self.type_hint {
212             properties.push(("type-hint", type_hint));
213         }
214         if let Some(ref urgency_hint) = self.urgency_hint {
215             properties.push(("urgency-hint", urgency_hint));
216         }
217         if let Some(ref window_position) = self.window_position {
218             properties.push(("window-position", window_position));
219         }
220         if let Some(ref border_width) = self.border_width {
221             properties.push(("border-width", border_width));
222         }
223         if let Some(ref child) = self.child {
224             properties.push(("child", child));
225         }
226         if let Some(ref resize_mode) = self.resize_mode {
227             properties.push(("resize-mode", resize_mode));
228         }
229         if let Some(ref app_paintable) = self.app_paintable {
230             properties.push(("app-paintable", app_paintable));
231         }
232         if let Some(ref can_default) = self.can_default {
233             properties.push(("can-default", can_default));
234         }
235         if let Some(ref can_focus) = self.can_focus {
236             properties.push(("can-focus", can_focus));
237         }
238         if let Some(ref events) = self.events {
239             properties.push(("events", events));
240         }
241         if let Some(ref expand) = self.expand {
242             properties.push(("expand", expand));
243         }
244         #[cfg(any(feature = "v3_20", feature = "dox"))]
245         {
246             if let Some(ref focus_on_click) = self.focus_on_click {
247                 properties.push(("focus-on-click", focus_on_click));
248             }
249         }
250         if let Some(ref halign) = self.halign {
251             properties.push(("halign", halign));
252         }
253         if let Some(ref has_default) = self.has_default {
254             properties.push(("has-default", has_default));
255         }
256         if let Some(ref has_focus) = self.has_focus {
257             properties.push(("has-focus", has_focus));
258         }
259         if let Some(ref has_tooltip) = self.has_tooltip {
260             properties.push(("has-tooltip", has_tooltip));
261         }
262         if let Some(ref height_request) = self.height_request {
263             properties.push(("height-request", height_request));
264         }
265         if let Some(ref hexpand) = self.hexpand {
266             properties.push(("hexpand", hexpand));
267         }
268         if let Some(ref hexpand_set) = self.hexpand_set {
269             properties.push(("hexpand-set", hexpand_set));
270         }
271         if let Some(ref is_focus) = self.is_focus {
272             properties.push(("is-focus", is_focus));
273         }
274         if let Some(ref margin) = self.margin {
275             properties.push(("margin", margin));
276         }
277         if let Some(ref margin_bottom) = self.margin_bottom {
278             properties.push(("margin-bottom", margin_bottom));
279         }
280         if let Some(ref margin_end) = self.margin_end {
281             properties.push(("margin-end", margin_end));
282         }
283         if let Some(ref margin_start) = self.margin_start {
284             properties.push(("margin-start", margin_start));
285         }
286         if let Some(ref margin_top) = self.margin_top {
287             properties.push(("margin-top", margin_top));
288         }
289         if let Some(ref name) = self.name {
290             properties.push(("name", name));
291         }
292         if let Some(ref no_show_all) = self.no_show_all {
293             properties.push(("no-show-all", no_show_all));
294         }
295         if let Some(ref opacity) = self.opacity {
296             properties.push(("opacity", opacity));
297         }
298         if let Some(ref parent) = self.parent {
299             properties.push(("parent", parent));
300         }
301         if let Some(ref receives_default) = self.receives_default {
302             properties.push(("receives-default", receives_default));
303         }
304         if let Some(ref sensitive) = self.sensitive {
305             properties.push(("sensitive", sensitive));
306         }
307         if let Some(ref tooltip_markup) = self.tooltip_markup {
308             properties.push(("tooltip-markup", tooltip_markup));
309         }
310         if let Some(ref tooltip_text) = self.tooltip_text {
311             properties.push(("tooltip-text", tooltip_text));
312         }
313         if let Some(ref valign) = self.valign {
314             properties.push(("valign", valign));
315         }
316         if let Some(ref vexpand) = self.vexpand {
317             properties.push(("vexpand", vexpand));
318         }
319         if let Some(ref vexpand_set) = self.vexpand_set {
320             properties.push(("vexpand-set", vexpand_set));
321         }
322         if let Some(ref visible) = self.visible {
323             properties.push(("visible", visible));
324         }
325         if let Some(ref width_request) = self.width_request {
326             properties.push(("width-request", width_request));
327         }
328         glib::Object::new(Assistant::static_type(), &properties)
329             .expect("object new")
330             .downcast()
331             .expect("downcast")
332     }
333 
use_header_bar(mut self, use_header_bar: i32) -> Self334     pub fn use_header_bar(mut self, use_header_bar: i32) -> Self {
335         self.use_header_bar = Some(use_header_bar);
336         self
337     }
338 
accept_focus(mut self, accept_focus: bool) -> Self339     pub fn accept_focus(mut self, accept_focus: bool) -> Self {
340         self.accept_focus = Some(accept_focus);
341         self
342     }
343 
application<P: IsA<Application>>(mut self, application: &P) -> Self344     pub fn application<P: IsA<Application>>(mut self, application: &P) -> Self {
345         self.application = Some(application.clone().upcast());
346         self
347     }
348 
attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self349     pub fn attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self {
350         self.attached_to = Some(attached_to.clone().upcast());
351         self
352     }
353 
decorated(mut self, decorated: bool) -> Self354     pub fn decorated(mut self, decorated: bool) -> Self {
355         self.decorated = Some(decorated);
356         self
357     }
358 
default_height(mut self, default_height: i32) -> Self359     pub fn default_height(mut self, default_height: i32) -> Self {
360         self.default_height = Some(default_height);
361         self
362     }
363 
default_width(mut self, default_width: i32) -> Self364     pub fn default_width(mut self, default_width: i32) -> Self {
365         self.default_width = Some(default_width);
366         self
367     }
368 
deletable(mut self, deletable: bool) -> Self369     pub fn deletable(mut self, deletable: bool) -> Self {
370         self.deletable = Some(deletable);
371         self
372     }
373 
destroy_with_parent(mut self, destroy_with_parent: bool) -> Self374     pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self {
375         self.destroy_with_parent = Some(destroy_with_parent);
376         self
377     }
378 
focus_on_map(mut self, focus_on_map: bool) -> Self379     pub fn focus_on_map(mut self, focus_on_map: bool) -> Self {
380         self.focus_on_map = Some(focus_on_map);
381         self
382     }
383 
focus_visible(mut self, focus_visible: bool) -> Self384     pub fn focus_visible(mut self, focus_visible: bool) -> Self {
385         self.focus_visible = Some(focus_visible);
386         self
387     }
388 
gravity(mut self, gravity: gdk::Gravity) -> Self389     pub fn gravity(mut self, gravity: gdk::Gravity) -> Self {
390         self.gravity = Some(gravity);
391         self
392     }
393 
hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self394     pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self {
395         self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized);
396         self
397     }
398 
icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self399     pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self {
400         self.icon = Some(icon.clone());
401         self
402     }
403 
icon_name(mut self, icon_name: &str) -> Self404     pub fn icon_name(mut self, icon_name: &str) -> Self {
405         self.icon_name = Some(icon_name.to_string());
406         self
407     }
408 
mnemonics_visible(mut self, mnemonics_visible: bool) -> Self409     pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self {
410         self.mnemonics_visible = Some(mnemonics_visible);
411         self
412     }
413 
modal(mut self, modal: bool) -> Self414     pub fn modal(mut self, modal: bool) -> Self {
415         self.modal = Some(modal);
416         self
417     }
418 
resizable(mut self, resizable: bool) -> Self419     pub fn resizable(mut self, resizable: bool) -> Self {
420         self.resizable = Some(resizable);
421         self
422     }
423 
role(mut self, role: &str) -> Self424     pub fn role(mut self, role: &str) -> Self {
425         self.role = Some(role.to_string());
426         self
427     }
428 
screen(mut self, screen: &gdk::Screen) -> Self429     pub fn screen(mut self, screen: &gdk::Screen) -> Self {
430         self.screen = Some(screen.clone());
431         self
432     }
433 
skip_pager_hint(mut self, skip_pager_hint: bool) -> Self434     pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self {
435         self.skip_pager_hint = Some(skip_pager_hint);
436         self
437     }
438 
skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self439     pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self {
440         self.skip_taskbar_hint = Some(skip_taskbar_hint);
441         self
442     }
443 
startup_id(mut self, startup_id: &str) -> Self444     pub fn startup_id(mut self, startup_id: &str) -> Self {
445         self.startup_id = Some(startup_id.to_string());
446         self
447     }
448 
title(mut self, title: &str) -> Self449     pub fn title(mut self, title: &str) -> Self {
450         self.title = Some(title.to_string());
451         self
452     }
453 
transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self454     pub fn transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self {
455         self.transient_for = Some(transient_for.clone().upcast());
456         self
457     }
458 
type_(mut self, type_: WindowType) -> Self459     pub fn type_(mut self, type_: WindowType) -> Self {
460         self.type_ = Some(type_);
461         self
462     }
463 
type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self464     pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self {
465         self.type_hint = Some(type_hint);
466         self
467     }
468 
urgency_hint(mut self, urgency_hint: bool) -> Self469     pub fn urgency_hint(mut self, urgency_hint: bool) -> Self {
470         self.urgency_hint = Some(urgency_hint);
471         self
472     }
473 
window_position(mut self, window_position: WindowPosition) -> Self474     pub fn window_position(mut self, window_position: WindowPosition) -> Self {
475         self.window_position = Some(window_position);
476         self
477     }
478 
border_width(mut self, border_width: u32) -> Self479     pub fn border_width(mut self, border_width: u32) -> Self {
480         self.border_width = Some(border_width);
481         self
482     }
483 
child<P: IsA<Widget>>(mut self, child: &P) -> Self484     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
485         self.child = Some(child.clone().upcast());
486         self
487     }
488 
resize_mode(mut self, resize_mode: ResizeMode) -> Self489     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
490         self.resize_mode = Some(resize_mode);
491         self
492     }
493 
app_paintable(mut self, app_paintable: bool) -> Self494     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
495         self.app_paintable = Some(app_paintable);
496         self
497     }
498 
can_default(mut self, can_default: bool) -> Self499     pub fn can_default(mut self, can_default: bool) -> Self {
500         self.can_default = Some(can_default);
501         self
502     }
503 
can_focus(mut self, can_focus: bool) -> Self504     pub fn can_focus(mut self, can_focus: bool) -> Self {
505         self.can_focus = Some(can_focus);
506         self
507     }
508 
events(mut self, events: gdk::EventMask) -> Self509     pub fn events(mut self, events: gdk::EventMask) -> Self {
510         self.events = Some(events);
511         self
512     }
513 
expand(mut self, expand: bool) -> Self514     pub fn expand(mut self, expand: bool) -> Self {
515         self.expand = Some(expand);
516         self
517     }
518 
519     #[cfg(any(feature = "v3_20", feature = "dox"))]
focus_on_click(mut self, focus_on_click: bool) -> Self520     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
521         self.focus_on_click = Some(focus_on_click);
522         self
523     }
524 
halign(mut self, halign: Align) -> Self525     pub fn halign(mut self, halign: Align) -> Self {
526         self.halign = Some(halign);
527         self
528     }
529 
has_default(mut self, has_default: bool) -> Self530     pub fn has_default(mut self, has_default: bool) -> Self {
531         self.has_default = Some(has_default);
532         self
533     }
534 
has_focus(mut self, has_focus: bool) -> Self535     pub fn has_focus(mut self, has_focus: bool) -> Self {
536         self.has_focus = Some(has_focus);
537         self
538     }
539 
has_tooltip(mut self, has_tooltip: bool) -> Self540     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
541         self.has_tooltip = Some(has_tooltip);
542         self
543     }
544 
height_request(mut self, height_request: i32) -> Self545     pub fn height_request(mut self, height_request: i32) -> Self {
546         self.height_request = Some(height_request);
547         self
548     }
549 
hexpand(mut self, hexpand: bool) -> Self550     pub fn hexpand(mut self, hexpand: bool) -> Self {
551         self.hexpand = Some(hexpand);
552         self
553     }
554 
hexpand_set(mut self, hexpand_set: bool) -> Self555     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
556         self.hexpand_set = Some(hexpand_set);
557         self
558     }
559 
is_focus(mut self, is_focus: bool) -> Self560     pub fn is_focus(mut self, is_focus: bool) -> Self {
561         self.is_focus = Some(is_focus);
562         self
563     }
564 
margin(mut self, margin: i32) -> Self565     pub fn margin(mut self, margin: i32) -> Self {
566         self.margin = Some(margin);
567         self
568     }
569 
margin_bottom(mut self, margin_bottom: i32) -> Self570     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
571         self.margin_bottom = Some(margin_bottom);
572         self
573     }
574 
margin_end(mut self, margin_end: i32) -> Self575     pub fn margin_end(mut self, margin_end: i32) -> Self {
576         self.margin_end = Some(margin_end);
577         self
578     }
579 
margin_start(mut self, margin_start: i32) -> Self580     pub fn margin_start(mut self, margin_start: i32) -> Self {
581         self.margin_start = Some(margin_start);
582         self
583     }
584 
margin_top(mut self, margin_top: i32) -> Self585     pub fn margin_top(mut self, margin_top: i32) -> Self {
586         self.margin_top = Some(margin_top);
587         self
588     }
589 
name(mut self, name: &str) -> Self590     pub fn name(mut self, name: &str) -> Self {
591         self.name = Some(name.to_string());
592         self
593     }
594 
no_show_all(mut self, no_show_all: bool) -> Self595     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
596         self.no_show_all = Some(no_show_all);
597         self
598     }
599 
opacity(mut self, opacity: f64) -> Self600     pub fn opacity(mut self, opacity: f64) -> Self {
601         self.opacity = Some(opacity);
602         self
603     }
604 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self605     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
606         self.parent = Some(parent.clone().upcast());
607         self
608     }
609 
receives_default(mut self, receives_default: bool) -> Self610     pub fn receives_default(mut self, receives_default: bool) -> Self {
611         self.receives_default = Some(receives_default);
612         self
613     }
614 
sensitive(mut self, sensitive: bool) -> Self615     pub fn sensitive(mut self, sensitive: bool) -> Self {
616         self.sensitive = Some(sensitive);
617         self
618     }
619 
tooltip_markup(mut self, tooltip_markup: &str) -> Self620     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
621         self.tooltip_markup = Some(tooltip_markup.to_string());
622         self
623     }
624 
tooltip_text(mut self, tooltip_text: &str) -> Self625     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
626         self.tooltip_text = Some(tooltip_text.to_string());
627         self
628     }
629 
valign(mut self, valign: Align) -> Self630     pub fn valign(mut self, valign: Align) -> Self {
631         self.valign = Some(valign);
632         self
633     }
634 
vexpand(mut self, vexpand: bool) -> Self635     pub fn vexpand(mut self, vexpand: bool) -> Self {
636         self.vexpand = Some(vexpand);
637         self
638     }
639 
vexpand_set(mut self, vexpand_set: bool) -> Self640     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
641         self.vexpand_set = Some(vexpand_set);
642         self
643     }
644 
visible(mut self, visible: bool) -> Self645     pub fn visible(mut self, visible: bool) -> Self {
646         self.visible = Some(visible);
647         self
648     }
649 
width_request(mut self, width_request: i32) -> Self650     pub fn width_request(mut self, width_request: i32) -> Self {
651         self.width_request = Some(width_request);
652         self
653     }
654 }
655 
656 pub const NONE_ASSISTANT: Option<&Assistant> = None;
657 
658 pub trait AssistantExt: 'static {
add_action_widget<P: IsA<Widget>>(&self, child: &P)659     fn add_action_widget<P: IsA<Widget>>(&self, child: &P);
660 
append_page<P: IsA<Widget>>(&self, page: &P) -> i32661     fn append_page<P: IsA<Widget>>(&self, page: &P) -> i32;
662 
commit(&self)663     fn commit(&self);
664 
get_current_page(&self) -> i32665     fn get_current_page(&self) -> i32;
666 
get_n_pages(&self) -> i32667     fn get_n_pages(&self) -> i32;
668 
get_nth_page(&self, page_num: i32) -> Option<Widget>669     fn get_nth_page(&self, page_num: i32) -> Option<Widget>;
670 
get_page_complete<P: IsA<Widget>>(&self, page: &P) -> bool671     fn get_page_complete<P: IsA<Widget>>(&self, page: &P) -> bool;
672 
673     #[cfg(any(feature = "v3_18", feature = "dox"))]
get_page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool674     fn get_page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool;
675 
get_page_title<P: IsA<Widget>>(&self, page: &P) -> Option<GString>676     fn get_page_title<P: IsA<Widget>>(&self, page: &P) -> Option<GString>;
677 
get_page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType678     fn get_page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType;
679 
insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32680     fn insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32;
681 
next_page(&self)682     fn next_page(&self);
683 
prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32684     fn prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32;
685 
previous_page(&self)686     fn previous_page(&self);
687 
remove_action_widget<P: IsA<Widget>>(&self, child: &P)688     fn remove_action_widget<P: IsA<Widget>>(&self, child: &P);
689 
remove_page(&self, page_num: i32)690     fn remove_page(&self, page_num: i32);
691 
set_current_page(&self, page_num: i32)692     fn set_current_page(&self, page_num: i32);
693 
set_forward_page_func(&self, page_func: Option<Box_<dyn Fn(i32) -> i32 + 'static>>)694     fn set_forward_page_func(&self, page_func: Option<Box_<dyn Fn(i32) -> i32 + 'static>>);
695 
set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool)696     fn set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool);
697 
698     #[cfg(any(feature = "v3_18", feature = "dox"))]
set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool)699     fn set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool);
700 
set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str)701     fn set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str);
702 
set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType)703     fn set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType);
704 
update_buttons_state(&self)705     fn update_buttons_state(&self);
706 
get_property_use_header_bar(&self) -> i32707     fn get_property_use_header_bar(&self) -> i32;
708 
get_child_complete<T: IsA<Widget>>(&self, item: &T) -> bool709     fn get_child_complete<T: IsA<Widget>>(&self, item: &T) -> bool;
710 
set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool)711     fn set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool);
712 
get_child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool713     fn get_child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool;
714 
set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool)715     fn set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool);
716 
get_child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType717     fn get_child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType;
718 
set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType)719     fn set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType);
720 
get_child_title<T: IsA<Widget>>(&self, item: &T) -> Option<GString>721     fn get_child_title<T: IsA<Widget>>(&self, item: &T) -> Option<GString>;
722 
set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>)723     fn set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>);
724 
connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId725     fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
726 
connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId727     fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
728 
connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId729     fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
730 
connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId731     fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
732 
emit_escape(&self)733     fn emit_escape(&self);
734 
connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId735     fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId;
736 }
737 
738 impl<O: IsA<Assistant>> AssistantExt for O {
add_action_widget<P: IsA<Widget>>(&self, child: &P)739     fn add_action_widget<P: IsA<Widget>>(&self, child: &P) {
740         unsafe {
741             gtk_sys::gtk_assistant_add_action_widget(
742                 self.as_ref().to_glib_none().0,
743                 child.as_ref().to_glib_none().0,
744             );
745         }
746     }
747 
append_page<P: IsA<Widget>>(&self, page: &P) -> i32748     fn append_page<P: IsA<Widget>>(&self, page: &P) -> i32 {
749         unsafe {
750             gtk_sys::gtk_assistant_append_page(
751                 self.as_ref().to_glib_none().0,
752                 page.as_ref().to_glib_none().0,
753             )
754         }
755     }
756 
commit(&self)757     fn commit(&self) {
758         unsafe {
759             gtk_sys::gtk_assistant_commit(self.as_ref().to_glib_none().0);
760         }
761     }
762 
get_current_page(&self) -> i32763     fn get_current_page(&self) -> i32 {
764         unsafe { gtk_sys::gtk_assistant_get_current_page(self.as_ref().to_glib_none().0) }
765     }
766 
get_n_pages(&self) -> i32767     fn get_n_pages(&self) -> i32 {
768         unsafe { gtk_sys::gtk_assistant_get_n_pages(self.as_ref().to_glib_none().0) }
769     }
770 
get_nth_page(&self, page_num: i32) -> Option<Widget>771     fn get_nth_page(&self, page_num: i32) -> Option<Widget> {
772         unsafe {
773             from_glib_none(gtk_sys::gtk_assistant_get_nth_page(
774                 self.as_ref().to_glib_none().0,
775                 page_num,
776             ))
777         }
778     }
779 
get_page_complete<P: IsA<Widget>>(&self, page: &P) -> bool780     fn get_page_complete<P: IsA<Widget>>(&self, page: &P) -> bool {
781         unsafe {
782             from_glib(gtk_sys::gtk_assistant_get_page_complete(
783                 self.as_ref().to_glib_none().0,
784                 page.as_ref().to_glib_none().0,
785             ))
786         }
787     }
788 
789     #[cfg(any(feature = "v3_18", feature = "dox"))]
get_page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool790     fn get_page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool {
791         unsafe {
792             from_glib(gtk_sys::gtk_assistant_get_page_has_padding(
793                 self.as_ref().to_glib_none().0,
794                 page.as_ref().to_glib_none().0,
795             ))
796         }
797     }
798 
get_page_title<P: IsA<Widget>>(&self, page: &P) -> Option<GString>799     fn get_page_title<P: IsA<Widget>>(&self, page: &P) -> Option<GString> {
800         unsafe {
801             from_glib_none(gtk_sys::gtk_assistant_get_page_title(
802                 self.as_ref().to_glib_none().0,
803                 page.as_ref().to_glib_none().0,
804             ))
805         }
806     }
807 
get_page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType808     fn get_page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType {
809         unsafe {
810             from_glib(gtk_sys::gtk_assistant_get_page_type(
811                 self.as_ref().to_glib_none().0,
812                 page.as_ref().to_glib_none().0,
813             ))
814         }
815     }
816 
insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32817     fn insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32 {
818         unsafe {
819             gtk_sys::gtk_assistant_insert_page(
820                 self.as_ref().to_glib_none().0,
821                 page.as_ref().to_glib_none().0,
822                 position,
823             )
824         }
825     }
826 
next_page(&self)827     fn next_page(&self) {
828         unsafe {
829             gtk_sys::gtk_assistant_next_page(self.as_ref().to_glib_none().0);
830         }
831     }
832 
prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32833     fn prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32 {
834         unsafe {
835             gtk_sys::gtk_assistant_prepend_page(
836                 self.as_ref().to_glib_none().0,
837                 page.as_ref().to_glib_none().0,
838             )
839         }
840     }
841 
previous_page(&self)842     fn previous_page(&self) {
843         unsafe {
844             gtk_sys::gtk_assistant_previous_page(self.as_ref().to_glib_none().0);
845         }
846     }
847 
remove_action_widget<P: IsA<Widget>>(&self, child: &P)848     fn remove_action_widget<P: IsA<Widget>>(&self, child: &P) {
849         unsafe {
850             gtk_sys::gtk_assistant_remove_action_widget(
851                 self.as_ref().to_glib_none().0,
852                 child.as_ref().to_glib_none().0,
853             );
854         }
855     }
856 
remove_page(&self, page_num: i32)857     fn remove_page(&self, page_num: i32) {
858         unsafe {
859             gtk_sys::gtk_assistant_remove_page(self.as_ref().to_glib_none().0, page_num);
860         }
861     }
862 
set_current_page(&self, page_num: i32)863     fn set_current_page(&self, page_num: i32) {
864         unsafe {
865             gtk_sys::gtk_assistant_set_current_page(self.as_ref().to_glib_none().0, page_num);
866         }
867     }
868 
set_forward_page_func(&self, page_func: Option<Box_<dyn Fn(i32) -> i32 + 'static>>)869     fn set_forward_page_func(&self, page_func: Option<Box_<dyn Fn(i32) -> i32 + 'static>>) {
870         let page_func_data: Box_<Option<Box_<dyn Fn(i32) -> i32 + 'static>>> = Box_::new(page_func);
871         unsafe extern "C" fn page_func_func(
872             current_page: libc::c_int,
873             data: glib_sys::gpointer,
874         ) -> libc::c_int {
875             let callback: &Option<Box_<dyn Fn(i32) -> i32 + 'static>> = &*(data as *mut _);
876             let res = if let Some(ref callback) = *callback {
877                 callback(current_page)
878             } else {
879                 panic!("cannot get closure...")
880             };
881             res
882         }
883         let page_func = if page_func_data.is_some() {
884             Some(page_func_func as _)
885         } else {
886             None
887         };
888         unsafe extern "C" fn destroy_func(data: glib_sys::gpointer) {
889             let _callback: Box_<Option<Box_<dyn Fn(i32) -> i32 + 'static>>> =
890                 Box_::from_raw(data as *mut _);
891         }
892         let destroy_call3 = Some(destroy_func as _);
893         let super_callback0: Box_<Option<Box_<dyn Fn(i32) -> i32 + 'static>>> = page_func_data;
894         unsafe {
895             gtk_sys::gtk_assistant_set_forward_page_func(
896                 self.as_ref().to_glib_none().0,
897                 page_func,
898                 Box_::into_raw(super_callback0) as *mut _,
899                 destroy_call3,
900             );
901         }
902     }
903 
set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool)904     fn set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool) {
905         unsafe {
906             gtk_sys::gtk_assistant_set_page_complete(
907                 self.as_ref().to_glib_none().0,
908                 page.as_ref().to_glib_none().0,
909                 complete.to_glib(),
910             );
911         }
912     }
913 
914     #[cfg(any(feature = "v3_18", feature = "dox"))]
set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool)915     fn set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool) {
916         unsafe {
917             gtk_sys::gtk_assistant_set_page_has_padding(
918                 self.as_ref().to_glib_none().0,
919                 page.as_ref().to_glib_none().0,
920                 has_padding.to_glib(),
921             );
922         }
923     }
924 
set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str)925     fn set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str) {
926         unsafe {
927             gtk_sys::gtk_assistant_set_page_title(
928                 self.as_ref().to_glib_none().0,
929                 page.as_ref().to_glib_none().0,
930                 title.to_glib_none().0,
931             );
932         }
933     }
934 
set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType)935     fn set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType) {
936         unsafe {
937             gtk_sys::gtk_assistant_set_page_type(
938                 self.as_ref().to_glib_none().0,
939                 page.as_ref().to_glib_none().0,
940                 type_.to_glib(),
941             );
942         }
943     }
944 
update_buttons_state(&self)945     fn update_buttons_state(&self) {
946         unsafe {
947             gtk_sys::gtk_assistant_update_buttons_state(self.as_ref().to_glib_none().0);
948         }
949     }
950 
get_property_use_header_bar(&self) -> i32951     fn get_property_use_header_bar(&self) -> i32 {
952         unsafe {
953             let mut value = Value::from_type(<i32 as StaticType>::static_type());
954             gobject_sys::g_object_get_property(
955                 self.to_glib_none().0 as *mut gobject_sys::GObject,
956                 b"use-header-bar\0".as_ptr() as *const _,
957                 value.to_glib_none_mut().0,
958             );
959             value
960                 .get()
961                 .expect("Return Value for property `use-header-bar` getter")
962                 .unwrap()
963         }
964     }
965 
get_child_complete<T: IsA<Widget>>(&self, item: &T) -> bool966     fn get_child_complete<T: IsA<Widget>>(&self, item: &T) -> bool {
967         unsafe {
968             let mut value = Value::from_type(<bool as StaticType>::static_type());
969             gtk_sys::gtk_container_child_get_property(
970                 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
971                 item.to_glib_none().0 as *mut _,
972                 b"complete\0".as_ptr() as *const _,
973                 value.to_glib_none_mut().0,
974             );
975             value
976                 .get()
977                 .expect("Return Value for property `complete` getter")
978                 .unwrap()
979         }
980     }
981 
set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool)982     fn set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool) {
983         unsafe {
984             gtk_sys::gtk_container_child_set_property(
985                 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
986                 item.to_glib_none().0 as *mut _,
987                 b"complete\0".as_ptr() as *const _,
988                 Value::from(&complete).to_glib_none().0,
989             );
990         }
991     }
992 
get_child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool993     fn get_child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool {
994         unsafe {
995             let mut value = Value::from_type(<bool as StaticType>::static_type());
996             gtk_sys::gtk_container_child_get_property(
997                 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
998                 item.to_glib_none().0 as *mut _,
999                 b"has-padding\0".as_ptr() as *const _,
1000                 value.to_glib_none_mut().0,
1001             );
1002             value
1003                 .get()
1004                 .expect("Return Value for property `has-padding` getter")
1005                 .unwrap()
1006         }
1007     }
1008 
set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool)1009     fn set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool) {
1010         unsafe {
1011             gtk_sys::gtk_container_child_set_property(
1012                 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1013                 item.to_glib_none().0 as *mut _,
1014                 b"has-padding\0".as_ptr() as *const _,
1015                 Value::from(&has_padding).to_glib_none().0,
1016             );
1017         }
1018     }
1019 
get_child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType1020     fn get_child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType {
1021         unsafe {
1022             let mut value = Value::from_type(<AssistantPageType as StaticType>::static_type());
1023             gtk_sys::gtk_container_child_get_property(
1024                 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1025                 item.to_glib_none().0 as *mut _,
1026                 b"page-type\0".as_ptr() as *const _,
1027                 value.to_glib_none_mut().0,
1028             );
1029             value
1030                 .get()
1031                 .expect("Return Value for property `page-type` getter")
1032                 .unwrap()
1033         }
1034     }
1035 
set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType)1036     fn set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType) {
1037         unsafe {
1038             gtk_sys::gtk_container_child_set_property(
1039                 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1040                 item.to_glib_none().0 as *mut _,
1041                 b"page-type\0".as_ptr() as *const _,
1042                 Value::from(&page_type).to_glib_none().0,
1043             );
1044         }
1045     }
1046 
get_child_title<T: IsA<Widget>>(&self, item: &T) -> Option<GString>1047     fn get_child_title<T: IsA<Widget>>(&self, item: &T) -> Option<GString> {
1048         unsafe {
1049             let mut value = Value::from_type(<GString as StaticType>::static_type());
1050             gtk_sys::gtk_container_child_get_property(
1051                 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1052                 item.to_glib_none().0 as *mut _,
1053                 b"title\0".as_ptr() as *const _,
1054                 value.to_glib_none_mut().0,
1055             );
1056             value
1057                 .get()
1058                 .expect("Return Value for property `title` getter")
1059         }
1060     }
1061 
set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>)1062     fn set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>) {
1063         unsafe {
1064             gtk_sys::gtk_container_child_set_property(
1065                 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1066                 item.to_glib_none().0 as *mut _,
1067                 b"title\0".as_ptr() as *const _,
1068                 Value::from(title).to_glib_none().0,
1069             );
1070         }
1071     }
1072 
connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1073     fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1074         unsafe extern "C" fn apply_trampoline<P, F: Fn(&P) + 'static>(
1075             this: *mut gtk_sys::GtkAssistant,
1076             f: glib_sys::gpointer,
1077         ) where
1078             P: IsA<Assistant>,
1079         {
1080             let f: &F = &*(f as *const F);
1081             f(&Assistant::from_glib_borrow(this).unsafe_cast())
1082         }
1083         unsafe {
1084             let f: Box_<F> = Box_::new(f);
1085             connect_raw(
1086                 self.as_ptr() as *mut _,
1087                 b"apply\0".as_ptr() as *const _,
1088                 Some(transmute(apply_trampoline::<Self, F> as usize)),
1089                 Box_::into_raw(f),
1090             )
1091         }
1092     }
1093 
connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1094     fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1095         unsafe extern "C" fn cancel_trampoline<P, F: Fn(&P) + 'static>(
1096             this: *mut gtk_sys::GtkAssistant,
1097             f: glib_sys::gpointer,
1098         ) where
1099             P: IsA<Assistant>,
1100         {
1101             let f: &F = &*(f as *const F);
1102             f(&Assistant::from_glib_borrow(this).unsafe_cast())
1103         }
1104         unsafe {
1105             let f: Box_<F> = Box_::new(f);
1106             connect_raw(
1107                 self.as_ptr() as *mut _,
1108                 b"cancel\0".as_ptr() as *const _,
1109                 Some(transmute(cancel_trampoline::<Self, F> as usize)),
1110                 Box_::into_raw(f),
1111             )
1112         }
1113     }
1114 
connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1115     fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1116         unsafe extern "C" fn close_trampoline<P, F: Fn(&P) + 'static>(
1117             this: *mut gtk_sys::GtkAssistant,
1118             f: glib_sys::gpointer,
1119         ) where
1120             P: IsA<Assistant>,
1121         {
1122             let f: &F = &*(f as *const F);
1123             f(&Assistant::from_glib_borrow(this).unsafe_cast())
1124         }
1125         unsafe {
1126             let f: Box_<F> = Box_::new(f);
1127             connect_raw(
1128                 self.as_ptr() as *mut _,
1129                 b"close\0".as_ptr() as *const _,
1130                 Some(transmute(close_trampoline::<Self, F> as usize)),
1131                 Box_::into_raw(f),
1132             )
1133         }
1134     }
1135 
connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1136     fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1137         unsafe extern "C" fn escape_trampoline<P, F: Fn(&P) + 'static>(
1138             this: *mut gtk_sys::GtkAssistant,
1139             f: glib_sys::gpointer,
1140         ) where
1141             P: IsA<Assistant>,
1142         {
1143             let f: &F = &*(f as *const F);
1144             f(&Assistant::from_glib_borrow(this).unsafe_cast())
1145         }
1146         unsafe {
1147             let f: Box_<F> = Box_::new(f);
1148             connect_raw(
1149                 self.as_ptr() as *mut _,
1150                 b"escape\0".as_ptr() as *const _,
1151                 Some(transmute(escape_trampoline::<Self, F> as usize)),
1152                 Box_::into_raw(f),
1153             )
1154         }
1155     }
1156 
emit_escape(&self)1157     fn emit_escape(&self) {
1158         let _ = unsafe {
1159             glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1160                 .emit("escape", &[])
1161                 .unwrap()
1162         };
1163     }
1164 
connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId1165     fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
1166         unsafe extern "C" fn prepare_trampoline<P, F: Fn(&P, &Widget) + 'static>(
1167             this: *mut gtk_sys::GtkAssistant,
1168             page: *mut gtk_sys::GtkWidget,
1169             f: glib_sys::gpointer,
1170         ) where
1171             P: IsA<Assistant>,
1172         {
1173             let f: &F = &*(f as *const F);
1174             f(
1175                 &Assistant::from_glib_borrow(this).unsafe_cast(),
1176                 &from_glib_borrow(page),
1177             )
1178         }
1179         unsafe {
1180             let f: Box_<F> = Box_::new(f);
1181             connect_raw(
1182                 self.as_ptr() as *mut _,
1183                 b"prepare\0".as_ptr() as *const _,
1184                 Some(transmute(prepare_trampoline::<Self, F> as usize)),
1185                 Box_::into_raw(f),
1186             )
1187         }
1188     }
1189 }
1190 
1191 impl fmt::Display for Assistant {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1192     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1193         write!(f, "Assistant")
1194     }
1195 }
1196