diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-02 16:32:01 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-02 16:32:01 +0800 |
commit | 2daf6b4066dbde6fdcaa3aee6d85d67f3353bfac (patch) | |
tree | 1f0a9794b8c5e741ade07afc45262c81df381529 | |
parent | fa00d369ea01b464f62a7835e8f61d65f94bc29f (diff) | |
download | gsoc2013-empathy-2daf6b4066dbde6fdcaa3aee6d85d67f3353bfac.tar gsoc2013-empathy-2daf6b4066dbde6fdcaa3aee6d85d67f3353bfac.tar.gz gsoc2013-empathy-2daf6b4066dbde6fdcaa3aee6d85d67f3353bfac.tar.bz2 gsoc2013-empathy-2daf6b4066dbde6fdcaa3aee6d85d67f3353bfac.tar.lz gsoc2013-empathy-2daf6b4066dbde6fdcaa3aee6d85d67f3353bfac.tar.xz gsoc2013-empathy-2daf6b4066dbde6fdcaa3aee6d85d67f3353bfac.tar.zst gsoc2013-empathy-2daf6b4066dbde6fdcaa3aee6d85d67f3353bfac.zip |
move theme migration code to sanity-cleaning.c
That's where this kind of code is meant to be.
-rw-r--r-- | libempathy-gtk/empathy-theme-manager.c | 40 | ||||
-rw-r--r-- | src/empathy-sanity-cleaning.c | 46 |
2 files changed, 45 insertions, 41 deletions
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c index 13d98af73..7d0ebfa93 100644 --- a/libempathy-gtk/empathy-theme-manager.c +++ b/libempathy-gtk/empathy-theme-manager.c @@ -266,44 +266,6 @@ empathy_theme_manager_class_init (EmpathyThemeManagerClass *klass) } static void -theme_manager_migrate_from_legacy_theme (EmpathyThemeManager *self) -{ - EmpathyThemeManagerPriv *priv = self->priv; - char *theme = g_settings_get_string (priv->gsettings_chat, - EMPATHY_PREFS_CHAT_THEME); - const char *adium_theme, *variant = ""; - - if (!tp_strdiff (theme, "adium")) { - goto finally; - } else if (!tp_strdiff (theme, "gnome")) { - adium_theme = "PlanetGNOME"; - } else if (!tp_strdiff (theme, "simple")) { - adium_theme = "Boxes"; - variant = "Simple"; - } else if (!tp_strdiff (theme, "clean")) { - adium_theme = "Boxes"; - variant = "Clean"; - } else if (!tp_strdiff (theme, "blue")) { - adium_theme = "Boxes"; - variant = "Blue"; - } else { - adium_theme = "Classic"; - } - - DEBUG ("Migrating to '%s' variant '%s'", adium_theme, variant); - - g_settings_set_string (priv->gsettings_chat, - EMPATHY_PREFS_CHAT_THEME, "adium"); - g_settings_set_string (priv->gsettings_chat, - EMPATHY_PREFS_CHAT_ADIUM_PATH, adium_theme); - g_settings_set_string (priv->gsettings_chat, - EMPATHY_PREFS_CHAT_THEME_VARIANT, variant); - -finally: - g_free (theme); -} - -static void empathy_theme_manager_init (EmpathyThemeManager *manager) { EmpathyThemeManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, @@ -314,8 +276,6 @@ empathy_theme_manager_init (EmpathyThemeManager *manager) priv->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA); - theme_manager_migrate_from_legacy_theme (manager); - /* Take the adium path/variant and track changes */ g_signal_connect (priv->gsettings_chat, "changed::" EMPATHY_PREFS_CHAT_ADIUM_PATH, diff --git a/src/empathy-sanity-cleaning.c b/src/empathy-sanity-cleaning.c index 70e5de273..b14f4f527 100644 --- a/src/empathy-sanity-cleaning.c +++ b/src/empathy-sanity-cleaning.c @@ -38,7 +38,7 @@ * If the number stored in gsettings is lower than it, all the tasks will * be executed. */ -#define SANITY_CLEANING_NUMBER 2 +#define SANITY_CLEANING_NUMBER 3 static void account_update_parameters_cb (GObject *source, @@ -141,12 +141,56 @@ set_facebook_account_fallback_server (TpAccountManager *am) } static void +upgrade_chat_theme_settings (void) +{ + GSettings *gsettings_chat; + gchar *theme; + const char *adium_theme, *variant = ""; + + gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA); + + theme = g_settings_get_string (gsettings_chat, + EMPATHY_PREFS_CHAT_THEME); + + if (!tp_strdiff (theme, "adium")) { + goto finally; + } else if (!tp_strdiff (theme, "gnome")) { + adium_theme = "PlanetGNOME"; + } else if (!tp_strdiff (theme, "simple")) { + adium_theme = "Boxes"; + variant = "Simple"; + } else if (!tp_strdiff (theme, "clean")) { + adium_theme = "Boxes"; + variant = "Clean"; + } else if (!tp_strdiff (theme, "blue")) { + adium_theme = "Boxes"; + variant = "Blue"; + } else { + adium_theme = "Classic"; + } + + DEBUG ("Migrating to '%s' variant '%s'", adium_theme, variant); + + g_settings_set_string (gsettings_chat, + EMPATHY_PREFS_CHAT_THEME, "adium"); + g_settings_set_string (gsettings_chat, + EMPATHY_PREFS_CHAT_ADIUM_PATH, adium_theme); + g_settings_set_string (gsettings_chat, + EMPATHY_PREFS_CHAT_THEME_VARIANT, variant); + +finally: + g_free (theme); + g_object_unref (gsettings_chat); +} + +static void run_sanity_cleaning_tasks (TpAccountManager *am) { DEBUG ("Starting sanity cleaning tasks"); fix_xmpp_account_priority (am); set_facebook_account_fallback_server (am); + upgrade_chat_theme_settings (); } static void |