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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::ffi;
use glib::{prelude::*, translate::*};

glib::wrapper! {
    ///
    ///
    /// # Implements
    ///
    /// [`trait@glib::ObjectExt`], [`trait@gio::prelude::ActionGroupExt`]
    #[doc(alias = "PanelActionMuxer")]
    pub struct ActionMuxer(Object<ffi::PanelActionMuxer, ffi::PanelActionMuxerClass>) @implements gio::ActionGroup;

    match fn {
        type_ => || ffi::panel_action_muxer_get_type(),
    }
}

impl ActionMuxer {
    #[doc(alias = "panel_action_muxer_new")]
    pub fn new() -> ActionMuxer {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::panel_action_muxer_new()) }
    }

    /// Locates the [`gio::ActionGroup`][crate::gio::ActionGroup] inserted as `prefix`.
    ///
    /// If no group was found matching `group`, [`None`] is returned.
    /// ## `prefix`
    /// the name of the inserted action group
    ///
    /// # Returns
    ///
    /// a [`gio::ActionGroup`][crate::gio::ActionGroup] matching `prefix` if
    ///  found, otherwise [`None`].
    #[doc(alias = "panel_action_muxer_get_action_group")]
    #[doc(alias = "get_action_group")]
    pub fn action_group(&self, prefix: &str) -> Option<gio::ActionGroup> {
        unsafe {
            from_glib_none(ffi::panel_action_muxer_get_action_group(
                self.to_glib_none().0,
                prefix.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "panel_action_muxer_insert_action_group")]
    pub fn insert_action_group(&self, prefix: &str, action_group: &impl IsA<gio::ActionGroup>) {
        unsafe {
            ffi::panel_action_muxer_insert_action_group(
                self.to_glib_none().0,
                prefix.to_glib_none().0,
                action_group.as_ref().to_glib_none().0,
            );
        }
    }

    /// Gets a list of group names in the muxer.
    ///
    /// # Returns
    ///
    ///
    ///  an array containing the names of groups within the muxer
    #[doc(alias = "panel_action_muxer_list_groups")]
    pub fn list_groups(&self) -> Vec<glib::GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::panel_action_muxer_list_groups(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "panel_action_muxer_remove_action_group")]
    pub fn remove_action_group(&self, prefix: &str) {
        unsafe {
            ffi::panel_action_muxer_remove_action_group(
                self.to_glib_none().0,
                prefix.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "panel_action_muxer_remove_all")]
    pub fn remove_all(&self) {
        unsafe {
            ffi::panel_action_muxer_remove_all(self.to_glib_none().0);
        }
    }
}

impl Default for ActionMuxer {
    fn default() -> Self {
        Self::new()
    }
}