[Xfce4-commits] <midori:master> Be sure to only migrate bookmarks if .db doesn't exist

Christian Dywan noreply at xfce.org
Thu Feb 17 19:56:03 CET 2011


Updating branch refs/heads/master
         to 503ed3ac9471f67082a2d9bc2563edfaf2b1b0b3 (commit)
       from 40a6743e78ceb25027ff4e53ae854209e5ad0f7f (commit)

commit 503ed3ac9471f67082a2d9bc2563edfaf2b1b0b3
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Feb 17 19:45:23 2011 +0100

    Be sure to only migrate bookmarks if .db doesn't exist
    
    Fixes: https://bugs.launchpad.net/midori/+bug/711377

 midori/main.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/midori/main.c b/midori/main.c
index 2bea2c0..06b9e7a 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -1647,6 +1647,7 @@ main (int    argc,
     MidoriWebSettings* settings;
     gchar* config_file;
     gchar* bookmarks_file;
+    gboolean bookmarks_exist;
     MidoriStartup load_on_startup;
     KatzeArray* search_engines;
     KatzeArray* bookmarks;
@@ -1980,6 +1981,7 @@ main (int    argc,
 
     bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
     bookmarks_file = g_build_filename (config, "bookmarks.db", NULL);
+    bookmarks_exist = g_access (bookmarks_file, F_OK) == 0;
     errmsg = NULL;
     if ((db = midori_bookmarks_initialize (bookmarks, bookmarks_file, &errmsg)) == NULL)
     {
@@ -1987,8 +1989,9 @@ main (int    argc,
             _("Bookmarks couldn't be loaded: %s\n"), errmsg);
         g_free (errmsg);
     }
-    else
+    else if (!bookmarks_exist)
     {
+        /* Initial creation, import old bookmarks */
         gchar* old_bookmarks;
         if (g_path_is_absolute (BOOKMARK_FILE))
             old_bookmarks = g_strdup (BOOKMARK_FILE);
@@ -2000,8 +2003,8 @@ main (int    argc,
             /* Leave old bookmarks around */
         }
         g_free (old_bookmarks);
-        g_object_set_data (G_OBJECT (bookmarks), "db", db);
     }
+    g_object_set_data (G_OBJECT (bookmarks), "db", db);
     midori_startup_timer ("Bookmarks read: \t%f");
 
     config_file = NULL;



More information about the Xfce4-commits mailing list