/** * gtk_actionable_set_action_target: * @actionable: a #GtkActionable widget * @format_string: a GVariant format string * @...: arguments appropriate for @format_string * * Sets the target of an actionable widget. * * This is a convenience function that calls g_variant_new() for * @format_string and uses the result to call * gtk_actionable_set_action_target_value(). * * If you are setting a string-valued target and want to set the action * name at the same time, you can use * gtk_actionable_set_detailed_action_name (). * * Since: 3.4 **/ void gtk_actionable_set_action_target (GtkActionable *actionable, const gchar *format_string, ...) { va_list ap; va_start (ap, format_string); gtk_actionable_set_action_target_value (actionable, g_variant_new_va (format_string, NULL, &ap)); va_end (ap); }
/** * g_notification_set_default_action_and_target: (skip) * @notification: a #GNotification * @action: an action name * @target_format: (allow-none): a #GVariant format string, or %NULL * @...: positional parameters, as determined by @target_format * * Sets the default action of @notification to @action. This action is * activated when the notification is clicked on. It must be an * application-wide action (it must start with "app."). * * If @target_format is given, it is used to collect remaining * positional parameters into a #GVariant instance, similar to * g_variant_new(). @action will be activated with that #GVariant as its * parameter. * * When no default action is set, the application that the notification * was sent on is activated. * * Since: 2.40 */ void g_notification_set_default_action_and_target (GNotification *notification, const gchar *action, const gchar *target_format, ...) { va_list args; GVariant *target = NULL; if (target_format) { va_start (args, target_format); target = g_variant_new_va (target_format, NULL, &args); va_end (args); } g_notification_set_default_action_and_target_value (notification, action, target); }
/** * g_notification_add_button_with_target: (skip) * @notification: a #GNotification * @label: label of the button * @action: an action name * @target_format: (allow-none): a #GVariant format string, or %NULL * @...: positional parameters, as determined by @target_format * * Adds a button to @notification that activates @action when clicked. * @action must be an application-wide action (it must start with "app."). * * If @target_format is given, it is used to collect remaining * positional parameters into a #GVariant instance, similar to * g_variant_new(). @action will be activated with that #GVariant as its * parameter. * * Since: 2.40 */ void g_notification_add_button_with_target (GNotification *notification, const gchar *label, const gchar *action, const gchar *target_format, ...) { va_list args; GVariant *target = NULL; if (target_format) { va_start (args, target_format); target = g_variant_new_va (target_format, NULL, &args); va_end (args); } g_notification_add_button_with_target_value (notification, label, action, target); }
gboolean eas_gdbus_call (struct eas_gdbus_client *client, const gchar *object, const gchar *interface, const gchar *method, EasProgressFn progress_fn, gpointer progress_data, const gchar *in_params, const gchar *out_params, GCancellable *cancellable, GError **error, ...) { GDBusMessage *message; struct _eas_call_data call; GMainContext *ctxt; GVariant *v = NULL; va_list ap; gboolean success; guint cancel_handler_id; guint32 serial = 0; va_start (ap, error); message = g_dbus_message_new_method_call (EAS_SERVICE_NAME, object, interface, method); v = g_variant_new_va (in_params, NULL, &ap); g_dbus_message_set_body (message, v); call.cancelled = FALSE; call.result = NULL; ctxt = g_main_context_new (); call.loop = g_main_loop_new (ctxt, FALSE); g_main_context_push_thread_default (ctxt); g_dbus_connection_send_message_with_reply (client->connection, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, 1000000, &serial, cancellable, _call_done, (gpointer) &call); g_object_unref (message); if (cancellable) cancel_handler_id = g_cancellable_connect (cancellable, G_CALLBACK (_call_cancel), (gpointer) &call, NULL); /* Ignore error; it's not the end of the world if progress info is lost, and it should never happen anyway */ if (progress_fn) eas_client_add_progress_info_to_table (client, serial, progress_fn, progress_data, NULL); g_main_loop_run (call.loop); if (cancellable) g_cancellable_disconnect (cancellable, cancel_handler_id); success = eas_gdbus_call_finish (client, call.result, call.cancelled ? serial : 0, out_params, &ap, error); if (serial && progress_fn) { EasProgressCallbackInfo *cbinfo; g_mutex_lock (client->progress_lock); cbinfo = g_hash_table_lookup (client->progress_fns_table, GUINT_TO_POINTER (serial)); if (cbinfo && cbinfo->calling) { g_debug ("Progress for call %u is running; wait for it to complete", serial); g_hash_table_steal (client->progress_fns_table, GUINT_TO_POINTER (serial)); do { g_cond_wait (client->progress_cond, client->progress_lock); } while (cbinfo->calling); g_free (cbinfo); } else if (cbinfo) { g_hash_table_remove (client->progress_fns_table, GUINT_TO_POINTER (serial)); } g_mutex_unlock (client->progress_lock); } va_end (ap); g_main_context_pop_thread_default (ctxt); g_main_context_unref (ctxt); g_main_loop_unref (call.loop); g_object_unref (call.result); return success; }