diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-02 18:58:56 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-02 19:00:56 +0800 |
commit | 9b222761cc9995a09f37b7537a12e4955b586323 (patch) | |
tree | db1925d6d43a85bcb9bb49c1626a0237c46525a2 /libempathy-gtk | |
parent | 5e112661cca767870225936428515a82b2f6f82c (diff) | |
download | gsoc2013-empathy-9b222761cc9995a09f37b7537a12e4955b586323.tar gsoc2013-empathy-9b222761cc9995a09f37b7537a12e4955b586323.tar.gz gsoc2013-empathy-9b222761cc9995a09f37b7537a12e4955b586323.tar.bz2 gsoc2013-empathy-9b222761cc9995a09f37b7537a12e4955b586323.tar.lz gsoc2013-empathy-9b222761cc9995a09f37b7537a12e4955b586323.tar.xz gsoc2013-empathy-9b222761cc9995a09f37b7537a12e4955b586323.tar.zst gsoc2013-empathy-9b222761cc9995a09f37b7537a12e4955b586323.zip |
Store the theme name in the 'theme' gsettings key
The 'adium-path' key is now deprecated as we lookup the theme path from its
name.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-theme-manager.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c index 1f6611663..c18ca56be 100644 --- a/libempathy-gtk/empathy-theme-manager.c +++ b/libempathy-gtk/empathy-theme-manager.c @@ -132,48 +132,41 @@ theme_manager_create_adium_view (EmpathyThemeManager *self) } static void -theme_manager_notify_adium_path_cb (GSettings *gsettings_chat, +theme_manager_notify_theme_cb (GSettings *gsettings_chat, const gchar *key, gpointer user_data) { EmpathyThemeManager *self = EMPATHY_THEME_MANAGER (user_data); - const gchar *current_path = NULL; - gchar *new_path; + gchar *theme, *path; - new_path = g_settings_get_string (gsettings_chat, key); + theme = g_settings_get_string (gsettings_chat, key); - if (self->priv->adium_data != NULL) - current_path = empathy_adium_data_get_path (self->priv->adium_data); - - /* If path did not really changed, ignore */ - if (!tp_strdiff (current_path, new_path)) - goto finally; - - /* If path does not really contains an adium path, ignore */ - if (empathy_adium_path_is_valid (new_path)) - { - /* pass */ - } - else if (empathy_theme_manager_find_theme (new_path) != NULL) + if (empathy_theme_manager_find_theme (theme) != NULL) { - new_path = empathy_theme_manager_find_theme (new_path); + path = empathy_theme_manager_find_theme (theme); + g_free (theme); } else { - g_warning ("Do not understand theme: %s", new_path); - goto finally; + g_warning ("Can't find theme: %s; fallback to 'Classic'", + theme); + + g_free (theme); + + path = empathy_theme_manager_find_theme ("Classic"); + if (path == NULL) + g_critical ("Can't find 'Classic theme"); } /* Load new theme data, we can stop tracking existing views since we * won't be able to change them live anymore */ clear_list_of_views (&self->priv->adium_views); tp_clear_pointer (&self->priv->adium_data, empathy_adium_data_unref); - self->priv->adium_data = empathy_adium_data_new (new_path); + self->priv->adium_data = empathy_adium_data_new (path); theme_manager_emit_changed (self); -finally: - g_free (new_path); + g_free (path); } static void @@ -261,11 +254,11 @@ empathy_theme_manager_init (EmpathyThemeManager *self) /* Take the adium path/variant and track changes */ g_signal_connect (self->priv->gsettings_chat, - "changed::" EMPATHY_PREFS_CHAT_ADIUM_PATH, - G_CALLBACK (theme_manager_notify_adium_path_cb), self); + "changed::" EMPATHY_PREFS_CHAT_THEME, + G_CALLBACK (theme_manager_notify_theme_cb), self); - theme_manager_notify_adium_path_cb (self->priv->gsettings_chat, - EMPATHY_PREFS_CHAT_ADIUM_PATH, self); + theme_manager_notify_theme_cb (self->priv->gsettings_chat, + EMPATHY_PREFS_CHAT_THEME, self); g_signal_connect (self->priv->gsettings_chat, "changed::" EMPATHY_PREFS_CHAT_THEME_VARIANT, |