1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use crate::Align;
6 use crate::BaselinePosition;
7 use crate::Box;
8 use crate::Buildable;
9 use crate::Container;
10 use crate::Dialog;
11 use crate::FileChooser;
12 use crate::FileChooserAction;
13 use crate::FileFilter;
14 use crate::Orientable;
15 use crate::Orientation;
16 use crate::ResizeMode;
17 use crate::Widget;
18 use glib::object::Cast;
19 use glib::object::IsA;
20 use glib::signal::connect_raw;
21 use glib::signal::SignalHandlerId;
22 use glib::translate::*;
23 use glib::StaticType;
24 use glib::ToValue;
25 use std::boxed::Box as Box_;
26 use std::fmt;
27 use std::mem::transmute;
28 
29 glib::wrapper! {
30     #[doc(alias = "GtkFileChooserButton")]
31     pub struct FileChooserButton(Object<ffi::GtkFileChooserButton, ffi::GtkFileChooserButtonClass>) @extends Box, Container, Widget, @implements Buildable, Orientable, FileChooser;
32 
33     match fn {
34         type_ => || ffi::gtk_file_chooser_button_get_type(),
35     }
36 }
37 
38 impl FileChooserButton {
39     #[doc(alias = "gtk_file_chooser_button_new")]
new(title: &str, action: FileChooserAction) -> FileChooserButton40     pub fn new(title: &str, action: FileChooserAction) -> FileChooserButton {
41         assert_initialized_main_thread!();
42         unsafe {
43             Widget::from_glib_none(ffi::gtk_file_chooser_button_new(
44                 title.to_glib_none().0,
45                 action.into_glib(),
46             ))
47             .unsafe_cast()
48         }
49     }
50 
51     #[doc(alias = "gtk_file_chooser_button_new_with_dialog")]
52     #[doc(alias = "new_with_dialog")]
with_dialog<P: IsA<Dialog>>(dialog: &P) -> FileChooserButton53     pub fn with_dialog<P: IsA<Dialog>>(dialog: &P) -> FileChooserButton {
54         skip_assert_initialized!();
55         unsafe {
56             Widget::from_glib_none(ffi::gtk_file_chooser_button_new_with_dialog(
57                 dialog.as_ref().to_glib_none().0,
58             ))
59             .unsafe_cast()
60         }
61     }
62 
63     // rustdoc-stripper-ignore-next
64     /// Creates a new builder-pattern struct instance to construct [`FileChooserButton`] objects.
65     ///
66     /// This method returns an instance of [`FileChooserButtonBuilder`] which can be used to create [`FileChooserButton`] objects.
builder() -> FileChooserButtonBuilder67     pub fn builder() -> FileChooserButtonBuilder {
68         FileChooserButtonBuilder::default()
69     }
70 }
71 
72 #[derive(Clone, Default)]
73 // rustdoc-stripper-ignore-next
74 /// A [builder-pattern] type to construct [`FileChooserButton`] objects.
75 ///
76 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
77 pub struct FileChooserButtonBuilder {
78     dialog: Option<FileChooser>,
79     title: Option<String>,
80     width_chars: Option<i32>,
81     baseline_position: Option<BaselinePosition>,
82     homogeneous: Option<bool>,
83     spacing: Option<i32>,
84     border_width: Option<u32>,
85     child: Option<Widget>,
86     resize_mode: Option<ResizeMode>,
87     app_paintable: Option<bool>,
88     can_default: Option<bool>,
89     can_focus: Option<bool>,
90     events: Option<gdk::EventMask>,
91     expand: Option<bool>,
92     #[cfg(any(feature = "v3_20", feature = "dox"))]
93     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
94     focus_on_click: Option<bool>,
95     halign: Option<Align>,
96     has_default: Option<bool>,
97     has_focus: Option<bool>,
98     has_tooltip: Option<bool>,
99     height_request: Option<i32>,
100     hexpand: Option<bool>,
101     hexpand_set: Option<bool>,
102     is_focus: Option<bool>,
103     margin: Option<i32>,
104     margin_bottom: Option<i32>,
105     margin_end: Option<i32>,
106     margin_start: Option<i32>,
107     margin_top: Option<i32>,
108     name: Option<String>,
109     no_show_all: Option<bool>,
110     opacity: Option<f64>,
111     parent: Option<Container>,
112     receives_default: Option<bool>,
113     sensitive: Option<bool>,
114     tooltip_markup: Option<String>,
115     tooltip_text: Option<String>,
116     valign: Option<Align>,
117     vexpand: Option<bool>,
118     vexpand_set: Option<bool>,
119     visible: Option<bool>,
120     width_request: Option<i32>,
121     orientation: Option<Orientation>,
122     action: Option<FileChooserAction>,
123     create_folders: Option<bool>,
124     do_overwrite_confirmation: Option<bool>,
125     extra_widget: Option<Widget>,
126     filter: Option<FileFilter>,
127     local_only: Option<bool>,
128     preview_widget: Option<Widget>,
129     preview_widget_active: Option<bool>,
130     select_multiple: Option<bool>,
131     show_hidden: Option<bool>,
132     use_preview_label: Option<bool>,
133 }
134 
135 impl FileChooserButtonBuilder {
136     // rustdoc-stripper-ignore-next
137     /// Create a new [`FileChooserButtonBuilder`].
new() -> Self138     pub fn new() -> Self {
139         Self::default()
140     }
141 
142     // rustdoc-stripper-ignore-next
143     /// Build the [`FileChooserButton`].
build(self) -> FileChooserButton144     pub fn build(self) -> FileChooserButton {
145         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
146         if let Some(ref dialog) = self.dialog {
147             properties.push(("dialog", dialog));
148         }
149         if let Some(ref title) = self.title {
150             properties.push(("title", title));
151         }
152         if let Some(ref width_chars) = self.width_chars {
153             properties.push(("width-chars", width_chars));
154         }
155         if let Some(ref baseline_position) = self.baseline_position {
156             properties.push(("baseline-position", baseline_position));
157         }
158         if let Some(ref homogeneous) = self.homogeneous {
159             properties.push(("homogeneous", homogeneous));
160         }
161         if let Some(ref spacing) = self.spacing {
162             properties.push(("spacing", spacing));
163         }
164         if let Some(ref border_width) = self.border_width {
165             properties.push(("border-width", border_width));
166         }
167         if let Some(ref child) = self.child {
168             properties.push(("child", child));
169         }
170         if let Some(ref resize_mode) = self.resize_mode {
171             properties.push(("resize-mode", resize_mode));
172         }
173         if let Some(ref app_paintable) = self.app_paintable {
174             properties.push(("app-paintable", app_paintable));
175         }
176         if let Some(ref can_default) = self.can_default {
177             properties.push(("can-default", can_default));
178         }
179         if let Some(ref can_focus) = self.can_focus {
180             properties.push(("can-focus", can_focus));
181         }
182         if let Some(ref events) = self.events {
183             properties.push(("events", events));
184         }
185         if let Some(ref expand) = self.expand {
186             properties.push(("expand", expand));
187         }
188         #[cfg(any(feature = "v3_20", feature = "dox"))]
189         if let Some(ref focus_on_click) = self.focus_on_click {
190             properties.push(("focus-on-click", focus_on_click));
191         }
192         if let Some(ref halign) = self.halign {
193             properties.push(("halign", halign));
194         }
195         if let Some(ref has_default) = self.has_default {
196             properties.push(("has-default", has_default));
197         }
198         if let Some(ref has_focus) = self.has_focus {
199             properties.push(("has-focus", has_focus));
200         }
201         if let Some(ref has_tooltip) = self.has_tooltip {
202             properties.push(("has-tooltip", has_tooltip));
203         }
204         if let Some(ref height_request) = self.height_request {
205             properties.push(("height-request", height_request));
206         }
207         if let Some(ref hexpand) = self.hexpand {
208             properties.push(("hexpand", hexpand));
209         }
210         if let Some(ref hexpand_set) = self.hexpand_set {
211             properties.push(("hexpand-set", hexpand_set));
212         }
213         if let Some(ref is_focus) = self.is_focus {
214             properties.push(("is-focus", is_focus));
215         }
216         if let Some(ref margin) = self.margin {
217             properties.push(("margin", margin));
218         }
219         if let Some(ref margin_bottom) = self.margin_bottom {
220             properties.push(("margin-bottom", margin_bottom));
221         }
222         if let Some(ref margin_end) = self.margin_end {
223             properties.push(("margin-end", margin_end));
224         }
225         if let Some(ref margin_start) = self.margin_start {
226             properties.push(("margin-start", margin_start));
227         }
228         if let Some(ref margin_top) = self.margin_top {
229             properties.push(("margin-top", margin_top));
230         }
231         if let Some(ref name) = self.name {
232             properties.push(("name", name));
233         }
234         if let Some(ref no_show_all) = self.no_show_all {
235             properties.push(("no-show-all", no_show_all));
236         }
237         if let Some(ref opacity) = self.opacity {
238             properties.push(("opacity", opacity));
239         }
240         if let Some(ref parent) = self.parent {
241             properties.push(("parent", parent));
242         }
243         if let Some(ref receives_default) = self.receives_default {
244             properties.push(("receives-default", receives_default));
245         }
246         if let Some(ref sensitive) = self.sensitive {
247             properties.push(("sensitive", sensitive));
248         }
249         if let Some(ref tooltip_markup) = self.tooltip_markup {
250             properties.push(("tooltip-markup", tooltip_markup));
251         }
252         if let Some(ref tooltip_text) = self.tooltip_text {
253             properties.push(("tooltip-text", tooltip_text));
254         }
255         if let Some(ref valign) = self.valign {
256             properties.push(("valign", valign));
257         }
258         if let Some(ref vexpand) = self.vexpand {
259             properties.push(("vexpand", vexpand));
260         }
261         if let Some(ref vexpand_set) = self.vexpand_set {
262             properties.push(("vexpand-set", vexpand_set));
263         }
264         if let Some(ref visible) = self.visible {
265             properties.push(("visible", visible));
266         }
267         if let Some(ref width_request) = self.width_request {
268             properties.push(("width-request", width_request));
269         }
270         if let Some(ref orientation) = self.orientation {
271             properties.push(("orientation", orientation));
272         }
273         if let Some(ref action) = self.action {
274             properties.push(("action", action));
275         }
276         if let Some(ref create_folders) = self.create_folders {
277             properties.push(("create-folders", create_folders));
278         }
279         if let Some(ref do_overwrite_confirmation) = self.do_overwrite_confirmation {
280             properties.push(("do-overwrite-confirmation", do_overwrite_confirmation));
281         }
282         if let Some(ref extra_widget) = self.extra_widget {
283             properties.push(("extra-widget", extra_widget));
284         }
285         if let Some(ref filter) = self.filter {
286             properties.push(("filter", filter));
287         }
288         if let Some(ref local_only) = self.local_only {
289             properties.push(("local-only", local_only));
290         }
291         if let Some(ref preview_widget) = self.preview_widget {
292             properties.push(("preview-widget", preview_widget));
293         }
294         if let Some(ref preview_widget_active) = self.preview_widget_active {
295             properties.push(("preview-widget-active", preview_widget_active));
296         }
297         if let Some(ref select_multiple) = self.select_multiple {
298             properties.push(("select-multiple", select_multiple));
299         }
300         if let Some(ref show_hidden) = self.show_hidden {
301             properties.push(("show-hidden", show_hidden));
302         }
303         if let Some(ref use_preview_label) = self.use_preview_label {
304             properties.push(("use-preview-label", use_preview_label));
305         }
306         glib::Object::new::<FileChooserButton>(&properties)
307             .expect("Failed to create an instance of FileChooserButton")
308     }
309 
dialog<P: IsA<FileChooser>>(mut self, dialog: &P) -> Self310     pub fn dialog<P: IsA<FileChooser>>(mut self, dialog: &P) -> Self {
311         self.dialog = Some(dialog.clone().upcast());
312         self
313     }
314 
title(mut self, title: &str) -> Self315     pub fn title(mut self, title: &str) -> Self {
316         self.title = Some(title.to_string());
317         self
318     }
319 
width_chars(mut self, width_chars: i32) -> Self320     pub fn width_chars(mut self, width_chars: i32) -> Self {
321         self.width_chars = Some(width_chars);
322         self
323     }
324 
baseline_position(mut self, baseline_position: BaselinePosition) -> Self325     pub fn baseline_position(mut self, baseline_position: BaselinePosition) -> Self {
326         self.baseline_position = Some(baseline_position);
327         self
328     }
329 
homogeneous(mut self, homogeneous: bool) -> Self330     pub fn homogeneous(mut self, homogeneous: bool) -> Self {
331         self.homogeneous = Some(homogeneous);
332         self
333     }
334 
spacing(mut self, spacing: i32) -> Self335     pub fn spacing(mut self, spacing: i32) -> Self {
336         self.spacing = Some(spacing);
337         self
338     }
339 
border_width(mut self, border_width: u32) -> Self340     pub fn border_width(mut self, border_width: u32) -> Self {
341         self.border_width = Some(border_width);
342         self
343     }
344 
child<P: IsA<Widget>>(mut self, child: &P) -> Self345     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
346         self.child = Some(child.clone().upcast());
347         self
348     }
349 
resize_mode(mut self, resize_mode: ResizeMode) -> Self350     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
351         self.resize_mode = Some(resize_mode);
352         self
353     }
354 
app_paintable(mut self, app_paintable: bool) -> Self355     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
356         self.app_paintable = Some(app_paintable);
357         self
358     }
359 
can_default(mut self, can_default: bool) -> Self360     pub fn can_default(mut self, can_default: bool) -> Self {
361         self.can_default = Some(can_default);
362         self
363     }
364 
can_focus(mut self, can_focus: bool) -> Self365     pub fn can_focus(mut self, can_focus: bool) -> Self {
366         self.can_focus = Some(can_focus);
367         self
368     }
369 
events(mut self, events: gdk::EventMask) -> Self370     pub fn events(mut self, events: gdk::EventMask) -> Self {
371         self.events = Some(events);
372         self
373     }
374 
expand(mut self, expand: bool) -> Self375     pub fn expand(mut self, expand: bool) -> Self {
376         self.expand = Some(expand);
377         self
378     }
379 
380     #[cfg(any(feature = "v3_20", feature = "dox"))]
381     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self382     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
383         self.focus_on_click = Some(focus_on_click);
384         self
385     }
386 
halign(mut self, halign: Align) -> Self387     pub fn halign(mut self, halign: Align) -> Self {
388         self.halign = Some(halign);
389         self
390     }
391 
has_default(mut self, has_default: bool) -> Self392     pub fn has_default(mut self, has_default: bool) -> Self {
393         self.has_default = Some(has_default);
394         self
395     }
396 
has_focus(mut self, has_focus: bool) -> Self397     pub fn has_focus(mut self, has_focus: bool) -> Self {
398         self.has_focus = Some(has_focus);
399         self
400     }
401 
has_tooltip(mut self, has_tooltip: bool) -> Self402     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
403         self.has_tooltip = Some(has_tooltip);
404         self
405     }
406 
height_request(mut self, height_request: i32) -> Self407     pub fn height_request(mut self, height_request: i32) -> Self {
408         self.height_request = Some(height_request);
409         self
410     }
411 
hexpand(mut self, hexpand: bool) -> Self412     pub fn hexpand(mut self, hexpand: bool) -> Self {
413         self.hexpand = Some(hexpand);
414         self
415     }
416 
hexpand_set(mut self, hexpand_set: bool) -> Self417     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
418         self.hexpand_set = Some(hexpand_set);
419         self
420     }
421 
is_focus(mut self, is_focus: bool) -> Self422     pub fn is_focus(mut self, is_focus: bool) -> Self {
423         self.is_focus = Some(is_focus);
424         self
425     }
426 
margin(mut self, margin: i32) -> Self427     pub fn margin(mut self, margin: i32) -> Self {
428         self.margin = Some(margin);
429         self
430     }
431 
margin_bottom(mut self, margin_bottom: i32) -> Self432     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
433         self.margin_bottom = Some(margin_bottom);
434         self
435     }
436 
margin_end(mut self, margin_end: i32) -> Self437     pub fn margin_end(mut self, margin_end: i32) -> Self {
438         self.margin_end = Some(margin_end);
439         self
440     }
441 
margin_start(mut self, margin_start: i32) -> Self442     pub fn margin_start(mut self, margin_start: i32) -> Self {
443         self.margin_start = Some(margin_start);
444         self
445     }
446 
margin_top(mut self, margin_top: i32) -> Self447     pub fn margin_top(mut self, margin_top: i32) -> Self {
448         self.margin_top = Some(margin_top);
449         self
450     }
451 
name(mut self, name: &str) -> Self452     pub fn name(mut self, name: &str) -> Self {
453         self.name = Some(name.to_string());
454         self
455     }
456 
no_show_all(mut self, no_show_all: bool) -> Self457     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
458         self.no_show_all = Some(no_show_all);
459         self
460     }
461 
opacity(mut self, opacity: f64) -> Self462     pub fn opacity(mut self, opacity: f64) -> Self {
463         self.opacity = Some(opacity);
464         self
465     }
466 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self467     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
468         self.parent = Some(parent.clone().upcast());
469         self
470     }
471 
receives_default(mut self, receives_default: bool) -> Self472     pub fn receives_default(mut self, receives_default: bool) -> Self {
473         self.receives_default = Some(receives_default);
474         self
475     }
476 
sensitive(mut self, sensitive: bool) -> Self477     pub fn sensitive(mut self, sensitive: bool) -> Self {
478         self.sensitive = Some(sensitive);
479         self
480     }
481 
tooltip_markup(mut self, tooltip_markup: &str) -> Self482     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
483         self.tooltip_markup = Some(tooltip_markup.to_string());
484         self
485     }
486 
tooltip_text(mut self, tooltip_text: &str) -> Self487     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
488         self.tooltip_text = Some(tooltip_text.to_string());
489         self
490     }
491 
valign(mut self, valign: Align) -> Self492     pub fn valign(mut self, valign: Align) -> Self {
493         self.valign = Some(valign);
494         self
495     }
496 
vexpand(mut self, vexpand: bool) -> Self497     pub fn vexpand(mut self, vexpand: bool) -> Self {
498         self.vexpand = Some(vexpand);
499         self
500     }
501 
vexpand_set(mut self, vexpand_set: bool) -> Self502     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
503         self.vexpand_set = Some(vexpand_set);
504         self
505     }
506 
visible(mut self, visible: bool) -> Self507     pub fn visible(mut self, visible: bool) -> Self {
508         self.visible = Some(visible);
509         self
510     }
511 
width_request(mut self, width_request: i32) -> Self512     pub fn width_request(mut self, width_request: i32) -> Self {
513         self.width_request = Some(width_request);
514         self
515     }
516 
orientation(mut self, orientation: Orientation) -> Self517     pub fn orientation(mut self, orientation: Orientation) -> Self {
518         self.orientation = Some(orientation);
519         self
520     }
521 
action(mut self, action: FileChooserAction) -> Self522     pub fn action(mut self, action: FileChooserAction) -> Self {
523         self.action = Some(action);
524         self
525     }
526 
create_folders(mut self, create_folders: bool) -> Self527     pub fn create_folders(mut self, create_folders: bool) -> Self {
528         self.create_folders = Some(create_folders);
529         self
530     }
531 
do_overwrite_confirmation(mut self, do_overwrite_confirmation: bool) -> Self532     pub fn do_overwrite_confirmation(mut self, do_overwrite_confirmation: bool) -> Self {
533         self.do_overwrite_confirmation = Some(do_overwrite_confirmation);
534         self
535     }
536 
extra_widget<P: IsA<Widget>>(mut self, extra_widget: &P) -> Self537     pub fn extra_widget<P: IsA<Widget>>(mut self, extra_widget: &P) -> Self {
538         self.extra_widget = Some(extra_widget.clone().upcast());
539         self
540     }
541 
filter(mut self, filter: &FileFilter) -> Self542     pub fn filter(mut self, filter: &FileFilter) -> Self {
543         self.filter = Some(filter.clone());
544         self
545     }
546 
local_only(mut self, local_only: bool) -> Self547     pub fn local_only(mut self, local_only: bool) -> Self {
548         self.local_only = Some(local_only);
549         self
550     }
551 
preview_widget<P: IsA<Widget>>(mut self, preview_widget: &P) -> Self552     pub fn preview_widget<P: IsA<Widget>>(mut self, preview_widget: &P) -> Self {
553         self.preview_widget = Some(preview_widget.clone().upcast());
554         self
555     }
556 
preview_widget_active(mut self, preview_widget_active: bool) -> Self557     pub fn preview_widget_active(mut self, preview_widget_active: bool) -> Self {
558         self.preview_widget_active = Some(preview_widget_active);
559         self
560     }
561 
select_multiple(mut self, select_multiple: bool) -> Self562     pub fn select_multiple(mut self, select_multiple: bool) -> Self {
563         self.select_multiple = Some(select_multiple);
564         self
565     }
566 
show_hidden(mut self, show_hidden: bool) -> Self567     pub fn show_hidden(mut self, show_hidden: bool) -> Self {
568         self.show_hidden = Some(show_hidden);
569         self
570     }
571 
use_preview_label(mut self, use_preview_label: bool) -> Self572     pub fn use_preview_label(mut self, use_preview_label: bool) -> Self {
573         self.use_preview_label = Some(use_preview_label);
574         self
575     }
576 }
577 
578 pub const NONE_FILE_CHOOSER_BUTTON: Option<&FileChooserButton> = None;
579 
580 pub trait FileChooserButtonExt: 'static {
581     #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")]
582     #[cfg(any(not(feature = "v3_20"), feature = "dox"))]
583     #[cfg_attr(feature = "dox", doc(cfg(not(feature = "v3_20"))))]
584     #[doc(alias = "gtk_file_chooser_button_get_focus_on_click")]
585     #[doc(alias = "get_focus_on_click")]
gets_focus_on_click(&self) -> bool586     fn gets_focus_on_click(&self) -> bool;
587 
588     #[doc(alias = "gtk_file_chooser_button_get_title")]
589     #[doc(alias = "get_title")]
title(&self) -> Option<glib::GString>590     fn title(&self) -> Option<glib::GString>;
591 
592     #[doc(alias = "gtk_file_chooser_button_get_width_chars")]
593     #[doc(alias = "get_width_chars")]
width_chars(&self) -> i32594     fn width_chars(&self) -> i32;
595 
596     #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")]
597     #[cfg(any(not(feature = "v3_20"), feature = "dox"))]
598     #[cfg_attr(feature = "dox", doc(cfg(not(feature = "v3_20"))))]
599     #[doc(alias = "gtk_file_chooser_button_set_focus_on_click")]
set_focus_on_click(&self, focus_on_click: bool)600     fn set_focus_on_click(&self, focus_on_click: bool);
601 
602     #[doc(alias = "gtk_file_chooser_button_set_title")]
set_title(&self, title: &str)603     fn set_title(&self, title: &str);
604 
605     #[doc(alias = "gtk_file_chooser_button_set_width_chars")]
set_width_chars(&self, n_chars: i32)606     fn set_width_chars(&self, n_chars: i32);
607 
608     #[doc(alias = "file-set")]
connect_file_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId609     fn connect_file_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
610 
611     #[doc(alias = "title")]
connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId612     fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
613 
614     #[doc(alias = "width-chars")]
connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId615     fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
616 }
617 
618 impl<O: IsA<FileChooserButton>> FileChooserButtonExt for O {
619     #[cfg(any(not(feature = "v3_20"), feature = "dox"))]
620     #[cfg_attr(feature = "dox", doc(cfg(not(feature = "v3_20"))))]
gets_focus_on_click(&self) -> bool621     fn gets_focus_on_click(&self) -> bool {
622         unsafe {
623             from_glib(ffi::gtk_file_chooser_button_get_focus_on_click(
624                 self.as_ref().to_glib_none().0,
625             ))
626         }
627     }
628 
title(&self) -> Option<glib::GString>629     fn title(&self) -> Option<glib::GString> {
630         unsafe {
631             from_glib_none(ffi::gtk_file_chooser_button_get_title(
632                 self.as_ref().to_glib_none().0,
633             ))
634         }
635     }
636 
width_chars(&self) -> i32637     fn width_chars(&self) -> i32 {
638         unsafe { ffi::gtk_file_chooser_button_get_width_chars(self.as_ref().to_glib_none().0) }
639     }
640 
641     #[cfg(any(not(feature = "v3_20"), feature = "dox"))]
642     #[cfg_attr(feature = "dox", doc(cfg(not(feature = "v3_20"))))]
set_focus_on_click(&self, focus_on_click: bool)643     fn set_focus_on_click(&self, focus_on_click: bool) {
644         unsafe {
645             ffi::gtk_file_chooser_button_set_focus_on_click(
646                 self.as_ref().to_glib_none().0,
647                 focus_on_click.into_glib(),
648             );
649         }
650     }
651 
set_title(&self, title: &str)652     fn set_title(&self, title: &str) {
653         unsafe {
654             ffi::gtk_file_chooser_button_set_title(
655                 self.as_ref().to_glib_none().0,
656                 title.to_glib_none().0,
657             );
658         }
659     }
660 
set_width_chars(&self, n_chars: i32)661     fn set_width_chars(&self, n_chars: i32) {
662         unsafe {
663             ffi::gtk_file_chooser_button_set_width_chars(self.as_ref().to_glib_none().0, n_chars);
664         }
665     }
666 
connect_file_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId667     fn connect_file_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
668         unsafe extern "C" fn file_set_trampoline<P: IsA<FileChooserButton>, F: Fn(&P) + 'static>(
669             this: *mut ffi::GtkFileChooserButton,
670             f: glib::ffi::gpointer,
671         ) {
672             let f: &F = &*(f as *const F);
673             f(FileChooserButton::from_glib_borrow(this).unsafe_cast_ref())
674         }
675         unsafe {
676             let f: Box_<F> = Box_::new(f);
677             connect_raw(
678                 self.as_ptr() as *mut _,
679                 b"file-set\0".as_ptr() as *const _,
680                 Some(transmute::<_, unsafe extern "C" fn()>(
681                     file_set_trampoline::<Self, F> as *const (),
682                 )),
683                 Box_::into_raw(f),
684             )
685         }
686     }
687 
connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId688     fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
689         unsafe extern "C" fn notify_title_trampoline<
690             P: IsA<FileChooserButton>,
691             F: Fn(&P) + 'static,
692         >(
693             this: *mut ffi::GtkFileChooserButton,
694             _param_spec: glib::ffi::gpointer,
695             f: glib::ffi::gpointer,
696         ) {
697             let f: &F = &*(f as *const F);
698             f(FileChooserButton::from_glib_borrow(this).unsafe_cast_ref())
699         }
700         unsafe {
701             let f: Box_<F> = Box_::new(f);
702             connect_raw(
703                 self.as_ptr() as *mut _,
704                 b"notify::title\0".as_ptr() as *const _,
705                 Some(transmute::<_, unsafe extern "C" fn()>(
706                     notify_title_trampoline::<Self, F> as *const (),
707                 )),
708                 Box_::into_raw(f),
709             )
710         }
711     }
712 
connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId713     fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
714         unsafe extern "C" fn notify_width_chars_trampoline<
715             P: IsA<FileChooserButton>,
716             F: Fn(&P) + 'static,
717         >(
718             this: *mut ffi::GtkFileChooserButton,
719             _param_spec: glib::ffi::gpointer,
720             f: glib::ffi::gpointer,
721         ) {
722             let f: &F = &*(f as *const F);
723             f(FileChooserButton::from_glib_borrow(this).unsafe_cast_ref())
724         }
725         unsafe {
726             let f: Box_<F> = Box_::new(f);
727             connect_raw(
728                 self.as_ptr() as *mut _,
729                 b"notify::width-chars\0".as_ptr() as *const _,
730                 Some(transmute::<_, unsafe extern "C" fn()>(
731                     notify_width_chars_trampoline::<Self, F> as *const (),
732                 )),
733                 Box_::into_raw(f),
734             )
735         }
736     }
737 }
738 
739 impl fmt::Display for FileChooserButton {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result740     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
741         f.write_str("FileChooserButton")
742     }
743 }
744