diff options
author | Cosimo Cecchi <cosimo.cecchi@collabora.co.uk> | 2009-08-01 16:32:39 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimo.cecchi@collabora.co.uk> | 2009-08-01 16:32:39 +0800 |
commit | 3e8f25168aadd741ecc0fe8da4d1847eece5ff83 (patch) | |
tree | 69b2fc8984c98b9cad38d2ca5e8563da2b9aad8a /libempathy-gtk/empathy-theme-manager.c | |
parent | 41e5b31c1918f40c3ba47bff2dc9ab682fe0391f (diff) | |
parent | 87070d25c5f2d9a0ecba73e8ce913eca7f183c79 (diff) | |
download | gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.gz gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.bz2 gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.lz gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.xz gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.zst gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.zip |
Merge branch 'sjoerd-mc5' into mc5
Conflicts:
libempathy-gtk/empathy-account-widget.c
libempathy-gtk/empathy-protocol-chooser.c
Diffstat (limited to 'libempathy-gtk/empathy-theme-manager.c')
-rw-r--r-- | libempathy-gtk/empathy-theme-manager.c | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c index ba3d48e68..fea2eca51 100644 --- a/libempathy-gtk/empathy-theme-manager.c +++ b/libempathy-gtk/empathy-theme-manager.c @@ -26,6 +26,7 @@ #include <string.h> #include <glib/gi18n-lib.h> +#include <telepathy-glib/dbus.h> #include <gtk/gtk.h> #include <telepathy-glib/util.h> @@ -67,9 +68,6 @@ static const gchar *themes[] = { "simple", N_("Simple"), "clean", N_("Clean"), "blue", N_("Blue"), -#ifdef HAVE_WEBKIT - "adium", N_("Adium"), -#endif NULL }; @@ -378,6 +376,10 @@ theme_manager_ensure_theme_exists (const gchar *name) return FALSE; } + if (strcmp ("adium", name) == 0) { + return TRUE; + } + for (i = 0; themes[i]; i += 2) { if (strcmp (themes[i], name) == 0) { return TRUE; @@ -534,3 +536,62 @@ empathy_theme_manager_get_themes (void) return themes; } +#ifdef HAVE_WEBKIT +static void +find_themes (GList **list, const gchar *dirpath) +{ + GDir *dir; + GError *error = NULL; + const gchar *name = NULL; + GHashTable *info = NULL; + + dir = g_dir_open (dirpath, 0, &error); + if (dir != NULL) { + name = g_dir_read_name (dir); + while (name != NULL) { + gchar *path; + + path = g_build_path (G_DIR_SEPARATOR_S, dirpath, name, NULL); + if (empathy_adium_path_is_valid (path)) { + info = empathy_adium_info_new (path); + if (info != NULL) { + *list = g_list_prepend (*list, info); + } + } + g_free (path); + name = g_dir_read_name (dir); + } + g_dir_close (dir); + } else { + DEBUG ("Error opening %s: %s\n", dirpath, error->message); + g_error_free (error); + } +} +#endif /* HAVE_WEBKIT */ + +GList * +empathy_theme_manager_get_adium_themes (void) +{ +#ifdef HAVE_WEBKIT + GList *themes = NULL; + gchar *userpath = NULL; + const gchar *const *paths = NULL; + gint i = 0; + + userpath = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (), "adium/message-styles", NULL); + find_themes (&themes, userpath); + g_free (userpath); + + paths = g_get_system_data_dirs (); + for (i = 0; paths[i] != NULL; i++) { + userpath = g_build_path (G_DIR_SEPARATOR_S, paths[i], + "adium/message-styles", NULL); + find_themes (&themes, userpath); + g_free (userpath); + } + + return themes; +#else + return NULL; +#endif /* HAVE_WEBKIT */ +} |