diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 8f3d7a9f02..6d93fc0ebf 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4633,7 +4633,7 @@ GtkWidgetActionActivateFunc gtk_widget_class_install_action gtk_widget_class_install_property_action gtk_widget_class_query_action -gtk_widget_action_enabled_changed +gtk_widget_action_set_enabled GTK_WIDGET diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 4c9c09a1f9..6c867eed71 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -6073,11 +6073,11 @@ gtk_label_update_actions (GtkLabel *label) else link = gtk_label_get_focus_link (label); - gtk_widget_action_enabled_changed (widget, "clipboard.copy", has_selection); - gtk_widget_action_enabled_changed (widget, "selection.select-all", - gtk_label_get_selectable (label)); - gtk_widget_action_enabled_changed (widget, "link.open", !has_selection && link); - gtk_widget_action_enabled_changed (widget, "link.copy", !has_selection && link); + gtk_widget_action_set_enabled (widget, "clipboard.copy", has_selection); + gtk_widget_action_set_enabled (widget, "selection.select-all", + gtk_label_get_selectable (label)); + gtk_widget_action_set_enabled (widget, "link.open", !has_selection && link); + gtk_widget_action_set_enabled (widget, "link.copy", !has_selection && link); } static GMenuModel * diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 7e91178259..d150dd21e4 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -5723,24 +5723,24 @@ gtk_text_update_clipboard_actions (GtkText *self) has_content = priv->buffer && (gtk_entry_buffer_get_length (priv->buffer) > 0); visible = mode == DISPLAY_NORMAL; - gtk_widget_action_enabled_changed (GTK_WIDGET (self), "clipboard.cut", - visible && priv->editable && has_selection); - gtk_widget_action_enabled_changed (GTK_WIDGET (self), "clipboard.copy", - visible && has_selection); - gtk_widget_action_enabled_changed (GTK_WIDGET (self), "clipboard.paste", - priv->editable && has_clipboard); + gtk_widget_action_set_enabled (GTK_WIDGET (self), "clipboard.cut", + visible && priv->editable && has_selection); + gtk_widget_action_set_enabled (GTK_WIDGET (self), "clipboard.copy", + visible && has_selection); + gtk_widget_action_set_enabled (GTK_WIDGET (self), "clipboard.paste", + priv->editable && has_clipboard); - gtk_widget_action_enabled_changed (GTK_WIDGET (self), "selection.delete", - priv->editable && has_selection); - gtk_widget_action_enabled_changed (GTK_WIDGET (self), "selection.select-all", - has_content); + gtk_widget_action_set_enabled (GTK_WIDGET (self), "selection.delete", + priv->editable && has_selection); + gtk_widget_action_set_enabled (GTK_WIDGET (self), "selection.select-all", + has_content); } static void gtk_text_update_emoji_action (GtkText *self) { - gtk_widget_action_enabled_changed (GTK_WIDGET (self), "misc.insert-emoji", - (gtk_text_get_input_hints (self) & GTK_INPUT_HINT_NO_EMOJI) == 0); + gtk_widget_action_set_enabled (GTK_WIDGET (self), "misc.insert-emoji", + (gtk_text_get_input_hints (self) & GTK_INPUT_HINT_NO_EMOJI) == 0); } static GMenuModel * diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 1c6e780b95..415c5ab5f4 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -8583,25 +8583,25 @@ gtk_text_view_update_clipboard_actions (GtkTextView *text_view) can_insert = gtk_text_iter_can_insert (&iter, priv->editable); - gtk_widget_action_enabled_changed (GTK_WIDGET (text_view), "clipboard.cut", - have_selection && - range_contains_editable_text (&sel_start, &sel_end, priv->editable)); - gtk_widget_action_enabled_changed (GTK_WIDGET (text_view), "clipboard.copy", - have_selection); - gtk_widget_action_enabled_changed (GTK_WIDGET (text_view), "clipboard.paste", - can_insert && can_paste); - gtk_widget_action_enabled_changed (GTK_WIDGET (text_view), "selection.delete", - have_selection && - range_contains_editable_text (&sel_start, &sel_end, priv->editable)); - gtk_widget_action_enabled_changed (GTK_WIDGET (text_view), "selection.select-all", - gtk_text_buffer_get_char_count (priv->buffer) > 0); + gtk_widget_action_set_enabled (GTK_WIDGET (text_view), "clipboard.cut", + have_selection && + range_contains_editable_text (&sel_start, &sel_end, priv->editable)); + gtk_widget_action_set_enabled (GTK_WIDGET (text_view), "clipboard.copy", + have_selection); + gtk_widget_action_set_enabled (GTK_WIDGET (text_view), "clipboard.paste", + can_insert && can_paste); + gtk_widget_action_set_enabled (GTK_WIDGET (text_view), "selection.delete", + have_selection && + range_contains_editable_text (&sel_start, &sel_end, priv->editable)); + gtk_widget_action_set_enabled (GTK_WIDGET (text_view), "selection.select-all", + gtk_text_buffer_get_char_count (priv->buffer) > 0); } static void gtk_text_view_update_emoji_action (GtkTextView *text_view) { - gtk_widget_action_enabled_changed (GTK_WIDGET (text_view), "misc.insert-emoji", - (gtk_text_view_get_input_hints (text_view) & GTK_INPUT_HINT_NO_EMOJI) == 0); + gtk_widget_action_set_enabled (GTK_WIDGET (text_view), "misc.insert-emoji", + (gtk_text_view_get_input_hints (text_view) & GTK_INPUT_HINT_NO_EMOJI) == 0); } static GMenuModel * diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 926d61fa00..d1394613f6 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -13567,19 +13567,18 @@ gtk_widget_class_install_property_action (GtkWidgetClass *widget_class, } /** - * gtk_widget_action_enabled_changed: + * gtk_widget_action_set_enabled: * @widget: a #GtkWidget * @action_name: action name, such as "clipboard.paste" * @enabled: whether the action is now enabled * - * Notify when an action installed with - * gtk_widget_class_install_action() changes its - * enabled state. + * Enable or disable an action installed with + * gtk_widget_class_install_action(). */ void -gtk_widget_action_enabled_changed (GtkWidget *widget, - const char *action_name, - gboolean enabled) +gtk_widget_action_set_enabled (GtkWidget *widget, + const char *action_name, + gboolean enabled) { GtkActionMuxer *muxer; diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index a9b1434f27..11ffe96a6b 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -1058,9 +1058,9 @@ gboolean gtk_widget_class_query_action (GtkWidgetClass *widg const GVariantType **state_type); GDK_AVAILABLE_IN_ALL -void gtk_widget_action_enabled_changed (GtkWidget *widget, - const char *action_name, - gboolean enabled); +void gtk_widget_action_set_enabled (GtkWidget *widget, + const char *action_name, + gboolean enabled); G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)