1use gdk;
6use gdk_pixbuf;
7use gio;
8use glib::object::Cast;
9use glib::object::IsA;
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 std::boxed::Box as Box_;
21use std::fmt;
22use std::mem::transmute;
23use Align;
24use AppChooser;
25use Application;
26use Bin;
27use Buildable;
28use Container;
29use Dialog;
30use DialogFlags;
31use ResizeMode;
32use Widget;
33use Window;
34use WindowPosition;
35use WindowType;
36
37glib_wrapper! {
38 pub struct AppChooserDialog(Object<gtk_sys::GtkAppChooserDialog, gtk_sys::GtkAppChooserDialogClass, AppChooserDialogClass>) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable, AppChooser;
39
40 match fn {
41 get_type => || gtk_sys::gtk_app_chooser_dialog_get_type(),
42 }
43}
44
45impl AppChooserDialog {
46 pub fn new<P: IsA<Window>, Q: IsA<gio::File>>(
47 parent: Option<&P>,
48 flags: DialogFlags,
49 file: &Q,
50 ) -> AppChooserDialog {
51 assert_initialized_main_thread!();
52 unsafe {
53 Widget::from_glib_none(gtk_sys::gtk_app_chooser_dialog_new(
54 parent.map(|p| p.as_ref()).to_glib_none().0,
55 flags.to_glib(),
56 file.as_ref().to_glib_none().0,
57 ))
58 .unsafe_cast()
59 }
60 }
61
62 pub fn new_for_content_type<P: IsA<Window>>(
63 parent: Option<&P>,
64 flags: DialogFlags,
65 content_type: &str,
66 ) -> AppChooserDialog {
67 assert_initialized_main_thread!();
68 unsafe {
69 Widget::from_glib_none(gtk_sys::gtk_app_chooser_dialog_new_for_content_type(
70 parent.map(|p| p.as_ref()).to_glib_none().0,
71 flags.to_glib(),
72 content_type.to_glib_none().0,
73 ))
74 .unsafe_cast()
75 }
76 }
77}
78
79pub struct AppChooserDialogBuilder {
80 gfile: Option<gio::File>,
81 heading: Option<String>,
82 use_header_bar: Option<i32>,
83 accept_focus: Option<bool>,
84 application: Option<Application>,
85 attached_to: Option<Widget>,
86 decorated: Option<bool>,
87 default_height: Option<i32>,
88 default_width: Option<i32>,
89 deletable: Option<bool>,
90 destroy_with_parent: Option<bool>,
91 focus_on_map: Option<bool>,
92 focus_visible: Option<bool>,
93 gravity: Option<gdk::Gravity>,
94 hide_titlebar_when_maximized: Option<bool>,
95 icon: Option<gdk_pixbuf::Pixbuf>,
96 icon_name: Option<String>,
97 mnemonics_visible: Option<bool>,
98 modal: Option<bool>,
99 resizable: Option<bool>,
100 role: Option<String>,
101 screen: Option<gdk::Screen>,
102 skip_pager_hint: Option<bool>,
103 skip_taskbar_hint: Option<bool>,
104 startup_id: Option<String>,
105 title: Option<String>,
106 transient_for: Option<Window>,
107 type_: Option<WindowType>,
108 type_hint: Option<gdk::WindowTypeHint>,
109 urgency_hint: Option<bool>,
110 window_position: Option<WindowPosition>,
111 border_width: Option<u32>,
112 child: Option<Widget>,
113 resize_mode: Option<ResizeMode>,
114 app_paintable: Option<bool>,
115 can_default: Option<bool>,
116 can_focus: Option<bool>,
117 events: Option<gdk::EventMask>,
118 expand: Option<bool>,
119 #[cfg(any(feature = "v3_20", feature = "dox"))]
120 focus_on_click: Option<bool>,
121 halign: Option<Align>,
122 has_default: Option<bool>,
123 has_focus: Option<bool>,
124 has_tooltip: Option<bool>,
125 height_request: Option<i32>,
126 hexpand: Option<bool>,
127 hexpand_set: Option<bool>,
128 is_focus: Option<bool>,
129 margin: Option<i32>,
130 margin_bottom: Option<i32>,
131 margin_end: Option<i32>,
132 margin_start: Option<i32>,
133 margin_top: Option<i32>,
134 name: Option<String>,
135 no_show_all: Option<bool>,
136 opacity: Option<f64>,
137 parent: Option<Container>,
138 receives_default: Option<bool>,
139 sensitive: Option<bool>,
140 tooltip_markup: Option<String>,
142 tooltip_text: Option<String>,
143 valign: Option<Align>,
144 vexpand: Option<bool>,
145 vexpand_set: Option<bool>,
146 visible: Option<bool>,
147 width_request: Option<i32>,
148}
149
150impl AppChooserDialogBuilder {
151 pub fn new() -> Self {
152 Self {
153 gfile: None,
154 heading: None,
155 use_header_bar: None,
156 accept_focus: None,
157 application: None,
158 attached_to: None,
159 decorated: None,
160 default_height: None,
161 default_width: None,
162 deletable: None,
163 destroy_with_parent: None,
164 focus_on_map: None,
165 focus_visible: None,
166 gravity: None,
167 hide_titlebar_when_maximized: None,
168 icon: None,
169 icon_name: None,
170 mnemonics_visible: None,
171 modal: None,
172 resizable: None,
173 role: None,
174 screen: None,
175 skip_pager_hint: None,
176 skip_taskbar_hint: None,
177 startup_id: None,
178 title: None,
179 transient_for: None,
180 type_: None,
181 type_hint: None,
182 urgency_hint: None,
183 window_position: None,
184 border_width: None,
185 child: None,
186 resize_mode: None,
187 app_paintable: None,
188 can_default: None,
189 can_focus: None,
190 events: None,
191 expand: None,
192 #[cfg(any(feature = "v3_20", feature = "dox"))]
193 focus_on_click: None,
194 halign: None,
195 has_default: None,
196 has_focus: None,
197 has_tooltip: None,
198 height_request: None,
199 hexpand: None,
200 hexpand_set: None,
201 is_focus: None,
202 margin: None,
203 margin_bottom: None,
204 margin_end: None,
205 margin_start: None,
206 margin_top: None,
207 name: None,
208 no_show_all: None,
209 opacity: None,
210 parent: None,
211 receives_default: None,
212 sensitive: None,
213 tooltip_markup: None,
214 tooltip_text: None,
215 valign: None,
216 vexpand: None,
217 vexpand_set: None,
218 visible: None,
219 width_request: None,
220 }
221 }
222
223 pub fn build(self) -> AppChooserDialog {
224 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
225 if let Some(ref gfile) = self.gfile {
226 properties.push(("gfile", gfile));
227 }
228 if let Some(ref heading) = self.heading {
229 properties.push(("heading", heading));
230 }
231 if let Some(ref use_header_bar) = self.use_header_bar {
232 properties.push(("use-header-bar", use_header_bar));
233 }
234 if let Some(ref accept_focus) = self.accept_focus {
235 properties.push(("accept-focus", accept_focus));
236 }
237 if let Some(ref application) = self.application {
238 properties.push(("application", application));
239 }
240 if let Some(ref attached_to) = self.attached_to {
241 properties.push(("attached-to", attached_to));
242 }
243 if let Some(ref decorated) = self.decorated {
244 properties.push(("decorated", decorated));
245 }
246 if let Some(ref default_height) = self.default_height {
247 properties.push(("default-height", default_height));
248 }
249 if let Some(ref default_width) = self.default_width {
250 properties.push(("default-width", default_width));
251 }
252 if let Some(ref deletable) = self.deletable {
253 properties.push(("deletable", deletable));
254 }
255 if let Some(ref destroy_with_parent) = self.destroy_with_parent {
256 properties.push(("destroy-with-parent", destroy_with_parent));
257 }
258 if let Some(ref focus_on_map) = self.focus_on_map {
259 properties.push(("focus-on-map", focus_on_map));
260 }
261 if let Some(ref focus_visible) = self.focus_visible {
262 properties.push(("focus-visible", focus_visible));
263 }
264 if let Some(ref gravity) = self.gravity {
265 properties.push(("gravity", gravity));
266 }
267 if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized {
268 properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized));
269 }
270 if let Some(ref icon) = self.icon {
271 properties.push(("icon", icon));
272 }
273 if let Some(ref icon_name) = self.icon_name {
274 properties.push(("icon-name", icon_name));
275 }
276 if let Some(ref mnemonics_visible) = self.mnemonics_visible {
277 properties.push(("mnemonics-visible", mnemonics_visible));
278 }
279 if let Some(ref modal) = self.modal {
280 properties.push(("modal", modal));
281 }
282 if let Some(ref resizable) = self.resizable {
283 properties.push(("resizable", resizable));
284 }
285 if let Some(ref role) = self.role {
286 properties.push(("role", role));
287 }
288 if let Some(ref screen) = self.screen {
289 properties.push(("screen", screen));
290 }
291 if let Some(ref skip_pager_hint) = self.skip_pager_hint {
292 properties.push(("skip-pager-hint", skip_pager_hint));
293 }
294 if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint {
295 properties.push(("skip-taskbar-hint", skip_taskbar_hint));
296 }
297 if let Some(ref startup_id) = self.startup_id {
298 properties.push(("startup-id", startup_id));
299 }
300 if let Some(ref title) = self.title {
301 properties.push(("title", title));
302 }
303 if let Some(ref transient_for) = self.transient_for {
304 properties.push(("transient-for", transient_for));
305 }
306 if let Some(ref type_) = self.type_ {
307 properties.push(("type", type_));
308 }
309 if let Some(ref type_hint) = self.type_hint {
310 properties.push(("type-hint", type_hint));
311 }
312 if let Some(ref urgency_hint) = self.urgency_hint {
313 properties.push(("urgency-hint", urgency_hint));
314 }
315 if let Some(ref window_position) = self.window_position {
316 properties.push(("window-position", window_position));
317 }
318 if let Some(ref border_width) = self.border_width {
319 properties.push(("border-width", border_width));
320 }
321 if let Some(ref child) = self.child {
322 properties.push(("child", child));
323 }
324 if let Some(ref resize_mode) = self.resize_mode {
325 properties.push(("resize-mode", resize_mode));
326 }
327 if let Some(ref app_paintable) = self.app_paintable {
328 properties.push(("app-paintable", app_paintable));
329 }
330 if let Some(ref can_default) = self.can_default {
331 properties.push(("can-default", can_default));
332 }
333 if let Some(ref can_focus) = self.can_focus {
334 properties.push(("can-focus", can_focus));
335 }
336 if let Some(ref events) = self.events {
337 properties.push(("events", events));
338 }
339 if let Some(ref expand) = self.expand {
340 properties.push(("expand", expand));
341 }
342 #[cfg(any(feature = "v3_20", feature = "dox"))]
343 {
344 if let Some(ref focus_on_click) = self.focus_on_click {
345 properties.push(("focus-on-click", focus_on_click));
346 }
347 }
348 if let Some(ref halign) = self.halign {
349 properties.push(("halign", halign));
350 }
351 if let Some(ref has_default) = self.has_default {
352 properties.push(("has-default", has_default));
353 }
354 if let Some(ref has_focus) = self.has_focus {
355 properties.push(("has-focus", has_focus));
356 }
357 if let Some(ref has_tooltip) = self.has_tooltip {
358 properties.push(("has-tooltip", has_tooltip));
359 }
360 if let Some(ref height_request) = self.height_request {
361 properties.push(("height-request", height_request));
362 }
363 if let Some(ref hexpand) = self.hexpand {
364 properties.push(("hexpand", hexpand));
365 }
366 if let Some(ref hexpand_set) = self.hexpand_set {
367 properties.push(("hexpand-set", hexpand_set));
368 }
369 if let Some(ref is_focus) = self.is_focus {
370 properties.push(("is-focus", is_focus));
371 }
372 if let Some(ref margin) = self.margin {
373 properties.push(("margin", margin));
374 }
375 if let Some(ref margin_bottom) = self.margin_bottom {
376 properties.push(("margin-bottom", margin_bottom));
377 }
378 if let Some(ref margin_end) = self.margin_end {
379 properties.push(("margin-end", margin_end));
380 }
381 if let Some(ref margin_start) = self.margin_start {
382 properties.push(("margin-start", margin_start));
383 }
384 if let Some(ref margin_top) = self.margin_top {
385 properties.push(("margin-top", margin_top));
386 }
387 if let Some(ref name) = self.name {
388 properties.push(("name", name));
389 }
390 if let Some(ref no_show_all) = self.no_show_all {
391 properties.push(("no-show-all", no_show_all));
392 }
393 if let Some(ref opacity) = self.opacity {
394 properties.push(("opacity", opacity));
395 }
396 if let Some(ref parent) = self.parent {
397 properties.push(("parent", parent));
398 }
399 if let Some(ref receives_default) = self.receives_default {
400 properties.push(("receives-default", receives_default));
401 }
402 if let Some(ref sensitive) = self.sensitive {
403 properties.push(("sensitive", sensitive));
404 }
405 if let Some(ref tooltip_markup) = self.tooltip_markup {
406 properties.push(("tooltip-markup", tooltip_markup));
407 }
408 if let Some(ref tooltip_text) = self.tooltip_text {
409 properties.push(("tooltip-text", tooltip_text));
410 }
411 if let Some(ref valign) = self.valign {
412 properties.push(("valign", valign));
413 }
414 if let Some(ref vexpand) = self.vexpand {
415 properties.push(("vexpand", vexpand));
416 }
417 if let Some(ref vexpand_set) = self.vexpand_set {
418 properties.push(("vexpand-set", vexpand_set));
419 }
420 if let Some(ref visible) = self.visible {
421 properties.push(("visible", visible));
422 }
423 if let Some(ref width_request) = self.width_request {
424 properties.push(("width-request", width_request));
425 }
426 glib::Object::new(AppChooserDialog::static_type(), &properties)
427 .expect("object new")
428 .downcast()
429 .expect("downcast")
430 }
431
432 pub fn gfile(mut self, gfile: &gio::File) -> Self {
433 self.gfile = Some(gfile.clone());
434 self
435 }
436
437 pub fn heading(mut self, heading: &str) -> Self {
438 self.heading = Some(heading.to_string());
439 self
440 }
441
442 pub fn use_header_bar(mut self, use_header_bar: i32) -> Self {
443 self.use_header_bar = Some(use_header_bar);
444 self
445 }
446
447 pub fn accept_focus(mut self, accept_focus: bool) -> Self {
448 self.accept_focus = Some(accept_focus);
449 self
450 }
451
452 pub fn application(mut self, application: &Application) -> Self {
453 self.application = Some(application.clone());
454 self
455 }
456
457 pub fn attached_to(mut self, attached_to: &Widget) -> Self {
458 self.attached_to = Some(attached_to.clone());
459 self
460 }
461
462 pub fn decorated(mut self, decorated: bool) -> Self {
463 self.decorated = Some(decorated);
464 self
465 }
466
467 pub fn default_height(mut self, default_height: i32) -> Self {
468 self.default_height = Some(default_height);
469 self
470 }
471
472 pub fn default_width(mut self, default_width: i32) -> Self {
473 self.default_width = Some(default_width);
474 self
475 }
476
477 pub fn deletable(mut self, deletable: bool) -> Self {
478 self.deletable = Some(deletable);
479 self
480 }
481
482 pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self {
483 self.destroy_with_parent = Some(destroy_with_parent);
484 self
485 }
486
487 pub fn focus_on_map(mut self, focus_on_map: bool) -> Self {
488 self.focus_on_map = Some(focus_on_map);
489 self
490 }
491
492 pub fn focus_visible(mut self, focus_visible: bool) -> Self {
493 self.focus_visible = Some(focus_visible);
494 self
495 }
496
497 pub fn gravity(mut self, gravity: gdk::Gravity) -> Self {
498 self.gravity = Some(gravity);
499 self
500 }
501
502 pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self {
503 self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized);
504 self
505 }
506
507 pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self {
508 self.icon = Some(icon.clone());
509 self
510 }
511
512 pub fn icon_name(mut self, icon_name: &str) -> Self {
513 self.icon_name = Some(icon_name.to_string());
514 self
515 }
516
517 pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self {
518 self.mnemonics_visible = Some(mnemonics_visible);
519 self
520 }
521
522 pub fn modal(mut self, modal: bool) -> Self {
523 self.modal = Some(modal);
524 self
525 }
526
527 pub fn resizable(mut self, resizable: bool) -> Self {
528 self.resizable = Some(resizable);
529 self
530 }
531
532 pub fn role(mut self, role: &str) -> Self {
533 self.role = Some(role.to_string());
534 self
535 }
536
537 pub fn screen(mut self, screen: &gdk::Screen) -> Self {
538 self.screen = Some(screen.clone());
539 self
540 }
541
542 pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self {
543 self.skip_pager_hint = Some(skip_pager_hint);
544 self
545 }
546
547 pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self {
548 self.skip_taskbar_hint = Some(skip_taskbar_hint);
549 self
550 }
551
552 pub fn startup_id(mut self, startup_id: &str) -> Self {
553 self.startup_id = Some(startup_id.to_string());
554 self
555 }
556
557 pub fn title(mut self, title: &str) -> Self {
558 self.title = Some(title.to_string());
559 self
560 }
561
562 pub fn transient_for(mut self, transient_for: &Window) -> Self {
563 self.transient_for = Some(transient_for.clone());
564 self
565 }
566
567 pub fn type_(mut self, type_: WindowType) -> Self {
568 self.type_ = Some(type_);
569 self
570 }
571
572 pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self {
573 self.type_hint = Some(type_hint);
574 self
575 }
576
577 pub fn urgency_hint(mut self, urgency_hint: bool) -> Self {
578 self.urgency_hint = Some(urgency_hint);
579 self
580 }
581
582 pub fn window_position(mut self, window_position: WindowPosition) -> Self {
583 self.window_position = Some(window_position);
584 self
585 }
586
587 pub fn border_width(mut self, border_width: u32) -> Self {
588 self.border_width = Some(border_width);
589 self
590 }
591
592 pub fn child(mut self, child: &Widget) -> Self {
593 self.child = Some(child.clone());
594 self
595 }
596
597 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
598 self.resize_mode = Some(resize_mode);
599 self
600 }
601
602 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
603 self.app_paintable = Some(app_paintable);
604 self
605 }
606
607 pub fn can_default(mut self, can_default: bool) -> Self {
608 self.can_default = Some(can_default);
609 self
610 }
611
612 pub fn can_focus(mut self, can_focus: bool) -> Self {
613 self.can_focus = Some(can_focus);
614 self
615 }
616
617 pub fn events(mut self, events: gdk::EventMask) -> Self {
618 self.events = Some(events);
619 self
620 }
621
622 pub fn expand(mut self, expand: bool) -> Self {
623 self.expand = Some(expand);
624 self
625 }
626
627 #[cfg(any(feature = "v3_20", feature = "dox"))]
628 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
629 self.focus_on_click = Some(focus_on_click);
630 self
631 }
632
633 pub fn halign(mut self, halign: Align) -> Self {
634 self.halign = Some(halign);
635 self
636 }
637
638 pub fn has_default(mut self, has_default: bool) -> Self {
639 self.has_default = Some(has_default);
640 self
641 }
642
643 pub fn has_focus(mut self, has_focus: bool) -> Self {
644 self.has_focus = Some(has_focus);
645 self
646 }
647
648 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
649 self.has_tooltip = Some(has_tooltip);
650 self
651 }
652
653 pub fn height_request(mut self, height_request: i32) -> Self {
654 self.height_request = Some(height_request);
655 self
656 }
657
658 pub fn hexpand(mut self, hexpand: bool) -> Self {
659 self.hexpand = Some(hexpand);
660 self
661 }
662
663 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
664 self.hexpand_set = Some(hexpand_set);
665 self
666 }
667
668 pub fn is_focus(mut self, is_focus: bool) -> Self {
669 self.is_focus = Some(is_focus);
670 self
671 }
672
673 pub fn margin(mut self, margin: i32) -> Self {
674 self.margin = Some(margin);
675 self
676 }
677
678 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
679 self.margin_bottom = Some(margin_bottom);
680 self
681 }
682
683 pub fn margin_end(mut self, margin_end: i32) -> Self {
684 self.margin_end = Some(margin_end);
685 self
686 }
687
688 pub fn margin_start(mut self, margin_start: i32) -> Self {
689 self.margin_start = Some(margin_start);
690 self
691 }
692
693 pub fn margin_top(mut self, margin_top: i32) -> Self {
694 self.margin_top = Some(margin_top);
695 self
696 }
697
698 pub fn name(mut self, name: &str) -> Self {
699 self.name = Some(name.to_string());
700 self
701 }
702
703 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
704 self.no_show_all = Some(no_show_all);
705 self
706 }
707
708 pub fn opacity(mut self, opacity: f64) -> Self {
709 self.opacity = Some(opacity);
710 self
711 }
712
713 pub fn parent(mut self, parent: &Container) -> Self {
714 self.parent = Some(parent.clone());
715 self
716 }
717
718 pub fn receives_default(mut self, receives_default: bool) -> Self {
719 self.receives_default = Some(receives_default);
720 self
721 }
722
723 pub fn sensitive(mut self, sensitive: bool) -> Self {
724 self.sensitive = Some(sensitive);
725 self
726 }
727
728 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
729 self.tooltip_markup = Some(tooltip_markup.to_string());
730 self
731 }
732
733 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
734 self.tooltip_text = Some(tooltip_text.to_string());
735 self
736 }
737
738 pub fn valign(mut self, valign: Align) -> Self {
739 self.valign = Some(valign);
740 self
741 }
742
743 pub fn vexpand(mut self, vexpand: bool) -> Self {
744 self.vexpand = Some(vexpand);
745 self
746 }
747
748 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
749 self.vexpand_set = Some(vexpand_set);
750 self
751 }
752
753 pub fn visible(mut self, visible: bool) -> Self {
754 self.visible = Some(visible);
755 self
756 }
757
758 pub fn width_request(mut self, width_request: i32) -> Self {
759 self.width_request = Some(width_request);
760 self
761 }
762}
763
764pub const NONE_APP_CHOOSER_DIALOG: Option<&AppChooserDialog> = None;
765
766pub trait AppChooserDialogExt: 'static {
767 fn get_heading(&self) -> Option<GString>;
768
769 fn get_widget(&self) -> Widget;
770
771 fn set_heading(&self, heading: &str);
772
773 fn get_property_gfile(&self) -> Option<gio::File>;
774
775 fn connect_property_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
776}
777
778impl<O: IsA<AppChooserDialog>> AppChooserDialogExt for O {
779 fn get_heading(&self) -> Option<GString> {
780 unsafe {
781 from_glib_none(gtk_sys::gtk_app_chooser_dialog_get_heading(
782 self.as_ref().to_glib_none().0,
783 ))
784 }
785 }
786
787 fn get_widget(&self) -> Widget {
788 unsafe {
789 from_glib_none(gtk_sys::gtk_app_chooser_dialog_get_widget(
790 self.as_ref().to_glib_none().0,
791 ))
792 }
793 }
794
795 fn set_heading(&self, heading: &str) {
796 unsafe {
797 gtk_sys::gtk_app_chooser_dialog_set_heading(
798 self.as_ref().to_glib_none().0,
799 heading.to_glib_none().0,
800 );
801 }
802 }
803
804 fn get_property_gfile(&self) -> Option<gio::File> {
805 unsafe {
806 let mut value = Value::from_type(<gio::File as StaticType>::static_type());
807 gobject_sys::g_object_get_property(
808 self.to_glib_none().0 as *mut gobject_sys::GObject,
809 b"gfile\0".as_ptr() as *const _,
810 value.to_glib_none_mut().0,
811 );
812 value.get()
813 }
814 }
815
816 fn connect_property_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
817 unsafe extern "C" fn notify_heading_trampoline<P, F: Fn(&P) + 'static>(
818 this: *mut gtk_sys::GtkAppChooserDialog,
819 _param_spec: glib_sys::gpointer,
820 f: glib_sys::gpointer,
821 ) where
822 P: IsA<AppChooserDialog>,
823 {
824 let f: &F = &*(f as *const F);
825 f(&AppChooserDialog::from_glib_borrow(this).unsafe_cast())
826 }
827 unsafe {
828 let f: Box_<F> = Box_::new(f);
829 connect_raw(
830 self.as_ptr() as *mut _,
831 b"notify::heading\0".as_ptr() as *const _,
832 Some(transmute(notify_heading_trampoline::<Self, F> as usize)),
833 Box_::into_raw(f),
834 )
835 }
836 }
837}
838
839impl fmt::Display for AppChooserDialog {
840 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
841 write!(f, "AppChooserDialog")
842 }
843}