diff options
author | Alexander Larsson <alexl@redhat.com> | 2001-03-30 15:46:17 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2001-03-30 15:46:17 +0000 |
commit | aa209a95faa6374b241ba9d7590a70e554f773d3 (patch) | |
tree | 473a50e3905dd539b9db7bd41d48575cfe27c86d /gtk/gtkhscale.c | |
parent | c80b705470ae83ac8ca144f4a55d8365a229ded7 (diff) | |
download | gtk+-aa209a95faa6374b241ba9d7590a70e554f773d3.tar.gz |
Remove leaks.
2001-03-30 Alexander Larsson <alexl@redhat.com>
* gtk/gtkbutton.c (gtk_button_get_property):
* gtk/gtklabel.c:
Remove leaks.
* gtk/gtkcontainer.c:
* gtk/gtkhscale.c:
* gtk/gtkhscrollbar.c:
* gtk/gtklayout.c:
* gtk/gtkmisc.c:
* gtk/gtkprogress.c:
* gtk/gtkprogressbar.c:
* gtk/gtkrange.c:
* gtk/gtktable.c:
* gtk/gtkviewport.c:
* gtk/gtkvscale.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkwidget.c:
Property patches, based on patches from John Margaglione and Lee Mallabone.
Diffstat (limited to 'gtk/gtkhscale.c')
-rw-r--r-- | gtk/gtkhscale.c | 79 |
1 files changed, 46 insertions, 33 deletions
diff --git a/gtk/gtkhscale.c b/gtk/gtkhscale.c index c09182051b..c3f72a067a 100644 --- a/gtk/gtkhscale.c +++ b/gtk/gtkhscale.c @@ -28,23 +28,26 @@ #include "gtkhscale.h" #include "gtksignal.h" #include "gdk/gdkkeysyms.h" +#include "gtkintl.h" #define SCALE_CLASS(w) GTK_SCALE_GET_CLASS (w) #define RANGE_CLASS(w) GTK_RANGE_GET_CLASS (w) enum { - ARG_0, - ARG_ADJUSTMENT + PROP_0, + PROP_ADJUSTMENT }; static void gtk_hscale_class_init (GtkHScaleClass *klass); static void gtk_hscale_init (GtkHScale *hscale); -static void gtk_hscale_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_hscale_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); +static void gtk_hscale_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gtk_hscale_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); static void gtk_hscale_realize (GtkWidget *widget); static void gtk_hscale_size_request (GtkWidget *widget, GtkRequisition *requisition); @@ -97,24 +100,21 @@ gtk_hscale_get_type (void) static void gtk_hscale_class_init (GtkHScaleClass *class) { + GObjectClass *gobject_class; GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkRangeClass *range_class; GtkScaleClass *scale_class; - + + gobject_class = (GObjectClass*) class; object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; range_class = (GtkRangeClass*) class; scale_class = (GtkScaleClass*) class; - - gtk_object_add_arg_type ("GtkHScale::adjustment", - GTK_TYPE_ADJUSTMENT, - GTK_ARG_READWRITE, - ARG_ADJUSTMENT); - - object_class->set_arg = gtk_hscale_set_arg; - object_class->get_arg = gtk_hscale_get_arg; - + + gobject_class->set_property = gtk_hscale_set_property; + gobject_class->get_property = gtk_hscale_get_property; + widget_class->realize = gtk_hscale_realize; widget_class->size_request = gtk_hscale_size_request; widget_class->size_allocate = gtk_hscale_size_allocate; @@ -127,43 +127,56 @@ gtk_hscale_class_init (GtkHScaleClass *class) range_class->clear_background = gtk_hscale_clear_background; scale_class->draw_value = gtk_hscale_draw_value; + + g_object_class_install_property (gobject_class, + PROP_ADJUSTMENT, + g_param_spec_object ("adjustment", + _("Adjustment"), + _("The GtkAdjustment that determines the values to use for this HScale."), + GTK_TYPE_ADJUSTMENT, + G_PARAM_READWRITE)); + } -static void -gtk_hscale_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +static void +gtk_hscale_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GtkHScale *hscale; hscale = GTK_HSCALE (object); - switch (arg_id) + switch (prop_id) { - case ARG_ADJUSTMENT: - gtk_range_set_adjustment (GTK_RANGE (hscale), GTK_VALUE_POINTER (*arg)); + case PROP_ADJUSTMENT: + gtk_range_set_adjustment (GTK_RANGE (hscale), g_value_get_object (value)); break; default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } -static void -gtk_hscale_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +static void +gtk_hscale_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { GtkHScale *hscale; hscale = GTK_HSCALE (object); - switch (arg_id) + switch (prop_id) { - case ARG_ADJUSTMENT: - GTK_VALUE_POINTER (*arg) = GTK_RANGE (hscale); + case PROP_ADJUSTMENT: + g_value_set_object (value, + G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (hscale)))); break; default: - arg->type = GTK_TYPE_INVALID; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } |