spinbutton: Use increment/decrement icon names

And add list-{remove,add}-symbolic as fallback.

Fixes #1569
This commit is contained in:
Timm Bäder 2019-01-11 18:17:08 +01:00
parent 563b80d434
commit 5fd936beef

View File

@ -840,6 +840,9 @@ static void
gtk_spin_button_init (GtkSpinButton *spin_button)
{
GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
const char *up_icon_names[] = { "value-increase-symbolic", "list-add-symbolic" };
const char *down_icon_names[] = { "value-decrease-symbolic", "list-remove-symbolic" };
GIcon *icon;
GtkEventController *controller;
GtkGesture *gesture;
@ -873,7 +876,12 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
g_signal_connect (priv->entry, "activate", G_CALLBACK (gtk_spin_button_activate), spin_button);
gtk_container_add (GTK_CONTAINER (priv->box), priv->entry);
priv->down_button = gtk_button_new_from_icon_name ("list-remove-symbolic");
priv->down_button = gtk_button_new ();
icon = g_themed_icon_new_from_names ((char **)down_icon_names, 2);
gtk_container_add (GTK_CONTAINER (priv->down_button), gtk_image_new_from_gicon (icon));
g_object_unref (icon);
gtk_style_context_add_class (gtk_widget_get_style_context (priv->down_button), "image-button");
gtk_widget_set_can_focus (priv->down_button, FALSE);
gtk_style_context_add_class (gtk_widget_get_style_context (priv->down_button), "down");
gtk_container_add (GTK_CONTAINER (priv->box), priv->down_button);
@ -887,7 +895,11 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
g_signal_connect (gesture, "released", G_CALLBACK (button_released_cb), spin_button);
gtk_widget_add_controller (GTK_WIDGET (priv->down_button), GTK_EVENT_CONTROLLER (gesture));
priv->up_button = gtk_button_new_from_icon_name ("list-add-symbolic");
priv->up_button = gtk_button_new ();
icon = g_themed_icon_new_from_names ((char **)up_icon_names, 2);
gtk_container_add (GTK_CONTAINER (priv->up_button), gtk_image_new_from_gicon (icon));
g_object_unref (icon);
gtk_style_context_add_class (gtk_widget_get_style_context (priv->up_button), "image-button");
gtk_widget_set_can_focus (priv->up_button, FALSE);
gtk_style_context_add_class (gtk_widget_get_style_context (priv->up_button), "up");
gtk_container_add (GTK_CONTAINER (priv->box), priv->up_button);