forked from AuroraMiddleware/gtk
widget: Make gtk_widget_activate_action() return TRUE/FALSE
TRUE if an action was successfully activated, FALSE if it wasn't found.
This commit is contained in:
parent
1b68e76852
commit
01be7f0666
@ -12444,8 +12444,11 @@ gtk_widget_get_template_child (GtkWidget *widget,
|
||||
*
|
||||
* The arguments must match the actions expected parameter
|
||||
* type, as returned by g_action_get_parameter_type().
|
||||
*
|
||||
* Returns: %TRUE if the action was activated, %FALSE if the action does
|
||||
* not exist.
|
||||
*/
|
||||
void
|
||||
gboolean
|
||||
gtk_widget_activate_action_variant (GtkWidget *widget,
|
||||
const char *name,
|
||||
GVariant *args)
|
||||
@ -12453,8 +12456,15 @@ gtk_widget_activate_action_variant (GtkWidget *widget,
|
||||
GtkActionMuxer *muxer;
|
||||
|
||||
muxer = _gtk_widget_get_action_muxer (widget, FALSE);
|
||||
if (muxer)
|
||||
g_action_group_activate_action (G_ACTION_GROUP (muxer), name, args);
|
||||
if (muxer == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!g_action_group_has_action (G_ACTION_GROUP (muxer), name))
|
||||
return FALSE;
|
||||
|
||||
g_action_group_activate_action (G_ACTION_GROUP (muxer), name, args);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -12470,14 +12480,18 @@ gtk_widget_activate_action_variant (GtkWidget *widget,
|
||||
*
|
||||
* This is a wrapper around gtk_widget_activate_action_variant()
|
||||
* that constructs the @args variant according to @format_string.
|
||||
*
|
||||
* Returns: %TRUE if the action was activated, %FALSE if the action does
|
||||
* not exist.
|
||||
*/
|
||||
void
|
||||
gboolean
|
||||
gtk_widget_activate_action (GtkWidget *widget,
|
||||
const char *name,
|
||||
const char *format_string,
|
||||
...)
|
||||
{
|
||||
GVariant *parameters = NULL;
|
||||
gboolean result;
|
||||
|
||||
if (format_string != NULL)
|
||||
{
|
||||
@ -12490,9 +12504,11 @@ gtk_widget_activate_action (GtkWidget *widget,
|
||||
g_variant_ref_sink (parameters);
|
||||
}
|
||||
|
||||
gtk_widget_activate_action_variant (widget, name, parameters);
|
||||
result = gtk_widget_activate_action_variant (widget, name, parameters);
|
||||
|
||||
g_clear_pointer (¶meters, g_variant_unref);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -972,17 +972,17 @@ void gtk_widget_insert_action_group (GtkWidget *widget,
|
||||
GActionGroup *group);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_activate_action (GtkWidget *widget,
|
||||
gboolean gtk_widget_activate_action (GtkWidget *widget,
|
||||
const char *name,
|
||||
const char *format_string,
|
||||
...);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_activate_action_variant (GtkWidget *widget,
|
||||
gboolean gtk_widget_activate_action_variant (GtkWidget *widget,
|
||||
const char *name,
|
||||
GVariant *args);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_activate_default (GtkWidget *widget);
|
||||
void gtk_widget_activate_default (GtkWidget *widget);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_set_font_map (GtkWidget *widget,
|
||||
|
Loading…
Reference in New Issue
Block a user