]> spindle.queued.net Git - midori/commitdiff
Refresh bookmark sidebar on new items
authorAlexander Butenko <a.butenka@gmail.com>
Mon, 14 Jun 2010 06:39:42 +0000 (02:39 -0400)
committerChristian Dywan <christian@twotoasts.de>
Wed, 16 Jun 2010 22:02:10 +0000 (00:02 +0200)
TODO
midori/midori-browser.c
panels/midori-bookmarks.c

diff --git a/TODO b/TODO
index 67a6603f54787c6ec6d49cd790f5c87c3e36b893..212bae1234c4fa5f7ff9a9d5e9ffcfcd8b4373f6 100644 (file)
--- 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
index 2628cf5a726654fae299cc5961aad95e8e59251d..7d73626b90c8545114976d55d948677a1850a813 100644 (file)
@@ -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
index 68731d65d318dda1e935aa771478b0837911719b..8c9c71ff1112036b331db4215ca50456c03a289e 100644 (file)
@@ -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