diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c index 4172eb296b..7c29976c01 100644 --- a/gtk/gtkcolorchooserwidget.c +++ b/gtk/gtkcolorchooserwidget.c @@ -90,8 +90,6 @@ struct _GtkColorChooserWidgetPrivate gboolean has_default_palette; GSettings *settings; - - GActionMap *context_actions; }; enum @@ -493,11 +491,11 @@ add_default_palette (GtkColorChooserWidget *cc) } static void -customize_color (GSimpleAction *action, - GVariant *parameter, - gpointer user_data) +gtk_color_chooser_widget_activate_color_customize (GtkWidget *widget, + const char *name, + GVariant *parameter) { - GtkColorChooserWidget *cc = user_data; + GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (widget); GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc); GdkRGBA color; @@ -511,11 +509,11 @@ customize_color (GSimpleAction *action, } static void -select_color (GSimpleAction *action, - GVariant *parameter, - gpointer user_data) +gtk_color_chooser_widget_activate_color_select (GtkWidget *widget, + const char *name, + GVariant *parameter) { - GtkColorChooserWidget *cc = user_data; + GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (widget); GdkRGBA color; g_variant_get (parameter, "(dddd)", &color.red, &color.green, &color.blue, &color.alpha); @@ -523,26 +521,6 @@ select_color (GSimpleAction *action, _gtk_color_chooser_color_activated (GTK_COLOR_CHOOSER (cc), &color); } -static void -gtk_color_chooser_widget_add_context_actions (GtkColorChooserWidget *cc) -{ - GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc); - - GActionEntry entries[] = { - { "select", select_color, "(dddd)", NULL, NULL }, - { "customize", customize_color, "(dddd)", NULL, NULL }, - }; - - GSimpleActionGroup *actions = g_simple_action_group_new (); - - priv->context_actions = G_ACTION_MAP (actions); - - g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), cc); - - gtk_widget_insert_action_group (GTK_WIDGET (cc), "color", G_ACTION_GROUP (actions)); -} - - static void gtk_color_chooser_widget_init (GtkColorChooserWidget *cc) { @@ -634,8 +612,6 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc) priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_size_group_add_widget (priv->size_group, priv->palette); gtk_size_group_add_widget (priv->size_group, box); - - gtk_color_chooser_widget_add_context_actions (cc); } /* GObject implementation {{{1 */ @@ -736,6 +712,13 @@ gtk_color_chooser_widget_class_init (GtkColorChooserWidgetClass *class) FALSE, GTK_PARAM_READWRITE)); 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); + gtk_widget_class_install_stateful_action (GTK_WIDGET_CLASS (class), "color.customize", + gtk_color_chooser_widget_activate_color_customize, + "(dddd)", NULL, NULL); } /* GtkColorChooser implementation {{{1 */