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 glib::object::Cast;
7 use glib::object::IsA;
8 use glib::signal::connect_raw;
9 use glib::signal::SignalHandlerId;
10 use glib::translate::*;
11 use glib::GString;
12 use glib::StaticType;
13 use glib::ToValue;
14 use glib_sys;
15 use gtk_sys;
16 use std::boxed::Box as Box_;
17 use std::fmt;
18 use std::mem::transmute;
19 use Align;
20 use BaselinePosition;
21 use Box;
22 use Buildable;
23 use Container;
24 use Dialog;
25 use FileChooser;
26 use FileChooserAction;
27 use FileFilter;
28 use Orientable;
29 use Orientation;
30 use ResizeMode;
31 use Widget;
32 
33 glib_wrapper! {
34     pub struct FileChooserButton(Object<gtk_sys::GtkFileChooserButton, gtk_sys::GtkFileChooserButtonClass, FileChooserButtonClass>) @extends Box, Container, Widget, @implements Buildable, Orientable, FileChooser;
35 
36     match fn {
37         get_type => || gtk_sys::gtk_file_chooser_button_get_type(),
38     }
39 }
40 
41 impl FileChooserButton {
new(title: &str, action: FileChooserAction) -> FileChooserButton42     pub fn new(title: &str, action: FileChooserAction) -> FileChooserButton {
43         assert_initialized_main_thread!();
44         unsafe {
45             Widget::from_glib_none(gtk_sys::gtk_file_chooser_button_new(
46                 title.to_glib_none().0,
47                 action.to_glib(),
48             ))
49             .unsafe_cast()
50         }
51     }
52 
new_with_dialog<P: IsA<Dialog>>(dialog: &P) -> FileChooserButton53     pub fn new_with_dialog<P: IsA<Dialog>>(dialog: &P) -> FileChooserButton {
54         skip_assert_initialized!();
55         unsafe {
56             Widget::from_glib_none(gtk_sys::gtk_file_chooser_button_new_with_dialog(
57                 dialog.as_ref().to_glib_none().0,
58             ))
59             .unsafe_cast()
60         }
61     }
62 }
63 
64 #[derive(Clone, Default)]
65 pub struct FileChooserButtonBuilder {
66     dialog: Option<FileChooser>,
67     title: Option<String>,
68     width_chars: Option<i32>,
69     baseline_position: Option<BaselinePosition>,
70     homogeneous: Option<bool>,
71     spacing: Option<i32>,
72     border_width: Option<u32>,
73     child: Option<Widget>,
74     resize_mode: Option<ResizeMode>,
75     app_paintable: Option<bool>,
76     can_default: Option<bool>,
77     can_focus: Option<bool>,
78     events: Option<gdk::EventMask>,
79     expand: Option<bool>,
80     #[cfg(any(feature = "v3_20", feature = "dox"))]
81     focus_on_click: Option<bool>,
82     halign: Option<Align>,
83     has_default: Option<bool>,
84     has_focus: Option<bool>,
85     has_tooltip: Option<bool>,
86     height_request: Option<i32>,
87     hexpand: Option<bool>,
88     hexpand_set: Option<bool>,
89     is_focus: Option<bool>,
90     margin: Option<i32>,
91     margin_bottom: Option<i32>,
92     margin_end: Option<i32>,
93     margin_start: Option<i32>,
94     margin_top: Option<i32>,
95     name: Option<String>,
96     no_show_all: Option<bool>,
97     opacity: Option<f64>,
98     parent: Option<Container>,
99     receives_default: Option<bool>,
100     sensitive: Option<bool>,
101     tooltip_markup: Option<String>,
102     tooltip_text: Option<String>,
103     valign: Option<Align>,
104     vexpand: Option<bool>,
105     vexpand_set: Option<bool>,
106     visible: Option<bool>,
107     width_request: Option<i32>,
108     orientation: Option<Orientation>,
109     action: Option<FileChooserAction>,
110     create_folders: Option<bool>,
111     do_overwrite_confirmation: Option<bool>,
112     extra_widget: Option<Widget>,
113     filter: Option<FileFilter>,
114     local_only: Option<bool>,
115     preview_widget: Option<Widget>,
116     preview_widget_active: Option<bool>,
117     select_multiple: Option<bool>,
118     show_hidden: Option<bool>,
119     use_preview_label: Option<bool>,
120 }
121 
122 impl FileChooserButtonBuilder {
new() -> Self123     pub fn new() -> Self {
124         Self::default()
125     }
126 
build(self) -> FileChooserButton127     pub fn build(self) -> FileChooserButton {
128         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
129         if let Some(ref dialog) = self.dialog {
130             properties.push(("dialog", dialog));
131         }
132         if let Some(ref title) = self.title {
133             properties.push(("title", title));
134         }
135         if let Some(ref width_chars) = self.width_chars {
136             properties.push(("width-chars", width_chars));
137         }
138         if let Some(ref baseline_position) = self.baseline_position {
139             properties.push(("baseline-position", baseline_position));
140         }
141         if let Some(ref homogeneous) = self.homogeneous {
142             properties.push(("homogeneous", homogeneous));
143         }
144         if let Some(ref spacing) = self.spacing {
145             properties.push(("spacing", spacing));
146         }
147         if let Some(ref border_width) = self.border_width {
148             properties.push(("border-width", border_width));
149         }
150         if let Some(ref child) = self.child {
151             properties.push(("child", child));
152         }
153         if let Some(ref resize_mode) = self.resize_mode {
154             properties.push(("resize-mode", resize_mode));
155         }
156         if let Some(ref app_paintable) = self.app_paintable {
157             properties.push(("app-paintable", app_paintable));
158         }
159         if let Some(ref can_default) = self.can_default {
160             properties.push(("can-default", can_default));
161         }
162         if let Some(ref can_focus) = self.can_focus {
163             properties.push(("can-focus", can_focus));
164         }
165         if let Some(ref events) = self.events {
166             properties.push(("events", events));
167         }
168         if let Some(ref expand) = self.expand {
169             properties.push(("expand", expand));
170         }
171         #[cfg(any(feature = "v3_20", feature = "dox"))]
172         {
173             if let Some(ref focus_on_click) = self.focus_on_click {
174                 properties.push(("focus-on-click", focus_on_click));
175             }
176         }
177         if let Some(ref halign) = self.halign {
178             properties.push(("halign", halign));
179         }
180         if let Some(ref has_default) = self.has_default {
181             properties.push(("has-default", has_default));
182         }
183         if let Some(ref has_focus) = self.has_focus {
184             properties.push(("has-focus", has_focus));
185         }
186         if let Some(ref has_tooltip) = self.has_tooltip {
187             properties.push(("has-tooltip", has_tooltip));
188         }
189         if let Some(ref height_request) = self.height_request {
190             properties.push(("height-request", height_request));
191         }
192         if let Some(ref hexpand) = self.hexpand {
193             properties.push(("hexpand", hexpand));
194         }
195         if let Some(ref hexpand_set) = self.hexpand_set {
196             properties.push(("hexpand-set", hexpand_set));
197         }
198         if let Some(ref is_focus) = self.is_focus {
199             properties.push(("is-focus", is_focus));
200         }
201         if let Some(ref margin) = self.margin {
202             properties.push(("margin", margin));
203         }
204         if let Some(ref margin_bottom) = self.margin_bottom {
205             properties.push(("margin-bottom", margin_bottom));
206         }
207         if let Some(ref margin_end) = self.margin_end {
208             properties.push(("margin-end", margin_end));
209         }
210         if let Some(ref margin_start) = self.margin_start {
211             properties.push(("margin-start", margin_start));
212         }
213         if let Some(ref margin_top) = self.margin_top {
214             properties.push(("margin-top", margin_top));
215         }
216         if let Some(ref name) = self.name {
217             properties.push(("name", name));
218         }
219         if let Some(ref no_show_all) = self.no_show_all {
220             properties.push(("no-show-all", no_show_all));
221         }
222         if let Some(ref opacity) = self.opacity {
223             properties.push(("opacity", opacity));
224         }
225         if let Some(ref parent) = self.parent {
226             properties.push(("parent", parent));
227         }
228         if let Some(ref receives_default) = self.receives_default {
229             properties.push(("receives-default", receives_default));
230         }
231         if let Some(ref sensitive) = self.sensitive {
232             properties.push(("sensitive", sensitive));
233         }
234         if let Some(ref tooltip_markup) = self.tooltip_markup {
235             properties.push(("tooltip-markup", tooltip_markup));
236         }
237         if let Some(ref tooltip_text) = self.tooltip_text {
238             properties.push(("tooltip-text", tooltip_text));
239         }
240         if let Some(ref valign) = self.valign {
241             properties.push(("valign", valign));
242         }
243         if let Some(ref vexpand) = self.vexpand {
244             properties.push(("vexpand", vexpand));
245         }
246         if let Some(ref vexpand_set) = self.vexpand_set {
247             properties.push(("vexpand-set", vexpand_set));
248         }
249         if let Some(ref visible) = self.visible {
250             properties.push(("visible", visible));
251         }
252         if let Some(ref width_request) = self.width_request {
253             properties.push(("width-request", width_request));
254         }
255         if let Some(ref orientation) = self.orientation {
256             properties.push(("orientation", orientation));
257         }
258         if let Some(ref action) = self.action {
259             properties.push(("action", action));
260         }
261         if let Some(ref create_folders) = self.create_folders {
262             properties.push(("create-folders", create_folders));
263         }
264         if let Some(ref do_overwrite_confirmation) = self.do_overwrite_confirmation {
265             properties.push(("do-overwrite-confirmation", do_overwrite_confirmation));
266         }
267         if let Some(ref extra_widget) = self.extra_widget {
268             properties.push(("extra-widget", extra_widget));
269         }
270         if let Some(ref filter) = self.filter {
271             properties.push(("filter", filter));
272         }
273         if let Some(ref local_only) = self.local_only {
274             properties.push(("local-only", local_only));
275         }
276         if let Some(ref preview_widget) = self.preview_widget {
277             properties.push(("preview-widget", preview_widget));
278         }
279         if let Some(ref preview_widget_active) = self.preview_widget_active {
280             properties.push(("preview-widget-active", preview_widget_active));
281         }
282         if let Some(ref select_multiple) = self.select_multiple {
283             properties.push(("select-multiple", select_multiple));
284         }
285         if let Some(ref show_hidden) = self.show_hidden {
286             properties.push(("show-hidden", show_hidden));
287         }
288         if let Some(ref use_preview_label) = self.use_preview_label {
289             properties.push(("use-preview-label", use_preview_label));
290         }
291         glib::Object::new(FileChooserButton::static_type(), &properties)
292             .expect("object new")
293             .downcast()
294             .expect("downcast")
295     }
296 
dialog<P: IsA<FileChooser>>(mut self, dialog: &P) -> Self297     pub fn dialog<P: IsA<FileChooser>>(mut self, dialog: &P) -> Self {
298         self.dialog = Some(dialog.clone().upcast());
299         self
300     }
301 
title(mut self, title: &str) -> Self302     pub fn title(mut self, title: &str) -> Self {
303         self.title = Some(title.to_string());
304         self
305     }
306 
width_chars(mut self, width_chars: i32) -> Self307     pub fn width_chars(mut self, width_chars: i32) -> Self {
308         self.width_chars = Some(width_chars);
309         self
310     }
311 
baseline_position(mut self, baseline_position: BaselinePosition) -> Self312     pub fn baseline_position(mut self, baseline_position: BaselinePosition) -> Self {
313         self.baseline_position = Some(baseline_position);
314         self
315     }
316 
homogeneous(mut self, homogeneous: bool) -> Self317     pub fn homogeneous(mut self, homogeneous: bool) -> Self {
318         self.homogeneous = Some(homogeneous);
319         self
320     }
321 
spacing(mut self, spacing: i32) -> Self322     pub fn spacing(mut self, spacing: i32) -> Self {
323         self.spacing = Some(spacing);
324         self
325     }
326 
border_width(mut self, border_width: u32) -> Self327     pub fn border_width(mut self, border_width: u32) -> Self {
328         self.border_width = Some(border_width);
329         self
330     }
331 
child<P: IsA<Widget>>(mut self, child: &P) -> Self332     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
333         self.child = Some(child.clone().upcast());
334         self
335     }
336 
resize_mode(mut self, resize_mode: ResizeMode) -> Self337     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
338         self.resize_mode = Some(resize_mode);
339         self
340     }
341 
app_paintable(mut self, app_paintable: bool) -> Self342     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
343         self.app_paintable = Some(app_paintable);
344         self
345     }
346 
can_default(mut self, can_default: bool) -> Self347     pub fn can_default(mut self, can_default: bool) -> Self {
348         self.can_default = Some(can_default);
349         self
350     }
351 
can_focus(mut self, can_focus: bool) -> Self352     pub fn can_focus(mut self, can_focus: bool) -> Self {
353         self.can_focus = Some(can_focus);
354         self
355     }
356 
events(mut self, events: gdk::EventMask) -> Self357     pub fn events(mut self, events: gdk::EventMask) -> Self {
358         self.events = Some(events);
359         self
360     }
361 
expand(mut self, expand: bool) -> Self362     pub fn expand(mut self, expand: bool) -> Self {
363         self.expand = Some(expand);
364         self
365     }
366 
367     #[cfg(any(feature = "v3_20", feature = "dox"))]
focus_on_click(mut self, focus_on_click: bool) -> Self368     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
369         self.focus_on_click = Some(focus_on_click);
370         self
371     }
372 
halign(mut self, halign: Align) -> Self373     pub fn halign(mut self, halign: Align) -> Self {
374         self.halign = Some(halign);
375         self
376     }
377 
has_default(mut self, has_default: bool) -> Self378     pub fn has_default(mut self, has_default: bool) -> Self {
379         self.has_default = Some(has_default);
380         self
381     }
382 
has_focus(mut self, has_focus: bool) -> Self383     pub fn has_focus(mut self, has_focus: bool) -> Self {
384         self.has_focus = Some(has_focus);
385         self
386     }
387 
has_tooltip(mut self, has_tooltip: bool) -> Self388     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
389         self.has_tooltip = Some(has_tooltip);
390         self
391     }
392 
height_request(mut self, height_request: i32) -> Self393     pub fn height_request(mut self, height_request: i32) -> Self {
394         self.height_request = Some(height_request);
395         self
396     }
397 
hexpand(mut self, hexpand: bool) -> Self398     pub fn hexpand(mut self, hexpand: bool) -> Self {
399         self.hexpand = Some(hexpand);
400         self
401     }
402 
hexpand_set(mut self, hexpand_set: bool) -> Self403     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
404         self.hexpand_set = Some(hexpand_set);
405         self
406     }
407 
is_focus(mut self, is_focus: bool) -> Self408     pub fn is_focus(mut self, is_focus: bool) -> Self {
409         self.is_focus = Some(is_focus);
410         self
411     }
412 
margin(mut self, margin: i32) -> Self413     pub fn margin(mut self, margin: i32) -> Self {
414         self.margin = Some(margin);
415         self
416     }
417 
margin_bottom(mut self, margin_bottom: i32) -> Self418     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
419         self.margin_bottom = Some(margin_bottom);
420         self
421     }
422 
margin_end(mut self, margin_end: i32) -> Self423     pub fn margin_end(mut self, margin_end: i32) -> Self {
424         self.margin_end = Some(margin_end);
425         self
426     }
427 
margin_start(mut self, margin_start: i32) -> Self428     pub fn margin_start(mut self, margin_start: i32) -> Self {
429         self.margin_start = Some(margin_start);
430         self
431     }
432 
margin_top(mut self, margin_top: i32) -> Self433     pub fn margin_top(mut self, margin_top: i32) -> Self {
434         self.margin_top = Some(margin_top);
435         self
436     }
437 
name(mut self, name: &str) -> Self438     pub fn name(mut self, name: &str) -> Self {
439         self.name = Some(name.to_string());
440         self
441     }
442 
no_show_all(mut self, no_show_all: bool) -> Self443     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
444         self.no_show_all = Some(no_show_all);
445         self
446     }
447 
opacity(mut self, opacity: f64) -> Self448     pub fn opacity(mut self, opacity: f64) -> Self {
449         self.opacity = Some(opacity);
450         self
451     }
452 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self453     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
454         self.parent = Some(parent.clone().upcast());
455         self
456     }
457 
receives_default(mut self, receives_default: bool) -> Self458     pub fn receives_default(mut self, receives_default: bool) -> Self {
459         self.receives_default = Some(receives_default);
460         self
461     }
462 
sensitive(mut self, sensitive: bool) -> Self463     pub fn sensitive(mut self, sensitive: bool) -> Self {
464         self.sensitive = Some(sensitive);
465         self
466     }
467 
tooltip_markup(mut self, tooltip_markup: &str) -> Self468     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
469         self.tooltip_markup = Some(tooltip_markup.to_string());
470         self
471     }
472 
tooltip_text(mut self, tooltip_text: &str) -> Self473     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
474         self.tooltip_text = Some(tooltip_text.to_string());
475         self
476     }
477 
valign(mut self, valign: Align) -> Self478     pub fn valign(mut self, valign: Align) -> Self {
479         self.valign = Some(valign);
480         self
481     }
482 
vexpand(mut self, vexpand: bool) -> Self483     pub fn vexpand(mut self, vexpand: bool) -> Self {
484         self.vexpand = Some(vexpand);
485         self
486     }
487 
vexpand_set(mut self, vexpand_set: bool) -> Self488     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
489         self.vexpand_set = Some(vexpand_set);
490         self
491     }
492 
visible(mut self, visible: bool) -> Self493     pub fn visible(mut self, visible: bool) -> Self {
494         self.visible = Some(visible);
495         self
496     }
497 
width_request(mut self, width_request: i32) -> Self498     pub fn width_request(mut self, width_request: i32) -> Self {
499         self.width_request = Some(width_request);
500         self
501     }
502 
orientation(mut self, orientation: Orientation) -> Self503     pub fn orientation(mut self, orientation: Orientation) -> Self {
504         self.orientation = Some(orientation);
505         self
506     }
507 
action(mut self, action: FileChooserAction) -> Self508     pub fn action(mut self, action: FileChooserAction) -> Self {
509         self.action = Some(action);
510         self
511     }
512 
create_folders(mut self, create_folders: bool) -> Self513     pub fn create_folders(mut self, create_folders: bool) -> Self {
514         self.create_folders = Some(create_folders);
515         self
516     }
517 
do_overwrite_confirmation(mut self, do_overwrite_confirmation: bool) -> Self518     pub fn do_overwrite_confirmation(mut self, do_overwrite_confirmation: bool) -> Self {
519         self.do_overwrite_confirmation = Some(do_overwrite_confirmation);
520         self
521     }
522 
extra_widget<P: IsA<Widget>>(mut self, extra_widget: &P) -> Self523     pub fn extra_widget<P: IsA<Widget>>(mut self, extra_widget: &P) -> Self {
524         self.extra_widget = Some(extra_widget.clone().upcast());
525         self
526     }
527 
filter(mut self, filter: &FileFilter) -> Self528     pub fn filter(mut self, filter: &FileFilter) -> Self {
529         self.filter = Some(filter.clone());
530         self
531     }
532 
local_only(mut self, local_only: bool) -> Self533     pub fn local_only(mut self, local_only: bool) -> Self {
534         self.local_only = Some(local_only);
535         self
536     }
537 
preview_widget<P: IsA<Widget>>(mut self, preview_widget: &P) -> Self538     pub fn preview_widget<P: IsA<Widget>>(mut self, preview_widget: &P) -> Self {
539         self.preview_widget = Some(preview_widget.clone().upcast());
540         self
541     }
542 
preview_widget_active(mut self, preview_widget_active: bool) -> Self543     pub fn preview_widget_active(mut self, preview_widget_active: bool) -> Self {
544         self.preview_widget_active = Some(preview_widget_active);
545         self
546     }
547 
select_multiple(mut self, select_multiple: bool) -> Self548     pub fn select_multiple(mut self, select_multiple: bool) -> Self {
549         self.select_multiple = Some(select_multiple);
550         self
551     }
552 
show_hidden(mut self, show_hidden: bool) -> Self553     pub fn show_hidden(mut self, show_hidden: bool) -> Self {
554         self.show_hidden = Some(show_hidden);
555         self
556     }
557 
use_preview_label(mut self, use_preview_label: bool) -> Self558     pub fn use_preview_label(mut self, use_preview_label: bool) -> Self {
559         self.use_preview_label = Some(use_preview_label);
560         self
561     }
562 }
563 
564 pub const NONE_FILE_CHOOSER_BUTTON: Option<&FileChooserButton> = None;
565 
566 pub trait FileChooserButtonExt: 'static {
567     #[cfg_attr(feature = "v3_20", deprecated)]
568     #[cfg(any(not(feature = "v3_20"), feature = "dox"))]
get_focus_on_click(&self) -> bool569     fn get_focus_on_click(&self) -> bool;
570 
get_title(&self) -> Option<GString>571     fn get_title(&self) -> Option<GString>;
572 
get_width_chars(&self) -> i32573     fn get_width_chars(&self) -> i32;
574 
575     #[cfg_attr(feature = "v3_20", deprecated)]
576     #[cfg(any(not(feature = "v3_20"), feature = "dox"))]
set_focus_on_click(&self, focus_on_click: bool)577     fn set_focus_on_click(&self, focus_on_click: bool);
578 
set_title(&self, title: &str)579     fn set_title(&self, title: &str);
580 
set_width_chars(&self, n_chars: i32)581     fn set_width_chars(&self, n_chars: i32);
582 
connect_file_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId583     fn connect_file_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
584 
connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId585     fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
586 
connect_property_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId587     fn connect_property_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
588 }
589 
590 impl<O: IsA<FileChooserButton>> FileChooserButtonExt for O {
591     #[cfg(any(not(feature = "v3_20"), feature = "dox"))]
get_focus_on_click(&self) -> bool592     fn get_focus_on_click(&self) -> bool {
593         unsafe {
594             from_glib(gtk_sys::gtk_file_chooser_button_get_focus_on_click(
595                 self.as_ref().to_glib_none().0,
596             ))
597         }
598     }
599 
get_title(&self) -> Option<GString>600     fn get_title(&self) -> Option<GString> {
601         unsafe {
602             from_glib_none(gtk_sys::gtk_file_chooser_button_get_title(
603                 self.as_ref().to_glib_none().0,
604             ))
605         }
606     }
607 
get_width_chars(&self) -> i32608     fn get_width_chars(&self) -> i32 {
609         unsafe { gtk_sys::gtk_file_chooser_button_get_width_chars(self.as_ref().to_glib_none().0) }
610     }
611 
612     #[cfg(any(not(feature = "v3_20"), feature = "dox"))]
set_focus_on_click(&self, focus_on_click: bool)613     fn set_focus_on_click(&self, focus_on_click: bool) {
614         unsafe {
615             gtk_sys::gtk_file_chooser_button_set_focus_on_click(
616                 self.as_ref().to_glib_none().0,
617                 focus_on_click.to_glib(),
618             );
619         }
620     }
621 
set_title(&self, title: &str)622     fn set_title(&self, title: &str) {
623         unsafe {
624             gtk_sys::gtk_file_chooser_button_set_title(
625                 self.as_ref().to_glib_none().0,
626                 title.to_glib_none().0,
627             );
628         }
629     }
630 
set_width_chars(&self, n_chars: i32)631     fn set_width_chars(&self, n_chars: i32) {
632         unsafe {
633             gtk_sys::gtk_file_chooser_button_set_width_chars(
634                 self.as_ref().to_glib_none().0,
635                 n_chars,
636             );
637         }
638     }
639 
connect_file_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId640     fn connect_file_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
641         unsafe extern "C" fn file_set_trampoline<P, F: Fn(&P) + 'static>(
642             this: *mut gtk_sys::GtkFileChooserButton,
643             f: glib_sys::gpointer,
644         ) where
645             P: IsA<FileChooserButton>,
646         {
647             let f: &F = &*(f as *const F);
648             f(&FileChooserButton::from_glib_borrow(this).unsafe_cast())
649         }
650         unsafe {
651             let f: Box_<F> = Box_::new(f);
652             connect_raw(
653                 self.as_ptr() as *mut _,
654                 b"file-set\0".as_ptr() as *const _,
655                 Some(transmute(file_set_trampoline::<Self, F> as usize)),
656                 Box_::into_raw(f),
657             )
658         }
659     }
660 
connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId661     fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
662         unsafe extern "C" fn notify_title_trampoline<P, F: Fn(&P) + 'static>(
663             this: *mut gtk_sys::GtkFileChooserButton,
664             _param_spec: glib_sys::gpointer,
665             f: glib_sys::gpointer,
666         ) where
667             P: IsA<FileChooserButton>,
668         {
669             let f: &F = &*(f as *const F);
670             f(&FileChooserButton::from_glib_borrow(this).unsafe_cast())
671         }
672         unsafe {
673             let f: Box_<F> = Box_::new(f);
674             connect_raw(
675                 self.as_ptr() as *mut _,
676                 b"notify::title\0".as_ptr() as *const _,
677                 Some(transmute(notify_title_trampoline::<Self, F> as usize)),
678                 Box_::into_raw(f),
679             )
680         }
681     }
682 
connect_property_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId683     fn connect_property_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
684         unsafe extern "C" fn notify_width_chars_trampoline<P, F: Fn(&P) + 'static>(
685             this: *mut gtk_sys::GtkFileChooserButton,
686             _param_spec: glib_sys::gpointer,
687             f: glib_sys::gpointer,
688         ) where
689             P: IsA<FileChooserButton>,
690         {
691             let f: &F = &*(f as *const F);
692             f(&FileChooserButton::from_glib_borrow(this).unsafe_cast())
693         }
694         unsafe {
695             let f: Box_<F> = Box_::new(f);
696             connect_raw(
697                 self.as_ptr() as *mut _,
698                 b"notify::width-chars\0".as_ptr() as *const _,
699                 Some(transmute(notify_width_chars_trampoline::<Self, F> as usize)),
700                 Box_::into_raw(f),
701             )
702         }
703     }
704 }
705 
706 impl fmt::Display for FileChooserButton {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result707     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
708         write!(f, "FileChooserButton")
709     }
710 }
711