1use gdk;
6use gio;
7use glib::object::Cast;
8use glib::object::IsA;
9use glib::signal::connect_raw;
10use glib::signal::SignalHandlerId;
11use glib::translate::*;
12use glib::GString;
13use glib::StaticType;
14use glib::ToValue;
15use glib_sys;
16use gtk_sys;
17use libc;
18use std::boxed::Box as Box_;
19use std::fmt;
20use std::mem::transmute;
21use Align;
22use AppChooser;
23use Bin;
24use Buildable;
25use CellArea;
26use CellEditable;
27use CellLayout;
28use ComboBox;
29use Container;
30use ResizeMode;
31use SensitivityType;
32use TreeModel;
33use Widget;
34
35glib_wrapper! {
36 pub struct AppChooserButton(Object<gtk_sys::GtkAppChooserButton, gtk_sys::GtkAppChooserButtonClass, AppChooserButtonClass>) @extends ComboBox, Bin, Container, Widget, @implements Buildable, CellEditable, CellLayout, AppChooser;
37
38 match fn {
39 get_type => || gtk_sys::gtk_app_chooser_button_get_type(),
40 }
41}
42
43impl AppChooserButton {
44 pub fn new(content_type: &str) -> AppChooserButton {
45 assert_initialized_main_thread!();
46 unsafe {
47 Widget::from_glib_none(gtk_sys::gtk_app_chooser_button_new(
48 content_type.to_glib_none().0,
49 ))
50 .unsafe_cast()
51 }
52 }
53}
54
55pub struct AppChooserButtonBuilder {
56 heading: Option<String>,
57 show_default_item: Option<bool>,
58 show_dialog_item: Option<bool>,
59 active: Option<i32>,
60 active_id: Option<String>,
61 button_sensitivity: Option<SensitivityType>,
62 cell_area: Option<CellArea>,
63 column_span_column: Option<i32>,
64 entry_text_column: Option<i32>,
65 has_entry: Option<bool>,
66 has_frame: Option<bool>,
67 id_column: Option<i32>,
68 model: Option<TreeModel>,
69 popup_fixed_width: Option<bool>,
70 row_span_column: Option<i32>,
71 wrap_width: 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>,
103 tooltip_text: Option<String>,
104 valign: Option<Align>,
105 vexpand: Option<bool>,
106 vexpand_set: Option<bool>,
107 visible: Option<bool>,
108 width_request: Option<i32>,
109}
110
111impl AppChooserButtonBuilder {
112 pub fn new() -> Self {
113 Self {
114 heading: None,
115 show_default_item: None,
116 show_dialog_item: None,
117 active: None,
118 active_id: None,
119 button_sensitivity: None,
120 cell_area: None,
121 column_span_column: None,
122 entry_text_column: None,
123 has_entry: None,
124 has_frame: None,
125 id_column: None,
126 model: None,
127 popup_fixed_width: None,
128 row_span_column: None,
129 wrap_width: None,
130 border_width: None,
131 child: None,
132 resize_mode: None,
133 app_paintable: None,
134 can_default: None,
135 can_focus: None,
136 events: None,
137 expand: None,
138 #[cfg(any(feature = "v3_20", feature = "dox"))]
139 focus_on_click: None,
140 halign: None,
141 has_default: None,
142 has_focus: None,
143 has_tooltip: None,
144 height_request: None,
145 hexpand: None,
146 hexpand_set: None,
147 is_focus: None,
148 margin: None,
149 margin_bottom: None,
150 margin_end: None,
151 margin_start: None,
152 margin_top: None,
153 name: None,
154 no_show_all: None,
155 opacity: None,
156 parent: None,
157 receives_default: None,
158 sensitive: None,
159 tooltip_markup: None,
160 tooltip_text: None,
161 valign: None,
162 vexpand: None,
163 vexpand_set: None,
164 visible: None,
165 width_request: None,
166 }
167 }
168
169 pub fn build(self) -> AppChooserButton {
170 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
171 if let Some(ref heading) = self.heading {
172 properties.push(("heading", heading));
173 }
174 if let Some(ref show_default_item) = self.show_default_item {
175 properties.push(("show-default-item", show_default_item));
176 }
177 if let Some(ref show_dialog_item) = self.show_dialog_item {
178 properties.push(("show-dialog-item", show_dialog_item));
179 }
180 if let Some(ref active) = self.active {
181 properties.push(("active", active));
182 }
183 if let Some(ref active_id) = self.active_id {
184 properties.push(("active-id", active_id));
185 }
186 if let Some(ref button_sensitivity) = self.button_sensitivity {
187 properties.push(("button-sensitivity", button_sensitivity));
188 }
189 if let Some(ref cell_area) = self.cell_area {
190 properties.push(("cell-area", cell_area));
191 }
192 if let Some(ref column_span_column) = self.column_span_column {
193 properties.push(("column-span-column", column_span_column));
194 }
195 if let Some(ref entry_text_column) = self.entry_text_column {
196 properties.push(("entry-text-column", entry_text_column));
197 }
198 if let Some(ref has_entry) = self.has_entry {
199 properties.push(("has-entry", has_entry));
200 }
201 if let Some(ref has_frame) = self.has_frame {
202 properties.push(("has-frame", has_frame));
203 }
204 if let Some(ref id_column) = self.id_column {
205 properties.push(("id-column", id_column));
206 }
207 if let Some(ref model) = self.model {
208 properties.push(("model", model));
209 }
210 if let Some(ref popup_fixed_width) = self.popup_fixed_width {
211 properties.push(("popup-fixed-width", popup_fixed_width));
212 }
213 if let Some(ref row_span_column) = self.row_span_column {
214 properties.push(("row-span-column", row_span_column));
215 }
216 if let Some(ref wrap_width) = self.wrap_width {
217 properties.push(("wrap-width", wrap_width));
218 }
219 if let Some(ref border_width) = self.border_width {
220 properties.push(("border-width", border_width));
221 }
222 if let Some(ref child) = self.child {
223 properties.push(("child", child));
224 }
225 if let Some(ref resize_mode) = self.resize_mode {
226 properties.push(("resize-mode", resize_mode));
227 }
228 if let Some(ref app_paintable) = self.app_paintable {
229 properties.push(("app-paintable", app_paintable));
230 }
231 if let Some(ref can_default) = self.can_default {
232 properties.push(("can-default", can_default));
233 }
234 if let Some(ref can_focus) = self.can_focus {
235 properties.push(("can-focus", can_focus));
236 }
237 if let Some(ref events) = self.events {
238 properties.push(("events", events));
239 }
240 if let Some(ref expand) = self.expand {
241 properties.push(("expand", expand));
242 }
243 #[cfg(any(feature = "v3_20", feature = "dox"))]
244 {
245 if let Some(ref focus_on_click) = self.focus_on_click {
246 properties.push(("focus-on-click", focus_on_click));
247 }
248 }
249 if let Some(ref halign) = self.halign {
250 properties.push(("halign", halign));
251 }
252 if let Some(ref has_default) = self.has_default {
253 properties.push(("has-default", has_default));
254 }
255 if let Some(ref has_focus) = self.has_focus {
256 properties.push(("has-focus", has_focus));
257 }
258 if let Some(ref has_tooltip) = self.has_tooltip {
259 properties.push(("has-tooltip", has_tooltip));
260 }
261 if let Some(ref height_request) = self.height_request {
262 properties.push(("height-request", height_request));
263 }
264 if let Some(ref hexpand) = self.hexpand {
265 properties.push(("hexpand", hexpand));
266 }
267 if let Some(ref hexpand_set) = self.hexpand_set {
268 properties.push(("hexpand-set", hexpand_set));
269 }
270 if let Some(ref is_focus) = self.is_focus {
271 properties.push(("is-focus", is_focus));
272 }
273 if let Some(ref margin) = self.margin {
274 properties.push(("margin", margin));
275 }
276 if let Some(ref margin_bottom) = self.margin_bottom {
277 properties.push(("margin-bottom", margin_bottom));
278 }
279 if let Some(ref margin_end) = self.margin_end {
280 properties.push(("margin-end", margin_end));
281 }
282 if let Some(ref margin_start) = self.margin_start {
283 properties.push(("margin-start", margin_start));
284 }
285 if let Some(ref margin_top) = self.margin_top {
286 properties.push(("margin-top", margin_top));
287 }
288 if let Some(ref name) = self.name {
289 properties.push(("name", name));
290 }
291 if let Some(ref no_show_all) = self.no_show_all {
292 properties.push(("no-show-all", no_show_all));
293 }
294 if let Some(ref opacity) = self.opacity {
295 properties.push(("opacity", opacity));
296 }
297 if let Some(ref parent) = self.parent {
298 properties.push(("parent", parent));
299 }
300 if let Some(ref receives_default) = self.receives_default {
301 properties.push(("receives-default", receives_default));
302 }
303 if let Some(ref sensitive) = self.sensitive {
304 properties.push(("sensitive", sensitive));
305 }
306 if let Some(ref tooltip_markup) = self.tooltip_markup {
307 properties.push(("tooltip-markup", tooltip_markup));
308 }
309 if let Some(ref tooltip_text) = self.tooltip_text {
310 properties.push(("tooltip-text", tooltip_text));
311 }
312 if let Some(ref valign) = self.valign {
313 properties.push(("valign", valign));
314 }
315 if let Some(ref vexpand) = self.vexpand {
316 properties.push(("vexpand", vexpand));
317 }
318 if let Some(ref vexpand_set) = self.vexpand_set {
319 properties.push(("vexpand-set", vexpand_set));
320 }
321 if let Some(ref visible) = self.visible {
322 properties.push(("visible", visible));
323 }
324 if let Some(ref width_request) = self.width_request {
325 properties.push(("width-request", width_request));
326 }
327 glib::Object::new(AppChooserButton::static_type(), &properties)
328 .expect("object new")
329 .downcast()
330 .expect("downcast")
331 }
332
333 pub fn heading(mut self, heading: &str) -> Self {
334 self.heading = Some(heading.to_string());
335 self
336 }
337
338 pub fn show_default_item(mut self, show_default_item: bool) -> Self {
339 self.show_default_item = Some(show_default_item);
340 self
341 }
342
343 pub fn show_dialog_item(mut self, show_dialog_item: bool) -> Self {
344 self.show_dialog_item = Some(show_dialog_item);
345 self
346 }
347
348 pub fn active(mut self, active: i32) -> Self {
349 self.active = Some(active);
350 self
351 }
352
353 pub fn active_id(mut self, active_id: &str) -> Self {
354 self.active_id = Some(active_id.to_string());
355 self
356 }
357
358 pub fn button_sensitivity(mut self, button_sensitivity: SensitivityType) -> Self {
359 self.button_sensitivity = Some(button_sensitivity);
360 self
361 }
362
363 pub fn cell_area(mut self, cell_area: &CellArea) -> Self {
364 self.cell_area = Some(cell_area.clone());
365 self
366 }
367
368 pub fn column_span_column(mut self, column_span_column: i32) -> Self {
369 self.column_span_column = Some(column_span_column);
370 self
371 }
372
373 pub fn entry_text_column(mut self, entry_text_column: i32) -> Self {
374 self.entry_text_column = Some(entry_text_column);
375 self
376 }
377
378 pub fn has_entry(mut self, has_entry: bool) -> Self {
379 self.has_entry = Some(has_entry);
380 self
381 }
382
383 pub fn has_frame(mut self, has_frame: bool) -> Self {
384 self.has_frame = Some(has_frame);
385 self
386 }
387
388 pub fn id_column(mut self, id_column: i32) -> Self {
389 self.id_column = Some(id_column);
390 self
391 }
392
393 pub fn model(mut self, model: &TreeModel) -> Self {
394 self.model = Some(model.clone());
395 self
396 }
397
398 pub fn popup_fixed_width(mut self, popup_fixed_width: bool) -> Self {
399 self.popup_fixed_width = Some(popup_fixed_width);
400 self
401 }
402
403 pub fn row_span_column(mut self, row_span_column: i32) -> Self {
404 self.row_span_column = Some(row_span_column);
405 self
406 }
407
408 pub fn wrap_width(mut self, wrap_width: i32) -> Self {
409 self.wrap_width = Some(wrap_width);
410 self
411 }
412
413 pub fn border_width(mut self, border_width: u32) -> Self {
414 self.border_width = Some(border_width);
415 self
416 }
417
418 pub fn child(mut self, child: &Widget) -> Self {
419 self.child = Some(child.clone());
420 self
421 }
422
423 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
424 self.resize_mode = Some(resize_mode);
425 self
426 }
427
428 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
429 self.app_paintable = Some(app_paintable);
430 self
431 }
432
433 pub fn can_default(mut self, can_default: bool) -> Self {
434 self.can_default = Some(can_default);
435 self
436 }
437
438 pub fn can_focus(mut self, can_focus: bool) -> Self {
439 self.can_focus = Some(can_focus);
440 self
441 }
442
443 pub fn events(mut self, events: gdk::EventMask) -> Self {
444 self.events = Some(events);
445 self
446 }
447
448 pub fn expand(mut self, expand: bool) -> Self {
449 self.expand = Some(expand);
450 self
451 }
452
453 #[cfg(any(feature = "v3_20", feature = "dox"))]
454 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
455 self.focus_on_click = Some(focus_on_click);
456 self
457 }
458
459 pub fn halign(mut self, halign: Align) -> Self {
460 self.halign = Some(halign);
461 self
462 }
463
464 pub fn has_default(mut self, has_default: bool) -> Self {
465 self.has_default = Some(has_default);
466 self
467 }
468
469 pub fn has_focus(mut self, has_focus: bool) -> Self {
470 self.has_focus = Some(has_focus);
471 self
472 }
473
474 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
475 self.has_tooltip = Some(has_tooltip);
476 self
477 }
478
479 pub fn height_request(mut self, height_request: i32) -> Self {
480 self.height_request = Some(height_request);
481 self
482 }
483
484 pub fn hexpand(mut self, hexpand: bool) -> Self {
485 self.hexpand = Some(hexpand);
486 self
487 }
488
489 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
490 self.hexpand_set = Some(hexpand_set);
491 self
492 }
493
494 pub fn is_focus(mut self, is_focus: bool) -> Self {
495 self.is_focus = Some(is_focus);
496 self
497 }
498
499 pub fn margin(mut self, margin: i32) -> Self {
500 self.margin = Some(margin);
501 self
502 }
503
504 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
505 self.margin_bottom = Some(margin_bottom);
506 self
507 }
508
509 pub fn margin_end(mut self, margin_end: i32) -> Self {
510 self.margin_end = Some(margin_end);
511 self
512 }
513
514 pub fn margin_start(mut self, margin_start: i32) -> Self {
515 self.margin_start = Some(margin_start);
516 self
517 }
518
519 pub fn margin_top(mut self, margin_top: i32) -> Self {
520 self.margin_top = Some(margin_top);
521 self
522 }
523
524 pub fn name(mut self, name: &str) -> Self {
525 self.name = Some(name.to_string());
526 self
527 }
528
529 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
530 self.no_show_all = Some(no_show_all);
531 self
532 }
533
534 pub fn opacity(mut self, opacity: f64) -> Self {
535 self.opacity = Some(opacity);
536 self
537 }
538
539 pub fn parent(mut self, parent: &Container) -> Self {
540 self.parent = Some(parent.clone());
541 self
542 }
543
544 pub fn receives_default(mut self, receives_default: bool) -> Self {
545 self.receives_default = Some(receives_default);
546 self
547 }
548
549 pub fn sensitive(mut self, sensitive: bool) -> Self {
550 self.sensitive = Some(sensitive);
551 self
552 }
553
554 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
555 self.tooltip_markup = Some(tooltip_markup.to_string());
556 self
557 }
558
559 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
560 self.tooltip_text = Some(tooltip_text.to_string());
561 self
562 }
563
564 pub fn valign(mut self, valign: Align) -> Self {
565 self.valign = Some(valign);
566 self
567 }
568
569 pub fn vexpand(mut self, vexpand: bool) -> Self {
570 self.vexpand = Some(vexpand);
571 self
572 }
573
574 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
575 self.vexpand_set = Some(vexpand_set);
576 self
577 }
578
579 pub fn visible(mut self, visible: bool) -> Self {
580 self.visible = Some(visible);
581 self
582 }
583
584 pub fn width_request(mut self, width_request: i32) -> Self {
585 self.width_request = Some(width_request);
586 self
587 }
588}
589
590pub const NONE_APP_CHOOSER_BUTTON: Option<&AppChooserButton> = None;
591
592pub trait AppChooserButtonExt: 'static {
593 fn append_custom_item<P: IsA<gio::Icon>>(&self, name: &str, label: &str, icon: &P);
594
595 fn append_separator(&self);
596
597 fn get_heading(&self) -> Option<GString>;
598
599 fn get_show_default_item(&self) -> bool;
600
601 fn get_show_dialog_item(&self) -> bool;
602
603 fn set_active_custom_item(&self, name: &str);
604
605 fn set_heading(&self, heading: &str);
606
607 fn set_show_default_item(&self, setting: bool);
608
609 fn set_show_dialog_item(&self, setting: bool);
610
611 fn connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
612
613 fn connect_property_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
614
615 fn connect_property_show_default_item_notify<F: Fn(&Self) + 'static>(
616 &self,
617 f: F,
618 ) -> SignalHandlerId;
619
620 fn connect_property_show_dialog_item_notify<F: Fn(&Self) + 'static>(
621 &self,
622 f: F,
623 ) -> SignalHandlerId;
624}
625
626impl<O: IsA<AppChooserButton>> AppChooserButtonExt for O {
627 fn append_custom_item<P: IsA<gio::Icon>>(&self, name: &str, label: &str, icon: &P) {
628 unsafe {
629 gtk_sys::gtk_app_chooser_button_append_custom_item(
630 self.as_ref().to_glib_none().0,
631 name.to_glib_none().0,
632 label.to_glib_none().0,
633 icon.as_ref().to_glib_none().0,
634 );
635 }
636 }
637
638 fn append_separator(&self) {
639 unsafe {
640 gtk_sys::gtk_app_chooser_button_append_separator(self.as_ref().to_glib_none().0);
641 }
642 }
643
644 fn get_heading(&self) -> Option<GString> {
645 unsafe {
646 from_glib_none(gtk_sys::gtk_app_chooser_button_get_heading(
647 self.as_ref().to_glib_none().0,
648 ))
649 }
650 }
651
652 fn get_show_default_item(&self) -> bool {
653 unsafe {
654 from_glib(gtk_sys::gtk_app_chooser_button_get_show_default_item(
655 self.as_ref().to_glib_none().0,
656 ))
657 }
658 }
659
660 fn get_show_dialog_item(&self) -> bool {
661 unsafe {
662 from_glib(gtk_sys::gtk_app_chooser_button_get_show_dialog_item(
663 self.as_ref().to_glib_none().0,
664 ))
665 }
666 }
667
668 fn set_active_custom_item(&self, name: &str) {
669 unsafe {
670 gtk_sys::gtk_app_chooser_button_set_active_custom_item(
671 self.as_ref().to_glib_none().0,
672 name.to_glib_none().0,
673 );
674 }
675 }
676
677 fn set_heading(&self, heading: &str) {
678 unsafe {
679 gtk_sys::gtk_app_chooser_button_set_heading(
680 self.as_ref().to_glib_none().0,
681 heading.to_glib_none().0,
682 );
683 }
684 }
685
686 fn set_show_default_item(&self, setting: bool) {
687 unsafe {
688 gtk_sys::gtk_app_chooser_button_set_show_default_item(
689 self.as_ref().to_glib_none().0,
690 setting.to_glib(),
691 );
692 }
693 }
694
695 fn set_show_dialog_item(&self, setting: bool) {
696 unsafe {
697 gtk_sys::gtk_app_chooser_button_set_show_dialog_item(
698 self.as_ref().to_glib_none().0,
699 setting.to_glib(),
700 );
701 }
702 }
703
704 fn connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
705 unsafe extern "C" fn custom_item_activated_trampoline<P, F: Fn(&P, &str) + 'static>(
706 this: *mut gtk_sys::GtkAppChooserButton,
707 item_name: *mut libc::c_char,
708 f: glib_sys::gpointer,
709 ) where
710 P: IsA<AppChooserButton>,
711 {
712 let f: &F = &*(f as *const F);
713 f(
714 &AppChooserButton::from_glib_borrow(this).unsafe_cast(),
715 &GString::from_glib_borrow(item_name),
716 )
717 }
718 unsafe {
719 let f: Box_<F> = Box_::new(f);
720 connect_raw(
721 self.as_ptr() as *mut _,
722 b"custom-item-activated\0".as_ptr() as *const _,
723 Some(transmute(
724 custom_item_activated_trampoline::<Self, F> as usize,
725 )),
726 Box_::into_raw(f),
727 )
728 }
729 }
730
731 fn connect_property_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
732 unsafe extern "C" fn notify_heading_trampoline<P, F: Fn(&P) + 'static>(
733 this: *mut gtk_sys::GtkAppChooserButton,
734 _param_spec: glib_sys::gpointer,
735 f: glib_sys::gpointer,
736 ) where
737 P: IsA<AppChooserButton>,
738 {
739 let f: &F = &*(f as *const F);
740 f(&AppChooserButton::from_glib_borrow(this).unsafe_cast())
741 }
742 unsafe {
743 let f: Box_<F> = Box_::new(f);
744 connect_raw(
745 self.as_ptr() as *mut _,
746 b"notify::heading\0".as_ptr() as *const _,
747 Some(transmute(notify_heading_trampoline::<Self, F> as usize)),
748 Box_::into_raw(f),
749 )
750 }
751 }
752
753 fn connect_property_show_default_item_notify<F: Fn(&Self) + 'static>(
754 &self,
755 f: F,
756 ) -> SignalHandlerId {
757 unsafe extern "C" fn notify_show_default_item_trampoline<P, F: Fn(&P) + 'static>(
758 this: *mut gtk_sys::GtkAppChooserButton,
759 _param_spec: glib_sys::gpointer,
760 f: glib_sys::gpointer,
761 ) where
762 P: IsA<AppChooserButton>,
763 {
764 let f: &F = &*(f as *const F);
765 f(&AppChooserButton::from_glib_borrow(this).unsafe_cast())
766 }
767 unsafe {
768 let f: Box_<F> = Box_::new(f);
769 connect_raw(
770 self.as_ptr() as *mut _,
771 b"notify::show-default-item\0".as_ptr() as *const _,
772 Some(transmute(
773 notify_show_default_item_trampoline::<Self, F> as usize,
774 )),
775 Box_::into_raw(f),
776 )
777 }
778 }
779
780 fn connect_property_show_dialog_item_notify<F: Fn(&Self) + 'static>(
781 &self,
782 f: F,
783 ) -> SignalHandlerId {
784 unsafe extern "C" fn notify_show_dialog_item_trampoline<P, F: Fn(&P) + 'static>(
785 this: *mut gtk_sys::GtkAppChooserButton,
786 _param_spec: glib_sys::gpointer,
787 f: glib_sys::gpointer,
788 ) where
789 P: IsA<AppChooserButton>,
790 {
791 let f: &F = &*(f as *const F);
792 f(&AppChooserButton::from_glib_borrow(this).unsafe_cast())
793 }
794 unsafe {
795 let f: Box_<F> = Box_::new(f);
796 connect_raw(
797 self.as_ptr() as *mut _,
798 b"notify::show-dialog-item\0".as_ptr() as *const _,
799 Some(transmute(
800 notify_show_dialog_item_trampoline::<Self, F> as usize,
801 )),
802 Box_::into_raw(f),
803 )
804 }
805 }
806}
807
808impl fmt::Display for AppChooserButton {
809 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
810 write!(f, "AppChooserButton")
811 }
812}