forked from AuroraMiddleware/gtk
widget: Rename a function
set_enabled is shorter and more to the point than enabled_changed, now that we no longer have a callback to query the state. Adapt all callers.
This commit is contained in:
parent
d1f4068b94
commit
35a88c1440
@ -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
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_WIDGET
|
||||
|
@ -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_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_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, "link.open", !has_selection && link);
|
||||
gtk_widget_action_set_enabled (widget, "link.copy", !has_selection && link);
|
||||
}
|
||||
|
||||
static GMenuModel *
|
||||
|
@ -5723,23 +5723,23 @@ 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",
|
||||
gtk_widget_action_set_enabled (GTK_WIDGET (self), "clipboard.cut",
|
||||
visible && priv->editable && has_selection);
|
||||
gtk_widget_action_enabled_changed (GTK_WIDGET (self), "clipboard.copy",
|
||||
gtk_widget_action_set_enabled (GTK_WIDGET (self), "clipboard.copy",
|
||||
visible && has_selection);
|
||||
gtk_widget_action_enabled_changed (GTK_WIDGET (self), "clipboard.paste",
|
||||
gtk_widget_action_set_enabled (GTK_WIDGET (self), "clipboard.paste",
|
||||
priv->editable && has_clipboard);
|
||||
|
||||
gtk_widget_action_enabled_changed (GTK_WIDGET (self), "selection.delete",
|
||||
gtk_widget_action_set_enabled (GTK_WIDGET (self), "selection.delete",
|
||||
priv->editable && has_selection);
|
||||
gtk_widget_action_enabled_changed (GTK_WIDGET (self), "selection.select-all",
|
||||
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_widget_action_set_enabled (GTK_WIDGET (self), "misc.insert-emoji",
|
||||
(gtk_text_get_input_hints (self) & GTK_INPUT_HINT_NO_EMOJI) == 0);
|
||||
}
|
||||
|
||||
|
@ -8583,24 +8583,24 @@ 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",
|
||||
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_enabled_changed (GTK_WIDGET (text_view), "clipboard.copy",
|
||||
gtk_widget_action_set_enabled (GTK_WIDGET (text_view), "clipboard.copy",
|
||||
have_selection);
|
||||
gtk_widget_action_enabled_changed (GTK_WIDGET (text_view), "clipboard.paste",
|
||||
gtk_widget_action_set_enabled (GTK_WIDGET (text_view), "clipboard.paste",
|
||||
can_insert && can_paste);
|
||||
gtk_widget_action_enabled_changed (GTK_WIDGET (text_view), "selection.delete",
|
||||
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_enabled_changed (GTK_WIDGET (text_view), "selection.select-all",
|
||||
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_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);
|
||||
}
|
||||
|
||||
|
@ -13567,17 +13567,16 @@ 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,
|
||||
gtk_widget_action_set_enabled (GtkWidget *widget,
|
||||
const char *action_name,
|
||||
gboolean enabled)
|
||||
{
|
||||
|
@ -1058,7 +1058,7 @@ gboolean gtk_widget_class_query_action (GtkWidgetClass *widg
|
||||
const GVariantType **state_type);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_action_enabled_changed (GtkWidget *widget,
|
||||
void gtk_widget_action_set_enabled (GtkWidget *widget,
|
||||
const char *action_name,
|
||||
gboolean enabled);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user