2009-01-20 Alejandro G. Castro <alex@igalia.com>
authorAlejandro G. Castro <alex@igalia.com>
Tue, 20 Jan 2009 12:02:05 +0000 (12:02 +0000)
committerAlejandro G. Castro <alex@igalia.com>
Tue, 20 Jan 2009 12:02:05 +0000 (12:02 +0000)
* src/hildon-time-selector.c,
(hildon_time_selector_class_init),
(hildon_time_selector_constructor),
(hildon_time_selector_init): Overrided the construct function when
creating the time selector object. We have moved the minutes model
handling code from the init to the new construction function:
hildon_time_selector_constructor.

ChangeLog
src/hildon-time-selector.c

index 53d549e..83b6a7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-01-20  Alejandro G. Castro  <alex@igalia.com>
+
+       * src/hildon-time-selector.c,
+       (hildon_time_selector_class_init),
+       (hildon_time_selector_constructor),
+       (hildon_time_selector_init): Overrided the construct function when
+       creating the time selector object. We have moved the minutes model
+       handling code from the init to the new construction function:
+       hildon_time_selector_constructor.
+
 2009-01-20  Claudio Saavedra  <csaavedra@igalia.com>
 
        * examples/hildon-date-button-example.c: (main): Use the new
index ec18387..ca98a70 100644 (file)
@@ -93,6 +93,9 @@ struct _HildonTimeSelectorPrivate
 };
 
 static void hildon_time_selector_finalize (GObject * object);
+static GObject* hildon_time_selector_constructor (GType type,
+                                                  guint n_construct_properties,
+                                                  GObjectConstructParam *construct_params);
 
 /* private functions */
 static GtkTreeModel *_create_hours_model (HildonTimeSelector * selector);
@@ -121,6 +124,7 @@ hildon_time_selector_class_init (HildonTimeSelectorClass * class)
   container_class = (GtkContainerClass *) class;
 
   /* GObject */
+  gobject_class->constructor = hildon_time_selector_constructor;
   gobject_class->finalize = hildon_time_selector_finalize;
 
   /* GtkWidget */
@@ -132,6 +136,35 @@ hildon_time_selector_class_init (HildonTimeSelectorClass * class)
   g_type_class_add_private (object_class, sizeof (HildonTimeSelectorPrivate));
 }
 
+static GObject*
+hildon_time_selector_constructor (GType type,
+                                  guint n_construct_properties,
+                                  GObjectConstructParam *construct_params)
+{
+  GObject *object;
+  HildonTimeSelector *selector;
+  HildonTouchSelectorColumn *column;
+
+  object = (* G_OBJECT_CLASS (hildon_time_selector_parent_class)->constructor)
+    (type, n_construct_properties, construct_params);
+
+  selector = HILDON_TIME_SELECTOR (object);
+
+  /* we need initialization parameters in order to create minute models*/
+  selector->priv->minutes_model = _create_minutes_model (selector);
+
+  column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                     selector->priv->minutes_model, TRUE);
+  g_object_set (column, "text-column", 0, NULL);
+
+  /* By default we should select the current day */
+  hildon_time_selector_set_time (selector,
+                                 selector->priv->creation_hours,
+                                 selector->priv->creation_minutes);
+
+  return object;
+
+}
 
 static void
 hildon_time_selector_init (HildonTimeSelector * selector)
@@ -152,15 +185,11 @@ hildon_time_selector_init (HildonTimeSelector * selector)
   _check_ampm_format (selector);
 
   selector->priv->hours_model = _create_hours_model (selector);
-  selector->priv->minutes_model = _create_minutes_model (selector);
 
   column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
                                                      selector->priv->hours_model, TRUE);
   g_object_set (column, "text-column", 0, NULL);
 
-  column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                                     selector->priv->minutes_model, TRUE);
-  g_object_set (column, "text-column", 0, NULL);
 
   if (selector->priv->ampm_format) {
     selector->priv->ampm_model = _create_ampm_model (selector);
@@ -173,11 +202,6 @@ hildon_time_selector_init (HildonTimeSelector * selector)
                       NULL);
   }
 
-  /* By default we should select the current day */
-  hildon_time_selector_set_time (selector,
-                                 selector->priv->creation_hours,
-                                 selector->priv->creation_minutes);
-
 }
 
 static void