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
// This file was generated by gir (4b09025) from gir-files (71d73f0)
// DO NOT EDIT

use Action;
use ActionGroup;
use ActionMap;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;

glib_wrapper! {
    pub struct SimpleActionGroup(Object<ffi::GSimpleActionGroup>): ActionGroup, ActionMap;

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

impl SimpleActionGroup {
    pub fn new() -> SimpleActionGroup {
        unsafe {
            from_glib_full(ffi::g_simple_action_group_new())
        }
    }
}

pub trait SimpleActionGroupExt {
    //fn add_entries<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, entries: /*Ignored*/&[&ActionEntry], user_data: P);

    fn insert<P: IsA<Action>>(&self, action: &P);

    fn lookup(&self, action_name: &str) -> Option<Action>;

    fn remove(&self, action_name: &str);
}

impl<O: IsA<SimpleActionGroup>> SimpleActionGroupExt for O {
    //fn add_entries<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, entries: /*Ignored*/&[&ActionEntry], user_data: P) {
    //    unsafe { TODO: call ffi::g_simple_action_group_add_entries() }
    //}

    fn insert<P: IsA<Action>>(&self, action: &P) {
        unsafe {
            ffi::g_simple_action_group_insert(self.to_glib_none().0, action.to_glib_none().0);
        }
    }

    fn lookup(&self, action_name: &str) -> Option<Action> {
        unsafe {
            from_glib_none(ffi::g_simple_action_group_lookup(self.to_glib_none().0, action_name.to_glib_none().0))
        }
    }

    fn remove(&self, action_name: &str) {
        unsafe {
            ffi::g_simple_action_group_remove(self.to_glib_none().0, action_name.to_glib_none().0);
        }
    }
}