[devhelp/gnome-2-32] contents tree: update if list of disabled books changes



commit 6c827e8998019e84f8ae48dc699c63bf2d988a3a
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu May 20 15:44:13 2010 +0200

    contents tree: update if list of disabled books changes

 src/dh-book-tree.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/dh-book-tree.c b/src/dh-book-tree.c
index 37d250a..d6be62e 100644
--- a/src/dh-book-tree.c
+++ b/src/dh-book-tree.c
@@ -166,6 +166,8 @@ book_tree_populate_tree (DhBookTree *tree)
         DhBookTreePriv *priv = GET_PRIVATE (tree);
         GList          *l;
 
+        gtk_tree_store_clear (priv->store);
+
         for (l = dh_book_manager_get_books (priv->book_manager);
              l;
              l = g_list_next (l)) {
@@ -181,6 +183,14 @@ book_tree_populate_tree (DhBookTree *tree)
 }
 
 static void
+book_manager_disabled_book_list_changed_cb (DhBookManager *book_manager,
+                                            gpointer user_data)
+{
+        DhBookTree *tree = user_data;
+        book_tree_populate_tree (tree);
+}
+
+static void
 book_tree_insert_node (DhBookTree  *tree,
 		       GNode       *node,
 		       GtkTreeIter *parent_iter)
@@ -249,6 +259,11 @@ dh_book_tree_new (DhBookManager *book_manager)
         priv = GET_PRIVATE (tree);
 
         priv->book_manager = g_object_ref (book_manager);
+        g_signal_connect (priv->book_manager,
+                          "disabled-book-list-updated",
+                          G_CALLBACK (book_manager_disabled_book_list_changed_cb),
+                          tree);
+
         book_tree_populate_tree (tree);
 
 	/* Mark the first item as selected, or it would get automatically



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