diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 12 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 12 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 12 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 12 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 12 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 12 | ||||
-rw-r--r-- | gdk/gdkpixmap.h | 39 | ||||
-rw-r--r-- | gtk/gtkaccellabel.c | 88 | ||||
-rw-r--r-- | gtk/gtkaccellabel.h | 2 | ||||
-rw-r--r-- | gtk/gtkmenubar.c | 5 | ||||
-rw-r--r-- | gtk/gtkscale.c | 126 | ||||
-rw-r--r-- | gtk/gtktogglebutton.c | 140 |
13 files changed, 321 insertions, 163 deletions
@@ -1,3 +1,14 @@ +Thu May 10 19:22:28 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktogglebutton.c: Patch from John Margaglione converting to + property API. (#51669) + + * gtk/gtkscale.c: Patch from John Margaglione converting to + property API. (#51891) + + * gtk/gtkaccellabel.c: Applied patch from Lee Mallabone, converting + to property API. (#50985) + Fri May 11 20:13:44 2001 Tim Janik <timj@gtk.org> * gtk/gtkmain.c (gtk_main_do_event): remember widget's double @@ -54,6 +65,7 @@ Fri May 11 01:05:00 2001 Tim Janik <timj@gtk.org> * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_clear_area): Handle background pixmaps. +>>>>>>> 1.1955 Wed May 9 15:27:22 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_set_column_drag_function): New diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 2c29dbe219..8a7cfc393d 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,14 @@ +Thu May 10 19:22:28 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktogglebutton.c: Patch from John Margaglione converting to + property API. (#51669) + + * gtk/gtkscale.c: Patch from John Margaglione converting to + property API. (#51891) + + * gtk/gtkaccellabel.c: Applied patch from Lee Mallabone, converting + to property API. (#50985) + Fri May 11 20:13:44 2001 Tim Janik <timj@gtk.org> * gtk/gtkmain.c (gtk_main_do_event): remember widget's double @@ -54,6 +65,7 @@ Fri May 11 01:05:00 2001 Tim Janik <timj@gtk.org> * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_clear_area): Handle background pixmaps. +>>>>>>> 1.1955 Wed May 9 15:27:22 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_set_column_drag_function): New diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2c29dbe219..8a7cfc393d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Thu May 10 19:22:28 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktogglebutton.c: Patch from John Margaglione converting to + property API. (#51669) + + * gtk/gtkscale.c: Patch from John Margaglione converting to + property API. (#51891) + + * gtk/gtkaccellabel.c: Applied patch from Lee Mallabone, converting + to property API. (#50985) + Fri May 11 20:13:44 2001 Tim Janik <timj@gtk.org> * gtk/gtkmain.c (gtk_main_do_event): remember widget's double @@ -54,6 +65,7 @@ Fri May 11 01:05:00 2001 Tim Janik <timj@gtk.org> * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_clear_area): Handle background pixmaps. +>>>>>>> 1.1955 Wed May 9 15:27:22 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_set_column_drag_function): New diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 2c29dbe219..8a7cfc393d 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,14 @@ +Thu May 10 19:22:28 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktogglebutton.c: Patch from John Margaglione converting to + property API. (#51669) + + * gtk/gtkscale.c: Patch from John Margaglione converting to + property API. (#51891) + + * gtk/gtkaccellabel.c: Applied patch from Lee Mallabone, converting + to property API. (#50985) + Fri May 11 20:13:44 2001 Tim Janik <timj@gtk.org> * gtk/gtkmain.c (gtk_main_do_event): remember widget's double @@ -54,6 +65,7 @@ Fri May 11 01:05:00 2001 Tim Janik <timj@gtk.org> * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_clear_area): Handle background pixmaps. +>>>>>>> 1.1955 Wed May 9 15:27:22 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_set_column_drag_function): New diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 2c29dbe219..8a7cfc393d 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +Thu May 10 19:22:28 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktogglebutton.c: Patch from John Margaglione converting to + property API. (#51669) + + * gtk/gtkscale.c: Patch from John Margaglione converting to + property API. (#51891) + + * gtk/gtkaccellabel.c: Applied patch from Lee Mallabone, converting + to property API. (#50985) + Fri May 11 20:13:44 2001 Tim Janik <timj@gtk.org> * gtk/gtkmain.c (gtk_main_do_event): remember widget's double @@ -54,6 +65,7 @@ Fri May 11 01:05:00 2001 Tim Janik <timj@gtk.org> * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_clear_area): Handle background pixmaps. +>>>>>>> 1.1955 Wed May 9 15:27:22 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_set_column_drag_function): New diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 2c29dbe219..8a7cfc393d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Thu May 10 19:22:28 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktogglebutton.c: Patch from John Margaglione converting to + property API. (#51669) + + * gtk/gtkscale.c: Patch from John Margaglione converting to + property API. (#51891) + + * gtk/gtkaccellabel.c: Applied patch from Lee Mallabone, converting + to property API. (#50985) + Fri May 11 20:13:44 2001 Tim Janik <timj@gtk.org> * gtk/gtkmain.c (gtk_main_do_event): remember widget's double @@ -54,6 +65,7 @@ Fri May 11 01:05:00 2001 Tim Janik <timj@gtk.org> * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_clear_area): Handle background pixmaps. +>>>>>>> 1.1955 Wed May 9 15:27:22 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_set_column_drag_function): New diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2c29dbe219..8a7cfc393d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Thu May 10 19:22:28 2001 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktogglebutton.c: Patch from John Margaglione converting to + property API. (#51669) + + * gtk/gtkscale.c: Patch from John Margaglione converting to + property API. (#51891) + + * gtk/gtkaccellabel.c: Applied patch from Lee Mallabone, converting + to property API. (#50985) + Fri May 11 20:13:44 2001 Tim Janik <timj@gtk.org> * gtk/gtkmain.c (gtk_main_do_event): remember widget's double @@ -54,6 +65,7 @@ Fri May 11 01:05:00 2001 Tim Janik <timj@gtk.org> * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_clear_area): Handle background pixmaps. +>>>>>>> 1.1955 Wed May 9 15:27:22 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_set_column_drag_function): New diff --git a/gdk/gdkpixmap.h b/gdk/gdkpixmap.h index 2d08ac6ca5..47535609d8 100644 --- a/gdk/gdkpixmap.h +++ b/gdk/gdkpixmap.h @@ -53,26 +53,25 @@ GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window, gint depth, GdkColor *fg, GdkColor *bg); -GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window, - GdkBitmap **mask, - GdkColor *transparent_color, - const gchar *filename); -GdkPixmap* gdk_pixmap_colormap_create_from_xpm - (GdkWindow *window, - GdkColormap *colormap, - GdkBitmap **mask, - GdkColor *transparent_color, - const gchar *filename); -GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window, - GdkBitmap **mask, - GdkColor *transparent_color, - gchar **data); -GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d - (GdkWindow *window, - GdkColormap *colormap, - GdkBitmap **mask, - GdkColor *transparent_color, - gchar **data); + +GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window, + GdkBitmap **mask, + GdkColor *transparent_color, + const gchar *filename); +GdkPixmap* gdk_pixmap_colormap_create_from_xpm (GdkWindow *window, + GdkColormap *colormap, + GdkBitmap **mask, + GdkColor *transparent_color, + const gchar *filename); +GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window, + GdkBitmap **mask, + GdkColor *transparent_color, + gchar **data); +GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window, + GdkColormap *colormap, + GdkBitmap **mask, + GdkColor *transparent_color, + gchar **data); #ifdef __cplusplus } diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index bb332f1fa9..853e26fae5 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -21,7 +21,7 @@ */ /* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS + * Modified by the GTK+ Team and others 1997-2001. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with * GTK+ at ftp://ftp.gtk.org/pub/gtk/. @@ -32,28 +32,30 @@ #include "gtkmain.h" #include "gtksignal.h" #include "gtkaccellabel.h" - +#include "gtkintl.h" enum { - ARG_0, - ARG_ACCEL_WIDGET + PROP_0, + PROP_ACCEL_WIDGET }; -static void gtk_accel_label_class_init (GtkAccelLabelClass *klass); -static void gtk_accel_label_init (GtkAccelLabel *accel_label); -static void gtk_accel_label_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_accel_label_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_accel_label_destroy (GtkObject *object); -static void gtk_accel_label_finalize (GObject *object); -static void gtk_accel_label_size_request (GtkWidget *widget, - GtkRequisition *requisition); -static gboolean gtk_accel_label_expose_event (GtkWidget *widget, - GdkEventExpose *event); -static gboolean gtk_accel_label_refetch_idle (GtkAccelLabel *accel_label); +static void gtk_accel_label_class_init (GtkAccelLabelClass *klass); +static void gtk_accel_label_init (GtkAccelLabel *accel_label); +static void gtk_accel_label_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gtk_accel_label_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gtk_accel_label_destroy (GtkObject *object); +static void gtk_accel_label_finalize (GObject *object); +static void gtk_accel_label_size_request (GtkWidget *widget, + GtkRequisition *requisition); +static gboolean gtk_accel_label_expose_event (GtkWidget *widget, + GdkEventExpose *event); +static gboolean gtk_accel_label_refetch_idle (GtkAccelLabel *accel_label); static GtkAccelLabelClass *accel_label_class = NULL; static GtkLabelClass *parent_class = NULL; @@ -101,14 +103,21 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class) parent_class = gtk_type_class (GTK_TYPE_LABEL); - gtk_object_add_arg_type ("GtkAccelLabel::accel_widget", GTK_TYPE_WIDGET, GTK_ARG_READWRITE, ARG_ACCEL_WIDGET); - gobject_class->finalize = gtk_accel_label_finalize; - - object_class->set_arg = gtk_accel_label_set_arg; - object_class->get_arg = gtk_accel_label_get_arg; + gobject_class->set_property = gtk_accel_label_set_property; + gobject_class->get_property = gtk_accel_label_get_property; + object_class->destroy = gtk_accel_label_destroy; + g_object_class_install_property (G_OBJECT_CLASS(object_class), + PROP_ACCEL_WIDGET, + g_param_spec_object ("accel_widget", + _("Accelerator widget"), + _("The widget monitored by this accelerator label"), + GTK_TYPE_WIDGET, + G_PARAM_READABLE | G_PARAM_WRITABLE)); + + widget_class->size_request = gtk_accel_label_size_request; widget_class->expose_event = gtk_accel_label_expose_event; @@ -123,40 +132,42 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class) } static void -gtk_accel_label_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +gtk_accel_label_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GtkAccelLabel *accel_label; accel_label = GTK_ACCEL_LABEL (object); - switch (arg_id) + switch (prop_id) { - case ARG_ACCEL_WIDGET: - gtk_accel_label_set_accel_widget (accel_label, (GtkWidget*) GTK_VALUE_OBJECT (*arg)); + case PROP_ACCEL_WIDGET: + gtk_accel_label_set_accel_widget (accel_label, (GtkWidget*) g_value_get_object (value)); break; default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } -static void -gtk_accel_label_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +static void gtk_accel_label_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { GtkAccelLabel *accel_label; accel_label = GTK_ACCEL_LABEL (object); - switch (arg_id) + switch (prop_id) { - case ARG_ACCEL_WIDGET: - GTK_VALUE_OBJECT (*arg) = (GtkObject*) accel_label->accel_widget; + case PROP_ACCEL_WIDGET: + g_value_set_object (value, G_OBJECT (accel_label->accel_widget)); break; default: - arg->type = GTK_TYPE_INVALID; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } @@ -359,6 +370,7 @@ gtk_accel_label_set_accel_widget (GtkAccelLabel *accel_label, GTK_SIGNAL_FUNC (gtk_accel_label_queue_refetch), GTK_OBJECT (accel_label)); } + g_object_notify (G_OBJECT (accel_label), "accel_widget"); } } diff --git a/gtk/gtkaccellabel.h b/gtk/gtkaccellabel.h index 61973fef0b..9e09de425a 100644 --- a/gtk/gtkaccellabel.h +++ b/gtk/gtkaccellabel.h @@ -21,7 +21,7 @@ */ /* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS + * Modified by the GTK+ Team and others 1997-2001. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with * GTK+ at ftp://ftp.gtk.org/pub/gtk/. diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index 8cefad1ed5..9616638422 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -34,11 +34,6 @@ #include "gtkwindow.h" #include "gtksignal.h" -enum { - ARG_0, - ARG_SHADOW -}; - #define BORDER_SPACING 0 #define CHILD_SPACING 3 diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index 992cdfe41d..74d7056f39 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -30,10 +30,10 @@ #include "gtkmarshal.h" enum { - ARG_0, - ARG_DIGITS, - ARG_DRAW_VALUE, - ARG_VALUE_POS + PROP_0, + PROP_DIGITS, + PROP_DRAW_VALUE, + PROP_VALUE_POS }; enum { @@ -43,16 +43,18 @@ enum { static guint signals[LAST_SIGNAL]; -static void gtk_scale_class_init (GtkScaleClass *klass); -static void gtk_scale_init (GtkScale *scale); -static void gtk_scale_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_scale_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_scale_map (GtkWidget *widget); -static void gtk_scale_unmap (GtkWidget *widget); +static void gtk_scale_class_init (GtkScaleClass *klass); +static void gtk_scale_init (GtkScale *scale); +static void gtk_scale_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gtk_scale_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gtk_scale_map (GtkWidget *widget); +static void gtk_scale_unmap (GtkWidget *widget); static void gtk_scale_draw_background (GtkRange *range); @@ -104,28 +106,44 @@ single_string_accumulator (GSignalInvocationHint *ihint, static void gtk_scale_class_init (GtkScaleClass *class) { + GObjectClass *gobject_class; GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkRangeClass *range_class; + gobject_class = G_OBJECT_CLASS (class); object_class = (GtkObjectClass*) class; range_class = (GtkRangeClass*) class; widget_class = (GtkWidgetClass*) class; parent_class = gtk_type_class (GTK_TYPE_RANGE); - gtk_object_add_arg_type ("GtkScale::digits", - GTK_TYPE_INT, - GTK_ARG_READWRITE, - ARG_DIGITS); - gtk_object_add_arg_type ("GtkScale::draw_value", - GTK_TYPE_BOOL, - GTK_ARG_READWRITE, - ARG_DRAW_VALUE); - gtk_object_add_arg_type ("GtkScale::value_pos", - GTK_TYPE_POSITION_TYPE, - GTK_ARG_READWRITE, - ARG_VALUE_POS); + g_object_class_install_property (gobject_class, + PROP_DIGITS, + g_param_spec_int ("digits", + _("Digits"), + _("The number of decimal places that are displayed in the value"), + 0, + G_MAXINT, + 0, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, + PROP_DRAW_VALUE, + g_param_spec_boolean ("draw_value", + _("Draw Value"), + _("Whether the current value is displayed as a string next to the slider"), + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, + PROP_VALUE_POS, + g_param_spec_enum ("value_pos", + _("Value Position"), + _("The position in which the current value is displayed"), + GTK_TYPE_POSITION_TYPE, + GTK_POS_LEFT, + G_PARAM_READWRITE)); signals[FORMAT_VALUE] = g_signal_newc ("format_value", @@ -137,8 +155,9 @@ gtk_scale_class_init (GtkScaleClass *class) G_TYPE_STRING, 1, G_TYPE_DOUBLE); - object_class->set_arg = gtk_scale_set_arg; - object_class->get_arg = gtk_scale_get_arg; + + gobject_class->set_property = gtk_scale_set_property; + gobject_class->get_property = gtk_scale_get_property; widget_class->map = gtk_scale_map; widget_class->unmap = gtk_scale_unmap; @@ -158,52 +177,55 @@ gtk_scale_class_init (GtkScaleClass *class) } static void -gtk_scale_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +gtk_scale_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GtkScale *scale; scale = GTK_SCALE (object); - switch (arg_id) + switch (prop_id) { - case ARG_DIGITS: - gtk_scale_set_digits (scale, GTK_VALUE_INT (*arg)); + case PROP_DIGITS: + gtk_scale_set_digits (scale, g_value_get_int (value)); break; - case ARG_DRAW_VALUE: - gtk_scale_set_draw_value (scale, GTK_VALUE_BOOL (*arg)); + case PROP_DRAW_VALUE: + gtk_scale_set_draw_value (scale, g_value_get_boolean (value)); break; - case ARG_VALUE_POS: - gtk_scale_set_value_pos (scale, GTK_VALUE_ENUM (*arg)); + case PROP_VALUE_POS: + gtk_scale_set_value_pos (scale, g_value_get_enum (value)); break; default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void -gtk_scale_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +gtk_scale_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { GtkScale *scale; scale = GTK_SCALE (object); - switch (arg_id) + switch (prop_id) { - case ARG_DIGITS: - GTK_VALUE_INT (*arg) = GTK_RANGE (scale)->digits; + case PROP_DIGITS: + g_value_set_int (value, GTK_RANGE (scale)->digits); break; - case ARG_DRAW_VALUE: - GTK_VALUE_BOOL (*arg) = scale->draw_value; + case PROP_DRAW_VALUE: + g_value_set_boolean (value, scale->draw_value); break; - case ARG_VALUE_POS: - GTK_VALUE_ENUM (*arg) = scale->value_pos; + case PROP_VALUE_POS: + g_value_set_enum (value, scale->value_pos); break; default: - arg->type = GTK_TYPE_INVALID; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } @@ -263,6 +285,8 @@ gtk_scale_set_digits (GtkScale *scale, GTK_RANGE (scale)->digits = digits; gtk_widget_queue_resize (GTK_WIDGET (scale)); + + g_object_notify (G_OBJECT (scale), "digits"); } } @@ -280,6 +304,8 @@ gtk_scale_set_draw_value (GtkScale *scale, scale->draw_value = draw_value; gtk_widget_queue_resize (GTK_WIDGET (scale)); + + g_object_notify (G_OBJECT (scale), "draw_value"); } } @@ -296,6 +322,8 @@ gtk_scale_set_value_pos (GtkScale *scale, if (GTK_WIDGET_VISIBLE (scale) && GTK_WIDGET_MAPPED (scale)) gtk_widget_queue_resize (GTK_WIDGET (scale)); + + g_object_notify (G_OBJECT (scale), "value_pos"); } } diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 46cc40d93a..434100df0a 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -28,7 +28,7 @@ #include "gtkmain.h" #include "gtksignal.h" #include "gtktogglebutton.h" - +#include "gtkintl.h" #define DEFAULT_LEFT_POS 4 #define DEFAULT_TOP_POS 4 @@ -40,36 +40,39 @@ enum { }; enum { - ARG_0, - ARG_ACTIVE, - ARG_DRAW_INDICATOR + PROP_0, + PROP_ACTIVE, + PROP_INCONSISTENT, + PROP_DRAW_INDICATOR }; -static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass); -static void gtk_toggle_button_init (GtkToggleButton *toggle_button); -static void gtk_toggle_button_paint (GtkWidget *widget, - GdkRectangle *area); -static void gtk_toggle_button_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gint gtk_toggle_button_expose (GtkWidget *widget, - GdkEventExpose *event); -static void gtk_toggle_button_pressed (GtkButton *button); -static void gtk_toggle_button_released (GtkButton *button); -static void gtk_toggle_button_clicked (GtkButton *button); -static void gtk_toggle_button_enter (GtkButton *button); -static void gtk_toggle_button_leave (GtkButton *button); -static void gtk_toggle_button_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_toggle_button_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_toggle_button_leave (GtkButton *button); -static void gtk_toggle_button_realize (GtkWidget *widget); -static void gtk_toggle_button_unrealize (GtkWidget *widget); -static void gtk_toggle_button_map (GtkWidget *widget); -static void gtk_toggle_button_unmap (GtkWidget *widget); +static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass); +static void gtk_toggle_button_init (GtkToggleButton *toggle_button); +static void gtk_toggle_button_paint (GtkWidget *widget, + GdkRectangle *area); +static void gtk_toggle_button_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static gint gtk_toggle_button_expose (GtkWidget *widget, + GdkEventExpose *event); +static void gtk_toggle_button_pressed (GtkButton *button); +static void gtk_toggle_button_released (GtkButton *button); +static void gtk_toggle_button_clicked (GtkButton *button); +static void gtk_toggle_button_enter (GtkButton *button); +static void gtk_toggle_button_leave (GtkButton *button); +static void gtk_toggle_button_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gtk_toggle_button_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gtk_toggle_button_leave (GtkButton *button); +static void gtk_toggle_button_realize (GtkWidget *widget); +static void gtk_toggle_button_unrealize (GtkWidget *widget); +static void gtk_toggle_button_map (GtkWidget *widget); +static void gtk_toggle_button_unmap (GtkWidget *widget); static guint toggle_button_signals[LAST_SIGNAL] = { 0 }; static GtkContainerClass *parent_class = NULL; @@ -103,11 +106,13 @@ static void gtk_toggle_button_class_init (GtkToggleButtonClass *class) { GtkObjectClass *object_class; + GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; GtkButtonClass *button_class; object_class = (GtkObjectClass*) class; + gobject_class = G_OBJECT_CLASS (class); widget_class = (GtkWidgetClass*) class; container_class = (GtkContainerClass*) class; button_class = (GtkButtonClass*) class; @@ -115,8 +120,8 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class) parent_class = gtk_type_class (GTK_TYPE_BUTTON); - object_class->set_arg = gtk_toggle_button_set_arg; - object_class->get_arg = gtk_toggle_button_get_arg; + gobject_class->set_property = gtk_toggle_button_set_property; + gobject_class->get_property = gtk_toggle_button_get_property; widget_class->size_allocate = gtk_toggle_button_size_allocate; widget_class->expose_event = gtk_toggle_button_expose; @@ -133,8 +138,29 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class) class->toggled = NULL; - gtk_object_add_arg_type ("GtkToggleButton::active", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ACTIVE); - gtk_object_add_arg_type ("GtkToggleButton::draw_indicator", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_INDICATOR); + g_object_class_install_property (gobject_class, + PROP_ACTIVE, + g_param_spec_boolean ("active", + _("Active"), + _("If the toggle button should be pressed in or not"), + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, + PROP_INCONSISTENT, + g_param_spec_boolean ("inconsistent", + _("Inconsistent"), + _("If the toggle button is in an \"in between\" state."), + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, + PROP_DRAW_INDICATOR, + g_param_spec_boolean ("draw_indicator", + _("Draw Indicator"), + _("If the toggle part of the button is displayed"), + FALSE, + G_PARAM_READWRITE)); toggle_button_signals[TOGGLED] = gtk_signal_new ("toggled", @@ -177,21 +203,25 @@ gtk_toggle_button_new_with_label (const gchar *label) } static void -gtk_toggle_button_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +gtk_toggle_button_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GtkToggleButton *tb; tb = GTK_TOGGLE_BUTTON (object); - switch (arg_id) + switch (prop_id) { - case ARG_ACTIVE: - gtk_toggle_button_set_active (tb, GTK_VALUE_BOOL (*arg)); + case PROP_ACTIVE: + gtk_toggle_button_set_active (tb, g_value_get_boolean (value)); + break; + case PROP_INCONSISTENT: + gtk_toggle_button_set_inconsistent (tb, g_value_get_boolean (value)); break; - case ARG_DRAW_INDICATOR: - gtk_toggle_button_set_mode (tb, GTK_VALUE_BOOL (*arg)); + case PROP_DRAW_INDICATOR: + gtk_toggle_button_set_mode (tb, g_value_get_boolean (value)); break; default: break; @@ -199,24 +229,28 @@ gtk_toggle_button_set_arg (GtkObject *object, } static void -gtk_toggle_button_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +gtk_toggle_button_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { GtkToggleButton *tb; tb = GTK_TOGGLE_BUTTON (object); - switch (arg_id) + switch (prop_id) { - case ARG_ACTIVE: - GTK_VALUE_BOOL (*arg) = tb->active; + case PROP_ACTIVE: + g_value_set_boolean (value, tb->active); + break; + case PROP_INCONSISTENT: + g_value_set_boolean (value, tb->inconsistent); break; - case ARG_DRAW_INDICATOR: - GTK_VALUE_BOOL (*arg) = tb->draw_indicator; + case PROP_DRAW_INDICATOR: + g_value_set_boolean (value, tb->draw_indicator); break; default: - arg->type = GTK_TYPE_INVALID; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } @@ -268,6 +302,8 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button, if (GTK_WIDGET_VISIBLE (toggle_button)) gtk_widget_queue_resize (GTK_WIDGET (toggle_button)); + + g_object_notify (G_OBJECT (toggle_button), "draw_indicator"); } } @@ -279,7 +315,7 @@ gtk_toggle_button_set_active (GtkToggleButton *toggle_button, g_return_if_fail (toggle_button != NULL); g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button)); - is_active = is_active != 0; + is_active = is_active != FALSE; if (toggle_button->active != is_active) gtk_button_clicked (GTK_BUTTON (toggle_button)); @@ -332,6 +368,8 @@ gtk_toggle_button_set_inconsistent (GtkToggleButton *toggle_button, { toggle_button->inconsistent = setting; gtk_widget_queue_draw (GTK_WIDGET (toggle_button)); + + g_object_notify (G_OBJECT (toggle_button), "inconsistent"); } } @@ -554,6 +592,8 @@ gtk_toggle_button_clicked (GtkButton *button) gtk_widget_set_state (GTK_WIDGET (button), new_state); else gtk_widget_queue_draw (GTK_WIDGET (button)); + + g_object_notify (G_OBJECT (toggle_button), "active"); } static void |