1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use gdk;
6 use glib;
7 use glib::object::Cast;
8 use glib::object::IsA;
9 use glib::signal::connect_raw;
10 use glib::signal::SignalHandlerId;
11 use glib::translate::*;
12 use glib::StaticType;
13 use glib::ToValue;
14 use glib::Value;
15 use glib_sys;
16 use gobject_sys;
17 use gtk_sys;
18 use pango;
19 use std::boxed::Box as Box_;
20 use std::fmt;
21 use std::mem;
22 use std::mem::transmute;
23 use Align;
24 use Buildable;
25 use Container;
26 use Justification;
27 use Label;
28 use Misc;
29 use Widget;
30 
31 glib_wrapper! {
32     pub struct AccelLabel(Object<gtk_sys::GtkAccelLabel, gtk_sys::GtkAccelLabelClass, AccelLabelClass>) @extends Label, Misc, Widget, @implements Buildable;
33 
34     match fn {
35         get_type => || gtk_sys::gtk_accel_label_get_type(),
36     }
37 }
38 
39 impl AccelLabel {
new(string: &str) -> AccelLabel40     pub fn new(string: &str) -> AccelLabel {
41         assert_initialized_main_thread!();
42         unsafe {
43             Widget::from_glib_none(gtk_sys::gtk_accel_label_new(string.to_glib_none().0))
44                 .unsafe_cast()
45         }
46     }
47 }
48 
49 #[derive(Clone, Default)]
50 pub struct AccelLabelBuilder {
51     accel_closure: Option<glib::Closure>,
52     accel_widget: Option<Widget>,
53     angle: Option<f64>,
54     attributes: Option<pango::AttrList>,
55     ellipsize: Option<pango::EllipsizeMode>,
56     justify: Option<Justification>,
57     label: Option<String>,
58     lines: Option<i32>,
59     max_width_chars: Option<i32>,
60     mnemonic_widget: Option<Widget>,
61     pattern: Option<String>,
62     selectable: Option<bool>,
63     single_line_mode: Option<bool>,
64     track_visited_links: Option<bool>,
65     use_markup: Option<bool>,
66     use_underline: Option<bool>,
67     width_chars: Option<i32>,
68     wrap: Option<bool>,
69     wrap_mode: Option<pango::WrapMode>,
70     #[cfg(any(feature = "v3_16", feature = "dox"))]
71     xalign: Option<f32>,
72     #[cfg(any(feature = "v3_16", feature = "dox"))]
73     yalign: Option<f32>,
74     app_paintable: Option<bool>,
75     can_default: Option<bool>,
76     can_focus: Option<bool>,
77     events: Option<gdk::EventMask>,
78     expand: Option<bool>,
79     #[cfg(any(feature = "v3_20", feature = "dox"))]
80     focus_on_click: Option<bool>,
81     halign: Option<Align>,
82     has_default: Option<bool>,
83     has_focus: Option<bool>,
84     has_tooltip: Option<bool>,
85     height_request: Option<i32>,
86     hexpand: Option<bool>,
87     hexpand_set: Option<bool>,
88     is_focus: Option<bool>,
89     margin: Option<i32>,
90     margin_bottom: Option<i32>,
91     margin_end: Option<i32>,
92     margin_start: Option<i32>,
93     margin_top: Option<i32>,
94     name: Option<String>,
95     no_show_all: Option<bool>,
96     opacity: Option<f64>,
97     parent: Option<Container>,
98     receives_default: Option<bool>,
99     sensitive: Option<bool>,
100     tooltip_markup: Option<String>,
101     tooltip_text: Option<String>,
102     valign: Option<Align>,
103     vexpand: Option<bool>,
104     vexpand_set: Option<bool>,
105     visible: Option<bool>,
106     width_request: Option<i32>,
107 }
108 
109 impl AccelLabelBuilder {
new() -> Self110     pub fn new() -> Self {
111         Self::default()
112     }
113 
build(self) -> AccelLabel114     pub fn build(self) -> AccelLabel {
115         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
116         if let Some(ref accel_closure) = self.accel_closure {
117             properties.push(("accel-closure", accel_closure));
118         }
119         if let Some(ref accel_widget) = self.accel_widget {
120             properties.push(("accel-widget", accel_widget));
121         }
122         if let Some(ref angle) = self.angle {
123             properties.push(("angle", angle));
124         }
125         if let Some(ref attributes) = self.attributes {
126             properties.push(("attributes", attributes));
127         }
128         if let Some(ref ellipsize) = self.ellipsize {
129             properties.push(("ellipsize", ellipsize));
130         }
131         if let Some(ref justify) = self.justify {
132             properties.push(("justify", justify));
133         }
134         if let Some(ref label) = self.label {
135             properties.push(("label", label));
136         }
137         if let Some(ref lines) = self.lines {
138             properties.push(("lines", lines));
139         }
140         if let Some(ref max_width_chars) = self.max_width_chars {
141             properties.push(("max-width-chars", max_width_chars));
142         }
143         if let Some(ref mnemonic_widget) = self.mnemonic_widget {
144             properties.push(("mnemonic-widget", mnemonic_widget));
145         }
146         if let Some(ref pattern) = self.pattern {
147             properties.push(("pattern", pattern));
148         }
149         if let Some(ref selectable) = self.selectable {
150             properties.push(("selectable", selectable));
151         }
152         if let Some(ref single_line_mode) = self.single_line_mode {
153             properties.push(("single-line-mode", single_line_mode));
154         }
155         if let Some(ref track_visited_links) = self.track_visited_links {
156             properties.push(("track-visited-links", track_visited_links));
157         }
158         if let Some(ref use_markup) = self.use_markup {
159             properties.push(("use-markup", use_markup));
160         }
161         if let Some(ref use_underline) = self.use_underline {
162             properties.push(("use-underline", use_underline));
163         }
164         if let Some(ref width_chars) = self.width_chars {
165             properties.push(("width-chars", width_chars));
166         }
167         if let Some(ref wrap) = self.wrap {
168             properties.push(("wrap", wrap));
169         }
170         if let Some(ref wrap_mode) = self.wrap_mode {
171             properties.push(("wrap-mode", wrap_mode));
172         }
173         #[cfg(any(feature = "v3_16", feature = "dox"))]
174         {
175             if let Some(ref xalign) = self.xalign {
176                 properties.push(("xalign", xalign));
177             }
178         }
179         #[cfg(any(feature = "v3_16", feature = "dox"))]
180         {
181             if let Some(ref yalign) = self.yalign {
182                 properties.push(("yalign", yalign));
183             }
184         }
185         if let Some(ref app_paintable) = self.app_paintable {
186             properties.push(("app-paintable", app_paintable));
187         }
188         if let Some(ref can_default) = self.can_default {
189             properties.push(("can-default", can_default));
190         }
191         if let Some(ref can_focus) = self.can_focus {
192             properties.push(("can-focus", can_focus));
193         }
194         if let Some(ref events) = self.events {
195             properties.push(("events", events));
196         }
197         if let Some(ref expand) = self.expand {
198             properties.push(("expand", expand));
199         }
200         #[cfg(any(feature = "v3_20", feature = "dox"))]
201         {
202             if let Some(ref focus_on_click) = self.focus_on_click {
203                 properties.push(("focus-on-click", focus_on_click));
204             }
205         }
206         if let Some(ref halign) = self.halign {
207             properties.push(("halign", halign));
208         }
209         if let Some(ref has_default) = self.has_default {
210             properties.push(("has-default", has_default));
211         }
212         if let Some(ref has_focus) = self.has_focus {
213             properties.push(("has-focus", has_focus));
214         }
215         if let Some(ref has_tooltip) = self.has_tooltip {
216             properties.push(("has-tooltip", has_tooltip));
217         }
218         if let Some(ref height_request) = self.height_request {
219             properties.push(("height-request", height_request));
220         }
221         if let Some(ref hexpand) = self.hexpand {
222             properties.push(("hexpand", hexpand));
223         }
224         if let Some(ref hexpand_set) = self.hexpand_set {
225             properties.push(("hexpand-set", hexpand_set));
226         }
227         if let Some(ref is_focus) = self.is_focus {
228             properties.push(("is-focus", is_focus));
229         }
230         if let Some(ref margin) = self.margin {
231             properties.push(("margin", margin));
232         }
233         if let Some(ref margin_bottom) = self.margin_bottom {
234             properties.push(("margin-bottom", margin_bottom));
235         }
236         if let Some(ref margin_end) = self.margin_end {
237             properties.push(("margin-end", margin_end));
238         }
239         if let Some(ref margin_start) = self.margin_start {
240             properties.push(("margin-start", margin_start));
241         }
242         if let Some(ref margin_top) = self.margin_top {
243             properties.push(("margin-top", margin_top));
244         }
245         if let Some(ref name) = self.name {
246             properties.push(("name", name));
247         }
248         if let Some(ref no_show_all) = self.no_show_all {
249             properties.push(("no-show-all", no_show_all));
250         }
251         if let Some(ref opacity) = self.opacity {
252             properties.push(("opacity", opacity));
253         }
254         if let Some(ref parent) = self.parent {
255             properties.push(("parent", parent));
256         }
257         if let Some(ref receives_default) = self.receives_default {
258             properties.push(("receives-default", receives_default));
259         }
260         if let Some(ref sensitive) = self.sensitive {
261             properties.push(("sensitive", sensitive));
262         }
263         if let Some(ref tooltip_markup) = self.tooltip_markup {
264             properties.push(("tooltip-markup", tooltip_markup));
265         }
266         if let Some(ref tooltip_text) = self.tooltip_text {
267             properties.push(("tooltip-text", tooltip_text));
268         }
269         if let Some(ref valign) = self.valign {
270             properties.push(("valign", valign));
271         }
272         if let Some(ref vexpand) = self.vexpand {
273             properties.push(("vexpand", vexpand));
274         }
275         if let Some(ref vexpand_set) = self.vexpand_set {
276             properties.push(("vexpand-set", vexpand_set));
277         }
278         if let Some(ref visible) = self.visible {
279             properties.push(("visible", visible));
280         }
281         if let Some(ref width_request) = self.width_request {
282             properties.push(("width-request", width_request));
283         }
284         glib::Object::new(AccelLabel::static_type(), &properties)
285             .expect("object new")
286             .downcast()
287             .expect("downcast")
288     }
289 
accel_closure(mut self, accel_closure: &glib::Closure) -> Self290     pub fn accel_closure(mut self, accel_closure: &glib::Closure) -> Self {
291         self.accel_closure = Some(accel_closure.clone());
292         self
293     }
294 
accel_widget<P: IsA<Widget>>(mut self, accel_widget: &P) -> Self295     pub fn accel_widget<P: IsA<Widget>>(mut self, accel_widget: &P) -> Self {
296         self.accel_widget = Some(accel_widget.clone().upcast());
297         self
298     }
299 
angle(mut self, angle: f64) -> Self300     pub fn angle(mut self, angle: f64) -> Self {
301         self.angle = Some(angle);
302         self
303     }
304 
attributes(mut self, attributes: &pango::AttrList) -> Self305     pub fn attributes(mut self, attributes: &pango::AttrList) -> Self {
306         self.attributes = Some(attributes.clone());
307         self
308     }
309 
ellipsize(mut self, ellipsize: pango::EllipsizeMode) -> Self310     pub fn ellipsize(mut self, ellipsize: pango::EllipsizeMode) -> Self {
311         self.ellipsize = Some(ellipsize);
312         self
313     }
314 
justify(mut self, justify: Justification) -> Self315     pub fn justify(mut self, justify: Justification) -> Self {
316         self.justify = Some(justify);
317         self
318     }
319 
label(mut self, label: &str) -> Self320     pub fn label(mut self, label: &str) -> Self {
321         self.label = Some(label.to_string());
322         self
323     }
324 
lines(mut self, lines: i32) -> Self325     pub fn lines(mut self, lines: i32) -> Self {
326         self.lines = Some(lines);
327         self
328     }
329 
max_width_chars(mut self, max_width_chars: i32) -> Self330     pub fn max_width_chars(mut self, max_width_chars: i32) -> Self {
331         self.max_width_chars = Some(max_width_chars);
332         self
333     }
334 
mnemonic_widget<P: IsA<Widget>>(mut self, mnemonic_widget: &P) -> Self335     pub fn mnemonic_widget<P: IsA<Widget>>(mut self, mnemonic_widget: &P) -> Self {
336         self.mnemonic_widget = Some(mnemonic_widget.clone().upcast());
337         self
338     }
339 
pattern(mut self, pattern: &str) -> Self340     pub fn pattern(mut self, pattern: &str) -> Self {
341         self.pattern = Some(pattern.to_string());
342         self
343     }
344 
selectable(mut self, selectable: bool) -> Self345     pub fn selectable(mut self, selectable: bool) -> Self {
346         self.selectable = Some(selectable);
347         self
348     }
349 
single_line_mode(mut self, single_line_mode: bool) -> Self350     pub fn single_line_mode(mut self, single_line_mode: bool) -> Self {
351         self.single_line_mode = Some(single_line_mode);
352         self
353     }
354 
track_visited_links(mut self, track_visited_links: bool) -> Self355     pub fn track_visited_links(mut self, track_visited_links: bool) -> Self {
356         self.track_visited_links = Some(track_visited_links);
357         self
358     }
359 
use_markup(mut self, use_markup: bool) -> Self360     pub fn use_markup(mut self, use_markup: bool) -> Self {
361         self.use_markup = Some(use_markup);
362         self
363     }
364 
use_underline(mut self, use_underline: bool) -> Self365     pub fn use_underline(mut self, use_underline: bool) -> Self {
366         self.use_underline = Some(use_underline);
367         self
368     }
369 
width_chars(mut self, width_chars: i32) -> Self370     pub fn width_chars(mut self, width_chars: i32) -> Self {
371         self.width_chars = Some(width_chars);
372         self
373     }
374 
wrap(mut self, wrap: bool) -> Self375     pub fn wrap(mut self, wrap: bool) -> Self {
376         self.wrap = Some(wrap);
377         self
378     }
379 
wrap_mode(mut self, wrap_mode: pango::WrapMode) -> Self380     pub fn wrap_mode(mut self, wrap_mode: pango::WrapMode) -> Self {
381         self.wrap_mode = Some(wrap_mode);
382         self
383     }
384 
385     #[cfg(any(feature = "v3_16", feature = "dox"))]
xalign(mut self, xalign: f32) -> Self386     pub fn xalign(mut self, xalign: f32) -> Self {
387         self.xalign = Some(xalign);
388         self
389     }
390 
391     #[cfg(any(feature = "v3_16", feature = "dox"))]
yalign(mut self, yalign: f32) -> Self392     pub fn yalign(mut self, yalign: f32) -> Self {
393         self.yalign = Some(yalign);
394         self
395     }
396 
app_paintable(mut self, app_paintable: bool) -> Self397     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
398         self.app_paintable = Some(app_paintable);
399         self
400     }
401 
can_default(mut self, can_default: bool) -> Self402     pub fn can_default(mut self, can_default: bool) -> Self {
403         self.can_default = Some(can_default);
404         self
405     }
406 
can_focus(mut self, can_focus: bool) -> Self407     pub fn can_focus(mut self, can_focus: bool) -> Self {
408         self.can_focus = Some(can_focus);
409         self
410     }
411 
events(mut self, events: gdk::EventMask) -> Self412     pub fn events(mut self, events: gdk::EventMask) -> Self {
413         self.events = Some(events);
414         self
415     }
416 
expand(mut self, expand: bool) -> Self417     pub fn expand(mut self, expand: bool) -> Self {
418         self.expand = Some(expand);
419         self
420     }
421 
422     #[cfg(any(feature = "v3_20", feature = "dox"))]
focus_on_click(mut self, focus_on_click: bool) -> Self423     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
424         self.focus_on_click = Some(focus_on_click);
425         self
426     }
427 
halign(mut self, halign: Align) -> Self428     pub fn halign(mut self, halign: Align) -> Self {
429         self.halign = Some(halign);
430         self
431     }
432 
has_default(mut self, has_default: bool) -> Self433     pub fn has_default(mut self, has_default: bool) -> Self {
434         self.has_default = Some(has_default);
435         self
436     }
437 
has_focus(mut self, has_focus: bool) -> Self438     pub fn has_focus(mut self, has_focus: bool) -> Self {
439         self.has_focus = Some(has_focus);
440         self
441     }
442 
has_tooltip(mut self, has_tooltip: bool) -> Self443     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
444         self.has_tooltip = Some(has_tooltip);
445         self
446     }
447 
height_request(mut self, height_request: i32) -> Self448     pub fn height_request(mut self, height_request: i32) -> Self {
449         self.height_request = Some(height_request);
450         self
451     }
452 
hexpand(mut self, hexpand: bool) -> Self453     pub fn hexpand(mut self, hexpand: bool) -> Self {
454         self.hexpand = Some(hexpand);
455         self
456     }
457 
hexpand_set(mut self, hexpand_set: bool) -> Self458     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
459         self.hexpand_set = Some(hexpand_set);
460         self
461     }
462 
is_focus(mut self, is_focus: bool) -> Self463     pub fn is_focus(mut self, is_focus: bool) -> Self {
464         self.is_focus = Some(is_focus);
465         self
466     }
467 
margin(mut self, margin: i32) -> Self468     pub fn margin(mut self, margin: i32) -> Self {
469         self.margin = Some(margin);
470         self
471     }
472 
margin_bottom(mut self, margin_bottom: i32) -> Self473     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
474         self.margin_bottom = Some(margin_bottom);
475         self
476     }
477 
margin_end(mut self, margin_end: i32) -> Self478     pub fn margin_end(mut self, margin_end: i32) -> Self {
479         self.margin_end = Some(margin_end);
480         self
481     }
482 
margin_start(mut self, margin_start: i32) -> Self483     pub fn margin_start(mut self, margin_start: i32) -> Self {
484         self.margin_start = Some(margin_start);
485         self
486     }
487 
margin_top(mut self, margin_top: i32) -> Self488     pub fn margin_top(mut self, margin_top: i32) -> Self {
489         self.margin_top = Some(margin_top);
490         self
491     }
492 
name(mut self, name: &str) -> Self493     pub fn name(mut self, name: &str) -> Self {
494         self.name = Some(name.to_string());
495         self
496     }
497 
no_show_all(mut self, no_show_all: bool) -> Self498     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
499         self.no_show_all = Some(no_show_all);
500         self
501     }
502 
opacity(mut self, opacity: f64) -> Self503     pub fn opacity(mut self, opacity: f64) -> Self {
504         self.opacity = Some(opacity);
505         self
506     }
507 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self508     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
509         self.parent = Some(parent.clone().upcast());
510         self
511     }
512 
receives_default(mut self, receives_default: bool) -> Self513     pub fn receives_default(mut self, receives_default: bool) -> Self {
514         self.receives_default = Some(receives_default);
515         self
516     }
517 
sensitive(mut self, sensitive: bool) -> Self518     pub fn sensitive(mut self, sensitive: bool) -> Self {
519         self.sensitive = Some(sensitive);
520         self
521     }
522 
tooltip_markup(mut self, tooltip_markup: &str) -> Self523     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
524         self.tooltip_markup = Some(tooltip_markup.to_string());
525         self
526     }
527 
tooltip_text(mut self, tooltip_text: &str) -> Self528     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
529         self.tooltip_text = Some(tooltip_text.to_string());
530         self
531     }
532 
valign(mut self, valign: Align) -> Self533     pub fn valign(mut self, valign: Align) -> Self {
534         self.valign = Some(valign);
535         self
536     }
537 
vexpand(mut self, vexpand: bool) -> Self538     pub fn vexpand(mut self, vexpand: bool) -> Self {
539         self.vexpand = Some(vexpand);
540         self
541     }
542 
vexpand_set(mut self, vexpand_set: bool) -> Self543     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
544         self.vexpand_set = Some(vexpand_set);
545         self
546     }
547 
visible(mut self, visible: bool) -> Self548     pub fn visible(mut self, visible: bool) -> Self {
549         self.visible = Some(visible);
550         self
551     }
552 
width_request(mut self, width_request: i32) -> Self553     pub fn width_request(mut self, width_request: i32) -> Self {
554         self.width_request = Some(width_request);
555         self
556     }
557 }
558 
559 pub const NONE_ACCEL_LABEL: Option<&AccelLabel> = None;
560 
561 pub trait AccelLabelExt: 'static {
get_accel(&self) -> (u32, gdk::ModifierType)562     fn get_accel(&self) -> (u32, gdk::ModifierType);
563 
get_accel_widget(&self) -> Option<Widget>564     fn get_accel_widget(&self) -> Option<Widget>;
565 
get_accel_width(&self) -> u32566     fn get_accel_width(&self) -> u32;
567 
refetch(&self) -> bool568     fn refetch(&self) -> bool;
569 
set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType)570     fn set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType);
571 
set_accel_closure(&self, accel_closure: Option<&glib::Closure>)572     fn set_accel_closure(&self, accel_closure: Option<&glib::Closure>);
573 
set_accel_widget<P: IsA<Widget>>(&self, accel_widget: Option<&P>)574     fn set_accel_widget<P: IsA<Widget>>(&self, accel_widget: Option<&P>);
575 
get_property_accel_closure(&self) -> Option<glib::Closure>576     fn get_property_accel_closure(&self) -> Option<glib::Closure>;
577 
connect_property_accel_closure_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId578     fn connect_property_accel_closure_notify<F: Fn(&Self) + 'static>(
579         &self,
580         f: F,
581     ) -> SignalHandlerId;
582 
connect_property_accel_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId583     fn connect_property_accel_widget_notify<F: Fn(&Self) + 'static>(&self, f: F)
584         -> SignalHandlerId;
585 }
586 
587 impl<O: IsA<AccelLabel>> AccelLabelExt for O {
get_accel(&self) -> (u32, gdk::ModifierType)588     fn get_accel(&self) -> (u32, gdk::ModifierType) {
589         unsafe {
590             let mut accelerator_key = mem::MaybeUninit::uninit();
591             let mut accelerator_mods = mem::MaybeUninit::uninit();
592             gtk_sys::gtk_accel_label_get_accel(
593                 self.as_ref().to_glib_none().0,
594                 accelerator_key.as_mut_ptr(),
595                 accelerator_mods.as_mut_ptr(),
596             );
597             let accelerator_key = accelerator_key.assume_init();
598             let accelerator_mods = accelerator_mods.assume_init();
599             (accelerator_key, from_glib(accelerator_mods))
600         }
601     }
602 
get_accel_widget(&self) -> Option<Widget>603     fn get_accel_widget(&self) -> Option<Widget> {
604         unsafe {
605             from_glib_none(gtk_sys::gtk_accel_label_get_accel_widget(
606                 self.as_ref().to_glib_none().0,
607             ))
608         }
609     }
610 
get_accel_width(&self) -> u32611     fn get_accel_width(&self) -> u32 {
612         unsafe { gtk_sys::gtk_accel_label_get_accel_width(self.as_ref().to_glib_none().0) }
613     }
614 
refetch(&self) -> bool615     fn refetch(&self) -> bool {
616         unsafe {
617             from_glib(gtk_sys::gtk_accel_label_refetch(
618                 self.as_ref().to_glib_none().0,
619             ))
620         }
621     }
622 
set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType)623     fn set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType) {
624         unsafe {
625             gtk_sys::gtk_accel_label_set_accel(
626                 self.as_ref().to_glib_none().0,
627                 accelerator_key,
628                 accelerator_mods.to_glib(),
629             );
630         }
631     }
632 
set_accel_closure(&self, accel_closure: Option<&glib::Closure>)633     fn set_accel_closure(&self, accel_closure: Option<&glib::Closure>) {
634         unsafe {
635             gtk_sys::gtk_accel_label_set_accel_closure(
636                 self.as_ref().to_glib_none().0,
637                 accel_closure.to_glib_none().0,
638             );
639         }
640     }
641 
set_accel_widget<P: IsA<Widget>>(&self, accel_widget: Option<&P>)642     fn set_accel_widget<P: IsA<Widget>>(&self, accel_widget: Option<&P>) {
643         unsafe {
644             gtk_sys::gtk_accel_label_set_accel_widget(
645                 self.as_ref().to_glib_none().0,
646                 accel_widget.map(|p| p.as_ref()).to_glib_none().0,
647             );
648         }
649     }
650 
get_property_accel_closure(&self) -> Option<glib::Closure>651     fn get_property_accel_closure(&self) -> Option<glib::Closure> {
652         unsafe {
653             let mut value = Value::from_type(<glib::Closure as StaticType>::static_type());
654             gobject_sys::g_object_get_property(
655                 self.to_glib_none().0 as *mut gobject_sys::GObject,
656                 b"accel-closure\0".as_ptr() as *const _,
657                 value.to_glib_none_mut().0,
658             );
659             value
660                 .get()
661                 .expect("Return Value for property `accel-closure` getter")
662         }
663     }
664 
connect_property_accel_closure_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId665     fn connect_property_accel_closure_notify<F: Fn(&Self) + 'static>(
666         &self,
667         f: F,
668     ) -> SignalHandlerId {
669         unsafe extern "C" fn notify_accel_closure_trampoline<P, F: Fn(&P) + 'static>(
670             this: *mut gtk_sys::GtkAccelLabel,
671             _param_spec: glib_sys::gpointer,
672             f: glib_sys::gpointer,
673         ) where
674             P: IsA<AccelLabel>,
675         {
676             let f: &F = &*(f as *const F);
677             f(&AccelLabel::from_glib_borrow(this).unsafe_cast())
678         }
679         unsafe {
680             let f: Box_<F> = Box_::new(f);
681             connect_raw(
682                 self.as_ptr() as *mut _,
683                 b"notify::accel-closure\0".as_ptr() as *const _,
684                 Some(transmute(
685                     notify_accel_closure_trampoline::<Self, F> as usize,
686                 )),
687                 Box_::into_raw(f),
688             )
689         }
690     }
691 
connect_property_accel_widget_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId692     fn connect_property_accel_widget_notify<F: Fn(&Self) + 'static>(
693         &self,
694         f: F,
695     ) -> SignalHandlerId {
696         unsafe extern "C" fn notify_accel_widget_trampoline<P, F: Fn(&P) + 'static>(
697             this: *mut gtk_sys::GtkAccelLabel,
698             _param_spec: glib_sys::gpointer,
699             f: glib_sys::gpointer,
700         ) where
701             P: IsA<AccelLabel>,
702         {
703             let f: &F = &*(f as *const F);
704             f(&AccelLabel::from_glib_borrow(this).unsafe_cast())
705         }
706         unsafe {
707             let f: Box_<F> = Box_::new(f);
708             connect_raw(
709                 self.as_ptr() as *mut _,
710                 b"notify::accel-widget\0".as_ptr() as *const _,
711                 Some(transmute(
712                     notify_accel_widget_trampoline::<Self, F> as usize,
713                 )),
714                 Box_::into_raw(f),
715             )
716         }
717     }
718 }
719 
720 impl fmt::Display for AccelLabel {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result721     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
722         write!(f, "AccelLabel")
723     }
724 }
725