static gint _month_days (gint month, gint year);
static void _init_column_order (HildonDateSelector * selector);
-static gchar *_custom_print_func (HildonTouchSelector * selector);
+static gchar *_custom_print_func (HildonTouchSelector * selector,
+ gpointer user_data);
/***************************************************************************/
/* The following date routines are taken from the lib_date package. Keep
break;
}
}
- /* By default we should select the current day */
- hildon_date_selector_select_current_date (selector, selector->priv->creation_year,
- selector->priv->creation_month,
- selector->priv->creation_day);
}
static GObject *
GObjectConstructParam *construct_properties)
{
GObject *object;
+ HildonDateSelector *selector;
object = G_OBJECT_CLASS (hildon_date_selector_parent_class)->constructor
(type, n_construct_properties, construct_properties);
- hildon_date_selector_construct_ui (HILDON_DATE_SELECTOR (object));
+ selector = HILDON_DATE_SELECTOR (object);
+
+ hildon_date_selector_construct_ui (selector);
+
+ g_signal_connect (object, "changed", G_CALLBACK (_manage_selector_change_cb), NULL);
+
+ /* By default we should select the current day */
+ hildon_date_selector_select_current_date (selector, selector->priv->creation_year,
+ selector->priv->creation_month,
+ selector->priv->creation_day);
return object;
}
_get_real_date (&selector->priv->creation_year,
&selector->priv->creation_month, &selector->priv->creation_day);
selector->priv->current_num_days = 31;
-
-
- g_signal_connect (G_OBJECT (selector),
- "changed", G_CALLBACK (_manage_selector_change_cb), NULL);
}
static void
/* ------------------------------ PRIVATE METHODS ---------------------------- */
static gchar *
-_custom_print_func (HildonTouchSelector * touch_selector)
+_custom_print_func (HildonTouchSelector * touch_selector, gpointer user_data)
{
HildonDateSelector *selector = NULL;
gchar *result = NULL;
guint current_day = 0;
guint current_year = 0;
guint current_month = 0;
- guint num_days = 31;
+ gint num_days = 31;
hildon_date_selector_get_date (selector, ¤t_year, ¤t_month,
¤t_day);
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
};
- g_return_val_if_fail (month >= 0 && month <= 12, -1);
+ g_return_val_if_fail (month >= 0 && month < 12, -1);
return month_days[_leap (year)][month];
}
max_year = selector->priv->max_year;
g_return_val_if_fail (min_year <= year && year <= max_year, FALSE);
- g_return_val_if_fail (month >= 0 && month < 12, FALSE);
+ g_return_val_if_fail (month < 12, FALSE);
num_days = _month_days (month, year);
g_return_val_if_fail (day > 0 && day <= num_days, FALSE);