vinagre r359 - in trunk: . src



Author: jwendell
Date: Mon Jun  2 14:09:46 2008
New Revision: 359
URL: http://svn.gnome.org/viewvc/vinagre?rev=359&view=rev

Log:
2008-06-02  Jonh Wendell <jwendell gnome org>

	* src/vinagre-bookmarks.c (vinagre_bookmarks_init):
	Use XDG recomendation to store bookmarks file. Make sure to copy
	the old file to new location. Fixes #536111.


Modified:
   trunk/ChangeLog
   trunk/README
   trunk/src/vinagre-bookmarks.c

Modified: trunk/README
==============================================================================
--- trunk/README	(original)
+++ trunk/README	Mon Jun  2 14:09:46 2008
@@ -32,3 +32,11 @@
   compiled with this feature enabled.
     Simply build gtk-vnc with the flag '--with-gtkglext=yes', in the
     configure stage.
+
+Bookmarks
+=========
+
+  - In Vinagre 2.23.3 we have moved the bookmarks file location from ~/.gnome2
+  to ~/.local/share/vinagre, which is the recommended place for data files.
+  The change should be transparent, i.e., we automatically copy the old file
+  to the new place if we detect that new file does not exist yet.

Modified: trunk/src/vinagre-bookmarks.c
==============================================================================
--- trunk/src/vinagre-bookmarks.c	(original)
+++ trunk/src/vinagre-bookmarks.c	Mon Jun  2 14:09:46 2008
@@ -69,14 +69,44 @@
 
   book->priv->conns = NULL;
   book->priv->file = NULL;
-  book->priv->filename = g_build_filename (g_get_home_dir (),
-			                   ".gnome2",
+
+  book->priv->filename = g_build_filename (g_get_user_data_dir (),
+			                   "vinagre",
 			                   VINAGRE_BOOKMARKS_FILE,
 			                   NULL);
+  gfile = g_file_new_for_path (book->priv->filename);
+
+  if (!g_file_test (book->priv->filename, G_FILE_TEST_EXISTS))
+    {
+      gchar *old;
+
+      old = g_build_filename (g_get_home_dir (),
+			      ".gnome2",
+			      VINAGRE_BOOKMARKS_FILE,
+			      NULL);
+      if (g_file_test (old, G_FILE_TEST_EXISTS))
+	{
+	  GFile *src;
+	  GError *error = NULL;
+
+	  g_message (_("Copying the bookmarks file to the new location. This operation is supposed to run only once."));
+	  src = g_file_new_for_path (old);
+
+	  if (!g_file_copy (src, gfile, G_FILE_COPY_NONE, NULL, NULL, NULL, &error))
+	    {
+	      g_warning (_("Error: %s"), error->message);
+	      g_error_free (error);
+	    }
+
+	  g_object_unref (src);
+	}
+
+      g_free (old);
+    }
+
   vinagre_bookmarks_update_file (book);
   vinagre_bookmarks_update_conns (book);
 
-  gfile = g_file_new_for_path (book->priv->filename);
   book->priv->monitor = g_file_monitor_file (gfile,
                                              G_FILE_MONITOR_NONE,
                                              NULL,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]