[gtk+/wip/matthiasc/icon-size: 4/15] scalebutton: Remove icon size



commit 8bbc271cbc519d597c73e87eb8ea86b801399540
Author: Benjamin Otte <otte redhat com>
Date:   Fri Jan 20 07:49:11 2017 +0100

    scalebutton: Remove icon size

 gtk/gtkscalebutton.c      |   36 +++++-------------------------------
 gtk/gtkscalebutton.h      |    3 +--
 testsuite/gtk/templates.c |    3 +--
 3 files changed, 7 insertions(+), 35 deletions(-)
---
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 8ffd378..971547f 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -106,7 +106,6 @@ struct _GtkScaleButtonPrivate
   GtkWidget *image;
   GtkWidget *active_button;
 
-  GtkIconSize size;
   GtkOrientation orientation;
   GtkOrientation applied_orientation;
 
@@ -204,15 +203,6 @@ gtk_scale_button_class_init (GtkScaleButtonClass *klass)
                                                        GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
 
   g_object_class_install_property (gobject_class,
-                                  PROP_SIZE,
-                                  g_param_spec_enum ("size",
-                                                     P_("Icon size"),
-                                                     P_("The icon size"),
-                                                     GTK_TYPE_ICON_SIZE,
-                                                     GTK_ICON_SIZE_SMALL_TOOLBAR,
-                                                     GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
-  g_object_class_install_property (gobject_class,
                                    PROP_ADJUSTMENT,
                                    g_param_spec_object ("adjustment",
                                                        P_("Adjustment"),
@@ -383,12 +373,10 @@ static void
 gtk_scale_button_constructed (GObject *object)
 {
   GtkScaleButton *button = GTK_SCALE_BUTTON (object);
-  GtkScaleButtonPrivate *priv = button->priv;
 
   G_OBJECT_CLASS (gtk_scale_button_parent_class)->constructed (object);
 
   /* set button text and size */
-  priv->size = GTK_ICON_SIZE_SMALL_TOOLBAR;
   gtk_scale_button_update_icon (button);
 }
 
@@ -408,14 +396,6 @@ gtk_scale_button_set_property (GObject       *object,
     case PROP_VALUE:
       gtk_scale_button_set_value (button, g_value_get_double (value));
       break;
-    case PROP_SIZE:
-      if (button->priv->size != g_value_get_enum (value))
-        {
-          button->priv->size = g_value_get_enum (value);
-          gtk_scale_button_update_icon (button);
-          g_object_notify_by_pspec (object, pspec);
-        }
-      break;
     case PROP_ADJUSTMENT:
       gtk_scale_button_set_adjustment (button, g_value_get_object (value));
       break;
@@ -446,9 +426,6 @@ gtk_scale_button_get_property (GObject     *object,
     case PROP_VALUE:
       g_value_set_double (value, gtk_scale_button_get_value (button));
       break;
-    case PROP_SIZE:
-      g_value_set_enum (value, priv->size);
-      break;
     case PROP_ADJUSTMENT:
       g_value_set_object (value, gtk_scale_button_get_adjustment (button));
       break;
@@ -507,7 +484,6 @@ gtk_scale_button_dispose (GObject *object)
 
 /**
  * gtk_scale_button_new:
- * @size: (type int): a stock icon size (#GtkIconSize)
  * @min: the minimum value of the scale (usually 0)
  * @max: the maximum value of the scale (usually 100)
  * @step: the stepping of value when a scroll-wheel event,
@@ -524,8 +500,7 @@ gtk_scale_button_dispose (GObject *object)
  * Since: 2.12
  */
 GtkWidget *
-gtk_scale_button_new (GtkIconSize   size,
-                     gdouble       min,
+gtk_scale_button_new (gdouble       min,
                      gdouble       max,
                      gdouble       step,
                      const gchar **icons)
@@ -538,7 +513,6 @@ gtk_scale_button_new (GtkIconSize   size,
   button = g_object_new (GTK_TYPE_SCALE_BUTTON,
                          "adjustment", adjustment,
                          "icons", icons,
-                         "size", size,
                          NULL);
 
   return GTK_WIDGET (button);
@@ -980,7 +954,7 @@ gtk_scale_button_update_icon (GtkScaleButton *button)
     {
       gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
                                     "image-missing",
-                                    priv->size);
+                                    GTK_ICON_SIZE_SMALL_TOOLBAR);
       return;
     }
 
@@ -991,7 +965,7 @@ gtk_scale_button_update_icon (GtkScaleButton *button)
     {
       gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
                                     priv->icon_list[0],
-                                    priv->size);
+                                    GTK_ICON_SIZE_SMALL_TOOLBAR);
       return;
     }
 
@@ -1011,7 +985,7 @@ gtk_scale_button_update_icon (GtkScaleButton *button)
 
       gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
                                     name,
-                                    priv->size);
+                                    GTK_ICON_SIZE_SMALL_TOOLBAR);
       return;
     }
 
@@ -1036,7 +1010,7 @@ gtk_scale_button_update_icon (GtkScaleButton *button)
 
   gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
                                 name,
-                                priv->size);
+                                GTK_ICON_SIZE_SMALL_TOOLBAR);
 }
 
 static void
diff --git a/gtk/gtkscalebutton.h b/gtk/gtkscalebutton.h
index 2432ae0..0f01cbf 100644
--- a/gtk/gtkscalebutton.h
+++ b/gtk/gtkscalebutton.h
@@ -79,8 +79,7 @@ struct _GtkScaleButtonClass
 GDK_AVAILABLE_IN_ALL
 GType            gtk_scale_button_get_type         (void) G_GNUC_CONST;
 GDK_AVAILABLE_IN_ALL
-GtkWidget *      gtk_scale_button_new              (GtkIconSize      size,
-                                                    gdouble          min,
+GtkWidget *      gtk_scale_button_new              (gdouble          min,
                                                     gdouble          max,
                                                     gdouble          step,
                                                     const gchar    **icons);
diff --git a/testsuite/gtk/templates.c b/testsuite/gtk/templates.c
index a6e201c..8344cd5 100644
--- a/testsuite/gtk/templates.c
+++ b/testsuite/gtk/templates.c
@@ -117,8 +117,7 @@ test_scale_button_basic (void)
 {
   GtkWidget *widget;
 
-  widget = gtk_scale_button_new (GTK_ICON_SIZE_MENU,
-                                0, 100, 10, NULL);
+  widget = gtk_scale_button_new (0, 100, 10, NULL);
   g_assert (GTK_IS_SCALE_BUTTON (widget));
   gtk_widget_destroy (widget);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]