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