[nautilus] Migrate old nautilus metadata to gvfs on startup



commit 72f65592a84cb8e9ad2ccaa6bbfd7fe4fbe7371b
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Aug 18 16:27:45 2009 +0200

    Migrate old nautilus metadata to gvfs on startup
    
    If ~/.nautilus/metadata/migrated-to-gvfs doesn't exist, migrate and
    create it.

 src/Makefile.am            |    1 +
 src/nautilus-application.c |   19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 042caf6..edf9b5b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,6 +22,7 @@ INCLUDES =							\
 	$(EXEMPI_CFLAGS)                                        \
 	-DDATADIR=\""$(datadir)"\" 				\
 	-DLIBDIR=\""$(libdir)"\" 				\
+	-DLIBEXECDIR=\""$(libexecdir)"\" 			\
 	-DNAUTILUS_DATADIR=\""$(datadir)/nautilus"\" 		\
 	-DUIDIR=\""$(datadir)/nautilus/ui"\" 		\
 	-DNAUTILUS_PIXMAPDIR=\""$(datadir)/pixmaps/nautilus"\" 	\
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 7bd4892..6b5663d 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -631,11 +631,28 @@ static void
 do_upgrades_once (NautilusApplication *application,
 		  gboolean no_desktop)
 {
+	char *metafile_dir, *updated;
+	int fd;
+
 	if (!no_desktop) {
 		mark_desktop_files_trusted ();
 	}
-}
 
+	metafile_dir = g_build_filename (g_get_home_dir (),
+					 ".nautilus/metafiles", NULL);
+	if (g_file_test (metafile_dir, G_FILE_TEST_IS_DIR)) {
+		updated = g_build_filename (metafile_dir, "migrated-to-gvfs", NULL);
+		if (!g_file_test (updated, G_FILE_TEST_EXISTS)) {
+			g_spawn_command_line_async (LIBEXECDIR"/nautilus-convert-metadata --quiet", NULL);
+			fd = g_creat (updated, 0600);
+			if (fd != -1) {
+				close (fd);
+			}
+		}
+		g_free (updated);
+	}
+	g_free (metafile_dir);
+}
 
 static void
 finish_startup (NautilusApplication *application,



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