[Commits] [SCM] claws branch, master, updated. 3.15.0-146-g126ff4d

ticho at claws-mail.org ticho at claws-mail.org
Sun Oct 22 17:28:04 CEST 2017


The branch, master has been updated
       via  126ff4dcbc912d839ba9e0340857d22abf71e0ef (commit)
      from  d2578f7adcf14a288a101e94f048c8215e3a200b (commit)

Summary of changes:
 src/plugins/fancy/fancy_prefs.c  |    8 ++++++++
 src/plugins/fancy/fancy_viewer.c |   23 +++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit 126ff4dcbc912d839ba9e0340857d22abf71e0ef
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Oct 22 17:27:08 2017 +0200

    Made Fancy's custom stylesheet pref work on Windows

diff --git a/src/plugins/fancy/fancy_prefs.c b/src/plugins/fancy/fancy_prefs.c
index cbba959..a2ca781 100644
--- a/src/plugins/fancy/fancy_prefs.c
+++ b/src/plugins/fancy/fancy_prefs.c
@@ -442,7 +442,15 @@ static void save_fancy_prefs_page(PrefsPage *page)
 		fancy_prefs.enable_proxy = gtk_toggle_button_get_active
 				(GTK_TOGGLE_BUTTON(prefs_page->proxy_checkbox));
 		fancy_prefs.proxy_str = pref_get_pref_from_entry(GTK_ENTRY(prefs_page->proxy_str));
+#ifdef G_OS_WIN32
+		/* pref_get_pref_from_entry() escapes the backslashes in strings,
+		 * we do not want that, since this entry contains a Windows path.
+		 * Let's just strdup it. */
+		fancy_prefs.stylesheet = g_strdup(gtk_entry_get_text(
+					GTK_ENTRY(prefs_page->stylesheet)));
+#else
 		fancy_prefs.stylesheet = pref_get_pref_from_entry(GTK_ENTRY(prefs_page->stylesheet));
+#endif
 
 		save_fancy_prefs(page);
 }
diff --git a/src/plugins/fancy/fancy_viewer.c b/src/plugins/fancy/fancy_viewer.c
index 5aeff3d..81f8f04 100644
--- a/src/plugins/fancy/fancy_viewer.c
+++ b/src/plugins/fancy/fancy_viewer.c
@@ -148,10 +148,29 @@ static void fancy_set_defaults(FancyViewer *viewer)
 	viewer->override_prefs_plugins = fancy_prefs.enable_plugins;
 	viewer->override_prefs_java = fancy_prefs.enable_java;
 
-	gchar *tmp = g_uri_escape_string(fancy_prefs.stylesheet, "/", TRUE);
+	gchar *tmp;
+#ifdef G_OS_WIN32
+	/* Replace backslashes with forward slashes, since we'll be
+	 * using this string in an URI. */
+	gchar *tmp2 = g_strdup(fancy_prefs.stylesheet);
+	gchar *c;
+	for (c = tmp2; *c != '\0'; c++) {
+		if (*c == '\\')
+			*c = '/';
+	}
+
+	/* Escape string for use in an URI, keeping dir separators
+	 * and colon for Windows drive name ("C:") intact. */
+	tmp = g_uri_escape_string(tmp2, "/:", TRUE);
+	g_free(tmp2);
+#else
+	/* Escape string for use in an URI, keeping dir separators
+	 * intact. */
+	tmp = g_uri_escape_string(fancy_prefs.stylesheet, "/", TRUE);
+#endif
 	viewer->override_stylesheet = g_strconcat("file://", tmp, NULL);
 	g_free(tmp);
-	debug_print("Passing '%s' stylesheet URI to Webkit\n",
+	debug_print("Passing '%s' as stylesheet URI to Webkit\n",
 			viewer->override_stylesheet);
 
 	g_signal_handlers_block_by_func(G_OBJECT(viewer->enable_images),

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list