]> spindle.queued.net Git - midori/commitdiff
Fix edit bookmark behavior
authorAlexander Butenko <a.butenka@gmail.com>
Mon, 19 Jul 2010 20:58:18 +0000 (16:58 -0400)
committerChristian Dywan <christian@twotoasts.de>
Wed, 21 Jul 2010 21:01:13 +0000 (23:01 +0200)
midori/midori-browser.c
panels/midori-bookmarks.c

index a6bb4221c808f32dd685f032ef20b5ea61142170..c5043f2eea43f52991d95dcae42291975b3e87f9 100644 (file)
@@ -915,6 +915,11 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
     if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
     {
         gchar* selected;
+        GtkTreeView* treeview;
+        GtkTreeModel* model;
+
+        if (!new_bookmark)
+            midori_bookmarks_remove_item_from_db (db, bookmark);
 
         katze_item_set_name (bookmark,
             gtk_entry_get_text (GTK_ENTRY (entry_title)));
@@ -932,20 +937,18 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
 
         selected = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo_folder));
 
-        midori_bookmarks_remove_item_from_db (db, bookmark);
         if (!strcmp (selected, _("Toplevel folder")))
-        {
-            GtkTreeView* treeview;
-            GtkTreeModel* model;
+            selected = g_strdup ("");
 
-            midori_bookmarks_insert_item_db (db, bookmark, "");
+        midori_bookmarks_insert_item_db (db, bookmark, selected);
+
+        if (new_bookmark)
+        {
             treeview = g_object_get_data (G_OBJECT (browser->bookmarks), "treeview");
             model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
             gtk_tree_store_insert_with_values (GTK_TREE_STORE (model),
                 NULL, NULL, G_MAXINT, 0, bookmark, -1);
         }
-        else
-            midori_bookmarks_insert_item_db (db, bookmark, selected);
 
         if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar)))
             if (!gtk_widget_get_visible (browser->bookmarkbar))
index 3b9e26e0e4b2b5a04557e554065e4ec24aa9e769..0edac295aa12e0922f6fa7f0a25cb7c737636c49 100644 (file)
@@ -345,11 +345,8 @@ midori_bookmarks_edit_clicked_cb (GtkWidget*       toolitem,
         g_assert (!KATZE_ITEM_IS_SEPARATOR (item));
 
         browser = midori_browser_get_for_widget (bookmarks->treeview);
-        if (midori_browser_edit_bookmark_dialog_new (
-            browser, item, FALSE, KATZE_ITEM_IS_FOLDER (item)))
-        {
-            gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
-        }
+        midori_browser_edit_bookmark_dialog_new (
+            browser, item, FALSE, KATZE_ITEM_IS_FOLDER (item));
         g_object_unref (item);
     }
 }