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 crate::Align;
6 use crate::Buildable;
7 use crate::Container;
8 use crate::LevelBarMode;
9 use crate::Orientable;
10 use crate::Orientation;
11 use crate::Widget;
12 use glib::object::Cast;
13 use glib::object::IsA;
14 use glib::signal::connect_raw;
15 use glib::signal::SignalHandlerId;
16 use glib::translate::*;
17 use glib::StaticType;
18 use glib::ToValue;
19 use std::boxed::Box as Box_;
20 use std::fmt;
21 use std::mem;
22 use std::mem::transmute;
23 
24 glib::wrapper! {
25     #[doc(alias = "GtkLevelBar")]
26     pub struct LevelBar(Object<ffi::GtkLevelBar, ffi::GtkLevelBarClass>) @extends Widget, @implements Buildable, Orientable;
27 
28     match fn {
29         type_ => || ffi::gtk_level_bar_get_type(),
30     }
31 }
32 
33 impl LevelBar {
34     #[doc(alias = "gtk_level_bar_new")]
new() -> LevelBar35     pub fn new() -> LevelBar {
36         assert_initialized_main_thread!();
37         unsafe { Widget::from_glib_none(ffi::gtk_level_bar_new()).unsafe_cast() }
38     }
39 
40     #[doc(alias = "gtk_level_bar_new_for_interval")]
41     #[doc(alias = "new_for_interval")]
for_interval(min_value: f64, max_value: f64) -> LevelBar42     pub fn for_interval(min_value: f64, max_value: f64) -> LevelBar {
43         assert_initialized_main_thread!();
44         unsafe {
45             Widget::from_glib_none(ffi::gtk_level_bar_new_for_interval(min_value, max_value))
46                 .unsafe_cast()
47         }
48     }
49 
50     // rustdoc-stripper-ignore-next
51     /// Creates a new builder-pattern struct instance to construct [`LevelBar`] objects.
52     ///
53     /// This method returns an instance of [`LevelBarBuilder`] which can be used to create [`LevelBar`] objects.
builder() -> LevelBarBuilder54     pub fn builder() -> LevelBarBuilder {
55         LevelBarBuilder::default()
56     }
57 }
58 
59 impl Default for LevelBar {
default() -> Self60     fn default() -> Self {
61         Self::new()
62     }
63 }
64 
65 #[derive(Clone, Default)]
66 // rustdoc-stripper-ignore-next
67 /// A [builder-pattern] type to construct [`LevelBar`] objects.
68 ///
69 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
70 pub struct LevelBarBuilder {
71     inverted: Option<bool>,
72     max_value: Option<f64>,
73     min_value: Option<f64>,
74     mode: Option<LevelBarMode>,
75     value: Option<f64>,
76     app_paintable: Option<bool>,
77     can_default: Option<bool>,
78     can_focus: Option<bool>,
79     events: Option<gdk::EventMask>,
80     expand: Option<bool>,
81     #[cfg(any(feature = "v3_20", feature = "dox"))]
82     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
83     focus_on_click: Option<bool>,
84     halign: Option<Align>,
85     has_default: Option<bool>,
86     has_focus: Option<bool>,
87     has_tooltip: Option<bool>,
88     height_request: Option<i32>,
89     hexpand: Option<bool>,
90     hexpand_set: Option<bool>,
91     is_focus: Option<bool>,
92     margin: Option<i32>,
93     margin_bottom: Option<i32>,
94     margin_end: Option<i32>,
95     margin_start: Option<i32>,
96     margin_top: Option<i32>,
97     name: Option<String>,
98     no_show_all: Option<bool>,
99     opacity: Option<f64>,
100     parent: Option<Container>,
101     receives_default: Option<bool>,
102     sensitive: Option<bool>,
103     tooltip_markup: Option<String>,
104     tooltip_text: Option<String>,
105     valign: Option<Align>,
106     vexpand: Option<bool>,
107     vexpand_set: Option<bool>,
108     visible: Option<bool>,
109     width_request: Option<i32>,
110     orientation: Option<Orientation>,
111 }
112 
113 impl LevelBarBuilder {
114     // rustdoc-stripper-ignore-next
115     /// Create a new [`LevelBarBuilder`].
new() -> Self116     pub fn new() -> Self {
117         Self::default()
118     }
119 
120     // rustdoc-stripper-ignore-next
121     /// Build the [`LevelBar`].
build(self) -> LevelBar122     pub fn build(self) -> LevelBar {
123         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
124         if let Some(ref inverted) = self.inverted {
125             properties.push(("inverted", inverted));
126         }
127         if let Some(ref max_value) = self.max_value {
128             properties.push(("max-value", max_value));
129         }
130         if let Some(ref min_value) = self.min_value {
131             properties.push(("min-value", min_value));
132         }
133         if let Some(ref mode) = self.mode {
134             properties.push(("mode", mode));
135         }
136         if let Some(ref value) = self.value {
137             properties.push(("value", value));
138         }
139         if let Some(ref app_paintable) = self.app_paintable {
140             properties.push(("app-paintable", app_paintable));
141         }
142         if let Some(ref can_default) = self.can_default {
143             properties.push(("can-default", can_default));
144         }
145         if let Some(ref can_focus) = self.can_focus {
146             properties.push(("can-focus", can_focus));
147         }
148         if let Some(ref events) = self.events {
149             properties.push(("events", events));
150         }
151         if let Some(ref expand) = self.expand {
152             properties.push(("expand", expand));
153         }
154         #[cfg(any(feature = "v3_20", feature = "dox"))]
155         if let Some(ref focus_on_click) = self.focus_on_click {
156             properties.push(("focus-on-click", focus_on_click));
157         }
158         if let Some(ref halign) = self.halign {
159             properties.push(("halign", halign));
160         }
161         if let Some(ref has_default) = self.has_default {
162             properties.push(("has-default", has_default));
163         }
164         if let Some(ref has_focus) = self.has_focus {
165             properties.push(("has-focus", has_focus));
166         }
167         if let Some(ref has_tooltip) = self.has_tooltip {
168             properties.push(("has-tooltip", has_tooltip));
169         }
170         if let Some(ref height_request) = self.height_request {
171             properties.push(("height-request", height_request));
172         }
173         if let Some(ref hexpand) = self.hexpand {
174             properties.push(("hexpand", hexpand));
175         }
176         if let Some(ref hexpand_set) = self.hexpand_set {
177             properties.push(("hexpand-set", hexpand_set));
178         }
179         if let Some(ref is_focus) = self.is_focus {
180             properties.push(("is-focus", is_focus));
181         }
182         if let Some(ref margin) = self.margin {
183             properties.push(("margin", margin));
184         }
185         if let Some(ref margin_bottom) = self.margin_bottom {
186             properties.push(("margin-bottom", margin_bottom));
187         }
188         if let Some(ref margin_end) = self.margin_end {
189             properties.push(("margin-end", margin_end));
190         }
191         if let Some(ref margin_start) = self.margin_start {
192             properties.push(("margin-start", margin_start));
193         }
194         if let Some(ref margin_top) = self.margin_top {
195             properties.push(("margin-top", margin_top));
196         }
197         if let Some(ref name) = self.name {
198             properties.push(("name", name));
199         }
200         if let Some(ref no_show_all) = self.no_show_all {
201             properties.push(("no-show-all", no_show_all));
202         }
203         if let Some(ref opacity) = self.opacity {
204             properties.push(("opacity", opacity));
205         }
206         if let Some(ref parent) = self.parent {
207             properties.push(("parent", parent));
208         }
209         if let Some(ref receives_default) = self.receives_default {
210             properties.push(("receives-default", receives_default));
211         }
212         if let Some(ref sensitive) = self.sensitive {
213             properties.push(("sensitive", sensitive));
214         }
215         if let Some(ref tooltip_markup) = self.tooltip_markup {
216             properties.push(("tooltip-markup", tooltip_markup));
217         }
218         if let Some(ref tooltip_text) = self.tooltip_text {
219             properties.push(("tooltip-text", tooltip_text));
220         }
221         if let Some(ref valign) = self.valign {
222             properties.push(("valign", valign));
223         }
224         if let Some(ref vexpand) = self.vexpand {
225             properties.push(("vexpand", vexpand));
226         }
227         if let Some(ref vexpand_set) = self.vexpand_set {
228             properties.push(("vexpand-set", vexpand_set));
229         }
230         if let Some(ref visible) = self.visible {
231             properties.push(("visible", visible));
232         }
233         if let Some(ref width_request) = self.width_request {
234             properties.push(("width-request", width_request));
235         }
236         if let Some(ref orientation) = self.orientation {
237             properties.push(("orientation", orientation));
238         }
239         glib::Object::new::<LevelBar>(&properties)
240             .expect("Failed to create an instance of LevelBar")
241     }
242 
inverted(mut self, inverted: bool) -> Self243     pub fn inverted(mut self, inverted: bool) -> Self {
244         self.inverted = Some(inverted);
245         self
246     }
247 
max_value(mut self, max_value: f64) -> Self248     pub fn max_value(mut self, max_value: f64) -> Self {
249         self.max_value = Some(max_value);
250         self
251     }
252 
min_value(mut self, min_value: f64) -> Self253     pub fn min_value(mut self, min_value: f64) -> Self {
254         self.min_value = Some(min_value);
255         self
256     }
257 
mode(mut self, mode: LevelBarMode) -> Self258     pub fn mode(mut self, mode: LevelBarMode) -> Self {
259         self.mode = Some(mode);
260         self
261     }
262 
value(mut self, value: f64) -> Self263     pub fn value(mut self, value: f64) -> Self {
264         self.value = Some(value);
265         self
266     }
267 
app_paintable(mut self, app_paintable: bool) -> Self268     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
269         self.app_paintable = Some(app_paintable);
270         self
271     }
272 
can_default(mut self, can_default: bool) -> Self273     pub fn can_default(mut self, can_default: bool) -> Self {
274         self.can_default = Some(can_default);
275         self
276     }
277 
can_focus(mut self, can_focus: bool) -> Self278     pub fn can_focus(mut self, can_focus: bool) -> Self {
279         self.can_focus = Some(can_focus);
280         self
281     }
282 
events(mut self, events: gdk::EventMask) -> Self283     pub fn events(mut self, events: gdk::EventMask) -> Self {
284         self.events = Some(events);
285         self
286     }
287 
expand(mut self, expand: bool) -> Self288     pub fn expand(mut self, expand: bool) -> Self {
289         self.expand = Some(expand);
290         self
291     }
292 
293     #[cfg(any(feature = "v3_20", feature = "dox"))]
294     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self295     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
296         self.focus_on_click = Some(focus_on_click);
297         self
298     }
299 
halign(mut self, halign: Align) -> Self300     pub fn halign(mut self, halign: Align) -> Self {
301         self.halign = Some(halign);
302         self
303     }
304 
has_default(mut self, has_default: bool) -> Self305     pub fn has_default(mut self, has_default: bool) -> Self {
306         self.has_default = Some(has_default);
307         self
308     }
309 
has_focus(mut self, has_focus: bool) -> Self310     pub fn has_focus(mut self, has_focus: bool) -> Self {
311         self.has_focus = Some(has_focus);
312         self
313     }
314 
has_tooltip(mut self, has_tooltip: bool) -> Self315     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
316         self.has_tooltip = Some(has_tooltip);
317         self
318     }
319 
height_request(mut self, height_request: i32) -> Self320     pub fn height_request(mut self, height_request: i32) -> Self {
321         self.height_request = Some(height_request);
322         self
323     }
324 
hexpand(mut self, hexpand: bool) -> Self325     pub fn hexpand(mut self, hexpand: bool) -> Self {
326         self.hexpand = Some(hexpand);
327         self
328     }
329 
hexpand_set(mut self, hexpand_set: bool) -> Self330     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
331         self.hexpand_set = Some(hexpand_set);
332         self
333     }
334 
is_focus(mut self, is_focus: bool) -> Self335     pub fn is_focus(mut self, is_focus: bool) -> Self {
336         self.is_focus = Some(is_focus);
337         self
338     }
339 
margin(mut self, margin: i32) -> Self340     pub fn margin(mut self, margin: i32) -> Self {
341         self.margin = Some(margin);
342         self
343     }
344 
margin_bottom(mut self, margin_bottom: i32) -> Self345     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
346         self.margin_bottom = Some(margin_bottom);
347         self
348     }
349 
margin_end(mut self, margin_end: i32) -> Self350     pub fn margin_end(mut self, margin_end: i32) -> Self {
351         self.margin_end = Some(margin_end);
352         self
353     }
354 
margin_start(mut self, margin_start: i32) -> Self355     pub fn margin_start(mut self, margin_start: i32) -> Self {
356         self.margin_start = Some(margin_start);
357         self
358     }
359 
margin_top(mut self, margin_top: i32) -> Self360     pub fn margin_top(mut self, margin_top: i32) -> Self {
361         self.margin_top = Some(margin_top);
362         self
363     }
364 
name(mut self, name: &str) -> Self365     pub fn name(mut self, name: &str) -> Self {
366         self.name = Some(name.to_string());
367         self
368     }
369 
no_show_all(mut self, no_show_all: bool) -> Self370     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
371         self.no_show_all = Some(no_show_all);
372         self
373     }
374 
opacity(mut self, opacity: f64) -> Self375     pub fn opacity(mut self, opacity: f64) -> Self {
376         self.opacity = Some(opacity);
377         self
378     }
379 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self380     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
381         self.parent = Some(parent.clone().upcast());
382         self
383     }
384 
receives_default(mut self, receives_default: bool) -> Self385     pub fn receives_default(mut self, receives_default: bool) -> Self {
386         self.receives_default = Some(receives_default);
387         self
388     }
389 
sensitive(mut self, sensitive: bool) -> Self390     pub fn sensitive(mut self, sensitive: bool) -> Self {
391         self.sensitive = Some(sensitive);
392         self
393     }
394 
tooltip_markup(mut self, tooltip_markup: &str) -> Self395     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
396         self.tooltip_markup = Some(tooltip_markup.to_string());
397         self
398     }
399 
tooltip_text(mut self, tooltip_text: &str) -> Self400     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
401         self.tooltip_text = Some(tooltip_text.to_string());
402         self
403     }
404 
valign(mut self, valign: Align) -> Self405     pub fn valign(mut self, valign: Align) -> Self {
406         self.valign = Some(valign);
407         self
408     }
409 
vexpand(mut self, vexpand: bool) -> Self410     pub fn vexpand(mut self, vexpand: bool) -> Self {
411         self.vexpand = Some(vexpand);
412         self
413     }
414 
vexpand_set(mut self, vexpand_set: bool) -> Self415     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
416         self.vexpand_set = Some(vexpand_set);
417         self
418     }
419 
visible(mut self, visible: bool) -> Self420     pub fn visible(mut self, visible: bool) -> Self {
421         self.visible = Some(visible);
422         self
423     }
424 
width_request(mut self, width_request: i32) -> Self425     pub fn width_request(mut self, width_request: i32) -> Self {
426         self.width_request = Some(width_request);
427         self
428     }
429 
orientation(mut self, orientation: Orientation) -> Self430     pub fn orientation(mut self, orientation: Orientation) -> Self {
431         self.orientation = Some(orientation);
432         self
433     }
434 }
435 
436 pub const NONE_LEVEL_BAR: Option<&LevelBar> = None;
437 
438 pub trait LevelBarExt: 'static {
439     #[doc(alias = "gtk_level_bar_add_offset_value")]
add_offset_value(&self, name: &str, value: f64)440     fn add_offset_value(&self, name: &str, value: f64);
441 
442     #[doc(alias = "gtk_level_bar_get_inverted")]
443     #[doc(alias = "get_inverted")]
is_inverted(&self) -> bool444     fn is_inverted(&self) -> bool;
445 
446     #[doc(alias = "gtk_level_bar_get_max_value")]
447     #[doc(alias = "get_max_value")]
max_value(&self) -> f64448     fn max_value(&self) -> f64;
449 
450     #[doc(alias = "gtk_level_bar_get_min_value")]
451     #[doc(alias = "get_min_value")]
min_value(&self) -> f64452     fn min_value(&self) -> f64;
453 
454     #[doc(alias = "gtk_level_bar_get_mode")]
455     #[doc(alias = "get_mode")]
mode(&self) -> LevelBarMode456     fn mode(&self) -> LevelBarMode;
457 
458     #[doc(alias = "gtk_level_bar_get_offset_value")]
459     #[doc(alias = "get_offset_value")]
offset_value(&self, name: Option<&str>) -> Option<f64>460     fn offset_value(&self, name: Option<&str>) -> Option<f64>;
461 
462     #[doc(alias = "gtk_level_bar_get_value")]
463     #[doc(alias = "get_value")]
value(&self) -> f64464     fn value(&self) -> f64;
465 
466     #[doc(alias = "gtk_level_bar_remove_offset_value")]
remove_offset_value(&self, name: Option<&str>)467     fn remove_offset_value(&self, name: Option<&str>);
468 
469     #[doc(alias = "gtk_level_bar_set_inverted")]
set_inverted(&self, inverted: bool)470     fn set_inverted(&self, inverted: bool);
471 
472     #[doc(alias = "gtk_level_bar_set_max_value")]
set_max_value(&self, value: f64)473     fn set_max_value(&self, value: f64);
474 
475     #[doc(alias = "gtk_level_bar_set_min_value")]
set_min_value(&self, value: f64)476     fn set_min_value(&self, value: f64);
477 
478     #[doc(alias = "gtk_level_bar_set_mode")]
set_mode(&self, mode: LevelBarMode)479     fn set_mode(&self, mode: LevelBarMode);
480 
481     #[doc(alias = "gtk_level_bar_set_value")]
set_value(&self, value: f64)482     fn set_value(&self, value: f64);
483 
484     #[doc(alias = "offset-changed")]
connect_offset_changed<F: Fn(&Self, &str) + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId485     fn connect_offset_changed<F: Fn(&Self, &str) + 'static>(
486         &self,
487         detail: Option<&str>,
488         f: F,
489     ) -> SignalHandlerId;
490 
491     #[doc(alias = "inverted")]
connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId492     fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
493 
494     #[doc(alias = "max-value")]
connect_max_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId495     fn connect_max_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
496 
497     #[doc(alias = "min-value")]
connect_min_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId498     fn connect_min_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
499 
500     #[doc(alias = "mode")]
connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId501     fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
502 
503     #[doc(alias = "value")]
connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId504     fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
505 }
506 
507 impl<O: IsA<LevelBar>> LevelBarExt for O {
add_offset_value(&self, name: &str, value: f64)508     fn add_offset_value(&self, name: &str, value: f64) {
509         unsafe {
510             ffi::gtk_level_bar_add_offset_value(
511                 self.as_ref().to_glib_none().0,
512                 name.to_glib_none().0,
513                 value,
514             );
515         }
516     }
517 
is_inverted(&self) -> bool518     fn is_inverted(&self) -> bool {
519         unsafe {
520             from_glib(ffi::gtk_level_bar_get_inverted(
521                 self.as_ref().to_glib_none().0,
522             ))
523         }
524     }
525 
max_value(&self) -> f64526     fn max_value(&self) -> f64 {
527         unsafe { ffi::gtk_level_bar_get_max_value(self.as_ref().to_glib_none().0) }
528     }
529 
min_value(&self) -> f64530     fn min_value(&self) -> f64 {
531         unsafe { ffi::gtk_level_bar_get_min_value(self.as_ref().to_glib_none().0) }
532     }
533 
mode(&self) -> LevelBarMode534     fn mode(&self) -> LevelBarMode {
535         unsafe { from_glib(ffi::gtk_level_bar_get_mode(self.as_ref().to_glib_none().0)) }
536     }
537 
offset_value(&self, name: Option<&str>) -> Option<f64>538     fn offset_value(&self, name: Option<&str>) -> Option<f64> {
539         unsafe {
540             let mut value = mem::MaybeUninit::uninit();
541             let ret = from_glib(ffi::gtk_level_bar_get_offset_value(
542                 self.as_ref().to_glib_none().0,
543                 name.to_glib_none().0,
544                 value.as_mut_ptr(),
545             ));
546             let value = value.assume_init();
547             if ret {
548                 Some(value)
549             } else {
550                 None
551             }
552         }
553     }
554 
value(&self) -> f64555     fn value(&self) -> f64 {
556         unsafe { ffi::gtk_level_bar_get_value(self.as_ref().to_glib_none().0) }
557     }
558 
remove_offset_value(&self, name: Option<&str>)559     fn remove_offset_value(&self, name: Option<&str>) {
560         unsafe {
561             ffi::gtk_level_bar_remove_offset_value(
562                 self.as_ref().to_glib_none().0,
563                 name.to_glib_none().0,
564             );
565         }
566     }
567 
set_inverted(&self, inverted: bool)568     fn set_inverted(&self, inverted: bool) {
569         unsafe {
570             ffi::gtk_level_bar_set_inverted(self.as_ref().to_glib_none().0, inverted.into_glib());
571         }
572     }
573 
set_max_value(&self, value: f64)574     fn set_max_value(&self, value: f64) {
575         unsafe {
576             ffi::gtk_level_bar_set_max_value(self.as_ref().to_glib_none().0, value);
577         }
578     }
579 
set_min_value(&self, value: f64)580     fn set_min_value(&self, value: f64) {
581         unsafe {
582             ffi::gtk_level_bar_set_min_value(self.as_ref().to_glib_none().0, value);
583         }
584     }
585 
set_mode(&self, mode: LevelBarMode)586     fn set_mode(&self, mode: LevelBarMode) {
587         unsafe {
588             ffi::gtk_level_bar_set_mode(self.as_ref().to_glib_none().0, mode.into_glib());
589         }
590     }
591 
set_value(&self, value: f64)592     fn set_value(&self, value: f64) {
593         unsafe {
594             ffi::gtk_level_bar_set_value(self.as_ref().to_glib_none().0, value);
595         }
596     }
597 
connect_offset_changed<F: Fn(&Self, &str) + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId598     fn connect_offset_changed<F: Fn(&Self, &str) + 'static>(
599         &self,
600         detail: Option<&str>,
601         f: F,
602     ) -> SignalHandlerId {
603         unsafe extern "C" fn offset_changed_trampoline<
604             P: IsA<LevelBar>,
605             F: Fn(&P, &str) + 'static,
606         >(
607             this: *mut ffi::GtkLevelBar,
608             name: *mut libc::c_char,
609             f: glib::ffi::gpointer,
610         ) {
611             let f: &F = &*(f as *const F);
612             f(
613                 LevelBar::from_glib_borrow(this).unsafe_cast_ref(),
614                 &glib::GString::from_glib_borrow(name),
615             )
616         }
617         unsafe {
618             let f: Box_<F> = Box_::new(f);
619             let detailed_signal_name = detail.map(|name| format!("offset-changed::{}\0", name));
620             let signal_name: &[u8] = detailed_signal_name
621                 .as_ref()
622                 .map_or(&b"offset-changed\0"[..], |n| n.as_bytes());
623             connect_raw(
624                 self.as_ptr() as *mut _,
625                 signal_name.as_ptr() as *const _,
626                 Some(transmute::<_, unsafe extern "C" fn()>(
627                     offset_changed_trampoline::<Self, F> as *const (),
628                 )),
629                 Box_::into_raw(f),
630             )
631         }
632     }
633 
connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId634     fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
635         unsafe extern "C" fn notify_inverted_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
636             this: *mut ffi::GtkLevelBar,
637             _param_spec: glib::ffi::gpointer,
638             f: glib::ffi::gpointer,
639         ) {
640             let f: &F = &*(f as *const F);
641             f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
642         }
643         unsafe {
644             let f: Box_<F> = Box_::new(f);
645             connect_raw(
646                 self.as_ptr() as *mut _,
647                 b"notify::inverted\0".as_ptr() as *const _,
648                 Some(transmute::<_, unsafe extern "C" fn()>(
649                     notify_inverted_trampoline::<Self, F> as *const (),
650                 )),
651                 Box_::into_raw(f),
652             )
653         }
654     }
655 
connect_max_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId656     fn connect_max_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
657         unsafe extern "C" fn notify_max_value_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
658             this: *mut ffi::GtkLevelBar,
659             _param_spec: glib::ffi::gpointer,
660             f: glib::ffi::gpointer,
661         ) {
662             let f: &F = &*(f as *const F);
663             f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
664         }
665         unsafe {
666             let f: Box_<F> = Box_::new(f);
667             connect_raw(
668                 self.as_ptr() as *mut _,
669                 b"notify::max-value\0".as_ptr() as *const _,
670                 Some(transmute::<_, unsafe extern "C" fn()>(
671                     notify_max_value_trampoline::<Self, F> as *const (),
672                 )),
673                 Box_::into_raw(f),
674             )
675         }
676     }
677 
connect_min_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId678     fn connect_min_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
679         unsafe extern "C" fn notify_min_value_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
680             this: *mut ffi::GtkLevelBar,
681             _param_spec: glib::ffi::gpointer,
682             f: glib::ffi::gpointer,
683         ) {
684             let f: &F = &*(f as *const F);
685             f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
686         }
687         unsafe {
688             let f: Box_<F> = Box_::new(f);
689             connect_raw(
690                 self.as_ptr() as *mut _,
691                 b"notify::min-value\0".as_ptr() as *const _,
692                 Some(transmute::<_, unsafe extern "C" fn()>(
693                     notify_min_value_trampoline::<Self, F> as *const (),
694                 )),
695                 Box_::into_raw(f),
696             )
697         }
698     }
699 
connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId700     fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
701         unsafe extern "C" fn notify_mode_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
702             this: *mut ffi::GtkLevelBar,
703             _param_spec: glib::ffi::gpointer,
704             f: glib::ffi::gpointer,
705         ) {
706             let f: &F = &*(f as *const F);
707             f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
708         }
709         unsafe {
710             let f: Box_<F> = Box_::new(f);
711             connect_raw(
712                 self.as_ptr() as *mut _,
713                 b"notify::mode\0".as_ptr() as *const _,
714                 Some(transmute::<_, unsafe extern "C" fn()>(
715                     notify_mode_trampoline::<Self, F> as *const (),
716                 )),
717                 Box_::into_raw(f),
718             )
719         }
720     }
721 
connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId722     fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
723         unsafe extern "C" fn notify_value_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
724             this: *mut ffi::GtkLevelBar,
725             _param_spec: glib::ffi::gpointer,
726             f: glib::ffi::gpointer,
727         ) {
728             let f: &F = &*(f as *const F);
729             f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
730         }
731         unsafe {
732             let f: Box_<F> = Box_::new(f);
733             connect_raw(
734                 self.as_ptr() as *mut _,
735                 b"notify::value\0".as_ptr() as *const _,
736                 Some(transmute::<_, unsafe extern "C" fn()>(
737                     notify_value_trampoline::<Self, F> as *const (),
738                 )),
739                 Box_::into_raw(f),
740             )
741         }
742     }
743 }
744 
745 impl fmt::Display for LevelBar {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result746     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
747         f.write_str("LevelBar")
748     }
749 }
750