[Xfce4-commits] <midori:master> Refresh bookmark sidebar on new items

Christian Dywan noreply at xfce.org
Thu Jun 17 00:14:10 CEST 2010


Updating branch refs/heads/master
         to 09d9615964ee2536d994f949279b87a371a57564 (commit)
       from 0b99bbdd4e6b297265264d09d50be792f36f3696 (commit)

commit 09d9615964ee2536d994f949279b87a371a57564
Author: Alexander Butenko <a.butenka at gmail.com>
Date:   Mon Jun 14 02:39:42 2010 -0400

    Refresh bookmark sidebar on new items

 TODO                      |    3 ++-
 midori/midori-browser.c   |   10 ++++++++++
 panels/midori-bookmarks.c |   19 +++++++++++++------
 3 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/TODO b/TODO
index 67a6603..212bae1 100644
--- a/TODO
+++ b/TODO
@@ -94,8 +94,9 @@ TODO:
 
 BOOKMARK ISSUES:
  . Show on toolbar is not working
- . Refresh of sidebar is not done
  . Bookmark menu is not populated
  . Bookmark toolbar is broken
  . Import is broken
  . Integration with locationbar search
+ . Can't remove folder
+ . Can't select folder while adding new bookmark
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 2628cf5..7d73626 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -935,7 +935,17 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
         #if HAVE_SQLITE
         midori_bookmarks_remove_item_from_db (db, bookmark);
         if (!strcmp (selected, _("Toplevel folder")))
+        {
+            GtkTreeView* treeview;
+            GtkTreeModel* model;
+
             midori_bookmarks_insert_item_db (db, bookmark, "");
+            treeview = g_object_get_data (G_OBJECT (browser->bookmarks), "treeview");
+            model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
+            /* FIXME: We need to add item in the end of the list */
+            gtk_tree_store_insert_with_values (GTK_TREE_STORE (model),
+                NULL, NULL, 999, 0, bookmark, -1);
+        }
         else
             midori_bookmarks_insert_item_db (db, bookmark, selected);
         #endif
diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c
index 68731d6..8c9c71f 100644
--- a/panels/midori-bookmarks.c
+++ b/panels/midori-bookmarks.c
@@ -474,6 +474,7 @@ midori_bookmarks_set_app (MidoriBookmarks* bookmarks,
 
     g_object_ref (app);
     bookmarks->array = katze_object_get_object (app, "bookmarks");
+    g_object_set_data (G_OBJECT (bookmarks->array), "treeview", bookmarks->treeview);
 
     #if HAVE_SQLITE
     midori_bookmarks_read_from_db (bookmarks, GTK_TREE_STORE (model), NULL, "");
@@ -729,13 +730,19 @@ midori_bookmarks_delete_activate_cb (GtkWidget*       menuitem,
     #if HAVE_SQLITE
     sqlite3* db;
     #endif
+    GtkTreeModel* model;
+    GtkTreeIter iter;
 
-    item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
-    #if HAVE_SQLITE
-    db = g_object_get_data (G_OBJECT (bookmarks->array), "db");
-    midori_bookmarks_remove_item_from_db (db, item);
-    #endif
-    /* FIXME: Refresh menu */
+    if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (bookmarks->treeview),
+                                           &model, &iter))
+    {
+        item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
+        #if HAVE_SQLITE
+        db = g_object_get_data (G_OBJECT (bookmarks->array), "db");
+        midori_bookmarks_remove_item_from_db (db, item);
+        #endif
+        gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
+    }
 }
 
 static void



More information about the Xfce4-commits mailing list