mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
GDBusActionGroup: add _full variants of activation
This allows the platform_data to be explicitly specified.
This commit is contained in:
parent
e5ed11bcf8
commit
f58df66d4d
@ -2924,6 +2924,10 @@ g_dbus_connection_unexport_action_group
|
||||
GDBusActionGroup
|
||||
g_dbus_action_group_get
|
||||
|
||||
<SUBSECTION>
|
||||
g_dbus_action_group_activate_action_full
|
||||
g_dbus_action_group_change_action_state_full
|
||||
|
||||
<SUBSECTION Standard>
|
||||
G_TYPE_DBUS_ACTION_GROUP
|
||||
G_DBUS_ACTION_GROUP
|
||||
|
@ -369,10 +369,7 @@ g_dbus_action_group_change_state (GActionGroup *g_group,
|
||||
{
|
||||
GDBusActionGroup *group = G_DBUS_ACTION_GROUP (g_group);
|
||||
|
||||
/* Don't bother with the checks. The other side will do it again. */
|
||||
g_dbus_connection_call (group->connection, group->bus_name, group->object_path, "org.gtk.Actions", "SetState",
|
||||
g_variant_new ("(sva{sv})", action_name, value, NULL),
|
||||
NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
|
||||
g_dbus_action_group_change_action_state_full (group, action_name, value, g_variant_new ("a{sv}", NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -381,16 +378,8 @@ g_dbus_action_group_activate (GActionGroup *g_group,
|
||||
GVariant *parameter)
|
||||
{
|
||||
GDBusActionGroup *group = G_DBUS_ACTION_GROUP (g_group);
|
||||
GVariantBuilder builder;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
|
||||
|
||||
if (parameter)
|
||||
g_variant_builder_add (&builder, "v", parameter);
|
||||
|
||||
g_dbus_connection_call (group->connection, group->bus_name, group->object_path, "org.gtk.Actions", "Activate",
|
||||
g_variant_new ("(sava{sv})", action_name, &builder, NULL),
|
||||
NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
|
||||
g_dbus_action_group_activate_action_full (group, action_name, parameter, g_variant_new ("a{sv}", NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -507,3 +496,81 @@ g_dbus_action_group_sync (GDBusActionGroup *group,
|
||||
|
||||
return reply != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_dbus_action_group_activate_action_full:
|
||||
* @action_group: a #GDBusActionGroup
|
||||
* @action_name: the name of the action to activate
|
||||
* @parameter: (allow none): the optional parameter to the activation
|
||||
* @platform_data: the platform data to send
|
||||
*
|
||||
* Activates the remote action.
|
||||
*
|
||||
* This is the same as g_action_group_activate_action() except that it
|
||||
* allows for provision of "platform data" to be sent along with the
|
||||
* activation request. This typically contains details such as the user
|
||||
* interaction timestamp or startup notification information.
|
||||
*
|
||||
* @platform_data must be non-%NULL and must have the type
|
||||
* %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
|
||||
*
|
||||
* Since: 2.32
|
||||
**/
|
||||
void
|
||||
g_dbus_action_group_activate_action_full (GDBusActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *parameter,
|
||||
GVariant *platform_data)
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
|
||||
g_return_if_fail (G_IS_DBUS_ACTION_GROUP (action_group));
|
||||
g_return_if_fail (action_name != NULL);
|
||||
g_return_if_fail (platform_data != NULL);
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
|
||||
|
||||
if (parameter)
|
||||
g_variant_builder_add (&builder, "v", parameter);
|
||||
|
||||
g_dbus_connection_call (action_group->connection, action_group->bus_name, action_group->object_path,
|
||||
"org.gtk.Actions", "Activate",
|
||||
g_variant_new ("(sav@a{sv})", action_name, &builder, platform_data),
|
||||
NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_dbus_action_group_activate_action_full:
|
||||
* @action_group: a #GDBusActionGroup
|
||||
* @action_name: the name of the action to change the state of
|
||||
* @value: the new requested value for the state
|
||||
* @platform_data: the platform data to send
|
||||
*
|
||||
* Changes the state of a remote action.
|
||||
*
|
||||
* This is the same as g_action_group_change_action_state() except that
|
||||
* it allows for provision of "platform data" to be sent along with the
|
||||
* state change request. This typically contains details such as the
|
||||
* user interaction timestamp or startup notification information.
|
||||
*
|
||||
* @platform_data must be non-%NULL and must have the type
|
||||
* %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
|
||||
*
|
||||
* Since: 2.32
|
||||
**/
|
||||
void
|
||||
g_dbus_action_group_change_action_state_full (GDBusActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *value,
|
||||
GVariant *platform_data)
|
||||
{
|
||||
g_return_if_fail (G_IS_DBUS_ACTION_GROUP (action_group));
|
||||
g_return_if_fail (action_name != NULL);
|
||||
g_return_if_fail (value != NULL);
|
||||
g_return_if_fail (platform_data != NULL);
|
||||
|
||||
g_dbus_connection_call (action_group->connection, action_group->bus_name, action_group->object_path,
|
||||
"org.gtk.Actions", "SetState",
|
||||
g_variant_new ("(sv@a{sv})", action_name, value, platform_data),
|
||||
NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
|
||||
}
|
||||
|
@ -49,6 +49,15 @@ GDBusActionGroup * g_dbus_action_group_get (GDBusConn
|
||||
const gchar *bus_name,
|
||||
const gchar *object_path);
|
||||
|
||||
void g_dbus_action_group_activate_action_full (GDBusActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *parameter,
|
||||
GVariant *platform_data);
|
||||
void g_dbus_action_group_change_action_state_full (GDBusActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
GVariant *value,
|
||||
GVariant *platform_data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_DBUS_ACTION_GROUP_H__ */
|
||||
|
@ -1443,6 +1443,8 @@ g_simple_action_set_enabled
|
||||
g_simple_action_set_state
|
||||
g_dbus_action_group_get_type
|
||||
g_dbus_action_group_get
|
||||
g_dbus_action_group_activate_action_full
|
||||
g_dbus_action_group_change_action_state_full
|
||||
g_dbus_menu_model_get_type
|
||||
g_dbus_menu_model_get
|
||||
g_dbus_connection_export_action_group
|
||||
|
Loading…
Reference in New Issue
Block a user