# HG changeset patch # User Elliott Sales de Andrade # Date 1321639878 0 # Node ID 5111d364fa4940969dd0910cf96abe9731e3eaaf # Parent 96f3af93ee9877e5df031ed9e1be4c85c9d02e96 Fix fallback to builtin Template.html file. diff -r 96f3af93ee98 -r 5111d364fa49 pidgin/gtkconv-theme.c --- a/pidgin/gtkconv-theme.c Wed Nov 09 07:18:18 2011 +0000 +++ b/pidgin/gtkconv-theme.c Fri Nov 18 18:11:18 2011 +0000 @@ -111,6 +111,23 @@ return val; } +/* 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; + + 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", "theme", "conversation", "Template.html", NULL); + } + + return file; +} + static const char * get_template_html(PidginConvThemePrivate *priv, const char *dir) { @@ -119,14 +136,7 @@ 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 = 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); @@ -708,19 +718,12 @@ 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 *