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
// 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::object::IsA;
use glib::translate::*;
use std::fmt;

glib_wrapper! {
    pub struct SettingsBackend(Object<gio_sys::GSettingsBackend, gio_sys::GSettingsBackendClass, SettingsBackendClass>);

    match fn {
        get_type => || gio_sys::g_settings_backend_get_type(),
    }
}

impl SettingsBackend {
    //pub fn flatten_tree(tree: /*Ignored*/&glib::Tree) -> (GString, Vec<GString>, Vec<glib::Variant>) {
    //    unsafe { TODO: call gio_sys:g_settings_backend_flatten_tree() }
    //}

    pub fn get_default() -> Option<SettingsBackend> {
        unsafe { from_glib_full(gio_sys::g_settings_backend_get_default()) }
    }
}

pub const NONE_SETTINGS_BACKEND: Option<&SettingsBackend> = None;

pub trait SettingsBackendExt: 'static {
    //fn changed(&self, key: &str, origin_tag: /*Unimplemented*/Option<Fundamental: Pointer>);

    //fn changed_tree(&self, tree: /*Ignored*/&glib::Tree, origin_tag: /*Unimplemented*/Option<Fundamental: Pointer>);

    //fn keys_changed(&self, path: &str, items: &[&str], origin_tag: /*Unimplemented*/Option<Fundamental: Pointer>);

    //fn path_changed(&self, path: &str, origin_tag: /*Unimplemented*/Option<Fundamental: Pointer>);

    fn path_writable_changed(&self, path: &str);

    fn writable_changed(&self, key: &str);
}

impl<O: IsA<SettingsBackend>> SettingsBackendExt for O {
    //fn changed(&self, key: &str, origin_tag: /*Unimplemented*/Option<Fundamental: Pointer>) {
    //    unsafe { TODO: call gio_sys:g_settings_backend_changed() }
    //}

    //fn changed_tree(&self, tree: /*Ignored*/&glib::Tree, origin_tag: /*Unimplemented*/Option<Fundamental: Pointer>) {
    //    unsafe { TODO: call gio_sys:g_settings_backend_changed_tree() }
    //}

    //fn keys_changed(&self, path: &str, items: &[&str], origin_tag: /*Unimplemented*/Option<Fundamental: Pointer>) {
    //    unsafe { TODO: call gio_sys:g_settings_backend_keys_changed() }
    //}

    //fn path_changed(&self, path: &str, origin_tag: /*Unimplemented*/Option<Fundamental: Pointer>) {
    //    unsafe { TODO: call gio_sys:g_settings_backend_path_changed() }
    //}

    fn path_writable_changed(&self, path: &str) {
        unsafe {
            gio_sys::g_settings_backend_path_writable_changed(
                self.as_ref().to_glib_none().0,
                path.to_glib_none().0,
            );
        }
    }

    fn writable_changed(&self, key: &str) {
        unsafe {
            gio_sys::g_settings_backend_writable_changed(
                self.as_ref().to_glib_none().0,
                key.to_glib_none().0,
            );
        }
    }
}

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