aboutsummaryrefslogtreecommitdiff
path: root/examples/hildon-pannable-area-touch-list-example.c
diff options
context:
space:
mode:
authorAlberto Garcia <agarcia@igalia.com>2008-08-12 16:24:35 +0000
committerAlberto Garcia <agarcia@igalia.com>2008-08-12 16:24:35 +0000
commit5446b82e88e3aa87389eedf66161119536c9d322 (patch)
tree33e351d3d339d933ac2f55a4f34187fa63b4069b /examples/hildon-pannable-area-touch-list-example.c
parent3299f6d174c94fc773e8458e2d1ba30d117f5e7d (diff)
2008-08-12 Alberto Garcia <agarcia@igalia.com>
* examples/hildon-pannable-area-touch-list-example.c (create_tree_view) * examples/hildon-pannable-area-touch-grid-example.c (create_icon_view): Use gtk_{tree,icon}_view_new() and hildon_gtk_{tree,icon}_view_new() instead of g_object_new(). Fix memory leak when setting the tree model.
Diffstat (limited to 'examples/hildon-pannable-area-touch-list-example.c')
-rw-r--r--examples/hildon-pannable-area-touch-list-example.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/examples/hildon-pannable-area-touch-list-example.c b/examples/hildon-pannable-area-touch-list-example.c
index 8b65d6f..44a3090 100644
--- a/examples/hildon-pannable-area-touch-list-example.c
+++ b/examples/hildon-pannable-area-touch-list-example.c
@@ -80,13 +80,21 @@ create_tree_view (HildonUIMode mode,
GtkWidget *tree_view;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
+ GtkTreeModel *model;
- tree_view = g_object_new (GTK_TYPE_TREE_VIEW,
- "model", create_model (),
- "name", name,
- "hildon-ui-mode", mode,
- "rules-hint", TRUE,
- NULL);
+ if (name && g_str_equal (name, "fremantle-widget"))
+ tree_view = hildon_gtk_tree_view_new (mode);
+ else
+ tree_view = gtk_tree_view_new ();
+
+ if (name)
+ gtk_widget_set_name (tree_view, name);
+
+ gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree_view), TRUE);
+
+ model = create_model ();
+ gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), model);
+ g_object_unref (model);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
if (multi_select)