[evolution-data-server] Bug 723614 - Restore from GConf only once



commit 9d11edc5d1136ff1e27f6c8cafa613d677e02981
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 5 22:03:45 2015 +0100

    Bug 723614 - Restore from GConf only once

 data/Makefile.am                                   |    1 +
 .../org.gnome.evolution-data-server.gschema.xml.in |    8 ++++++++
 .../evolution-source-registry.c                    |   13 ++++++++++++-
 3 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index cbe3ec3..3c0fa21 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -2,6 +2,7 @@ NULL =
 
 gsettings_SCHEMAS = \
        org.gnome.Evolution.DefaultSources.gschema.xml \
+       org.gnome.evolution-data-server.gschema.xml \
        org.gnome.evolution-data-server.calendar.gschema.xml \
        org.gnome.evolution-data-server.addressbook.gschema.xml \
        org.gnome.evolution.shell.network-config.gschema.xml \
diff --git a/data/org.gnome.evolution-data-server.gschema.xml.in 
b/data/org.gnome.evolution-data-server.gschema.xml.in
new file mode 100644
index 0000000..1b38cda
--- /dev/null
+++ b/data/org.gnome.evolution-data-server.gschema.xml.in
@@ -0,0 +1,8 @@
+<schemalist>
+  <schema gettext-domain="evolution-data-server" id="org.gnome.evolution-data-server" 
path="/org/gnome/evolution-data-server/">
+    <key name="migrated" type="b">
+      <default>false</default>
+      <_summary>Whether the migration of old setting was already done</_summary>
+    </key>
+  </schema>
+</schemalist>
diff --git a/services/evolution-source-registry/evolution-source-registry.c 
b/services/evolution-source-registry/evolution-source-registry.c
index 96a8c86..3b2208b 100644
--- a/services/evolution-source-registry/evolution-source-registry.c
+++ b/services/evolution-source-registry/evolution-source-registry.c
@@ -145,6 +145,7 @@ main (gint argc,
        GOptionContext *context;
        EDBusServer *server;
        EDBusServerExitCode exit_code;
+       GSettings *settings;
        GError *error = NULL;
 
 #ifdef G_OS_WIN32
@@ -176,7 +177,11 @@ main (gint argc,
 
 reload:
 
-       if (!opt_disable_migration) {
+       settings = g_settings_new ("org.gnome.evolution-data-server");
+
+       if (!opt_disable_migration && !g_settings_get_boolean (settings, "migrated")) {
+               g_settings_set_boolean (settings, "migrated", TRUE);
+
                /* Migrate user data from ~/.evolution to XDG base directories. */
                evolution_source_registry_migrate_basedir ();
 
@@ -184,8 +189,14 @@ reload:
                 * Do this AFTER XDG base directory migration since the key
                 * files are saved according to XDG base directory settings. */
                evolution_source_registry_migrate_sources ();
+       } else if (opt_disable_migration) {
+               e_source_registry_debug_print (" * Skipping old account data migration, disabled on command 
line\n");
+       } else {
+               e_source_registry_debug_print (" * Skipping old account data migration, already migrated\n");
        }
 
+       g_object_unref (settings);
+
        server = e_source_registry_server_new ();
 
        g_signal_connect (


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