[gnome-color-manager/colord: 17/72] Do not migrate the old config file, we're not going to be using it at all soon



commit d3d06e067f3d76c86362c568232cce80dcc8b150
Author: Richard Hughes <richard hughsie com>
Date:   Sun Jan 16 19:34:18 2011 +0000

    Do not migrate the old config file, we're not going to be using it at all soon

 data/org.gnome.color-manager.gschema.xml |    5 --
 src/gcm-client.c                         |   81 ------------------------------
 src/gcm-utils.h                          |    1 -
 3 files changed, 0 insertions(+), 87 deletions(-)
---
diff --git a/data/org.gnome.color-manager.gschema.xml b/data/org.gnome.color-manager.gschema.xml
index 097c967..3930ce3 100644
--- a/data/org.gnome.color-manager.gschema.xml
+++ b/data/org.gnome.color-manager.gschema.xml
@@ -80,11 +80,6 @@
       <summary>The duration between sending notifications to recalibrate a printer</summary>
       <description>This is the number of seconds in between notifying the user to recalibrate each printer device. Set to 0 to disable the notification.</description>
     </key>
-    <key name="migrate-config-version" type="i">
-      <default>0</default>
-      <summary>If the data migration has been done</summary>
-      <description>This is incremented to the latest config version if the config file has been migrated.</description>
-    </key>
     <key name="enable-sane" type="b">
       <default>true</default>
       <summary>If SANE support is enabled</summary>
diff --git a/src/gcm-client.c b/src/gcm-client.c
index ced2979..6d650cf 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -831,81 +831,6 @@ out:
 }
 
 /**
- * gcm_client_possibly_migrate_config_file:
- *
- * Copy the configuration file from ~/.config/gnome-color-manager to ~/.config/color
- **/
-static gboolean
-gcm_client_possibly_migrate_config_file (GcmClient *client)
-{
-	gchar *dest = NULL;
-	gchar *source = NULL;
-	GFile *gdest = NULL;
-	GFile *gsource = NULL;
-	gboolean ret = FALSE;
-	gint config_version;
-	GError *error = NULL;
-
-	/* have we already attempted this (check first to avoid stating a file */
-	config_version = g_settings_get_int (client->priv->settings,
-					     GCM_SETTINGS_MIGRATE_CONFIG_VERSION);
-	if (config_version >= GCM_CONFIG_VERSION_SHARED_SPEC)
-		goto out;
-
-	/* create default path */
-	source = g_build_filename (g_get_user_config_dir (),
-				   "gnome-color-manager",
-				   "device-profiles.conf",
-				   NULL);
-	gsource = g_file_new_for_path (source);
-
-	/* no old profile */
-	ret = g_file_query_exists (gsource, NULL);
-	if (!ret) {
-		g_settings_set_int (client->priv->settings,
-				    GCM_SETTINGS_MIGRATE_CONFIG_VERSION,
-				    GCM_CONFIG_VERSION_SHARED_SPEC);
-		goto out;
-	}
-
-	/* ensure new root exists */
-	dest = gcm_utils_get_default_config_location ();
-	ret = gcm_utils_mkdir_for_filename (dest, &error);
-	if (!ret) {
-		g_warning ("failed to create new tree: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* copy to new root */
-	gdest = g_file_new_for_path (dest);
-	ret = g_file_copy (gsource, gdest, G_FILE_COPY_NONE, NULL, NULL, NULL, &error);
-	if (!ret) {
-		/* does the file already exist? -- i.e. the schema version was reset */
-		if (error->domain != G_IO_ERROR ||
-		    error->code != G_IO_ERROR_EXISTS) {
-			g_warning ("failed to copy: %s", error->message);
-			g_error_free (error);
-			goto out;
-		}
-		g_error_free (error);
-	}
-
-	/* do not attempt to migrate this again */
-	g_settings_set_int (client->priv->settings,
-			    GCM_SETTINGS_MIGRATE_CONFIG_VERSION,
-			    GCM_CONFIG_VERSION_SHARED_SPEC);
-out:
-	g_free (source);
-	g_free (dest);
-	if (gsource != NULL)
-		g_object_unref (gsource);
-	if (gdest != NULL)
-		g_object_unref (gdest);
-	return ret;
-}
-
-/**
  * gcm_client_add_saved:
  **/
 static gboolean
@@ -918,9 +843,6 @@ gcm_client_add_saved (GcmClient *client, GError **error)
 	guint i;
 	GcmDevice *device;
 
-	/* copy from old location */
-	gcm_client_possibly_migrate_config_file (client);
-
 	/* get the config file */
 	filename = gcm_utils_get_default_config_location ();
 	g_debug ("using %s", filename);
@@ -977,9 +899,6 @@ gcm_client_coldplug (GcmClient *client, GcmClientColdplug coldplug, GError **err
 
 	g_return_val_if_fail (GCM_IS_CLIENT (client), FALSE);
 
-	/* copy from old location */
-	gcm_client_possibly_migrate_config_file (client);
-
 	/* reset */
 	client->priv->loading_refcount = 0;
 
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index acd5aba..f5bb319 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -46,7 +46,6 @@
 #define GCM_SETTINGS_CALIBRATION_LENGTH			"calibration-length"
 #define GCM_SETTINGS_SHOW_FINE_TUNING			"show-fine-tuning"
 #define GCM_SETTINGS_SHOW_NOTIFICATIONS			"show-notifications"
-#define GCM_SETTINGS_MIGRATE_CONFIG_VERSION		"migrate-config-version"
 #define GCM_SETTINGS_RECALIBRATE_PRINTER_THRESHOLD	"recalibrate-printer-threshold"
 #define GCM_SETTINGS_RECALIBRATE_DISPLAY_THRESHOLD	"recalibrate-display-threshold"
 #define GCM_SETTINGS_ENABLE_SANE			"enable-sane"



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