aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2008-07-19 01:45:53 +0800
committerXavier Claessens <xclaesse@gmail.com>2009-06-12 00:06:30 +0800
commit9da5a48b5c7d8c47418b56776839ff7687ecd7f0 (patch)
tree21a74041da6afb74f4500027939377b3996f7ac6
parent294a19437a0ac22d5853dd1ec0934042fcd86360 (diff)
downloadgsoc2013-empathy-9da5a48b5c7d8c47418b56776839ff7687ecd7f0.tar
gsoc2013-empathy-9da5a48b5c7d8c47418b56776839ff7687ecd7f0.tar.gz
gsoc2013-empathy-9da5a48b5c7d8c47418b56776839ff7687ecd7f0.tar.bz2
gsoc2013-empathy-9da5a48b5c7d8c47418b56776839ff7687ecd7f0.tar.lz
gsoc2013-empathy-9da5a48b5c7d8c47418b56776839ff7687ecd7f0.tar.xz
gsoc2013-empathy-9da5a48b5c7d8c47418b56776839ff7687ecd7f0.tar.zst
gsoc2013-empathy-9da5a48b5c7d8c47418b56776839ff7687ecd7f0.zip
Quick check if the theme path is OK.
-rw-r--r--data/Makefile.am8
-rw-r--r--libempathy-gtk/empathy-theme-adium.c29
2 files changed, 29 insertions, 8 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index 50ac35185..52108fbe7 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -41,12 +41,16 @@ else
install-data-local:
endif
+htmldir = $(datadir)/empathy
+html_DATA = Template.html
+
EXTRA_DIST = \
$(profile_DATA) \
$(desktop_in_files) \
- $(desktop_DATA) \
+ $(desktop_DATA) \
$(schemas_in_files) \
- $(schemas_DATA)
+ $(schemas_DATA) \
+ $(html_DATA)
DISTCLEANFILES = \
$(desktop_DATA) \
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index a878715b6..84a023956 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -20,7 +20,9 @@
*/
#include "config.h"
+
#include <string.h>
+#include <glib/gi18n.h>
#include <webkit/webkitnetworkrequest.h>
@@ -61,7 +63,8 @@ G_DEFINE_TYPE_WITH_CODE (EmpathyThemeAdium, empathy_theme_adium,
theme_adium_iface_init));
static void
-theme_adium_load (EmpathyThemeAdium *theme)
+theme_adium_load (EmpathyThemeAdium *theme,
+ const gchar *path)
{
EmpathyThemeAdiumPriv *priv = GET_PRIV (theme);
gchar *basedir;
@@ -73,8 +76,7 @@ theme_adium_load (EmpathyThemeAdium *theme)
gchar *content;
gchar *css_path;
- /* FIXME: Find a better way to get the theme dir */
- basedir = g_build_filename (g_get_home_dir (), "Contents", "Resources", NULL);
+ basedir = g_build_filename (path, "Contents", "Resources", NULL);
/* Load html files */
file = g_build_filename (basedir, "Template.html", NULL);
@@ -558,6 +560,7 @@ empathy_theme_adium_init (EmpathyThemeAdium *theme)
{
EmpathyThemeAdiumPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (theme,
EMPATHY_TYPE_THEME_ADIUM, EmpathyThemeAdiumPriv);
+ gchar *path = NULL;
theme->priv = priv;
@@ -570,8 +573,10 @@ empathy_theme_adium_init (EmpathyThemeAdium *theme)
G_CALLBACK (theme_adium_navigation_requested_cb),
NULL);
-
- theme_adium_load (theme);
+ empathy_conf_get_string (empathy_conf_get (),
+ EMPATHY_PREFS_CHAT_ADIUM_PATH,
+ &path);
+ theme_adium_load (theme, path);
}
EmpathyThemeAdium *
@@ -583,6 +588,18 @@ empathy_theme_adium_new (void)
gboolean
empathy_theme_adium_is_valid (const gchar *path)
{
- return TRUE;
+ gboolean ret;
+ gchar *file;
+
+ /* We ship a default Template.html as fallback if there is any problem
+ * with the one inside the theme. The only other required file is
+ * Content.html for incoming messages (outgoing fallback to use
+ * incoming). */
+ file = g_build_filename (path, "Contents", "Resources", "Incoming",
+ "Content.html", NULL);
+ ret = g_file_test (file, G_FILE_TEST_EXISTS);
+ g_free (file);
+
+ return ret;
}