gio/auto/
settings_schema.rs

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
5use gio_sys;
6use glib::translate::*;
7use glib::GString;
8use SettingsSchemaKey;
9
10glib_wrapper! {
11    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
12    pub struct SettingsSchema(Shared<gio_sys::GSettingsSchema>);
13
14    match fn {
15        ref => |ptr| gio_sys::g_settings_schema_ref(ptr),
16        unref => |ptr| gio_sys::g_settings_schema_unref(ptr),
17        get_type => || gio_sys::g_settings_schema_get_type(),
18    }
19}
20
21impl SettingsSchema {
22    pub fn get_id(&self) -> Option<GString> {
23        unsafe { from_glib_none(gio_sys::g_settings_schema_get_id(self.to_glib_none().0)) }
24    }
25
26    pub fn get_key(&self, name: &str) -> Option<SettingsSchemaKey> {
27        unsafe {
28            from_glib_full(gio_sys::g_settings_schema_get_key(
29                self.to_glib_none().0,
30                name.to_glib_none().0,
31            ))
32        }
33    }
34
35    pub fn get_path(&self) -> Option<GString> {
36        unsafe { from_glib_none(gio_sys::g_settings_schema_get_path(self.to_glib_none().0)) }
37    }
38
39    pub fn has_key(&self, name: &str) -> bool {
40        unsafe {
41            from_glib(gio_sys::g_settings_schema_has_key(
42                self.to_glib_none().0,
43                name.to_glib_none().0,
44            ))
45        }
46    }
47
48    #[cfg(any(feature = "v2_44", feature = "dox"))]
49    pub fn list_children(&self) -> Vec<GString> {
50        unsafe {
51            FromGlibPtrContainer::from_glib_full(gio_sys::g_settings_schema_list_children(
52                self.to_glib_none().0,
53            ))
54        }
55    }
56
57    #[cfg(any(feature = "v2_46", feature = "dox"))]
58    pub fn list_keys(&self) -> Vec<GString> {
59        unsafe {
60            FromGlibPtrContainer::from_glib_full(gio_sys::g_settings_schema_list_keys(
61                self.to_glib_none().0,
62            ))
63        }
64    }
65}