From a173af9719ee3183c360c9e2416c1e16e9e68397 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jul 2010 20:28:37 -0500 Subject: Setting up basic property stuff and making a husk of a first property. --- src/indicator-datetime.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 6b32f1a..deef2f5 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -70,6 +70,17 @@ struct _IndicatorDatetimePrivate { DbusmenuGtkMenu * menu; }; +/* Enum for the properties so that they can be quickly + found and looked up. */ +enum { + PROP_0, + PROP_TIME_FORMAT +}; + +#define PROP_TIME_FORMAT_S "time-format" + +#define SETTING_TIME_FORMAT_S "indicator-time-format" + #define INDICATOR_DATETIME_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_DATETIME_TYPE, IndicatorDatetimePrivate)) @@ -77,6 +88,8 @@ GType indicator_datetime_get_type (void); static void indicator_datetime_class_init (IndicatorDatetimeClass *klass); static void indicator_datetime_init (IndicatorDatetime *self); +static void set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); +static void get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static void indicator_datetime_dispose (GObject *object); static void indicator_datetime_finalize (GObject *object); static GtkLabel * get_label (IndicatorObject * io); @@ -98,11 +111,27 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass) object_class->dispose = indicator_datetime_dispose; object_class->finalize = indicator_datetime_finalize; + object_class->set_property = set_property; + object_class->get_property = get_property; + IndicatorObjectClass * io_class = INDICATOR_OBJECT_CLASS(klass); io_class->get_label = get_label; io_class->get_menu = get_menu; + /** + IndicatorDatetime:time-format: + + The format that is used to show the time on the panel. + */ + g_object_class_install_property (object_class, + PROP_TIME_FORMAT, + g_param_spec_string(PROP_TIME_FORMAT_S, + "The format that is used to show the time on the panel.", + "A format string in the form used to pass to strftime to make a string for displaying on the panel.", + "%l:%M %p", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + return; } @@ -167,6 +196,20 @@ indicator_datetime_finalize (GObject *object) return; } +static void +set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) +{ + + return; +} + +static void +get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) +{ + + return; +} + /* Looks at the size of the label, if it grew beyond what we thought was the max, make sure it doesn't shrink again. */ static gboolean -- cgit v1.2.3