From 939047638c53f72c973f528befcb79f6218ab172 Mon Sep 17 00:00:00 2001 From: Claudio Saavedra Date: Mon, 4 Aug 2008 23:54:12 +0000 Subject: [PATCH] 2008-08-04 Claudio Saavedra * src/hildon-touch-selector.c: (hildon_touch_selector_class_init), (_hildon_touch_selector_set_model), (hildon_touch_selector_set_model): Move working code to _hildon_touch_selector_set_mode(). Call the class method instead. * src/hildon-touch-selector.h: Add (*set_model) to HildonTouchSelectorClass. Make hildon_touch_selector_set_model() a virtual method, so that derived classes can extend it and do fancy stuff with the model. --- ChangeLog | 13 +++++++++++++ src/hildon-touch-selector.c | 23 +++++++++++++++++------ src/hildon-touch-selector.h | 3 +++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41e9ed7..c079b54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2008-08-04 Claudio Saavedra + * src/hildon-touch-selector.c: (hildon_touch_selector_class_init), + (_hildon_touch_selector_set_model), + (hildon_touch_selector_set_model): Move working code to + _hildon_touch_selector_set_mode(). Call the class method instead. + + * src/hildon-touch-selector.h: Add (*set_model) to + HildonTouchSelectorClass. + + Make hildon_touch_selector_set_model() a virtual method, so that + derived classes can extend it and do fancy stuff with the model. + +2008-08-04 Claudio Saavedra + * configure.ac: Set back the tarname in AC_INIT to hildon. 2008-08-04 Kimmo Hämäläinen diff --git a/src/hildon-touch-selector.c b/src/hildon-touch-selector.c index 844df85..4cf88e7 100644 --- a/src/hildon-touch-selector.c +++ b/src/hildon-touch-selector.c @@ -94,6 +94,10 @@ static SelectorColumn *_create_new_column (HildonTouchSelector * selector, static gboolean _hildon_touch_selector_center_on_selected_items (gpointer data); static void +_hildon_touch_selector_set_model (HildonTouchSelector * selector, + gint num_column, GtkTreeModel * model); + +static void hildon_touch_selector_class_init (HildonTouchSelectorClass * class) { GObjectClass *gobject_class; @@ -114,6 +118,8 @@ hildon_touch_selector_class_init (HildonTouchSelectorClass * class) /* GtkContainer */ container_class->remove = hildon_touch_selector_remove; + /* HildonTouchSelector */ + class->set_model = _hildon_touch_selector_set_model; /* signals */ /** @@ -884,16 +890,12 @@ hildon_touch_selector_get_model (HildonTouchSelector * selector, gint column) return current_column->model; } -void -hildon_touch_selector_set_model (HildonTouchSelector * selector, +static void +_hildon_touch_selector_set_model (HildonTouchSelector * selector, gint num_column, GtkTreeModel * model) { SelectorColumn *column = NULL; - g_return_if_fail (HILDON_TOUCH_SELECTOR (selector)); - g_return_if_fail (num_column < - hildon_touch_selector_get_num_columns (selector)); - column = (SelectorColumn *) g_slist_nth_data (selector->priv->columns, num_column); @@ -901,6 +903,15 @@ hildon_touch_selector_set_model (HildonTouchSelector * selector, gtk_tree_view_set_model (column->tree_view, column->model); } +void +hildon_touch_selector_set_model (HildonTouchSelector * selector, + gint num_column, GtkTreeModel * model) +{ + g_return_if_fail (HILDON_TOUCH_SELECTOR (selector)); + g_return_if_fail (num_column < hildon_touch_selector_get_num_columns (selector)); + + HILDON_TOUCH_SELECTOR_GET_CLASS (selector)->set_model (selector, num_column, model); +} /** * hildon_touch_selector_get_active_text * @selector: the #HildonTouchSelector diff --git a/src/hildon-touch-selector.h b/src/hildon-touch-selector.h index 77e6888..7906dfa 100644 --- a/src/hildon-touch-selector.h +++ b/src/hildon-touch-selector.h @@ -52,6 +52,9 @@ struct _HildonTouchSelectorClass /* signals */ void (*changed) (HildonTouchSelector * selector, gint column); + + /* virtual methods */ + void (*set_model) (HildonTouchSelector *selector, gint column, GtkTreeModel *model); }; typedef enum -- 1.7.9.5