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