Skip to main content

gio/auto/
remote_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::{ActionGroup, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    ///  [`glib::Variant`][struct@crate::glib::Variant] to be specified: a dictionary providing
10    /// context for the action invocation (for example: timestamps, startup
11    /// notification IDs, etc).
12    ///
13    /// [`DBusActionGroup`][crate::DBusActionGroup] implements `GRemoteActionGroup`.  This provides a
14    /// mechanism to send platform data for action invocations over D-Bus.
15    ///
16    /// Additionally, [`DBusConnection::export_action_group()`][crate::DBusConnection::export_action_group()] will check if
17    /// the exported [`ActionGroup`][crate::ActionGroup] implements `GRemoteActionGroup` and use
18    /// the `_full` variants of the calls if available.  This
19    /// provides a mechanism by which to receive platform data for action
20    /// invocations that arrive by way of D-Bus.
21    ///
22    /// # Implements
23    ///
24    /// [`RemoteActionGroupExt`][trait@crate::prelude::RemoteActionGroupExt], [`ActionGroupExt`][trait@crate::prelude::ActionGroupExt]
25    #[doc(alias = "GRemoteActionGroup")]
26    pub struct RemoteActionGroup(Interface<ffi::GRemoteActionGroup, ffi::GRemoteActionGroupInterface>) @requires ActionGroup;
27
28    match fn {
29        type_ => || ffi::g_remote_action_group_get_type(),
30    }
31}
32
33impl RemoteActionGroup {
34    pub const NONE: Option<&'static RemoteActionGroup> = None;
35}
36
37/// Trait containing all [`struct@RemoteActionGroup`] methods.
38///
39/// # Implementors
40///
41/// [`DBusActionGroup`][struct@crate::DBusActionGroup], [`RemoteActionGroup`][struct@crate::RemoteActionGroup]
42pub trait RemoteActionGroupExt: IsA<RemoteActionGroup> + 'static {
43    /// Activates the remote action.
44    ///
45    /// This is the same as g_action_group_activate_action() except that it
46    /// allows for provision of "platform data" to be sent along with the
47    /// activation request.  This typically contains details such as the user
48    /// interaction timestamp or startup notification information.
49    ///
50    /// @platform_data must be non-[`None`] and must have the type
51    /// `G_VARIANT_TYPE_VARDICT`.  If it is floating, it will be consumed.
52    /// ## `action_name`
53    /// the name of the action to activate
54    /// ## `parameter`
55    /// the optional parameter to the activation
56    /// ## `platform_data`
57    /// the platform data to send
58    #[doc(alias = "g_remote_action_group_activate_action_full")]
59    fn activate_action_full(
60        &self,
61        action_name: &str,
62        parameter: Option<&glib::Variant>,
63        platform_data: &glib::Variant,
64    ) {
65        unsafe {
66            ffi::g_remote_action_group_activate_action_full(
67                self.as_ref().to_glib_none().0,
68                action_name.to_glib_none().0,
69                parameter.to_glib_none().0,
70                platform_data.to_glib_none().0,
71            );
72        }
73    }
74
75    /// Changes the state of a remote action.
76    ///
77    /// This is the same as g_action_group_change_action_state() except that
78    /// it allows for provision of "platform data" to be sent along with the
79    /// state change request.  This typically contains details such as the
80    /// user interaction timestamp or startup notification information.
81    ///
82    /// @platform_data must be non-[`None`] and must have the type
83    /// `G_VARIANT_TYPE_VARDICT`.  If it is floating, it will be consumed.
84    /// ## `action_name`
85    /// the name of the action to change the state of
86    /// ## `value`
87    /// the new requested value for the state
88    /// ## `platform_data`
89    /// the platform data to send
90    #[doc(alias = "g_remote_action_group_change_action_state_full")]
91    fn change_action_state_full(
92        &self,
93        action_name: &str,
94        value: &glib::Variant,
95        platform_data: &glib::Variant,
96    ) {
97        unsafe {
98            ffi::g_remote_action_group_change_action_state_full(
99                self.as_ref().to_glib_none().0,
100                action_name.to_glib_none().0,
101                value.to_glib_none().0,
102                platform_data.to_glib_none().0,
103            );
104        }
105    }
106}
107
108impl<O: IsA<RemoteActionGroup>> RemoteActionGroupExt for O {}