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
46/// Trait containing all [`struct@RemoteActionGroup`] methods.
47///
48/// # Implementors
49///
50/// [`DBusActionGroup`][struct@crate::DBusActionGroup], [`RemoteActionGroup`][struct@crate::RemoteActionGroup]
51pub trait RemoteActionGroupExt: IsA<RemoteActionGroup> + 'static {
52    /// Activates the remote action.
53    ///
54    /// This is the same as g_action_group_activate_action() except that it
55    /// allows for provision of "platform data" to be sent along with the
56    /// activation request.  This typically contains details such as the user
57    /// interaction timestamp or startup notification information.
58    ///
59    /// @platform_data must be non-[`None`] and must have the type
60    /// `G_VARIANT_TYPE_VARDICT`.  If it is floating, it will be consumed.
61    /// ## `action_name`
62    /// the name of the action to activate
63    /// ## `parameter`
64    /// the optional parameter to the activation
65    /// ## `platform_data`
66    /// the platform data to send
67    #[doc(alias = "g_remote_action_group_activate_action_full")]
68    fn activate_action_full(
69        &self,
70        action_name: &str,
71        parameter: Option<&glib::Variant>,
72        platform_data: &glib::Variant,
73    ) {
74        unsafe {
75            ffi::g_remote_action_group_activate_action_full(
76                self.as_ref().to_glib_none().0,
77                action_name.to_glib_none().0,
78                parameter.to_glib_none().0,
79                platform_data.to_glib_none().0,
80            );
81        }
82    }
83
84    /// Changes the state of a remote action.
85    ///
86    /// This is the same as g_action_group_change_action_state() except that
87    /// it allows for provision of "platform data" to be sent along with the
88    /// state change request.  This typically contains details such as the
89    /// user interaction timestamp or startup notification information.
90    ///
91    /// @platform_data must be non-[`None`] and must have the type
92    /// `G_VARIANT_TYPE_VARDICT`.  If it is floating, it will be consumed.
93    /// ## `action_name`
94    /// the name of the action to change the state of
95    /// ## `value`
96    /// the new requested value for the state
97    /// ## `platform_data`
98    /// the platform data to send
99    #[doc(alias = "g_remote_action_group_change_action_state_full")]
100    fn change_action_state_full(
101        &self,
102        action_name: &str,
103        value: &glib::Variant,
104        platform_data: &glib::Variant,
105    ) {
106        unsafe {
107            ffi::g_remote_action_group_change_action_state_full(
108                self.as_ref().to_glib_none().0,
109                action_name.to_glib_none().0,
110                value.to_glib_none().0,
111                platform_data.to_glib_none().0,
112            );
113        }
114    }
115}
116
117impl<O: IsA<RemoteActionGroup>> RemoteActionGroupExt for O {}