gio/auto/
dbus_menu_model.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, DBusConnection, MenuModel};
6use glib::translate::*;
7
8glib::wrapper! {
9    /// `GDBusMenuModel` is an implementation of [`MenuModel`][crate::MenuModel] that can be
10    /// used as a proxy for a menu model that is exported over D-Bus with
11    /// [`DBusConnection::export_menu_model()`][crate::DBusConnection::export_menu_model()].
12    ///
13    /// # Implements
14    ///
15    /// [`MenuModelExt`][trait@crate::prelude::MenuModelExt], [`trait@glib::ObjectExt`]
16    #[doc(alias = "GDBusMenuModel")]
17    pub struct DBusMenuModel(Object<ffi::GDBusMenuModel>) @extends MenuModel;
18
19    match fn {
20        type_ => || ffi::g_dbus_menu_model_get_type(),
21    }
22}
23
24impl DBusMenuModel {
25    /// Obtains a #GDBusMenuModel for the menu model which is exported
26    /// at the given @bus_name and @object_path.
27    ///
28    /// The thread default main context is taken at the time of this call.
29    /// All signals on the menu model (and any linked models) are reported
30    /// with respect to this context.  All calls on the returned menu model
31    /// (and linked models) must also originate from this same context, with
32    /// the thread default main context unchanged.
33    /// ## `connection`
34    /// a #GDBusConnection
35    /// ## `bus_name`
36    /// the bus name which exports the menu model
37    ///     or [`None`] if @connection is not a message bus connection
38    /// ## `object_path`
39    /// the object path at which the menu model is exported
40    ///
41    /// # Returns
42    ///
43    /// a #GDBusMenuModel object. Free with
44    ///     g_object_unref().
45    #[doc(alias = "g_dbus_menu_model_get")]
46    pub fn get(
47        connection: &DBusConnection,
48        bus_name: Option<&str>,
49        object_path: &str,
50    ) -> DBusMenuModel {
51        unsafe {
52            from_glib_full(ffi::g_dbus_menu_model_get(
53                connection.to_glib_none().0,
54                bus_name.to_glib_none().0,
55                object_path.to_glib_none().0,
56            ))
57        }
58    }
59}