From: Claudio Saavedra Date: Thu, 7 Aug 2008 01:56:21 +0000 (+0000) Subject: 2008-08-06 Claudio Saavedra X-Git-Tag: 2.1.66-1~620 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=3421229f0069d0573cec3fe9643dfb8fcc4f3cc7;p=hildon 2008-08-06 Claudio Saavedra * src/hildon-touch-selector.h: * examples/hildon-picker-button-multicolumn-example.c: (hildon_touch_selector_append_text_column): Add a gboolean parameter to determine if text must be centered in the column. * src/hildon-date-selector.c: (hildon_date_selector_init): * src/hildon-time-selector.c: (hildon_time_selector_init): * src/hildon-touch-selector.c: (hildon_touch_selector_new_text), (create_touch_selector): Update widgets and example to reflect the API change. --- diff --git a/ChangeLog b/ChangeLog index f07d778..2086477 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2008-08-06 Claudio Saavedra + * src/hildon-touch-selector.h: + * examples/hildon-picker-button-multicolumn-example.c: + (hildon_touch_selector_append_text_column): Add a gboolean + parameter to determine if text must be centered in the column. + + * src/hildon-date-selector.c: (hildon_date_selector_init): + * src/hildon-time-selector.c: (hildon_time_selector_init): + * src/hildon-touch-selector.c: (hildon_touch_selector_new_text), + (create_touch_selector): Update widgets and example to reflect + the API change. + +2008-08-06 Claudio Saavedra + * src/hildon-touch-selector.c: (hildon_touch_selector_set_active_iter): Set also the cursor in the active row. diff --git a/examples/hildon-picker-button-multicolumn-example.c b/examples/hildon-picker-button-multicolumn-example.c index 01ce000..1d8c752 100644 --- a/examples/hildon-picker-button-multicolumn-example.c +++ b/examples/hildon-picker-button-multicolumn-example.c @@ -46,7 +46,7 @@ create_touch_selector (void) gtk_list_store_set (model, &iter, 0, "Mailbox", -1); hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector), - GTK_TREE_MODEL (model)); + GTK_TREE_MODEL (model), TRUE); model = gtk_list_store_new (1, G_TYPE_STRING); @@ -60,7 +60,7 @@ create_touch_selector (void) gtk_list_store_set (model, &iter, 0, "Smoke signals", -1); hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector), - GTK_TREE_MODEL (model)); + GTK_TREE_MODEL (model), TRUE); return selector; } diff --git a/src/hildon-date-selector.c b/src/hildon-date-selector.c index a27ef38..e7bd707 100644 --- a/src/hildon-date-selector.c +++ b/src/hildon-date-selector.c @@ -244,15 +244,15 @@ hildon_date_selector_init (HildonDateSelector * selector) switch (current_item) { case DAY: hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector), - selector->priv->day_model); + selector->priv->day_model, TRUE); break; case MONTH: hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector), - selector->priv->month_model); + selector->priv->month_model, TRUE); break; case YEAR: hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector), - selector->priv->year_model); + selector->priv->year_model, TRUE); break; default: g_error ("Current column order incorrect"); diff --git a/src/hildon-time-selector.c b/src/hildon-time-selector.c index 3d60531..d876333 100644 --- a/src/hildon-time-selector.c +++ b/src/hildon-time-selector.c @@ -151,16 +151,16 @@ hildon_time_selector_init (HildonTimeSelector * selector) selector->priv->minutes_model = _create_minutes_model (selector); hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector), - selector->priv->hours_model); + selector->priv->hours_model, TRUE); hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector), - selector->priv->minutes_model); + selector->priv->minutes_model, TRUE); if (selector->priv->ampm_format) { selector->priv->ampm_model = _create_ampm_model (selector); hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector), - selector->priv->ampm_model); + selector->priv->ampm_model, TRUE); g_signal_connect (G_OBJECT (selector), "changed", G_CALLBACK (_manage_ampm_selection_cb), diff --git a/src/hildon-touch-selector.c b/src/hildon-touch-selector.c index e5d7f1e..e253665 100644 --- a/src/hildon-touch-selector.c +++ b/src/hildon-touch-selector.c @@ -472,7 +472,7 @@ hildon_touch_selector_new_text (void) store = gtk_list_store_new (1, G_TYPE_STRING); hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector), - GTK_TREE_MODEL (store)); + GTK_TREE_MODEL (store), TRUE); return selector; } @@ -608,6 +608,7 @@ hildon_touch_selector_append_column (HildonTouchSelector * selector, * hildon_touch_selector_append_text_column * @selector: the #HildonTouchSelector widget * @model: the #GtkTreeModel with the data of the column + * @center: whether to center the text on the column. * * Equivalent to hildon_touch_selector_append_column, but using a * default text cell renderer. This is the most common use of the @@ -617,7 +618,7 @@ hildon_touch_selector_append_column (HildonTouchSelector * selector, **/ gboolean hildon_touch_selector_append_text_column (HildonTouchSelector * selector, - GtkTreeModel * model) + GtkTreeModel * model, gboolean center) { GtkCellRenderer *renderer = NULL; GValue val = { 0, }; @@ -628,10 +629,12 @@ hildon_touch_selector_append_text_column (HildonTouchSelector * selector, if (model != NULL) { renderer = gtk_cell_renderer_text_new (); - g_value_init (&val, G_TYPE_FLOAT); - g_value_set_float (&val, 0.5); - /* FIXME: center the text, this should be configurable */ - g_object_set_property (G_OBJECT (renderer), "xalign", &val); + if (center) { + g_value_init (&val, G_TYPE_FLOAT); + g_value_set_float (&val, 0.5); + /* FIXME: center the text, this should be configurable */ + g_object_set_property (G_OBJECT (renderer), "xalign", &val); + } return hildon_touch_selector_append_column (selector, model, renderer, "text", 0, NULL); diff --git a/src/hildon-touch-selector.h b/src/hildon-touch-selector.h index 1aa3183..065edcc 100644 --- a/src/hildon-touch-selector.h +++ b/src/hildon-touch-selector.h @@ -81,7 +81,7 @@ void hildon_touch_selector_insert_text (HildonTouchSelector * selector, /* column related */ gboolean hildon_touch_selector_append_text_column (HildonTouchSelector * selector, - GtkTreeModel * model); + GtkTreeModel * model, gboolean center); gboolean hildon_touch_selector_append_column (HildonTouchSelector * selector, GtkTreeModel * model,