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