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
// 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::{DBusConnection, MenuModel};
use glib::translate::*;

glib::wrapper! {
    /// `GDBusMenuModel` is an implementation of [`MenuModel`][crate::MenuModel] that can be
    /// used as a proxy for a menu model that is exported over D-Bus with
    /// [`DBusConnection::export_menu_model()`][crate::DBusConnection::export_menu_model()].
    ///
    /// # Implements
    ///
    /// [`MenuModelExt`][trait@crate::prelude::MenuModelExt], [`trait@glib::ObjectExt`]
    #[doc(alias = "GDBusMenuModel")]
    pub struct DBusMenuModel(Object<ffi::GDBusMenuModel>) @extends MenuModel;

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

impl DBusMenuModel {
    /// Obtains a #GDBusMenuModel for the menu model 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.
    /// ## `connection`
    /// a #GDBusConnection
    /// ## `bus_name`
    /// the bus name which exports the menu model
    ///     or [`None`] if @connection is not a message bus connection
    /// ## `object_path`
    /// the object path at which the menu model is exported
    ///
    /// # Returns
    ///
    /// a #GDBusMenuModel object. Free with
    ///     g_object_unref().
    #[doc(alias = "g_dbus_menu_model_get")]
    pub fn get(
        connection: &DBusConnection,
        bus_name: Option<&str>,
        object_path: &str,
    ) -> DBusMenuModel {
        unsafe {
            from_glib_full(ffi::g_dbus_menu_model_get(
                connection.to_glib_none().0,
                bus_name.to_glib_none().0,
                object_path.to_glib_none().0,
            ))
        }
    }
}