aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-migrate.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2011-10-13 22:53:51 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-10-13 22:53:51 +0800
commitd4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9 (patch)
tree57244f41cfcd1cd6ded0348501ce465ebfba9d2d /shell/e-shell-migrate.c
parent805d8c25ac6c8f58c8e17f3b89fa50f17cfdf27b (diff)
downloadgsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar
gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.gz
gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.bz2
gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.lz
gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.xz
gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.tar.zst
gsoc2013-evolution-d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9.zip
Migrate most of the shell code to GSettings
Diffstat (limited to 'shell/e-shell-migrate.c')
-rw-r--r--shell/e-shell-migrate.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c
index dd75a40b82..e694ec29fd 100644
--- a/shell/e-shell-migrate.c
+++ b/shell/e-shell-migrate.c
@@ -38,9 +38,6 @@
#include "es-event.h"
-#define GCONF_VERSION_KEY "/apps/evolution/version"
-#define GCONF_LAST_VERSION_KEY "/apps/evolution/last_version"
-
/******************** Begin XDG Base Directory Migration ********************/
/* These are the known EShellBackend names as of Evolution 3.0 */
static const gchar *shell_backend_names[] =
@@ -735,23 +732,23 @@ shell_migrate_get_version (EShell *shell,
gint *minor,
gint *micro)
{
- GConfClient *client;
- const gchar *key;
+ GSettings *settings;
gchar *string;
*major = 0;
*minor = 0;
*micro = 0;
- key = GCONF_VERSION_KEY;
- client = e_shell_get_gconf_client (shell);
- string = gconf_client_get_string (client, key, NULL);
+ settings = g_settings_new ("org.gnome.evolution");
+ string = g_settings_get_string (settings, "version");
if (string != NULL) {
/* Since 1.4.0 we've kept the version key in GConf. */
sscanf (string, "%d.%d.%d", major, minor, micro);
g_free (string);
}
+
+ g_object_unref (settings);
}
static void
@@ -902,7 +899,7 @@ gboolean
e_shell_migrate_attempt (EShell *shell)
{
ESEvent *ese;
- GConfClient *client;
+ GSettings *settings;
const gchar *key;
gint major, minor, micro;
gint last_major, last_minor, last_micro;
@@ -912,7 +909,7 @@ e_shell_migrate_attempt (EShell *shell)
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
- client = e_shell_get_gconf_client (shell);
+ settings = g_settings_new ("org.gnome.evolution");
if (sscanf (BASE_VERSION, "%d.%d", &curr_major, &curr_minor) != 2) {
g_warning ("Could not parse BASE_VERSION (%s)", BASE_VERSION);
@@ -946,14 +943,13 @@ e_shell_migrate_attempt (EShell *shell)
/* Record a successful migration. */
string = g_strdup_printf (
"%d.%d.%d", curr_major, curr_minor, curr_micro);
- gconf_client_set_string (client, GCONF_VERSION_KEY, string, NULL);
+ g_settings_set_string (settings, "version", string);
g_free (string);
migrated = TRUE;
- key = GCONF_LAST_VERSION_KEY;
- /* Try to retrieve the last migrated version from GConf. */
- string = gconf_client_get_string (client, key, NULL);
+ /* Try to retrieve the last migrated version from GSettings. */
+ string = g_settings_get_string (client, "last-upgraded-version");
if (migrated || string == NULL || sscanf (string, "%d.%d.%d",
&last_major, &last_minor, &last_micro) != 3) {
last_major = major;
@@ -964,9 +960,11 @@ e_shell_migrate_attempt (EShell *shell)
string = g_strdup_printf (
"%d.%d.%d", last_major, last_minor, last_micro);
- gconf_client_set_string (client, key, string, NULL);
+ g_settings_set_string (client, "last-upgraded-version", string);
g_free (string);
+ g_object_unref (settings);
+
/** @Event: Shell attempted upgrade
* @Id: upgrade.done
* @Target: ESMenuTargetState