]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkhscale.c
Fix a compiler warning.
[~andy/gtk] / gtk / gtkhscale.c
index b981e16a1acba01b8507a9caa4edf0d418da3432..4b407ccf59f3dec20ba94612106e5a18148b3a7c 100644 (file)
 #include <stdlib.h>
 #include "gtkhscale.h"
 #include "gtkintl.h"
+#include "gtkalias.h"
 
-static gpointer parent_class;
-
-static void     gtk_hscale_class_init       (GtkHScaleClass *klass);
-static void     gtk_hscale_init             (GtkHScale      *hscale);
 static gboolean gtk_hscale_expose           (GtkWidget      *widget,
                                              GdkEventExpose *event);
 
@@ -42,32 +39,7 @@ static void     gtk_hscale_get_layout_offsets (GtkScale       *scale,
                                                gint           *x,
                                                gint           *y);
 
-GType
-gtk_hscale_get_type (void)
-{
-  static GType hscale_type = 0;
-  
-  if (!hscale_type)
-    {
-      static const GTypeInfo hscale_info =
-      {
-        sizeof (GtkHScaleClass),
-       NULL,           /* base_init */
-       NULL,           /* base_finalize */
-        (GClassInitFunc) gtk_hscale_class_init,
-       NULL,           /* class_finalize */
-       NULL,           /* class_data */
-        sizeof (GtkHScale),
-       0,              /* n_preallocs */
-        (GInstanceInitFunc) gtk_hscale_init,
-      };
-      
-      hscale_type = g_type_register_static (GTK_TYPE_SCALE, "GtkHScale",
-                                           &hscale_info, 0);
-    }
-  
-  return hscale_type;
-}
+G_DEFINE_TYPE (GtkHScale, gtk_hscale, GTK_TYPE_SCALE)
 
 static void
 gtk_hscale_class_init (GtkHScaleClass *class)
@@ -80,8 +52,6 @@ gtk_hscale_class_init (GtkHScaleClass *class)
   range_class = GTK_RANGE_CLASS (class);
   scale_class = GTK_SCALE_CLASS (class);
 
-  parent_class = g_type_class_peek_parent (class);
-
   range_class->slider_detail = "hscale";
 
   scale_class->get_layout_offsets = gtk_hscale_get_layout_offsets;
@@ -117,6 +87,10 @@ gtk_hscale_new (GtkAdjustment *adjustment)
  * increment @step.  @step must be nonzero; it's the distance the
  * slider moves when using the arrow keys to adjust the scale value.
  * 
+ * Note that the way in which the precision is derived works best if @step 
+ * is a power of ten. If the resulting precision is not suitable for your 
+ * needs, use gtk_scale_set_digits() to correct it.
+ * 
  * Return value: a new #GtkHScale
  **/
 GtkWidget*
@@ -161,8 +135,8 @@ gtk_hscale_expose (GtkWidget      *widget,
   /* We need to chain up _first_ so the various geometry members of
    * GtkRange struct are updated.
    */
-  if (GTK_WIDGET_CLASS (parent_class)->expose_event)
-    GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
+  if (GTK_WIDGET_CLASS (gtk_hscale_parent_class)->expose_event)
+    GTK_WIDGET_CLASS (gtk_hscale_parent_class)->expose_event (widget, event);
 
   if (scale->draw_value)
     {
@@ -214,7 +188,7 @@ gtk_hscale_get_layout_offsets (GtkScale *scale,
       return;
     }
 
-  gtk_widget_style_get (widget, "value_spacing", &value_spacing, NULL);
+  gtk_widget_style_get (widget, "value-spacing", &value_spacing, NULL);
 
   range = GTK_RANGE (widget);
   scale = GTK_SCALE (widget);
@@ -257,3 +231,6 @@ gtk_hscale_get_layout_offsets (GtkScale *scale,
   *x += widget->allocation.x;
   *y += widget->allocation.y;
 }
+
+#define __GTK_HSCALE_C__
+#include "gtkaliasdef.c"