gtk/auto/
file_chooser_widget.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use gdk;
6use glib;
7use glib::object::Cast;
8use glib::object::IsA;
9use glib::object::ObjectExt;
10use glib::signal::connect_raw;
11use glib::signal::SignalHandlerId;
12use glib::translate::*;
13use glib::GString;
14use glib::StaticType;
15use glib::ToValue;
16use glib::Value;
17use glib_sys;
18use gobject_sys;
19use gtk_sys;
20use libc;
21use std::boxed::Box as Box_;
22use std::fmt;
23use std::mem::transmute;
24use Align;
25use BaselinePosition;
26use Box;
27use Buildable;
28use Container;
29use FileChooser;
30use FileChooserAction;
31use Orientable;
32use ResizeMode;
33use Widget;
34
35glib_wrapper! {
36    pub struct FileChooserWidget(Object<gtk_sys::GtkFileChooserWidget, gtk_sys::GtkFileChooserWidgetClass, FileChooserWidgetClass>) @extends Box, Container, Widget, @implements Buildable, Orientable, FileChooser;
37
38    match fn {
39        get_type => || gtk_sys::gtk_file_chooser_widget_get_type(),
40    }
41}
42
43impl FileChooserWidget {
44    pub fn new(action: FileChooserAction) -> FileChooserWidget {
45        assert_initialized_main_thread!();
46        unsafe {
47            Widget::from_glib_none(gtk_sys::gtk_file_chooser_widget_new(action.to_glib()))
48                .unsafe_cast()
49        }
50    }
51}
52
53pub struct FileChooserWidgetBuilder {
54    search_mode: Option<bool>,
55    baseline_position: Option<BaselinePosition>,
56    homogeneous: Option<bool>,
57    spacing: Option<i32>,
58    border_width: Option<u32>,
59    child: Option<Widget>,
60    resize_mode: Option<ResizeMode>,
61    app_paintable: Option<bool>,
62    can_default: Option<bool>,
63    can_focus: Option<bool>,
64    events: Option<gdk::EventMask>,
65    expand: Option<bool>,
66    #[cfg(any(feature = "v3_20", feature = "dox"))]
67    focus_on_click: Option<bool>,
68    halign: Option<Align>,
69    has_default: Option<bool>,
70    has_focus: Option<bool>,
71    has_tooltip: Option<bool>,
72    height_request: Option<i32>,
73    hexpand: Option<bool>,
74    hexpand_set: Option<bool>,
75    is_focus: Option<bool>,
76    margin: Option<i32>,
77    margin_bottom: Option<i32>,
78    margin_end: Option<i32>,
79    margin_start: Option<i32>,
80    margin_top: Option<i32>,
81    name: Option<String>,
82    no_show_all: Option<bool>,
83    opacity: Option<f64>,
84    parent: Option<Container>,
85    receives_default: Option<bool>,
86    sensitive: Option<bool>,
87    //style: /*Unknown type*/,
88    tooltip_markup: Option<String>,
89    tooltip_text: Option<String>,
90    valign: Option<Align>,
91    vexpand: Option<bool>,
92    vexpand_set: Option<bool>,
93    visible: Option<bool>,
94    width_request: Option<i32>,
95}
96
97impl FileChooserWidgetBuilder {
98    pub fn new() -> Self {
99        Self {
100            search_mode: None,
101            baseline_position: None,
102            homogeneous: None,
103            spacing: None,
104            border_width: None,
105            child: None,
106            resize_mode: None,
107            app_paintable: None,
108            can_default: None,
109            can_focus: None,
110            events: None,
111            expand: None,
112            #[cfg(any(feature = "v3_20", feature = "dox"))]
113            focus_on_click: None,
114            halign: None,
115            has_default: None,
116            has_focus: None,
117            has_tooltip: None,
118            height_request: None,
119            hexpand: None,
120            hexpand_set: None,
121            is_focus: None,
122            margin: None,
123            margin_bottom: None,
124            margin_end: None,
125            margin_start: None,
126            margin_top: None,
127            name: None,
128            no_show_all: None,
129            opacity: None,
130            parent: None,
131            receives_default: None,
132            sensitive: None,
133            tooltip_markup: None,
134            tooltip_text: None,
135            valign: None,
136            vexpand: None,
137            vexpand_set: None,
138            visible: None,
139            width_request: None,
140        }
141    }
142
143    pub fn build(self) -> FileChooserWidget {
144        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
145        if let Some(ref search_mode) = self.search_mode {
146            properties.push(("search-mode", search_mode));
147        }
148        if let Some(ref baseline_position) = self.baseline_position {
149            properties.push(("baseline-position", baseline_position));
150        }
151        if let Some(ref homogeneous) = self.homogeneous {
152            properties.push(("homogeneous", homogeneous));
153        }
154        if let Some(ref spacing) = self.spacing {
155            properties.push(("spacing", spacing));
156        }
157        if let Some(ref border_width) = self.border_width {
158            properties.push(("border-width", border_width));
159        }
160        if let Some(ref child) = self.child {
161            properties.push(("child", child));
162        }
163        if let Some(ref resize_mode) = self.resize_mode {
164            properties.push(("resize-mode", resize_mode));
165        }
166        if let Some(ref app_paintable) = self.app_paintable {
167            properties.push(("app-paintable", app_paintable));
168        }
169        if let Some(ref can_default) = self.can_default {
170            properties.push(("can-default", can_default));
171        }
172        if let Some(ref can_focus) = self.can_focus {
173            properties.push(("can-focus", can_focus));
174        }
175        if let Some(ref events) = self.events {
176            properties.push(("events", events));
177        }
178        if let Some(ref expand) = self.expand {
179            properties.push(("expand", expand));
180        }
181        #[cfg(any(feature = "v3_20", feature = "dox"))]
182        {
183            if let Some(ref focus_on_click) = self.focus_on_click {
184                properties.push(("focus-on-click", focus_on_click));
185            }
186        }
187        if let Some(ref halign) = self.halign {
188            properties.push(("halign", halign));
189        }
190        if let Some(ref has_default) = self.has_default {
191            properties.push(("has-default", has_default));
192        }
193        if let Some(ref has_focus) = self.has_focus {
194            properties.push(("has-focus", has_focus));
195        }
196        if let Some(ref has_tooltip) = self.has_tooltip {
197            properties.push(("has-tooltip", has_tooltip));
198        }
199        if let Some(ref height_request) = self.height_request {
200            properties.push(("height-request", height_request));
201        }
202        if let Some(ref hexpand) = self.hexpand {
203            properties.push(("hexpand", hexpand));
204        }
205        if let Some(ref hexpand_set) = self.hexpand_set {
206            properties.push(("hexpand-set", hexpand_set));
207        }
208        if let Some(ref is_focus) = self.is_focus {
209            properties.push(("is-focus", is_focus));
210        }
211        if let Some(ref margin) = self.margin {
212            properties.push(("margin", margin));
213        }
214        if let Some(ref margin_bottom) = self.margin_bottom {
215            properties.push(("margin-bottom", margin_bottom));
216        }
217        if let Some(ref margin_end) = self.margin_end {
218            properties.push(("margin-end", margin_end));
219        }
220        if let Some(ref margin_start) = self.margin_start {
221            properties.push(("margin-start", margin_start));
222        }
223        if let Some(ref margin_top) = self.margin_top {
224            properties.push(("margin-top", margin_top));
225        }
226        if let Some(ref name) = self.name {
227            properties.push(("name", name));
228        }
229        if let Some(ref no_show_all) = self.no_show_all {
230            properties.push(("no-show-all", no_show_all));
231        }
232        if let Some(ref opacity) = self.opacity {
233            properties.push(("opacity", opacity));
234        }
235        if let Some(ref parent) = self.parent {
236            properties.push(("parent", parent));
237        }
238        if let Some(ref receives_default) = self.receives_default {
239            properties.push(("receives-default", receives_default));
240        }
241        if let Some(ref sensitive) = self.sensitive {
242            properties.push(("sensitive", sensitive));
243        }
244        if let Some(ref tooltip_markup) = self.tooltip_markup {
245            properties.push(("tooltip-markup", tooltip_markup));
246        }
247        if let Some(ref tooltip_text) = self.tooltip_text {
248            properties.push(("tooltip-text", tooltip_text));
249        }
250        if let Some(ref valign) = self.valign {
251            properties.push(("valign", valign));
252        }
253        if let Some(ref vexpand) = self.vexpand {
254            properties.push(("vexpand", vexpand));
255        }
256        if let Some(ref vexpand_set) = self.vexpand_set {
257            properties.push(("vexpand-set", vexpand_set));
258        }
259        if let Some(ref visible) = self.visible {
260            properties.push(("visible", visible));
261        }
262        if let Some(ref width_request) = self.width_request {
263            properties.push(("width-request", width_request));
264        }
265        glib::Object::new(FileChooserWidget::static_type(), &properties)
266            .expect("object new")
267            .downcast()
268            .expect("downcast")
269    }
270
271    pub fn search_mode(mut self, search_mode: bool) -> Self {
272        self.search_mode = Some(search_mode);
273        self
274    }
275
276    pub fn baseline_position(mut self, baseline_position: BaselinePosition) -> Self {
277        self.baseline_position = Some(baseline_position);
278        self
279    }
280
281    pub fn homogeneous(mut self, homogeneous: bool) -> Self {
282        self.homogeneous = Some(homogeneous);
283        self
284    }
285
286    pub fn spacing(mut self, spacing: i32) -> Self {
287        self.spacing = Some(spacing);
288        self
289    }
290
291    pub fn border_width(mut self, border_width: u32) -> Self {
292        self.border_width = Some(border_width);
293        self
294    }
295
296    pub fn child(mut self, child: &Widget) -> Self {
297        self.child = Some(child.clone());
298        self
299    }
300
301    pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
302        self.resize_mode = Some(resize_mode);
303        self
304    }
305
306    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
307        self.app_paintable = Some(app_paintable);
308        self
309    }
310
311    pub fn can_default(mut self, can_default: bool) -> Self {
312        self.can_default = Some(can_default);
313        self
314    }
315
316    pub fn can_focus(mut self, can_focus: bool) -> Self {
317        self.can_focus = Some(can_focus);
318        self
319    }
320
321    pub fn events(mut self, events: gdk::EventMask) -> Self {
322        self.events = Some(events);
323        self
324    }
325
326    pub fn expand(mut self, expand: bool) -> Self {
327        self.expand = Some(expand);
328        self
329    }
330
331    #[cfg(any(feature = "v3_20", feature = "dox"))]
332    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
333        self.focus_on_click = Some(focus_on_click);
334        self
335    }
336
337    pub fn halign(mut self, halign: Align) -> Self {
338        self.halign = Some(halign);
339        self
340    }
341
342    pub fn has_default(mut self, has_default: bool) -> Self {
343        self.has_default = Some(has_default);
344        self
345    }
346
347    pub fn has_focus(mut self, has_focus: bool) -> Self {
348        self.has_focus = Some(has_focus);
349        self
350    }
351
352    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
353        self.has_tooltip = Some(has_tooltip);
354        self
355    }
356
357    pub fn height_request(mut self, height_request: i32) -> Self {
358        self.height_request = Some(height_request);
359        self
360    }
361
362    pub fn hexpand(mut self, hexpand: bool) -> Self {
363        self.hexpand = Some(hexpand);
364        self
365    }
366
367    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
368        self.hexpand_set = Some(hexpand_set);
369        self
370    }
371
372    pub fn is_focus(mut self, is_focus: bool) -> Self {
373        self.is_focus = Some(is_focus);
374        self
375    }
376
377    pub fn margin(mut self, margin: i32) -> Self {
378        self.margin = Some(margin);
379        self
380    }
381
382    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
383        self.margin_bottom = Some(margin_bottom);
384        self
385    }
386
387    pub fn margin_end(mut self, margin_end: i32) -> Self {
388        self.margin_end = Some(margin_end);
389        self
390    }
391
392    pub fn margin_start(mut self, margin_start: i32) -> Self {
393        self.margin_start = Some(margin_start);
394        self
395    }
396
397    pub fn margin_top(mut self, margin_top: i32) -> Self {
398        self.margin_top = Some(margin_top);
399        self
400    }
401
402    pub fn name(mut self, name: &str) -> Self {
403        self.name = Some(name.to_string());
404        self
405    }
406
407    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
408        self.no_show_all = Some(no_show_all);
409        self
410    }
411
412    pub fn opacity(mut self, opacity: f64) -> Self {
413        self.opacity = Some(opacity);
414        self
415    }
416
417    pub fn parent(mut self, parent: &Container) -> Self {
418        self.parent = Some(parent.clone());
419        self
420    }
421
422    pub fn receives_default(mut self, receives_default: bool) -> Self {
423        self.receives_default = Some(receives_default);
424        self
425    }
426
427    pub fn sensitive(mut self, sensitive: bool) -> Self {
428        self.sensitive = Some(sensitive);
429        self
430    }
431
432    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
433        self.tooltip_markup = Some(tooltip_markup.to_string());
434        self
435    }
436
437    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
438        self.tooltip_text = Some(tooltip_text.to_string());
439        self
440    }
441
442    pub fn valign(mut self, valign: Align) -> Self {
443        self.valign = Some(valign);
444        self
445    }
446
447    pub fn vexpand(mut self, vexpand: bool) -> Self {
448        self.vexpand = Some(vexpand);
449        self
450    }
451
452    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
453        self.vexpand_set = Some(vexpand_set);
454        self
455    }
456
457    pub fn visible(mut self, visible: bool) -> Self {
458        self.visible = Some(visible);
459        self
460    }
461
462    pub fn width_request(mut self, width_request: i32) -> Self {
463        self.width_request = Some(width_request);
464        self
465    }
466}
467
468pub const NONE_FILE_CHOOSER_WIDGET: Option<&FileChooserWidget> = None;
469
470pub trait FileChooserWidgetExt: 'static {
471    fn get_property_search_mode(&self) -> bool;
472
473    fn set_property_search_mode(&self, search_mode: bool);
474
475    fn get_property_subtitle(&self) -> Option<GString>;
476
477    fn connect_desktop_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
478
479    fn emit_desktop_folder(&self);
480
481    fn connect_down_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
482
483    fn emit_down_folder(&self);
484
485    fn connect_home_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
486
487    fn emit_home_folder(&self);
488
489    fn connect_location_popup<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
490
491    fn emit_location_popup(&self, path: &str);
492
493    fn connect_location_popup_on_paste<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
494
495    fn emit_location_popup_on_paste(&self);
496
497    fn connect_location_toggle_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
498
499    fn emit_location_toggle_popup(&self);
500
501    fn connect_places_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
502
503    fn emit_places_shortcut(&self);
504
505    fn connect_quick_bookmark<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId;
506
507    fn emit_quick_bookmark(&self, bookmark_index: i32);
508
509    fn connect_recent_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
510
511    fn emit_recent_shortcut(&self);
512
513    fn connect_search_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
514
515    fn emit_search_shortcut(&self);
516
517    fn connect_show_hidden<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
518
519    fn emit_show_hidden(&self);
520
521    fn connect_up_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
522
523    fn emit_up_folder(&self);
524
525    fn connect_property_search_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
526
527    fn connect_property_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
528}
529
530impl<O: IsA<FileChooserWidget>> FileChooserWidgetExt for O {
531    fn get_property_search_mode(&self) -> bool {
532        unsafe {
533            let mut value = Value::from_type(<bool as StaticType>::static_type());
534            gobject_sys::g_object_get_property(
535                self.to_glib_none().0 as *mut gobject_sys::GObject,
536                b"search-mode\0".as_ptr() as *const _,
537                value.to_glib_none_mut().0,
538            );
539            value.get().unwrap()
540        }
541    }
542
543    fn set_property_search_mode(&self, search_mode: bool) {
544        unsafe {
545            gobject_sys::g_object_set_property(
546                self.to_glib_none().0 as *mut gobject_sys::GObject,
547                b"search-mode\0".as_ptr() as *const _,
548                Value::from(&search_mode).to_glib_none().0,
549            );
550        }
551    }
552
553    fn get_property_subtitle(&self) -> Option<GString> {
554        unsafe {
555            let mut value = Value::from_type(<GString as StaticType>::static_type());
556            gobject_sys::g_object_get_property(
557                self.to_glib_none().0 as *mut gobject_sys::GObject,
558                b"subtitle\0".as_ptr() as *const _,
559                value.to_glib_none_mut().0,
560            );
561            value.get()
562        }
563    }
564
565    fn connect_desktop_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
566        unsafe extern "C" fn desktop_folder_trampoline<P, F: Fn(&P) + 'static>(
567            this: *mut gtk_sys::GtkFileChooserWidget,
568            f: glib_sys::gpointer,
569        ) where
570            P: IsA<FileChooserWidget>,
571        {
572            let f: &F = &*(f as *const F);
573            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
574        }
575        unsafe {
576            let f: Box_<F> = Box_::new(f);
577            connect_raw(
578                self.as_ptr() as *mut _,
579                b"desktop-folder\0".as_ptr() as *const _,
580                Some(transmute(desktop_folder_trampoline::<Self, F> as usize)),
581                Box_::into_raw(f),
582            )
583        }
584    }
585
586    fn emit_desktop_folder(&self) {
587        let _ = unsafe {
588            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
589                .emit("desktop-folder", &[])
590                .unwrap()
591        };
592    }
593
594    fn connect_down_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
595        unsafe extern "C" fn down_folder_trampoline<P, F: Fn(&P) + 'static>(
596            this: *mut gtk_sys::GtkFileChooserWidget,
597            f: glib_sys::gpointer,
598        ) where
599            P: IsA<FileChooserWidget>,
600        {
601            let f: &F = &*(f as *const F);
602            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
603        }
604        unsafe {
605            let f: Box_<F> = Box_::new(f);
606            connect_raw(
607                self.as_ptr() as *mut _,
608                b"down-folder\0".as_ptr() as *const _,
609                Some(transmute(down_folder_trampoline::<Self, F> as usize)),
610                Box_::into_raw(f),
611            )
612        }
613    }
614
615    fn emit_down_folder(&self) {
616        let _ = unsafe {
617            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
618                .emit("down-folder", &[])
619                .unwrap()
620        };
621    }
622
623    fn connect_home_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
624        unsafe extern "C" fn home_folder_trampoline<P, F: Fn(&P) + 'static>(
625            this: *mut gtk_sys::GtkFileChooserWidget,
626            f: glib_sys::gpointer,
627        ) where
628            P: IsA<FileChooserWidget>,
629        {
630            let f: &F = &*(f as *const F);
631            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
632        }
633        unsafe {
634            let f: Box_<F> = Box_::new(f);
635            connect_raw(
636                self.as_ptr() as *mut _,
637                b"home-folder\0".as_ptr() as *const _,
638                Some(transmute(home_folder_trampoline::<Self, F> as usize)),
639                Box_::into_raw(f),
640            )
641        }
642    }
643
644    fn emit_home_folder(&self) {
645        let _ = unsafe {
646            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
647                .emit("home-folder", &[])
648                .unwrap()
649        };
650    }
651
652    fn connect_location_popup<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
653        unsafe extern "C" fn location_popup_trampoline<P, F: Fn(&P, &str) + 'static>(
654            this: *mut gtk_sys::GtkFileChooserWidget,
655            path: *mut libc::c_char,
656            f: glib_sys::gpointer,
657        ) where
658            P: IsA<FileChooserWidget>,
659        {
660            let f: &F = &*(f as *const F);
661            f(
662                &FileChooserWidget::from_glib_borrow(this).unsafe_cast(),
663                &GString::from_glib_borrow(path),
664            )
665        }
666        unsafe {
667            let f: Box_<F> = Box_::new(f);
668            connect_raw(
669                self.as_ptr() as *mut _,
670                b"location-popup\0".as_ptr() as *const _,
671                Some(transmute(location_popup_trampoline::<Self, F> as usize)),
672                Box_::into_raw(f),
673            )
674        }
675    }
676
677    fn emit_location_popup(&self, path: &str) {
678        let _ = unsafe {
679            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
680                .emit("location-popup", &[&path])
681                .unwrap()
682        };
683    }
684
685    fn connect_location_popup_on_paste<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
686        unsafe extern "C" fn location_popup_on_paste_trampoline<P, F: Fn(&P) + 'static>(
687            this: *mut gtk_sys::GtkFileChooserWidget,
688            f: glib_sys::gpointer,
689        ) where
690            P: IsA<FileChooserWidget>,
691        {
692            let f: &F = &*(f as *const F);
693            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
694        }
695        unsafe {
696            let f: Box_<F> = Box_::new(f);
697            connect_raw(
698                self.as_ptr() as *mut _,
699                b"location-popup-on-paste\0".as_ptr() as *const _,
700                Some(transmute(
701                    location_popup_on_paste_trampoline::<Self, F> as usize,
702                )),
703                Box_::into_raw(f),
704            )
705        }
706    }
707
708    fn emit_location_popup_on_paste(&self) {
709        let _ = unsafe {
710            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
711                .emit("location-popup-on-paste", &[])
712                .unwrap()
713        };
714    }
715
716    fn connect_location_toggle_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
717        unsafe extern "C" fn location_toggle_popup_trampoline<P, F: Fn(&P) + 'static>(
718            this: *mut gtk_sys::GtkFileChooserWidget,
719            f: glib_sys::gpointer,
720        ) where
721            P: IsA<FileChooserWidget>,
722        {
723            let f: &F = &*(f as *const F);
724            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
725        }
726        unsafe {
727            let f: Box_<F> = Box_::new(f);
728            connect_raw(
729                self.as_ptr() as *mut _,
730                b"location-toggle-popup\0".as_ptr() as *const _,
731                Some(transmute(
732                    location_toggle_popup_trampoline::<Self, F> as usize,
733                )),
734                Box_::into_raw(f),
735            )
736        }
737    }
738
739    fn emit_location_toggle_popup(&self) {
740        let _ = unsafe {
741            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
742                .emit("location-toggle-popup", &[])
743                .unwrap()
744        };
745    }
746
747    fn connect_places_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
748        unsafe extern "C" fn places_shortcut_trampoline<P, F: Fn(&P) + 'static>(
749            this: *mut gtk_sys::GtkFileChooserWidget,
750            f: glib_sys::gpointer,
751        ) where
752            P: IsA<FileChooserWidget>,
753        {
754            let f: &F = &*(f as *const F);
755            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
756        }
757        unsafe {
758            let f: Box_<F> = Box_::new(f);
759            connect_raw(
760                self.as_ptr() as *mut _,
761                b"places-shortcut\0".as_ptr() as *const _,
762                Some(transmute(places_shortcut_trampoline::<Self, F> as usize)),
763                Box_::into_raw(f),
764            )
765        }
766    }
767
768    fn emit_places_shortcut(&self) {
769        let _ = unsafe {
770            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
771                .emit("places-shortcut", &[])
772                .unwrap()
773        };
774    }
775
776    fn connect_quick_bookmark<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId {
777        unsafe extern "C" fn quick_bookmark_trampoline<P, F: Fn(&P, i32) + 'static>(
778            this: *mut gtk_sys::GtkFileChooserWidget,
779            bookmark_index: libc::c_int,
780            f: glib_sys::gpointer,
781        ) where
782            P: IsA<FileChooserWidget>,
783        {
784            let f: &F = &*(f as *const F);
785            f(
786                &FileChooserWidget::from_glib_borrow(this).unsafe_cast(),
787                bookmark_index,
788            )
789        }
790        unsafe {
791            let f: Box_<F> = Box_::new(f);
792            connect_raw(
793                self.as_ptr() as *mut _,
794                b"quick-bookmark\0".as_ptr() as *const _,
795                Some(transmute(quick_bookmark_trampoline::<Self, F> as usize)),
796                Box_::into_raw(f),
797            )
798        }
799    }
800
801    fn emit_quick_bookmark(&self, bookmark_index: i32) {
802        let _ = unsafe {
803            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
804                .emit("quick-bookmark", &[&bookmark_index])
805                .unwrap()
806        };
807    }
808
809    fn connect_recent_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
810        unsafe extern "C" fn recent_shortcut_trampoline<P, F: Fn(&P) + 'static>(
811            this: *mut gtk_sys::GtkFileChooserWidget,
812            f: glib_sys::gpointer,
813        ) where
814            P: IsA<FileChooserWidget>,
815        {
816            let f: &F = &*(f as *const F);
817            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
818        }
819        unsafe {
820            let f: Box_<F> = Box_::new(f);
821            connect_raw(
822                self.as_ptr() as *mut _,
823                b"recent-shortcut\0".as_ptr() as *const _,
824                Some(transmute(recent_shortcut_trampoline::<Self, F> as usize)),
825                Box_::into_raw(f),
826            )
827        }
828    }
829
830    fn emit_recent_shortcut(&self) {
831        let _ = unsafe {
832            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
833                .emit("recent-shortcut", &[])
834                .unwrap()
835        };
836    }
837
838    fn connect_search_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
839        unsafe extern "C" fn search_shortcut_trampoline<P, F: Fn(&P) + 'static>(
840            this: *mut gtk_sys::GtkFileChooserWidget,
841            f: glib_sys::gpointer,
842        ) where
843            P: IsA<FileChooserWidget>,
844        {
845            let f: &F = &*(f as *const F);
846            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
847        }
848        unsafe {
849            let f: Box_<F> = Box_::new(f);
850            connect_raw(
851                self.as_ptr() as *mut _,
852                b"search-shortcut\0".as_ptr() as *const _,
853                Some(transmute(search_shortcut_trampoline::<Self, F> as usize)),
854                Box_::into_raw(f),
855            )
856        }
857    }
858
859    fn emit_search_shortcut(&self) {
860        let _ = unsafe {
861            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
862                .emit("search-shortcut", &[])
863                .unwrap()
864        };
865    }
866
867    fn connect_show_hidden<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
868        unsafe extern "C" fn show_hidden_trampoline<P, F: Fn(&P) + 'static>(
869            this: *mut gtk_sys::GtkFileChooserWidget,
870            f: glib_sys::gpointer,
871        ) where
872            P: IsA<FileChooserWidget>,
873        {
874            let f: &F = &*(f as *const F);
875            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
876        }
877        unsafe {
878            let f: Box_<F> = Box_::new(f);
879            connect_raw(
880                self.as_ptr() as *mut _,
881                b"show-hidden\0".as_ptr() as *const _,
882                Some(transmute(show_hidden_trampoline::<Self, F> as usize)),
883                Box_::into_raw(f),
884            )
885        }
886    }
887
888    fn emit_show_hidden(&self) {
889        let _ = unsafe {
890            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
891                .emit("show-hidden", &[])
892                .unwrap()
893        };
894    }
895
896    fn connect_up_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
897        unsafe extern "C" fn up_folder_trampoline<P, F: Fn(&P) + 'static>(
898            this: *mut gtk_sys::GtkFileChooserWidget,
899            f: glib_sys::gpointer,
900        ) where
901            P: IsA<FileChooserWidget>,
902        {
903            let f: &F = &*(f as *const F);
904            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
905        }
906        unsafe {
907            let f: Box_<F> = Box_::new(f);
908            connect_raw(
909                self.as_ptr() as *mut _,
910                b"up-folder\0".as_ptr() as *const _,
911                Some(transmute(up_folder_trampoline::<Self, F> as usize)),
912                Box_::into_raw(f),
913            )
914        }
915    }
916
917    fn emit_up_folder(&self) {
918        let _ = unsafe {
919            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
920                .emit("up-folder", &[])
921                .unwrap()
922        };
923    }
924
925    fn connect_property_search_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
926        unsafe extern "C" fn notify_search_mode_trampoline<P, F: Fn(&P) + 'static>(
927            this: *mut gtk_sys::GtkFileChooserWidget,
928            _param_spec: glib_sys::gpointer,
929            f: glib_sys::gpointer,
930        ) where
931            P: IsA<FileChooserWidget>,
932        {
933            let f: &F = &*(f as *const F);
934            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
935        }
936        unsafe {
937            let f: Box_<F> = Box_::new(f);
938            connect_raw(
939                self.as_ptr() as *mut _,
940                b"notify::search-mode\0".as_ptr() as *const _,
941                Some(transmute(notify_search_mode_trampoline::<Self, F> as usize)),
942                Box_::into_raw(f),
943            )
944        }
945    }
946
947    fn connect_property_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
948        unsafe extern "C" fn notify_subtitle_trampoline<P, F: Fn(&P) + 'static>(
949            this: *mut gtk_sys::GtkFileChooserWidget,
950            _param_spec: glib_sys::gpointer,
951            f: glib_sys::gpointer,
952        ) where
953            P: IsA<FileChooserWidget>,
954        {
955            let f: &F = &*(f as *const F);
956            f(&FileChooserWidget::from_glib_borrow(this).unsafe_cast())
957        }
958        unsafe {
959            let f: Box_<F> = Box_::new(f);
960            connect_raw(
961                self.as_ptr() as *mut _,
962                b"notify::subtitle\0".as_ptr() as *const _,
963                Some(transmute(notify_subtitle_trampoline::<Self, F> as usize)),
964                Box_::into_raw(f),
965            )
966        }
967    }
968}
969
970impl fmt::Display for FileChooserWidget {
971    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
972        write!(f, "FileChooserWidget")
973    }
974}