diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c index 9830b20417..4edccad11a 100644 --- a/gtk/gtkcolorchooserwidget.c +++ b/gtk/gtkcolorchooserwidget.c @@ -713,12 +713,10 @@ gtk_color_chooser_widget_class_init (GtkColorChooserWidgetClass *class) gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (class), I_("colorchooser")); - gtk_widget_class_install_stateful_action (GTK_WIDGET_CLASS (class), "color.select", - gtk_color_chooser_widget_activate_color_select, - "(dddd)", NULL, NULL, NULL); - gtk_widget_class_install_stateful_action (GTK_WIDGET_CLASS (class), "color.customize", - gtk_color_chooser_widget_activate_color_customize, - "(dddd)", NULL, NULL, NULL); + gtk_widget_class_install_action (GTK_WIDGET_CLASS (class), "color.select", "(dddd)", + gtk_color_chooser_widget_activate_color_select); + gtk_widget_class_install_action (GTK_WIDGET_CLASS (class), "color.customize", "(dddd)", + gtk_color_chooser_widget_activate_color_customize); } /* GtkColorChooser implementation {{{1 */ diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 57a90dde26..4c9c09a1f9 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1160,19 +1160,19 @@ gtk_label_class_init (GtkLabelClass *class) quark_gtk_signal = g_quark_from_static_string ("gtk-signal"); quark_link = g_quark_from_static_string ("link"); - gtk_widget_class_install_action (widget_class, "clipboard.cut", + gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL, gtk_label_nop); - gtk_widget_class_install_action (widget_class, "clipboard.copy", + gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, gtk_label_activate_clipboard_copy); - gtk_widget_class_install_action (widget_class, "clipboard.paste", + gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL, gtk_label_nop); - gtk_widget_class_install_action (widget_class, "selection.delete", + gtk_widget_class_install_action (widget_class, "selection.delete", NULL, gtk_label_nop); - gtk_widget_class_install_action (widget_class, "selection.select-all", + gtk_widget_class_install_action (widget_class, "selection.select-all", NULL, gtk_label_activate_selection_select_all); - gtk_widget_class_install_action (widget_class, "link.open", + gtk_widget_class_install_action (widget_class, "link.open", NULL, gtk_label_activate_link_open); - gtk_widget_class_install_action (widget_class, "link.copy", + gtk_widget_class_install_action (widget_class, "link.copy", NULL, gtk_label_activate_link_copy); } diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c index 07c9b04e32..bbf19a08c7 100644 --- a/gtk/gtklinkbutton.c +++ b/gtk/gtklinkbutton.c @@ -232,7 +232,7 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass) gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LINK_BUTTON_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("button")); - gtk_widget_class_install_action (widget_class, "clipboard.copy", + gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, gtk_link_button_activate_clipboard_copy); } diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 370adda586..943f0d0cbf 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -1363,21 +1363,21 @@ gtk_text_class_init (GtkTextClass *class) gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TEXT_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("text")); - gtk_widget_class_install_action (widget_class, "clipboard.cut", + gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL, gtk_text_activate_clipboard_cut); - gtk_widget_class_install_action (widget_class, "clipboard.copy", + gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, gtk_text_activate_clipboard_copy); - gtk_widget_class_install_action (widget_class, "clipboard.paste", + gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL, gtk_text_activate_clipboard_paste); - gtk_widget_class_install_action (widget_class, "selection.delete", + gtk_widget_class_install_action (widget_class, "selection.delete", NULL, gtk_text_activate_selection_delete); - gtk_widget_class_install_action (widget_class, "selection.select-all", + gtk_widget_class_install_action (widget_class, "selection.select-all", NULL, gtk_text_activate_selection_select_all); - gtk_widget_class_install_action (widget_class, "misc.insert-emoji", + gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL, gtk_text_activate_misc_insert_emoji); - gtk_widget_class_install_stateful_action (widget_class, "misc.toggle-visibility", + gtk_widget_class_install_stateful_action (widget_class, "misc.toggle-visibility", NULL, gtk_text_activate_misc_toggle_visibility, - NULL, "b", + "b", gtk_text_set_misc_toggle_visibility, gtk_text_get_misc_toggle_visibility); } diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 923550ed47..1c6e780b95 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1602,17 +1602,17 @@ gtk_text_view_class_init (GtkTextViewClass *klass) quark_gtk_signal = g_quark_from_static_string ("gtk-signal"); quark_text_view_child = g_quark_from_static_string ("gtk-text-view-child"); - gtk_widget_class_install_action (widget_class, "clipboard.cut", + gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL, gtk_text_view_activate_clipboard_cut); - gtk_widget_class_install_action (widget_class, "clipboard.copy", + gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, gtk_text_view_activate_clipboard_copy); - gtk_widget_class_install_action (widget_class, "clipboard.paste", + gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL, gtk_text_view_activate_clipboard_paste); - gtk_widget_class_install_action (widget_class, "selection.delete", + gtk_widget_class_install_action (widget_class, "selection.delete", NULL, gtk_text_view_activate_selection_delete); - gtk_widget_class_install_action (widget_class, "selection.select-all", + gtk_widget_class_install_action (widget_class, "selection.select-all", NULL, gtk_text_view_activate_selection_select_all); - gtk_widget_class_install_action (widget_class, "misc.insert-emoji", + gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL, gtk_text_view_activate_misc_insert_emoji); } diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index de0ed764dc..16d86cfbb7 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -13434,6 +13434,7 @@ gtk_widget_should_layout (GtkWidget *widget) * gtk_widget_class_install_action: * @widget_class: a #GtkWidgetClass * @action_name: a prefixed action name, such as "clipboard.paste" + * @parameter_type: (allow-none): the parameter type, or %NULL * @activate: callback to use when the action is activated * * This should be called at class initialization time to specify @@ -13446,18 +13447,20 @@ gtk_widget_should_layout (GtkWidget *widget) void gtk_widget_class_install_action (GtkWidgetClass *widget_class, const char *action_name, + const char *parameter_type, GtkWidgetActionActivateFunc activate) { - gtk_widget_class_install_stateful_action (widget_class, action_name, activate, - NULL, NULL, NULL, NULL); + gtk_widget_class_install_stateful_action (widget_class, action_name, + parameter_type, activate, + NULL, NULL, NULL); } /* * gtk_widget_class_install_stateful_action: * @widget_class: a #GtkWidgetClass * @action_name: a prefixed action name, such as "clipboard.paste" - * @activate: callback to use when the action is activated * @parameter_type: (allow-none): the parameter type, or %NULL + * @activate: callback to use when the action is activated * @state_type: (allow-none): the state type, or %NULL * @set_state: (allow-none): callback to use when the action state is set, or %NULL for stateless actions @@ -13473,8 +13476,8 @@ gtk_widget_class_install_action (GtkWidgetClass *widget_class, void gtk_widget_class_install_stateful_action (GtkWidgetClass *widget_class, const char *action_name, - GtkWidgetActionActivateFunc activate, const char *parameter_type, + GtkWidgetActionActivateFunc activate, const char *state_type, GtkWidgetActionSetStateFunc set_state, GtkWidgetActionGetStateFunc get_state) @@ -13505,8 +13508,8 @@ gtk_widget_class_install_stateful_action (GtkWidgetClass *widget_cl action = g_new0 (GtkWidgetAction, 1); action->owner = G_TYPE_FROM_CLASS (widget_class); action->name = g_strdup (action_name); - action->activate = activate; action->parameter_type = parameter_type ? g_variant_type_new (parameter_type) : NULL; + action->activate = activate; action->state_type = state_type ? g_variant_type_new (state_type) : NULL; action->set_state = set_state; action->get_state = get_state; diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 4893910fb9..c1a0482278 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -1073,13 +1073,14 @@ typedef void (*GtkWidgetActionSetStateFunc) (GtkWidget *widget, GDK_AVAILABLE_IN_ALL void gtk_widget_class_install_action (GtkWidgetClass *widget_class, const char *action_name, + const char *parameter_type, GtkWidgetActionActivateFunc activate); GDK_AVAILABLE_IN_ALL void gtk_widget_class_install_stateful_action (GtkWidgetClass *widget_class, const char *action_name, - GtkWidgetActionActivateFunc activate, const char *parameter_type, + GtkWidgetActionActivateFunc activate, const char *state_type, GtkWidgetActionSetStateFunc set_state, GtkWidgetActionGetStateFunc get_state); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index f6a98efa9c..74110cc5c3 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1176,7 +1176,7 @@ gtk_window_class_init (GtkWindowClass *klass) * Key bindings */ - gtk_widget_class_install_action (widget_class, "default.activate", + gtk_widget_class_install_action (widget_class, "default.activate", NULL, gtk_window_activate_default_activate); binding_set = gtk_binding_set_by_class (klass);