pidgin: ba64b72a: Fix fallback to builtin Template.html fi...

qulogic at pidgin.im qulogic at pidgin.im
Fri Nov 18 13:25:49 EST 2011


----------------------------------------------------------------------
Revision: ba64b72a4ed30f1d5ca9fdc6c012964d7a897e7a
Parent:   9a08730847bfae5de18b19b1836579fe5fe03b04
Author:   qulogic at pidgin.im
Date:     11/18/11 13:11:18
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ba64b72a4ed30f1d5ca9fdc6c012964d7a897e7a

Changelog: 

Fix fallback to builtin Template.html file.

Changes against parent 9a08730847bfae5de18b19b1836579fe5fe03b04

  patched  pidgin/gtkconv-theme.c

-------------- next part --------------
============================================================
--- pidgin/gtkconv-theme.c	aba4989a4654466a2f40587699673abfe3df7e6f
+++ pidgin/gtkconv-theme.c	4f20d357ec6d038598ef965935b3a11a44fb584a
@@ -111,23 +111,33 @@ get_key(PidginConvThemePrivate *priv, co
 	return val;
 }
 
-static const char *
-get_template_html(PidginConvThemePrivate *priv, const char *dir)
+/* The template path can either come from the theme, or can
+ * be stock Template.html that comes with Pidgin */
+static char *
+get_template_path(const char *dir)
 {
 	char *file;
 
-	if (priv->template_html)
-		return priv->template_html;
-
-	/* The template path can either come from the theme, or can
-	 * be stock Template.html that comes with the plugin */
 	file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL);
 
 	if (!g_file_test(file, G_FILE_TEST_EXISTS)) {
 		g_free(file);
-		file = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL);
+		file = g_build_filename(DATADIR, "pidgin", "theme", "conversation", "Template.html", NULL);
 	}
 
+	return file;
+}
+
+static const char *
+get_template_html(PidginConvThemePrivate *priv, const char *dir)
+{
+	char *file;
+
+	if (priv->template_html)
+		return priv->template_html;
+
+	file = get_template_path(dir);
+
 	if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) {
 		purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file);
 		priv->template_html = g_strdup("");
@@ -708,19 +718,12 @@ pidgin_conversation_theme_get_template_p
 pidgin_conversation_theme_get_template_path(PidginConvTheme *theme)
 {
 	const char *dir;
-	char *filename;
 
 	g_return_val_if_fail(theme != NULL, NULL);
 
 	dir = purple_theme_get_dir(PURPLE_THEME(theme));
-	filename = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL);
 
-	if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
-		g_free(filename);
-		filename = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL);
-	}
-
-	return filename;
+	return get_template_path(dir);
 }
 
 char *


More information about the Commits mailing list