From 74335e88252ff2586a8d4f988138699bf2faf86f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 3 Apr 2005 07:31:58 +0000 Subject: [PATCH] Add a "metric" property. 2005-04-03 Matthias Clasen * gtk/gtkruler.c: Add a "metric" property. --- ChangeLog | 2 ++ ChangeLog.pre-2-10 | 2 ++ ChangeLog.pre-2-8 | 2 ++ gtk/gtkruler.c | 22 +++++++++++++++++++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0fbf5ef596..32a951b98b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-04-03 Matthias Clasen + * gtk/gtkruler.c: Add a "metric" property. + * gtk/gtkradiomenuitem.c: Add a "group" property like the one found in radio buttons. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 0fbf5ef596..32a951b98b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,7 @@ 2005-04-03 Matthias Clasen + * gtk/gtkruler.c: Add a "metric" property. + * gtk/gtkradiomenuitem.c: Add a "group" property like the one found in radio buttons. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 0fbf5ef596..32a951b98b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,7 @@ 2005-04-03 Matthias Clasen + * gtk/gtkruler.c: Add a "metric" property. + * gtk/gtkradiomenuitem.c: Add a "group" property like the one found in radio buttons. diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c index 77f31e24ba..f4e00ed244 100644 --- a/gtk/gtkruler.c +++ b/gtk/gtkruler.c @@ -35,7 +35,8 @@ enum { PROP_LOWER, PROP_UPPER, PROP_POSITION, - PROP_MAX_SIZE + PROP_MAX_SIZE, + PROP_METRIC }; static void gtk_ruler_class_init (GtkRulerClass *klass); @@ -154,6 +155,14 @@ gtk_ruler_class_init (GtkRulerClass *class) G_MAXDOUBLE, 0.0, GTK_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_METRIC, + g_param_spec_enum ("metric", + P_("Metric"), + P_("The metric used for the ruler"), + GTK_TYPE_METRIC_TYPE, + GTK_PIXELS, + GTK_PARAM_READWRITE)); } static void @@ -197,6 +206,12 @@ gtk_ruler_set_property (GObject *object, gtk_ruler_set_range (ruler, ruler->lower, ruler->upper, ruler->position, g_value_get_double (value)); break; + case PROP_METRIC: + gtk_ruler_set_metric (ruler, g_value_get_enum (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; } } @@ -222,6 +237,9 @@ gtk_ruler_get_property (GObject *object, case PROP_MAX_SIZE: g_value_set_double (value, ruler->max_size); break; + case PROP_METRIC: + g_value_set_enum (value, gtk_ruler_get_metric (ruler)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -238,6 +256,8 @@ gtk_ruler_set_metric (GtkRuler *ruler, if (GTK_WIDGET_DRAWABLE (ruler)) gtk_widget_queue_draw (GTK_WIDGET (ruler)); + + g_object_notify (G_OBJECT (ruler), "metric"); } /**