From 5859bbe2abd8244d71a33fd4b9ae2f6d7d6baf51 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Mon, 19 Jul 2010 16:58:18 -0400 Subject: [PATCH] Fix edit bookmark behavior --- midori/midori-browser.c | 17 ++++++++++------- panels/midori-bookmarks.c | 7 ++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index a6bb4221..c5043f2e 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -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)) diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c index 3b9e26e0..0edac295 100644 --- a/panels/midori-bookmarks.c +++ b/panels/midori-bookmarks.c @@ -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); } } -- 2.39.5