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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use Builder;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;

glib_wrapper! {
    pub struct Buildable(Object<ffi::GtkBuildable, ffi::GtkBuildableIface>);

    match fn {
        get_type => || ffi::gtk_buildable_get_type(),
    }
}

pub trait BuildableExt {
    fn add_child<'a, P: IsA<glib::Object>, Q: Into<Option<&'a str>>>(&self, builder: &Builder, child: &P, type_: Q);

    fn construct_child(&self, builder: &Builder, name: &str) -> Option<glib::Object>;

    //fn custom_finished<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>, R: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, builder: &Builder, child: Q, tagname: &str, data: R);

    //fn custom_tag_end<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>, R: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, builder: &Builder, child: Q, tagname: &str, data: R);

    //fn custom_tag_start<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>>(&self, builder: &Builder, child: Q, tagname: &str, parser: /*Ignored*/glib::MarkupParser, data: /*Unimplemented*/&mut Option<Fundamental: Pointer>) -> bool;

    fn get_internal_child(&self, builder: &Builder, childname: &str) -> Option<glib::Object>;

    fn parser_finished(&self, builder: &Builder);

    fn set_buildable_property(&self, builder: &Builder, name: &str, value: &glib::Value);
}

impl<O: IsA<Buildable>> BuildableExt for O {
    fn add_child<'a, P: IsA<glib::Object>, Q: Into<Option<&'a str>>>(&self, builder: &Builder, child: &P, type_: Q) {
        let type_ = type_.into();
        let type_ = type_.to_glib_none();
        unsafe {
            ffi::gtk_buildable_add_child(self.to_glib_none().0, builder.to_glib_none().0, child.to_glib_none().0, type_.0);
        }
    }

    fn construct_child(&self, builder: &Builder, name: &str) -> Option<glib::Object> {
        unsafe {
            from_glib_full(ffi::gtk_buildable_construct_child(self.to_glib_none().0, builder.to_glib_none().0, name.to_glib_none().0))
        }
    }

    //fn custom_finished<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>, R: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, builder: &Builder, child: Q, tagname: &str, data: R) {
    //    unsafe { TODO: call ffi::gtk_buildable_custom_finished() }
    //}

    //fn custom_tag_end<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>, R: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, builder: &Builder, child: Q, tagname: &str, data: R) {
    //    unsafe { TODO: call ffi::gtk_buildable_custom_tag_end() }
    //}

    //fn custom_tag_start<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>>(&self, builder: &Builder, child: Q, tagname: &str, parser: /*Ignored*/glib::MarkupParser, data: /*Unimplemented*/&mut Option<Fundamental: Pointer>) -> bool {
    //    unsafe { TODO: call ffi::gtk_buildable_custom_tag_start() }
    //}

    fn get_internal_child(&self, builder: &Builder, childname: &str) -> Option<glib::Object> {
        unsafe {
            from_glib_none(ffi::gtk_buildable_get_internal_child(self.to_glib_none().0, builder.to_glib_none().0, childname.to_glib_none().0))
        }
    }

    fn parser_finished(&self, builder: &Builder) {
        unsafe {
            ffi::gtk_buildable_parser_finished(self.to_glib_none().0, builder.to_glib_none().0);
        }
    }

    fn set_buildable_property(&self, builder: &Builder, name: &str, value: &glib::Value) {
        unsafe {
            ffi::gtk_buildable_set_buildable_property(self.to_glib_none().0, builder.to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0);
        }
    }
}