aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2012-06-22 15:53:02 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-07-02 16:03:23 +0800
commit2bdbb3de1b5fda8f230ad144e8248472321920f1 (patch)
treec55b2be042a5e990182df16ce7c2f41b53f507fb
parent4a3ff2e68eb3c17488f9a12587b7e9eb95a51645 (diff)
downloadgsoc2013-empathy-2bdbb3de1b5fda8f230ad144e8248472321920f1.tar
gsoc2013-empathy-2bdbb3de1b5fda8f230ad144e8248472321920f1.tar.gz
gsoc2013-empathy-2bdbb3de1b5fda8f230ad144e8248472321920f1.tar.bz2
gsoc2013-empathy-2bdbb3de1b5fda8f230ad144e8248472321920f1.tar.lz
gsoc2013-empathy-2bdbb3de1b5fda8f230ad144e8248472321920f1.tar.xz
gsoc2013-empathy-2bdbb3de1b5fda8f230ad144e8248472321920f1.tar.zst
gsoc2013-empathy-2bdbb3de1b5fda8f230ad144e8248472321920f1.zip
theme-manager: automatically migrate from legacy themes to Adium themes
Because Adium themes are saved by path (urgh), adding a legacy theme called 'gnome' which can be used to set the default theme.
-rw-r--r--libempathy-gtk/empathy-theme-manager.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c
index ff53c9594..bb0b3f784 100644
--- a/libempathy-gtk/empathy-theme-manager.c
+++ b/libempathy-gtk/empathy-theme-manager.c
@@ -262,6 +262,51 @@ 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 = "";
+ char *path;
+
+ 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";
+ }
+
+ path = g_strjoin (NULL, DATADIR, "/adium/message-styles/",
+ adium_theme, ".AdiumMessageStyle",
+ NULL);
+
+ DEBUG ("Migrating to '%s' variant '%s'", path, 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, path);
+ g_settings_set_string (priv->gsettings_chat,
+ EMPATHY_PREFS_CHAT_THEME_VARIANT, variant);
+
+ g_free (path);
+
+finally:
+ g_free (theme);
+}
+
+static void
empathy_theme_manager_init (EmpathyThemeManager *manager)
{
EmpathyThemeManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
@@ -272,6 +317,8 @@ 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,