aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-theme-manager.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2008-07-19 02:59:59 +0800
committerXavier Claessens <xclaesse@gmail.com>2009-06-12 00:06:30 +0800
commiteb48fbaf322604ee57888165242acd97efd8decc (patch)
tree866f37a0789e30ce4b0d66ff9d03cd281f181216 /libempathy-gtk/empathy-theme-manager.c
parent80f5d332a5a531f8d5b96d9ea50f2384bf515324 (diff)
downloadgsoc2013-empathy-eb48fbaf322604ee57888165242acd97efd8decc.tar
gsoc2013-empathy-eb48fbaf322604ee57888165242acd97efd8decc.tar.gz
gsoc2013-empathy-eb48fbaf322604ee57888165242acd97efd8decc.tar.bz2
gsoc2013-empathy-eb48fbaf322604ee57888165242acd97efd8decc.tar.lz
gsoc2013-empathy-eb48fbaf322604ee57888165242acd97efd8decc.tar.xz
gsoc2013-empathy-eb48fbaf322604ee57888165242acd97efd8decc.tar.zst
gsoc2013-empathy-eb48fbaf322604ee57888165242acd97efd8decc.zip
Add a path property on EmpathyThemeAdium and ge the adium-path gconf key in EmpathyThemeManager.
Diffstat (limited to 'libempathy-gtk/empathy-theme-manager.c')
-rw-r--r--libempathy-gtk/empathy-theme-manager.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c
index eebbd3105..12f04d0bd 100644
--- a/libempathy-gtk/empathy-theme-manager.c
+++ b/libempathy-gtk/empathy-theme-manager.c
@@ -49,6 +49,8 @@
typedef struct {
gchar *name;
guint name_notify_id;
+ gchar *adium_path;
+ guint adium_path_notify_id;
GtkSettings *settings;
GList *boxes_views;
} EmpathyThemeManagerPriv;
@@ -325,15 +327,21 @@ empathy_theme_manager_create_view (EmpathyThemeManager *manager)
DEBUG ("Using theme %s", priv->name);
- if (strcmp (priv->name, "classic") == 0) {
- return EMPATHY_CHAT_VIEW (theme_manager_create_irc_view (manager));
- }
#ifdef HAVE_WEBKIT
if (strcmp (priv->name, "adium") == 0) {
- return EMPATHY_CHAT_VIEW (empathy_theme_adium_new ());
+ if (empathy_theme_adium_is_valid (priv->adium_path)) {
+ return EMPATHY_CHAT_VIEW (empathy_theme_adium_new (priv->adium_path));
+ } else {
+ /* The adium path is not valid, fallback to classic theme */
+ return EMPATHY_CHAT_VIEW (theme_manager_create_irc_view (manager));
+ }
}
#endif
+ if (strcmp (priv->name, "classic") == 0) {
+ return EMPATHY_CHAT_VIEW (theme_manager_create_irc_view (manager));
+ }
+
theme = theme_manager_create_boxes_view (manager);
theme_manager_update_boxes_theme (manager, theme);
@@ -416,6 +424,27 @@ theme_manager_notify_name_cb (EmpathyConf *conf,
}
static void
+theme_manager_notify_adium_path_cb (EmpathyConf *conf,
+ const gchar *key,
+ gpointer user_data)
+{
+ EmpathyThemeManager *manager = EMPATHY_THEME_MANAGER (user_data);
+ EmpathyThemeManagerPriv *priv = GET_PRIV (manager);
+ gchar *adium_path = NULL;
+
+ if (!empathy_conf_get_string (conf, key, &adium_path) ||
+ !tp_strdiff (priv->adium_path, adium_path)) {
+ g_free (adium_path);
+ return;
+ }
+
+ g_free (priv->adium_path);
+ priv->adium_path = adium_path;
+
+ g_signal_emit (manager, signals[THEME_CHANGED], 0, NULL);
+}
+
+static void
theme_manager_finalize (GObject *object)
{
EmpathyThemeManagerPriv *priv = GET_PRIV (object);
@@ -423,6 +452,8 @@ theme_manager_finalize (GObject *object)
empathy_conf_notify_remove (empathy_conf_get (), priv->name_notify_id);
g_free (priv->name);
+ empathy_conf_notify_remove (empathy_conf_get (), priv->adium_path_notify_id);
+ g_free (priv->adium_path);
for (l = priv->boxes_views; l; l = l->next) {
g_object_weak_unref (G_OBJECT (l->data),
@@ -472,6 +503,16 @@ empathy_theme_manager_init (EmpathyThemeManager *manager)
EMPATHY_PREFS_CHAT_THEME,
manager);
+ /* Take the adium path and track changes */
+ priv->adium_path_notify_id =
+ empathy_conf_notify_add (empathy_conf_get (),
+ EMPATHY_PREFS_CHAT_ADIUM_PATH,
+ theme_manager_notify_adium_path_cb,
+ manager);
+ theme_manager_notify_adium_path_cb (empathy_conf_get (),
+ EMPATHY_PREFS_CHAT_ADIUM_PATH,
+ manager);
+
/* Track GTK color changes */
priv->settings = gtk_settings_get_default ();
g_signal_connect_swapped (priv->settings, "notify::color-hash",