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::Value;
16use glib_sys;
17use gobject_sys;
18use gtk_sys;
19use std::boxed::Box as Box_;
20use std::fmt;
21use std::mem::transmute;
22use Actionable;
23use Align;
24use Bin;
25use Buildable;
26use Button;
27use Container;
28use PositionType;
29use ReliefStyle;
30use ResizeMode;
31use Widget;
32
33glib_wrapper! {
34 pub struct LockButton(Object<gtk_sys::GtkLockButton, gtk_sys::GtkLockButtonClass, LockButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable;
35
36 match fn {
37 get_type => || gtk_sys::gtk_lock_button_get_type(),
38 }
39}
40
41impl LockButton {
42 pub fn new<P: IsA<gio::Permission>>(permission: Option<&P>) -> LockButton {
43 assert_initialized_main_thread!();
44 unsafe {
45 Widget::from_glib_none(gtk_sys::gtk_lock_button_new(
46 permission.map(|p| p.as_ref()).to_glib_none().0,
47 ))
48 .unsafe_cast()
49 }
50 }
51}
52
53pub struct LockButtonBuilder {
54 permission: Option<gio::Permission>,
55 text_lock: Option<String>,
56 text_unlock: Option<String>,
57 tooltip_lock: Option<String>,
58 tooltip_not_authorized: Option<String>,
59 tooltip_unlock: Option<String>,
60 always_show_image: Option<bool>,
61 image: Option<Widget>,
62 image_position: Option<PositionType>,
63 label: Option<String>,
64 relief: Option<ReliefStyle>,
65 use_underline: Option<bool>,
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 LockButtonBuilder {
106 pub fn new() -> Self {
107 Self {
108 permission: None,
109 text_lock: None,
110 text_unlock: None,
111 tooltip_lock: None,
112 tooltip_not_authorized: None,
113 tooltip_unlock: None,
114 always_show_image: None,
115 image: None,
116 image_position: None,
117 label: None,
118 relief: None,
119 use_underline: None,
120 border_width: None,
121 child: None,
122 resize_mode: None,
123 app_paintable: None,
124 can_default: None,
125 can_focus: None,
126 events: None,
127 expand: None,
128 #[cfg(any(feature = "v3_20", feature = "dox"))]
129 focus_on_click: None,
130 halign: None,
131 has_default: None,
132 has_focus: None,
133 has_tooltip: None,
134 height_request: None,
135 hexpand: None,
136 hexpand_set: None,
137 is_focus: None,
138 margin: None,
139 margin_bottom: None,
140 margin_end: None,
141 margin_start: None,
142 margin_top: None,
143 name: None,
144 no_show_all: None,
145 opacity: None,
146 parent: None,
147 receives_default: None,
148 sensitive: None,
149 tooltip_markup: None,
150 tooltip_text: None,
151 valign: None,
152 vexpand: None,
153 vexpand_set: None,
154 visible: None,
155 width_request: None,
156 }
157 }
158
159 pub fn build(self) -> LockButton {
160 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
161 if let Some(ref permission) = self.permission {
162 properties.push(("permission", permission));
163 }
164 if let Some(ref text_lock) = self.text_lock {
165 properties.push(("text-lock", text_lock));
166 }
167 if let Some(ref text_unlock) = self.text_unlock {
168 properties.push(("text-unlock", text_unlock));
169 }
170 if let Some(ref tooltip_lock) = self.tooltip_lock {
171 properties.push(("tooltip-lock", tooltip_lock));
172 }
173 if let Some(ref tooltip_not_authorized) = self.tooltip_not_authorized {
174 properties.push(("tooltip-not-authorized", tooltip_not_authorized));
175 }
176 if let Some(ref tooltip_unlock) = self.tooltip_unlock {
177 properties.push(("tooltip-unlock", tooltip_unlock));
178 }
179 if let Some(ref always_show_image) = self.always_show_image {
180 properties.push(("always-show-image", always_show_image));
181 }
182 if let Some(ref image) = self.image {
183 properties.push(("image", image));
184 }
185 if let Some(ref image_position) = self.image_position {
186 properties.push(("image-position", image_position));
187 }
188 if let Some(ref label) = self.label {
189 properties.push(("label", label));
190 }
191 if let Some(ref relief) = self.relief {
192 properties.push(("relief", relief));
193 }
194 if let Some(ref use_underline) = self.use_underline {
195 properties.push(("use-underline", use_underline));
196 }
197 if let Some(ref border_width) = self.border_width {
198 properties.push(("border-width", border_width));
199 }
200 if let Some(ref child) = self.child {
201 properties.push(("child", child));
202 }
203 if let Some(ref resize_mode) = self.resize_mode {
204 properties.push(("resize-mode", resize_mode));
205 }
206 if let Some(ref app_paintable) = self.app_paintable {
207 properties.push(("app-paintable", app_paintable));
208 }
209 if let Some(ref can_default) = self.can_default {
210 properties.push(("can-default", can_default));
211 }
212 if let Some(ref can_focus) = self.can_focus {
213 properties.push(("can-focus", can_focus));
214 }
215 if let Some(ref events) = self.events {
216 properties.push(("events", events));
217 }
218 if let Some(ref expand) = self.expand {
219 properties.push(("expand", expand));
220 }
221 #[cfg(any(feature = "v3_20", feature = "dox"))]
222 {
223 if let Some(ref focus_on_click) = self.focus_on_click {
224 properties.push(("focus-on-click", focus_on_click));
225 }
226 }
227 if let Some(ref halign) = self.halign {
228 properties.push(("halign", halign));
229 }
230 if let Some(ref has_default) = self.has_default {
231 properties.push(("has-default", has_default));
232 }
233 if let Some(ref has_focus) = self.has_focus {
234 properties.push(("has-focus", has_focus));
235 }
236 if let Some(ref has_tooltip) = self.has_tooltip {
237 properties.push(("has-tooltip", has_tooltip));
238 }
239 if let Some(ref height_request) = self.height_request {
240 properties.push(("height-request", height_request));
241 }
242 if let Some(ref hexpand) = self.hexpand {
243 properties.push(("hexpand", hexpand));
244 }
245 if let Some(ref hexpand_set) = self.hexpand_set {
246 properties.push(("hexpand-set", hexpand_set));
247 }
248 if let Some(ref is_focus) = self.is_focus {
249 properties.push(("is-focus", is_focus));
250 }
251 if let Some(ref margin) = self.margin {
252 properties.push(("margin", margin));
253 }
254 if let Some(ref margin_bottom) = self.margin_bottom {
255 properties.push(("margin-bottom", margin_bottom));
256 }
257 if let Some(ref margin_end) = self.margin_end {
258 properties.push(("margin-end", margin_end));
259 }
260 if let Some(ref margin_start) = self.margin_start {
261 properties.push(("margin-start", margin_start));
262 }
263 if let Some(ref margin_top) = self.margin_top {
264 properties.push(("margin-top", margin_top));
265 }
266 if let Some(ref name) = self.name {
267 properties.push(("name", name));
268 }
269 if let Some(ref no_show_all) = self.no_show_all {
270 properties.push(("no-show-all", no_show_all));
271 }
272 if let Some(ref opacity) = self.opacity {
273 properties.push(("opacity", opacity));
274 }
275 if let Some(ref parent) = self.parent {
276 properties.push(("parent", parent));
277 }
278 if let Some(ref receives_default) = self.receives_default {
279 properties.push(("receives-default", receives_default));
280 }
281 if let Some(ref sensitive) = self.sensitive {
282 properties.push(("sensitive", sensitive));
283 }
284 if let Some(ref tooltip_markup) = self.tooltip_markup {
285 properties.push(("tooltip-markup", tooltip_markup));
286 }
287 if let Some(ref tooltip_text) = self.tooltip_text {
288 properties.push(("tooltip-text", tooltip_text));
289 }
290 if let Some(ref valign) = self.valign {
291 properties.push(("valign", valign));
292 }
293 if let Some(ref vexpand) = self.vexpand {
294 properties.push(("vexpand", vexpand));
295 }
296 if let Some(ref vexpand_set) = self.vexpand_set {
297 properties.push(("vexpand-set", vexpand_set));
298 }
299 if let Some(ref visible) = self.visible {
300 properties.push(("visible", visible));
301 }
302 if let Some(ref width_request) = self.width_request {
303 properties.push(("width-request", width_request));
304 }
305 glib::Object::new(LockButton::static_type(), &properties)
306 .expect("object new")
307 .downcast()
308 .expect("downcast")
309 }
310
311 pub fn permission(mut self, permission: &gio::Permission) -> Self {
312 self.permission = Some(permission.clone());
313 self
314 }
315
316 pub fn text_lock(mut self, text_lock: &str) -> Self {
317 self.text_lock = Some(text_lock.to_string());
318 self
319 }
320
321 pub fn text_unlock(mut self, text_unlock: &str) -> Self {
322 self.text_unlock = Some(text_unlock.to_string());
323 self
324 }
325
326 pub fn tooltip_lock(mut self, tooltip_lock: &str) -> Self {
327 self.tooltip_lock = Some(tooltip_lock.to_string());
328 self
329 }
330
331 pub fn tooltip_not_authorized(mut self, tooltip_not_authorized: &str) -> Self {
332 self.tooltip_not_authorized = Some(tooltip_not_authorized.to_string());
333 self
334 }
335
336 pub fn tooltip_unlock(mut self, tooltip_unlock: &str) -> Self {
337 self.tooltip_unlock = Some(tooltip_unlock.to_string());
338 self
339 }
340
341 pub fn always_show_image(mut self, always_show_image: bool) -> Self {
342 self.always_show_image = Some(always_show_image);
343 self
344 }
345
346 pub fn image(mut self, image: &Widget) -> Self {
347 self.image = Some(image.clone());
348 self
349 }
350
351 pub fn image_position(mut self, image_position: PositionType) -> Self {
352 self.image_position = Some(image_position);
353 self
354 }
355
356 pub fn label(mut self, label: &str) -> Self {
357 self.label = Some(label.to_string());
358 self
359 }
360
361 pub fn relief(mut self, relief: ReliefStyle) -> Self {
362 self.relief = Some(relief);
363 self
364 }
365
366 pub fn use_underline(mut self, use_underline: bool) -> Self {
367 self.use_underline = Some(use_underline);
368 self
369 }
370
371 pub fn border_width(mut self, border_width: u32) -> Self {
372 self.border_width = Some(border_width);
373 self
374 }
375
376 pub fn child(mut self, child: &Widget) -> Self {
377 self.child = Some(child.clone());
378 self
379 }
380
381 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
382 self.resize_mode = Some(resize_mode);
383 self
384 }
385
386 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
387 self.app_paintable = Some(app_paintable);
388 self
389 }
390
391 pub fn can_default(mut self, can_default: bool) -> Self {
392 self.can_default = Some(can_default);
393 self
394 }
395
396 pub fn can_focus(mut self, can_focus: bool) -> Self {
397 self.can_focus = Some(can_focus);
398 self
399 }
400
401 pub fn events(mut self, events: gdk::EventMask) -> Self {
402 self.events = Some(events);
403 self
404 }
405
406 pub fn expand(mut self, expand: bool) -> Self {
407 self.expand = Some(expand);
408 self
409 }
410
411 #[cfg(any(feature = "v3_20", feature = "dox"))]
412 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
413 self.focus_on_click = Some(focus_on_click);
414 self
415 }
416
417 pub fn halign(mut self, halign: Align) -> Self {
418 self.halign = Some(halign);
419 self
420 }
421
422 pub fn has_default(mut self, has_default: bool) -> Self {
423 self.has_default = Some(has_default);
424 self
425 }
426
427 pub fn has_focus(mut self, has_focus: bool) -> Self {
428 self.has_focus = Some(has_focus);
429 self
430 }
431
432 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
433 self.has_tooltip = Some(has_tooltip);
434 self
435 }
436
437 pub fn height_request(mut self, height_request: i32) -> Self {
438 self.height_request = Some(height_request);
439 self
440 }
441
442 pub fn hexpand(mut self, hexpand: bool) -> Self {
443 self.hexpand = Some(hexpand);
444 self
445 }
446
447 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
448 self.hexpand_set = Some(hexpand_set);
449 self
450 }
451
452 pub fn is_focus(mut self, is_focus: bool) -> Self {
453 self.is_focus = Some(is_focus);
454 self
455 }
456
457 pub fn margin(mut self, margin: i32) -> Self {
458 self.margin = Some(margin);
459 self
460 }
461
462 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
463 self.margin_bottom = Some(margin_bottom);
464 self
465 }
466
467 pub fn margin_end(mut self, margin_end: i32) -> Self {
468 self.margin_end = Some(margin_end);
469 self
470 }
471
472 pub fn margin_start(mut self, margin_start: i32) -> Self {
473 self.margin_start = Some(margin_start);
474 self
475 }
476
477 pub fn margin_top(mut self, margin_top: i32) -> Self {
478 self.margin_top = Some(margin_top);
479 self
480 }
481
482 pub fn name(mut self, name: &str) -> Self {
483 self.name = Some(name.to_string());
484 self
485 }
486
487 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
488 self.no_show_all = Some(no_show_all);
489 self
490 }
491
492 pub fn opacity(mut self, opacity: f64) -> Self {
493 self.opacity = Some(opacity);
494 self
495 }
496
497 pub fn parent(mut self, parent: &Container) -> Self {
498 self.parent = Some(parent.clone());
499 self
500 }
501
502 pub fn receives_default(mut self, receives_default: bool) -> Self {
503 self.receives_default = Some(receives_default);
504 self
505 }
506
507 pub fn sensitive(mut self, sensitive: bool) -> Self {
508 self.sensitive = Some(sensitive);
509 self
510 }
511
512 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
513 self.tooltip_markup = Some(tooltip_markup.to_string());
514 self
515 }
516
517 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
518 self.tooltip_text = Some(tooltip_text.to_string());
519 self
520 }
521
522 pub fn valign(mut self, valign: Align) -> Self {
523 self.valign = Some(valign);
524 self
525 }
526
527 pub fn vexpand(mut self, vexpand: bool) -> Self {
528 self.vexpand = Some(vexpand);
529 self
530 }
531
532 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
533 self.vexpand_set = Some(vexpand_set);
534 self
535 }
536
537 pub fn visible(mut self, visible: bool) -> Self {
538 self.visible = Some(visible);
539 self
540 }
541
542 pub fn width_request(mut self, width_request: i32) -> Self {
543 self.width_request = Some(width_request);
544 self
545 }
546}
547
548pub const NONE_LOCK_BUTTON: Option<&LockButton> = None;
549
550pub trait LockButtonExt: 'static {
551 fn get_permission(&self) -> Option<gio::Permission>;
552
553 fn set_permission<P: IsA<gio::Permission>>(&self, permission: Option<&P>);
554
555 fn get_property_text_lock(&self) -> Option<GString>;
556
557 fn set_property_text_lock(&self, text_lock: Option<&str>);
558
559 fn get_property_text_unlock(&self) -> Option<GString>;
560
561 fn set_property_text_unlock(&self, text_unlock: Option<&str>);
562
563 fn get_property_tooltip_lock(&self) -> Option<GString>;
564
565 fn set_property_tooltip_lock(&self, tooltip_lock: Option<&str>);
566
567 fn get_property_tooltip_not_authorized(&self) -> Option<GString>;
568
569 fn set_property_tooltip_not_authorized(&self, tooltip_not_authorized: Option<&str>);
570
571 fn get_property_tooltip_unlock(&self) -> Option<GString>;
572
573 fn set_property_tooltip_unlock(&self, tooltip_unlock: Option<&str>);
574
575 fn connect_property_permission_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
576
577 fn connect_property_text_lock_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
578
579 fn connect_property_text_unlock_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
580
581 fn connect_property_tooltip_lock_notify<F: Fn(&Self) + 'static>(&self, f: F)
582 -> SignalHandlerId;
583
584 fn connect_property_tooltip_not_authorized_notify<F: Fn(&Self) + 'static>(
585 &self,
586 f: F,
587 ) -> SignalHandlerId;
588
589 fn connect_property_tooltip_unlock_notify<F: Fn(&Self) + 'static>(
590 &self,
591 f: F,
592 ) -> SignalHandlerId;
593}
594
595impl<O: IsA<LockButton>> LockButtonExt for O {
596 fn get_permission(&self) -> Option<gio::Permission> {
597 unsafe {
598 from_glib_none(gtk_sys::gtk_lock_button_get_permission(
599 self.as_ref().to_glib_none().0,
600 ))
601 }
602 }
603
604 fn set_permission<P: IsA<gio::Permission>>(&self, permission: Option<&P>) {
605 unsafe {
606 gtk_sys::gtk_lock_button_set_permission(
607 self.as_ref().to_glib_none().0,
608 permission.map(|p| p.as_ref()).to_glib_none().0,
609 );
610 }
611 }
612
613 fn get_property_text_lock(&self) -> Option<GString> {
614 unsafe {
615 let mut value = Value::from_type(<GString as StaticType>::static_type());
616 gobject_sys::g_object_get_property(
617 self.to_glib_none().0 as *mut gobject_sys::GObject,
618 b"text-lock\0".as_ptr() as *const _,
619 value.to_glib_none_mut().0,
620 );
621 value.get()
622 }
623 }
624
625 fn set_property_text_lock(&self, text_lock: Option<&str>) {
626 unsafe {
627 gobject_sys::g_object_set_property(
628 self.to_glib_none().0 as *mut gobject_sys::GObject,
629 b"text-lock\0".as_ptr() as *const _,
630 Value::from(text_lock).to_glib_none().0,
631 );
632 }
633 }
634
635 fn get_property_text_unlock(&self) -> Option<GString> {
636 unsafe {
637 let mut value = Value::from_type(<GString as StaticType>::static_type());
638 gobject_sys::g_object_get_property(
639 self.to_glib_none().0 as *mut gobject_sys::GObject,
640 b"text-unlock\0".as_ptr() as *const _,
641 value.to_glib_none_mut().0,
642 );
643 value.get()
644 }
645 }
646
647 fn set_property_text_unlock(&self, text_unlock: Option<&str>) {
648 unsafe {
649 gobject_sys::g_object_set_property(
650 self.to_glib_none().0 as *mut gobject_sys::GObject,
651 b"text-unlock\0".as_ptr() as *const _,
652 Value::from(text_unlock).to_glib_none().0,
653 );
654 }
655 }
656
657 fn get_property_tooltip_lock(&self) -> Option<GString> {
658 unsafe {
659 let mut value = Value::from_type(<GString as StaticType>::static_type());
660 gobject_sys::g_object_get_property(
661 self.to_glib_none().0 as *mut gobject_sys::GObject,
662 b"tooltip-lock\0".as_ptr() as *const _,
663 value.to_glib_none_mut().0,
664 );
665 value.get()
666 }
667 }
668
669 fn set_property_tooltip_lock(&self, tooltip_lock: Option<&str>) {
670 unsafe {
671 gobject_sys::g_object_set_property(
672 self.to_glib_none().0 as *mut gobject_sys::GObject,
673 b"tooltip-lock\0".as_ptr() as *const _,
674 Value::from(tooltip_lock).to_glib_none().0,
675 );
676 }
677 }
678
679 fn get_property_tooltip_not_authorized(&self) -> Option<GString> {
680 unsafe {
681 let mut value = Value::from_type(<GString as StaticType>::static_type());
682 gobject_sys::g_object_get_property(
683 self.to_glib_none().0 as *mut gobject_sys::GObject,
684 b"tooltip-not-authorized\0".as_ptr() as *const _,
685 value.to_glib_none_mut().0,
686 );
687 value.get()
688 }
689 }
690
691 fn set_property_tooltip_not_authorized(&self, tooltip_not_authorized: Option<&str>) {
692 unsafe {
693 gobject_sys::g_object_set_property(
694 self.to_glib_none().0 as *mut gobject_sys::GObject,
695 b"tooltip-not-authorized\0".as_ptr() as *const _,
696 Value::from(tooltip_not_authorized).to_glib_none().0,
697 );
698 }
699 }
700
701 fn get_property_tooltip_unlock(&self) -> Option<GString> {
702 unsafe {
703 let mut value = Value::from_type(<GString as StaticType>::static_type());
704 gobject_sys::g_object_get_property(
705 self.to_glib_none().0 as *mut gobject_sys::GObject,
706 b"tooltip-unlock\0".as_ptr() as *const _,
707 value.to_glib_none_mut().0,
708 );
709 value.get()
710 }
711 }
712
713 fn set_property_tooltip_unlock(&self, tooltip_unlock: Option<&str>) {
714 unsafe {
715 gobject_sys::g_object_set_property(
716 self.to_glib_none().0 as *mut gobject_sys::GObject,
717 b"tooltip-unlock\0".as_ptr() as *const _,
718 Value::from(tooltip_unlock).to_glib_none().0,
719 );
720 }
721 }
722
723 fn connect_property_permission_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
724 unsafe extern "C" fn notify_permission_trampoline<P, F: Fn(&P) + 'static>(
725 this: *mut gtk_sys::GtkLockButton,
726 _param_spec: glib_sys::gpointer,
727 f: glib_sys::gpointer,
728 ) where
729 P: IsA<LockButton>,
730 {
731 let f: &F = &*(f as *const F);
732 f(&LockButton::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::permission\0".as_ptr() as *const _,
739 Some(transmute(notify_permission_trampoline::<Self, F> as usize)),
740 Box_::into_raw(f),
741 )
742 }
743 }
744
745 fn connect_property_text_lock_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
746 unsafe extern "C" fn notify_text_lock_trampoline<P, F: Fn(&P) + 'static>(
747 this: *mut gtk_sys::GtkLockButton,
748 _param_spec: glib_sys::gpointer,
749 f: glib_sys::gpointer,
750 ) where
751 P: IsA<LockButton>,
752 {
753 let f: &F = &*(f as *const F);
754 f(&LockButton::from_glib_borrow(this).unsafe_cast())
755 }
756 unsafe {
757 let f: Box_<F> = Box_::new(f);
758 connect_raw(
759 self.as_ptr() as *mut _,
760 b"notify::text-lock\0".as_ptr() as *const _,
761 Some(transmute(notify_text_lock_trampoline::<Self, F> as usize)),
762 Box_::into_raw(f),
763 )
764 }
765 }
766
767 fn connect_property_text_unlock_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
768 unsafe extern "C" fn notify_text_unlock_trampoline<P, F: Fn(&P) + 'static>(
769 this: *mut gtk_sys::GtkLockButton,
770 _param_spec: glib_sys::gpointer,
771 f: glib_sys::gpointer,
772 ) where
773 P: IsA<LockButton>,
774 {
775 let f: &F = &*(f as *const F);
776 f(&LockButton::from_glib_borrow(this).unsafe_cast())
777 }
778 unsafe {
779 let f: Box_<F> = Box_::new(f);
780 connect_raw(
781 self.as_ptr() as *mut _,
782 b"notify::text-unlock\0".as_ptr() as *const _,
783 Some(transmute(notify_text_unlock_trampoline::<Self, F> as usize)),
784 Box_::into_raw(f),
785 )
786 }
787 }
788
789 fn connect_property_tooltip_lock_notify<F: Fn(&Self) + 'static>(
790 &self,
791 f: F,
792 ) -> SignalHandlerId {
793 unsafe extern "C" fn notify_tooltip_lock_trampoline<P, F: Fn(&P) + 'static>(
794 this: *mut gtk_sys::GtkLockButton,
795 _param_spec: glib_sys::gpointer,
796 f: glib_sys::gpointer,
797 ) where
798 P: IsA<LockButton>,
799 {
800 let f: &F = &*(f as *const F);
801 f(&LockButton::from_glib_borrow(this).unsafe_cast())
802 }
803 unsafe {
804 let f: Box_<F> = Box_::new(f);
805 connect_raw(
806 self.as_ptr() as *mut _,
807 b"notify::tooltip-lock\0".as_ptr() as *const _,
808 Some(transmute(
809 notify_tooltip_lock_trampoline::<Self, F> as usize,
810 )),
811 Box_::into_raw(f),
812 )
813 }
814 }
815
816 fn connect_property_tooltip_not_authorized_notify<F: Fn(&Self) + 'static>(
817 &self,
818 f: F,
819 ) -> SignalHandlerId {
820 unsafe extern "C" fn notify_tooltip_not_authorized_trampoline<P, F: Fn(&P) + 'static>(
821 this: *mut gtk_sys::GtkLockButton,
822 _param_spec: glib_sys::gpointer,
823 f: glib_sys::gpointer,
824 ) where
825 P: IsA<LockButton>,
826 {
827 let f: &F = &*(f as *const F);
828 f(&LockButton::from_glib_borrow(this).unsafe_cast())
829 }
830 unsafe {
831 let f: Box_<F> = Box_::new(f);
832 connect_raw(
833 self.as_ptr() as *mut _,
834 b"notify::tooltip-not-authorized\0".as_ptr() as *const _,
835 Some(transmute(
836 notify_tooltip_not_authorized_trampoline::<Self, F> as usize,
837 )),
838 Box_::into_raw(f),
839 )
840 }
841 }
842
843 fn connect_property_tooltip_unlock_notify<F: Fn(&Self) + 'static>(
844 &self,
845 f: F,
846 ) -> SignalHandlerId {
847 unsafe extern "C" fn notify_tooltip_unlock_trampoline<P, F: Fn(&P) + 'static>(
848 this: *mut gtk_sys::GtkLockButton,
849 _param_spec: glib_sys::gpointer,
850 f: glib_sys::gpointer,
851 ) where
852 P: IsA<LockButton>,
853 {
854 let f: &F = &*(f as *const F);
855 f(&LockButton::from_glib_borrow(this).unsafe_cast())
856 }
857 unsafe {
858 let f: Box_<F> = Box_::new(f);
859 connect_raw(
860 self.as_ptr() as *mut _,
861 b"notify::tooltip-unlock\0".as_ptr() as *const _,
862 Some(transmute(
863 notify_tooltip_unlock_trampoline::<Self, F> as usize,
864 )),
865 Box_::into_raw(f),
866 )
867 }
868 }
869}
870
871impl fmt::Display for LockButton {
872 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
873 write!(f, "LockButton")
874 }
875}