ux-components 0.1.3

Backend agnostic GUI framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
#![allow(unused_variables)]
#![allow(unused_mut)]

use crate::prelude::*;
use crate::{Actor, Align, Effect, HandlerId, StyleClass, Text, Theme, Timeline, Widget};
use std::{cell::RefCell, fmt};

#[derive(Default, Debug, Clone)]
pub struct LabelProps {
    pub text: Option<String>,
    pub fade_effect: Option<Effect>,
    pub x_align: Align,
    pub y_align: Align,
    pub fade_timeline: Option<Timeline>,
    pub em_width: i32,
    pub fade_out: bool,
    pub label_should_fade: bool,
    pub show_tooltip: bool,
    pub label: Option<Text>,
}

#[derive(Debug)]
pub struct Label {
    props: RefCell<LabelProps>,
    inner: Widget,
}

impl Label {
    pub fn new() -> Label {
        let props = LabelProps::default();

        let component = Self {
            props: RefCell::new(props),
            inner: Widget::new(),
        };

        component.init();
        component
    }

    pub fn with_text(text: &str) -> Label {
        let mut props = LabelProps::default();

        if !text.is_empty() {
            props.text = Some(text.into())
        }

        let component = Self {
            props: RefCell::new(props),
            inner: Widget::new(),
        };

        component.init();
        component
    }

    fn init(&self) {
        let mut props = self.props.borrow_mut();
        if let Some(text) = &props.text {
            let style = Theme::global().get(StyleClass::MdcButton).unwrap();
            let mut fontfamily = if let Some(fontfamily) = style.fontfamily {
                fontfamily
            } else {
                "Roboto".into()
            };

            // Sets the font used by a ClutterText.
            //The font_name string must either be NULL,
            // which means that the font name from the default ClutterBackend will be used;
            // or be something that can be parsed by the
            // pango_font_description_from_string() function, like:
            // "Sans 10"
            // "Serif 16px"
            // "Helvetica 10"
            // "sans bold 12"
            // "serif,monospace bold italic condensed 16"
            // "normal 10"

            // The format of the string representation is:
            // "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]"

            // The commonly available font families are: Normal, Sans, Serif and Monospace. The available styles are:

            // Normal | the font is upright.
            // Oblique | the font is slanted, but in a roman style.
            // Italic | the font is slanted in an italic style.

            // The available weights are:

            // Ultra-Light | the ultralight weight (= 200)
            // Light |	the light weight (=300)
            // Normal | the default weight (= 400)
            // Bold | the bold weight (= 700)
            // Ultra-Bold | the ultra-bold weight (= 800)
            // Heavy | the heavy weight (= 900)

            // The available variants are:

            // - Normal
            // - Small-Caps

            // The available stretch styles are:

            // Ultra-Condensed | the smallest width
            // Extra-Condensed |
            // Condensed |
            // Semi-Condensed |
            // Normal | the normal width
            // Semi-Expanded |
            // Expanded |
            // Extra-Expanded |
            // Ultra-Expanded | the widest width

            fontfamily.push_str(" Normal 14px");
            println!("ADD TEXT TO LABEL [{}] [{}]", text, fontfamily);

            let label = Text::with_text(Some(fontfamily.as_str()), text.as_str());
            label.set_color(color::WHITE);
            // self.inner.add_child(&label);

            // props.label = Some(label);
            unimplemented!()
        }
    }
}

impl Default for Label {
    fn default() -> Self {
        Self::new()
    }
}

impl Object for Label {}
impl Is<Label> for Label {}

impl AsRef<Label> for Label {
    fn as_ref(&self) -> &Label {
        self
    }
}

impl Is<Widget> for Label {}

impl AsRef<Widget> for Label {
    fn as_ref(&self) -> &Widget {
        &self.inner
    }
}

impl Is<Actor> for Label {}

impl AsRef<Actor> for Label {
    fn as_ref(&self) -> &Actor {
        let actor: &Actor = self.inner.as_ref();
        actor
    }
}

pub trait LabelExt: 'static {
    /// get_alignment:
    /// @label: An #Label
    /// @x_align: (out) (allow-none): return location for x alignment value
    /// @y_align: (out) (allow-none): return location for y alignment value
    ///
    /// Returns the text alignment on x and y axis.
    ///
    fn get_alignment(&self) -> (Align, Align);

    // /// get_clutter_text:
    // /// @label: a #Label
    // ///
    // /// Retrieve the internal #Text so that extra parameters can be set
    // ///
    // /// Returns: (transfer none): the #Text used by #Label. The label
    // /// is owned by the #Label and should not be unref'ed by the application.
    // ///
    // fn get_clutter_text(&self) -> Option<Actor>;

    /// get_fade_out:
    /// @label: A #Label
    ///
    /// Determines whether the label has been set to fade out when there isn't
    /// enough space allocated to display the entire label.
    ///
    /// Returns: %true if the label is set to fade out, %false otherwise
    ///
    fn get_fade_out(&self) -> bool;

    /// get_line_wrap:
    /// @label: An #Label
    ///
    /// Get the value of the #Label:line-wrap property.
    ///
    /// Returns: %true if the "line-wrap" property is set.
    ///
    fn get_line_wrap(&self) -> bool;

    /// get_show_tooltip:
    /// @label: A #Label
    ///
    /// Returns the current value of the #Label:show-tooltip property.
    ///
    /// Returns: %true if the #Label:show-tooltip property is enabled
    ///
    fn get_show_tooltip(&self) -> bool;

    /// get_text:
    /// @label: a #Label
    ///
    /// Get the text displayed on the label
    ///
    /// Returns: the text for the label. This must not be freed by the application
    ///
    fn get_text(&self) -> Option<String>;

    /// get_use_markup:
    /// @label: a #Label
    ///
    /// Determines whether the text of the label is being treated as Pango markup.
    ///
    /// Returns: %true if the text of the label is treated as Pango markup,
    ///   %false otherwise.
    ///
    fn get_use_markup(&self) -> bool;

    fn get_x_align(&self) -> Align;

    fn get_y_align(&self) -> Align;

    /// set_alignment:
    /// @label: An #Label
    /// @x_align: x alignment value
    /// @y_align: y alignment value
    ///
    /// Set the text alignment on x and y axis.
    ///
    fn set_alignment(&self, x_align: Align, y_align: Align);

    /// set_fade_out:
    /// @label: A #Label
    /// @fade: %true to fade out, %false otherwise
    ///
    /// Set whether to fade out the end of the label, instead of ellipsizing.
    /// Enabling this mode will also set the #Text:single-line-mode and
    /// #Text:ellipsize properties.
    ///
    fn set_fade_out(&self, fade: bool);

    /// set_line_wrap:
    /// @label: An #Label
    /// @line_wrap: new value of the line-wrap property.
    ///
    /// Set the value of the #Label:line-wrap property.
    ///
    fn set_line_wrap(&self, line_wrap: bool);

    /// set_show_tooltip:
    /// @label: A #Label
    /// @show_tooltip: %true if the tooltip should be shown
    ///
    /// Set the value of the #Label:show-tooltip property
    ///
    fn set_show_tooltip(&self, show_tooltip: bool);

    /// set_text:
    /// @label: a #Label
    /// @text: text to set the label to
    ///
    /// Sets the text displayed on the label
    ///
    fn set_text(&self, text: &str);

    /// set_use_markup:
    /// @label: a #Label
    /// @use_markup: %true to use Pango markup, %false otherwise
    ///
    /// Sets whether the text of the label should be treated as Pango markup.
    ///
    fn set_use_markup(&self, use_markup: bool);

    fn set_x_align(&self, align: Align);

    fn set_y_align(&self, align: Align);

    fn connect_property_clutter_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId;

    fn connect_property_fade_out_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId;

    fn connect_property_line_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId;

    fn connect_property_show_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId;

    fn connect_property_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId;

    fn connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId;

    fn connect_property_x_align_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId;

    fn connect_property_y_align_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId;
}

impl<O: Is<Label>> LabelExt for O {
    /// get_alignment:
    /// @label: An #Label
    /// @x_align: (out) (allow-none): return location for x alignment value
    /// @y_align: (out) (allow-none): return location for y alignment value
    ///
    /// Returns the text alignment on x and y axis.
    ///
    fn get_alignment(&self) -> (Align, Align) {
        let label = self.as_ref();
        let props = label.props.borrow();

        (props.x_align, props.y_align)
    }

    // /// get_clutter_text:
    // /// @label: a #Label
    // ///
    // /// Retrieve the internal #Text so that extra parameters can be set
    // ///
    // /// Returns: (transfer none): the #Text used by #Label. The label
    // /// is owned by the #Label and should not be unref'ed by the application.
    // ///
    // fn get_clutter_text(&self) -> Option<Actor> {
    //     let label = self.as_ref();
    //     let props = label.props.borrow();

    //     props.label.clone()
    // }

    /// get_fade_out:
    /// @label: A #Label
    ///
    /// Determines whether the label has been set to fade out when there isn't
    /// enough space allocated to display the entire label.
    ///
    /// Returns: %true if the label is set to fade out, %false otherwise
    ///
    fn get_fade_out(&self) -> bool {
        let label = self.as_ref();
        let props = label.props.borrow();

        props.fade_out
    }

    /// get_line_wrap:
    /// @label: An #Label
    ///
    /// Get the value of the #Label:line-wrap property.
    ///
    /// Returns: %true if the "line-wrap" property is set.
    ///
    fn get_line_wrap(&self) -> bool {
        let label = self.as_ref();

        // text_get_line_wrap(CLUTTER_TEXT (label.label));
        unimplemented!()
    }

    /// get_show_tooltip:
    /// @label: A #Label
    ///
    /// Returns the current value of the #Label:show-tooltip property.
    ///
    /// Returns: %true if the #Label:show-tooltip property is enabled
    ///
    fn get_show_tooltip(&self) -> bool {
        let label = self.as_ref();
        let props = label.props.borrow();

        props.show_tooltip
    }

    /// get_text:
    /// @label: a #Label
    ///
    /// Get the text displayed on the label
    ///
    /// Returns: the text for the label. This must not be freed by the application
    ///
    fn get_text(&self) -> Option<String> {
        let label = self.as_ref();

        // text_get_text(CLUTTER_TEXT(label.label));
        unimplemented!()
    }

    /// get_use_markup:
    /// @label: a #Label
    ///
    /// Determines whether the text of the label is being treated as Pango markup.
    ///
    /// Returns: %true if the text of the label is treated as Pango markup,
    ///   %false otherwise.
    ///
    fn get_use_markup(&self) -> bool {
        let label = self.as_ref();
        // text_get_use_markup(CLUTTER_TEXT(label.label));
        unimplemented!()
    }

    fn get_x_align(&self) -> Align {
        let label = self.as_ref();
        let props = label.props.borrow();

        props.x_align
    }

    fn get_y_align(&self) -> Align {
        let label = self.as_ref();
        let props = label.props.borrow();

        props.y_align
    }

    /// set_alignment:
    /// @label: An #Label
    /// @x_align: x alignment value
    /// @y_align: y alignment value
    ///
    /// Set the text alignment on x and y axis.
    ///
    fn set_alignment(&self, x_align: Align, y_align: Align) {
        let label = self.as_ref();
        let mut props = label.props.borrow_mut();

        if x_align != props.x_align {
            props.x_align = x_align;
            // actor_queue_relayout(CLUTTER_ACTOR(label));
            // g_object_notify(G_OBJECT(label), "x-align");
        }

        if y_align != props.y_align {
            props.y_align = y_align;
            // actor_queue_relayout(CLUTTER_ACTOR(label));
            // g_object_notify(G_OBJECT(label), "y-align");
        }
    }

    /// set_fade_out:
    /// @label: A #Label
    /// @fade: %true to fade out, %false otherwise
    ///
    /// Set whether to fade out the end of the label, instead of ellipsizing.
    /// Enabling this mode will also set the #Text:single-line-mode and
    /// #Text:ellipsize properties.
    ///
    fn set_fade_out(&self, fade: bool) {
        let label = self.as_ref();
        let mut props = label.props.borrow_mut();

        if props.fade_out != fade {
            props.fade_out = fade;
            // g_object_notify(G_OBJECT (label), "fade-out");

            // // Enable the fade-effect
            if fade {
                props.label_should_fade = false;
                // text_set_single_line_mode(CLUTTER_TEXT(label.label), true);
                // text_set_ellipsize(CLUTTER_TEXT(label.label),
                //                             PANGO_ELLIPSIZE_NONE);
            }

            // If we need to fade, listen for the font-description changing so
            // we can keep track of the em-width of the label.
            if fade {
                // g_signal_connect(label.label, "notify::font-description",
                //                     G_CALLBACK(label_font_description_cb), label);
                // label_font_description_cb(CLUTTER_TEXT(label.label),
                //                                 None, label);
            } else {
                // g_signal_handlers_disconnect_by_func(label.label,
                //                                     label_font_description_cb,
                //                                     label);
            }
        }
    }

    /// set_line_wrap:
    /// @label: An #Label
    /// @line_wrap: new value of the line-wrap property.
    ///
    /// Set the value of the #Label:line-wrap property.
    ///
    fn set_line_wrap(&self, line_wrap: bool) {
        let label = self.as_ref();

        // text_set_line_wrap(CLUTTER_TEXT(label.label), line_wrap);
        // g_object_notify(G_OBJECT(label), "line-wrap");
    }

    /// set_show_tooltip:
    /// @label: A #Label
    /// @show_tooltip: %true if the tooltip should be shown
    ///
    /// Set the value of the #Label:show-tooltip property
    ///
    fn set_show_tooltip(&self, show_tooltip: bool) {
        let label = self.as_ref();
        let mut props = label.props.borrow_mut();

        if props.show_tooltip != show_tooltip {
            props.show_tooltip = show_tooltip;
            // actor_queue_relayout(CLUTTER_ACTOR(label));
            // g_object_notify(G_OBJECT(label), "show-tooltip");
        }
    }

    /// set_text:
    /// @label: a #Label
    /// @text: text to set the label to
    ///
    /// Sets the text displayed on the label
    ///
    fn set_text(&self, text: &str) {
        let label = self.as_ref();

        // if text_get_use_markup(CLUTTER_TEXT(label.label)) {
        //     text_set_markup(CLUTTER_TEXT(label.label), (text) ? text : "");
        // } else {
        //     text_set_text(CLUTTER_TEXT(label.label), (text) ? text : "");
        // }

        // g_object_notify(G_OBJECT(label), "text");
    }

    /// set_use_markup:
    /// @label: a #Label
    /// @use_markup: %true to use Pango markup, %false otherwise
    ///
    /// Sets whether the text of the label should be treated as Pango markup.
    ///
    fn set_use_markup(&self, use_markup: bool) {
        let label = self.as_ref();

        // text_set_use_markup(CLUTTER_TEXT(label.label), use_markup);
        // g_object_notify(G_OBJECT(label), "use-markup");
    }

    fn set_x_align(&self, align: Align) {
        let label = self.as_ref();
        let mut props = label.props.borrow_mut();

        if align != props.x_align {
            props.x_align = align;
            // actor_queue_relayout(CLUTTER_ACTOR(label));
            // g_object_notify(G_OBJECT(label), "x-align");
        }
    }

    fn set_y_align(&self, align: Align) {
        let label = self.as_ref();
        let mut props = label.props.borrow_mut();

        if align != props.y_align {
            props.y_align = align;
            // actor_queue_relayout(CLUTTER_ACTOR(label));
            // g_object_notify(G_OBJECT(label), "y-align");
        }
    }

    fn connect_property_clutter_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId {
        // unsafe extern "C" fn notify_clutter_text_trampoline<P, F: Fn(&P) + 'static>(
        //     this: *mut ffi::Label,
        //     _param_spec: glib_sys::gpointer,
        //     f: glib_sys::gpointer,
        // ) where
        //     P: Is<Label>,
        // {
        //     let f: &F = &*(f as *const F);
        //     f(&Label::from_glib_borrow(this).unsafe_cast_ref())
        // }
        // unsafe {
        //     let f: Box<F> = Box::new(f);
        //     connect_raw(
        //         self.as_ptr() as *mut _,
        //         b"notify::clutter-text\0".as_ptr() as *const _,
        //         Some(transmute::<_, unsafe extern "C" fn()>(
        //             notify_clutter_text_trampoline::<Self, F> as *const (),
        //         )),
        //         Box::into_raw(f),
        //     )
        // }
        unimplemented!()
    }

    fn connect_property_fade_out_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId {
        // unsafe extern "C" fn notify_fade_out_trampoline<P, F: Fn(&P) + 'static>(
        //     this: *mut ffi::Label,
        //     _param_spec: glib_sys::gpointer,
        //     f: glib_sys::gpointer,
        // ) where
        //     P: Is<Label>,
        // {
        //     let f: &F = &*(f as *const F);
        //     f(&Label::from_glib_borrow(this).unsafe_cast_ref())
        // }
        // unsafe {
        //     let f: Box<F> = Box::new(f);
        //     connect_raw(
        //         self.as_ptr() as *mut _,
        //         b"notify::fade-out\0".as_ptr() as *const _,
        //         Some(transmute::<_, unsafe extern "C" fn()>(
        //             notify_fade_out_trampoline::<Self, F> as *const (),
        //         )),
        //         Box::into_raw(f),
        //     )
        // }
        unimplemented!()
    }

    fn connect_property_line_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId {
        // unsafe extern "C" fn notify_line_wrap_trampoline<P, F: Fn(&P) + 'static>(
        //     this: *mut ffi::Label,
        //     _param_spec: glib_sys::gpointer,
        //     f: glib_sys::gpointer,
        // ) where
        //     P: Is<Label>,
        // {
        //     let f: &F = &*(f as *const F);
        //     f(&Label::from_glib_borrow(this).unsafe_cast_ref())
        // }
        // unsafe {
        //     let f: Box<F> = Box::new(f);
        //     connect_raw(
        //         self.as_ptr() as *mut _,
        //         b"notify::line-wrap\0".as_ptr() as *const _,
        //         Some(transmute::<_, unsafe extern "C" fn()>(
        //             notify_line_wrap_trampoline::<Self, F> as *const (),
        //         )),
        //         Box::into_raw(f),
        //     )
        // }
        unimplemented!()
    }

    fn connect_property_show_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId {
        // unsafe extern "C" fn notify_show_tooltip_trampoline<P, F: Fn(&P) + 'static>(
        //     this: *mut ffi::Label,
        //     _param_spec: glib_sys::gpointer,
        //     f: glib_sys::gpointer,
        // ) where
        //     P: Is<Label>,
        // {
        //     let f: &F = &*(f as *const F);
        //     f(&Label::from_glib_borrow(this).unsafe_cast_ref())
        // }
        // unsafe {
        //     let f: Box<F> = Box::new(f);
        //     connect_raw(
        //         self.as_ptr() as *mut _,
        //         b"notify::show-tooltip\0".as_ptr() as *const _,
        //         Some(transmute::<_, unsafe extern "C" fn()>(
        //             notify_show_tooltip_trampoline::<Self, F> as *const (),
        //         )),
        //         Box::into_raw(f),
        //     )
        // }
        unimplemented!()
    }

    fn connect_property_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId {
        // unsafe extern "C" fn notify_text_trampoline<P, F: Fn(&P) + 'static>(
        //     this: *mut ffi::Label,
        //     _param_spec: glib_sys::gpointer,
        //     f: glib_sys::gpointer,
        // ) where
        //     P: Is<Label>,
        // {
        //     let f: &F = &*(f as *const F);
        //     f(&Label::from_glib_borrow(this).unsafe_cast_ref())
        // }
        // unsafe {
        //     let f: Box<F> = Box::new(f);
        //     connect_raw(
        //         self.as_ptr() as *mut _,
        //         b"notify::text\0".as_ptr() as *const _,
        //         Some(transmute::<_, unsafe extern "C" fn()>(
        //             notify_text_trampoline::<Self, F> as *const (),
        //         )),
        //         Box::into_raw(f),
        //     )
        // }
        unimplemented!()
    }

    fn connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId {
        // unsafe extern "C" fn notify_use_markup_trampoline<P, F: Fn(&P) + 'static>(
        //     this: *mut ffi::Label,
        //     _param_spec: glib_sys::gpointer,
        //     f: glib_sys::gpointer,
        // ) where
        //     P: Is<Label>,
        // {
        //     let f: &F = &*(f as *const F);
        //     f(&Label::from_glib_borrow(this).unsafe_cast_ref())
        // }
        // unsafe {
        //     let f: Box<F> = Box::new(f);
        //     connect_raw(
        //         self.as_ptr() as *mut _,
        //         b"notify::use-markup\0".as_ptr() as *const _,
        //         Some(transmute::<_, unsafe extern "C" fn()>(
        //             notify_use_markup_trampoline::<Self, F> as *const (),
        //         )),
        //         Box::into_raw(f),
        //     )
        // }
        unimplemented!()
    }

    fn connect_property_x_align_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId {
        // unsafe extern "C" fn notify_x_align_trampoline<P, F: Fn(&P) + 'static>(
        //     this: *mut ffi::Label,
        //     _param_spec: glib_sys::gpointer,
        //     f: glib_sys::gpointer,
        // ) where
        //     P: Is<Label>,
        // {
        //     let f: &F = &*(f as *const F);
        //     f(&Label::from_glib_borrow(this).unsafe_cast_ref())
        // }
        // unsafe {
        //     let f: Box<F> = Box::new(f);
        //     connect_raw(
        //         self.as_ptr() as *mut _,
        //         b"notify::x-align\0".as_ptr() as *const _,
        //         Some(transmute::<_, unsafe extern "C" fn()>(
        //             notify_x_align_trampoline::<Self, F> as *const (),
        //         )),
        //         Box::into_raw(f),
        //     )
        // }
        unimplemented!()
    }

    fn connect_property_y_align_notify<F: Fn(&Self) + 'static>(&self, f: F) -> HandlerId {
        // unsafe extern "C" fn notify_y_align_trampoline<P, F: Fn(&P) + 'static>(
        //     this: *mut ffi::Label,
        //     _param_spec: glib_sys::gpointer,
        //     f: glib_sys::gpointer,
        // ) where
        //     P: Is<Label>,
        // {
        //     let f: &F = &*(f as *const F);
        //     f(&Label::from_glib_borrow(this).unsafe_cast_ref())
        // }
        // unsafe {
        //     let f: Box<F> = Box::new(f);
        //     connect_raw(
        //         self.as_ptr() as *mut _,
        //         b"notify::y-align\0".as_ptr() as *const _,
        //         Some(transmute::<_, unsafe extern "C" fn()>(
        //             notify_y_align_trampoline::<Self, F> as *const (),
        //         )),
        //         Box::into_raw(f),
        //     )
        // }
        unimplemented!()
    }
}

impl fmt::Display for Label {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "Label")
    }
}