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
// 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 crate::ActionGroup;
use crate::DBusConnection;
use crate::RemoteActionGroup;
use glib::translate::*;
use std::fmt;
glib::wrapper! {
/// [`DBusActionGroup`][crate::DBusActionGroup] is an implementation of the [`ActionGroup`][crate::ActionGroup]
/// interface that can be used as a proxy for an action group
/// that is exported over D-Bus with [`DBusConnection::export_action_group()`][crate::DBusConnection::export_action_group()].
///
/// # Implements
///
/// [`trait@glib::ObjectExt`], [`ActionGroupExt`][trait@crate::prelude::ActionGroupExt], [`RemoteActionGroupExt`][trait@crate::prelude::RemoteActionGroupExt]
#[doc(alias = "GDBusActionGroup")]
pub struct DBusActionGroup(Object<ffi::GDBusActionGroup>) @implements ActionGroup, RemoteActionGroup;
match fn {
type_ => || ffi::g_dbus_action_group_get_type(),
}
}
impl DBusActionGroup {
/// Obtains a [`DBusActionGroup`][crate::DBusActionGroup] for the action group which is exported at
/// the given `bus_name` and `object_path`.
///
/// The thread default main context is taken at the time of this call.
/// All signals on the menu model (and any linked models) are reported
/// with respect to this context. All calls on the returned menu model
/// (and linked models) must also originate from this same context, with
/// the thread default main context unchanged.
///
/// This call is non-blocking. The returned action group may or may not
/// already be filled in. The correct thing to do is connect the signals
/// for the action group to monitor for changes and then to call
/// [`ActionGroupExt::list_actions()`][crate::prelude::ActionGroupExt::list_actions()] to get the initial list.
/// ## `connection`
/// A [`DBusConnection`][crate::DBusConnection]
/// ## `bus_name`
/// the bus name which exports the action
/// group or [`None`] if `connection` is not a message bus connection
/// ## `object_path`
/// the object path at which the action group is exported
///
/// # Returns
///
/// a [`DBusActionGroup`][crate::DBusActionGroup]
#[doc(alias = "g_dbus_action_group_get")]
pub fn get(
connection: &DBusConnection,
bus_name: Option<&str>,
object_path: &str,
) -> DBusActionGroup {
unsafe {
from_glib_full(ffi::g_dbus_action_group_get(
connection.to_glib_none().0,
bus_name.to_glib_none().0,
object_path.to_glib_none().0,
))
}
}
}
impl fmt::Display for DBusActionGroup {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("DBusActionGroup")
}
}