[gnome-color-manager] Rename 'done-migration' to 'migrate-config-version' so we could re-use this in the future
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Rename 'done-migration' to 'migrate-config-version' so we could re-use this in the future
- Date: Thu, 27 May 2010 11:11:38 +0000 (UTC)
commit 5ee8af6b89049d040f0556222c2ee0881976fe6b
Author: Richard Hughes <richard hughsie com>
Date: Thu May 27 12:11:30 2010 +0100
Rename 'done-migration' to 'migrate-config-version' so we could re-use this in the future
data/org.gnome.color-manager.gschema.xml | 6 +++---
src/gcm-client.c | 20 ++++++++++++++------
src/gcm-utils.h | 6 ++++--
3 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/data/org.gnome.color-manager.gschema.xml b/data/org.gnome.color-manager.gschema.xml
index b31f9bb..7e40bdd 100644
--- a/data/org.gnome.color-manager.gschema.xml
+++ b/data/org.gnome.color-manager.gschema.xml
@@ -65,10 +65,10 @@
<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="done-migration" type="b">
- <default>false</default>
+ <key name="migrate-config-version" type="i">
+ <default>0</default>
<summary>If the data migration has been done</summary>
- <description>This is set to TRUE when the data migration does not need to be attempted.</description>
+ <description>This is incremented to the latest config version if the config file has been migrated.</description>
</key>
</schema>
</schemalist>
diff --git a/src/gcm-client.c b/src/gcm-client.c
index e7b00da..7865dd0 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -956,22 +956,28 @@ gcm_client_possibly_migrate_config_file (GcmClient *client)
GFile *gdest = NULL;
GFile *gsource = NULL;
gboolean ret = FALSE;
- gboolean done_migration;
+ gint config_version;
GError *error = NULL;
/* have we already attempted this (check first to avoid stating a file */
- done_migration = g_settings_get_boolean (client->priv->settings, GCM_SETTINGS_DONE_MIGRATION);
- if (done_migration)
+ 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);
+ 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_boolean (client->priv->settings, GCM_SETTINGS_DONE_MIGRATION, TRUE);
+ g_settings_set_int (client->priv->settings,
+ GCM_SETTINGS_MIGRATE_CONFIG_VERSION,
+ GCM_CONFIG_VERSION_SHARED_SPEC);
goto out;
}
@@ -994,7 +1000,9 @@ gcm_client_possibly_migrate_config_file (GcmClient *client)
}
/* do not attempt to migrate this again */
- g_settings_set_boolean (client->priv->settings, GCM_SETTINGS_DONE_MIGRATION, TRUE);
+ g_settings_set_int (client->priv->settings,
+ GCM_SETTINGS_MIGRATE_CONFIG_VERSION,
+ GCM_CONFIG_VERSION_SHARED_SPEC);
out:
g_free (source);
g_free (dest);
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index 384572f..f24904d 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -46,11 +46,13 @@
#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_DONE_MIGRATION "done-migration"
-
+#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_CONFIG_VERSION_ORIGINAL 0
+#define GCM_CONFIG_VERSION_SHARED_SPEC 1
+
/* DISTROS: you will have to patch if you have changed the name of these packages */
#define GCM_PREFS_PACKAGE_NAME_SHARED_COLOR_TARGETS "shared-color-targets"
#define GCM_PREFS_PACKAGE_NAME_ARGYLLCMS "argyllcms"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]