gio/auto/
dbus_action_group.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 crate::{ffi, ActionGroup, DBusConnection, RemoteActionGroup};
6use glib::translate::*;
7
8glib::wrapper! {
9    /// `GDBusActionGroup` is an implementation of the [`ActionGroup`][crate::ActionGroup]
10    /// interface.
11    ///
12    /// `GDBusActionGroup` can be used as a proxy for an action group
13    /// that is exported over D-Bus with [`DBusConnection::export_action_group()`][crate::DBusConnection::export_action_group()].
14    ///
15    /// # Implements
16    ///
17    /// [`trait@glib::ObjectExt`], [`ActionGroupExt`][trait@crate::prelude::ActionGroupExt], [`RemoteActionGroupExt`][trait@crate::prelude::RemoteActionGroupExt]
18    #[doc(alias = "GDBusActionGroup")]
19    pub struct DBusActionGroup(Object<ffi::GDBusActionGroup>) @implements ActionGroup, RemoteActionGroup;
20
21    match fn {
22        type_ => || ffi::g_dbus_action_group_get_type(),
23    }
24}
25
26impl DBusActionGroup {
27    /// Obtains a #GDBusActionGroup for the action group which is exported at
28    /// the given @bus_name and @object_path.
29    ///
30    /// The thread default main context is taken at the time of this call.
31    /// All signals on the menu model (and any linked models) are reported
32    /// with respect to this context.  All calls on the returned menu model
33    /// (and linked models) must also originate from this same context, with
34    /// the thread default main context unchanged.
35    ///
36    /// This call is non-blocking.  The returned action group may or may not
37    /// already be filled in.  The correct thing to do is connect the signals
38    /// for the action group to monitor for changes and then to call
39    /// g_action_group_list_actions() to get the initial list.
40    /// ## `connection`
41    /// A #GDBusConnection
42    /// ## `bus_name`
43    /// the bus name which exports the action
44    ///     group or [`None`] if @connection is not a message bus connection
45    /// ## `object_path`
46    /// the object path at which the action group is exported
47    ///
48    /// # Returns
49    ///
50    /// a #GDBusActionGroup
51    #[doc(alias = "g_dbus_action_group_get")]
52    pub fn get(
53        connection: &DBusConnection,
54        bus_name: Option<&str>,
55        object_path: &str,
56    ) -> DBusActionGroup {
57        unsafe {
58            from_glib_full(ffi::g_dbus_action_group_get(
59                connection.to_glib_none().0,
60                bus_name.to_glib_none().0,
61                object_path.to_glib_none().0,
62            ))
63        }
64    }
65}