diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2009-06-22 16:43:38 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2009-06-22 21:24:55 +0800 |
commit | 4c782007bf100a3820dc265bca6fceda17991a77 (patch) | |
tree | 6bed62af4f688f2bf5047a36527f343bd0f678eb /libempathy-gtk/empathy-theme-manager.c | |
parent | 0f915c44a5e5a2fd91c5b5b26f5a8e5a78ee7ed3 (diff) | |
download | gsoc2013-empathy-4c782007bf100a3820dc265bca6fceda17991a77.tar gsoc2013-empathy-4c782007bf100a3820dc265bca6fceda17991a77.tar.gz gsoc2013-empathy-4c782007bf100a3820dc265bca6fceda17991a77.tar.bz2 gsoc2013-empathy-4c782007bf100a3820dc265bca6fceda17991a77.tar.lz gsoc2013-empathy-4c782007bf100a3820dc265bca6fceda17991a77.tar.xz gsoc2013-empathy-4c782007bf100a3820dc265bca6fceda17991a77.tar.zst gsoc2013-empathy-4c782007bf100a3820dc265bca6fceda17991a77.zip |
Move all data about an adium theme into EmpathyAdiumData struct and share it with all EmpathyThemeAdium instances.
Diffstat (limited to 'libempathy-gtk/empathy-theme-manager.c')
-rw-r--r-- | libempathy-gtk/empathy-theme-manager.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c index c6da8ea68..348d6ec70 100644 --- a/libempathy-gtk/empathy-theme-manager.c +++ b/libempathy-gtk/empathy-theme-manager.c @@ -329,8 +329,28 @@ empathy_theme_manager_create_view (EmpathyThemeManager *manager) #ifdef HAVE_WEBKIT if (strcmp (priv->name, "adium") == 0) { - if (empathy_theme_adium_is_valid (priv->adium_path)) { - return EMPATHY_CHAT_VIEW (empathy_theme_adium_new (priv->adium_path)); + if (empathy_adium_path_is_valid (priv->adium_path)) { + static EmpathyAdiumData *data = NULL; + EmpathyThemeAdium *theme_adium; + + if (data && + !tp_strdiff (empathy_adium_data_get_path (data), + priv->adium_path)) { + /* Theme did not change, reuse data */ + theme_adium = empathy_theme_adium_new (data); + return EMPATHY_CHAT_VIEW (theme_adium); + } + + /* Theme changed, drop old data if any and + * load a new one */ + if (data) { + empathy_adium_data_unref (data); + data = NULL; + } + + data = empathy_adium_data_new (priv->adium_path); + theme_adium = empathy_theme_adium_new (data); + return EMPATHY_CHAT_VIEW (theme_adium); } else { /* The adium path is not valid, fallback to classic theme */ return EMPATHY_CHAT_VIEW (theme_manager_create_irc_view (manager)); |