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
// 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 gio_sys;
use glib::translate::*;
use glib::GString;
use SettingsSchemaKey;

glib_wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct SettingsSchema(Shared<gio_sys::GSettingsSchema>);

    match fn {
        ref => |ptr| gio_sys::g_settings_schema_ref(ptr),
        unref => |ptr| gio_sys::g_settings_schema_unref(ptr),
        get_type => || gio_sys::g_settings_schema_get_type(),
    }
}

impl SettingsSchema {
    pub fn get_id(&self) -> Option<GString> {
        unsafe { from_glib_none(gio_sys::g_settings_schema_get_id(self.to_glib_none().0)) }
    }

    pub fn get_key(&self, name: &str) -> Option<SettingsSchemaKey> {
        unsafe {
            from_glib_full(gio_sys::g_settings_schema_get_key(
                self.to_glib_none().0,
                name.to_glib_none().0,
            ))
        }
    }

    pub fn get_path(&self) -> Option<GString> {
        unsafe { from_glib_none(gio_sys::g_settings_schema_get_path(self.to_glib_none().0)) }
    }

    pub fn has_key(&self, name: &str) -> bool {
        unsafe {
            from_glib(gio_sys::g_settings_schema_has_key(
                self.to_glib_none().0,
                name.to_glib_none().0,
            ))
        }
    }

    #[cfg(any(feature = "v2_44", feature = "dox"))]
    pub fn list_children(&self) -> Vec<GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(gio_sys::g_settings_schema_list_children(
                self.to_glib_none().0,
            ))
        }
    }

    #[cfg(any(feature = "v2_46", feature = "dox"))]
    pub fn list_keys(&self) -> Vec<GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(gio_sys::g_settings_schema_list_keys(
                self.to_glib_none().0,
            ))
        }
    }
}