From 5fd936beef7a999828e5e3625506ea6708188762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 11 Jan 2019 18:17:08 +0100 Subject: [PATCH] spinbutton: Use increment/decrement icon names And add list-{remove,add}-symbolic as fallback. Fixes #1569 --- gtk/gtkspinbutton.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 5bf431ee8e..37fb282cf7 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -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);