[devhelp] BookTree: configure GtkTreeView in init()



commit 9e904dc34c5c7f539e7afb198155c587415b570e
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri May 5 13:41:40 2017 +0200

    BookTree: configure GtkTreeView in init()
    
    Not by passing properties to g_object_new().
    
    When creating a DhBookTree object with another call to g_object_new(),
    the GtkTreeView will be correctly configured.
    
    Also a problem in the string is discovered only at run-time, while the
    function call is checked at compile time.

 src/dh-book-tree.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/dh-book-tree.c b/src/dh-book-tree.c
index 66ea9d2..8bd976f 100644
--- a/src/dh-book-tree.c
+++ b/src/dh-book-tree.c
@@ -645,6 +645,9 @@ dh_book_tree_init (DhBookTree *tree)
 
         priv = dh_book_tree_get_instance_private (tree);
 
+        gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree), FALSE);
+        gtk_tree_view_set_enable_search (GTK_TREE_VIEW (tree), FALSE);
+
         priv->store = gtk_tree_store_new (N_COLUMNS,
                                           G_TYPE_STRING, /* Title */
                                           G_TYPE_POINTER, /* DhLink */
@@ -655,8 +658,6 @@ dh_book_tree_init (DhBookTree *tree)
         gtk_tree_view_set_model (GTK_TREE_VIEW (tree),
                                  GTK_TREE_MODEL (priv->store));
 
-        gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree), FALSE);
-
         book_tree_add_columns (tree);
         book_tree_setup_selection (tree);
 
@@ -703,9 +704,7 @@ dh_book_tree_init (DhBookTree *tree)
 DhBookTree *
 dh_book_tree_new (void)
 {
-        return g_object_new (DH_TYPE_BOOK_TREE,
-                             "enable-search", FALSE,
-                             NULL);
+        return g_object_new (DH_TYPE_BOOK_TREE, NULL);
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]