[Commits] [SCM] claws branch, master, updated. 3.10.1-124-g1a51762

claws at claws-mail.org claws at claws-mail.org
Wed Jul 16 16:39:04 CEST 2014


#	This is an automated email from the git hooks/post-receive script. It was
#	generated because a ref change was pushed to the repository containing
#	the project "claws" (Claws Mail).

The branch, master has been updated
       via  1a51762c493c8b1cf109d138e6619a3f9dca391e (commit)
      from  ae895c83393ec495cdf3454de4ff12e89dcc65c8 (commit)

Summary of changes:
 src/plugins/fancy/fancy_prefs.c  |   72 +++++++++++++++++++++++++++++++++++---
 src/plugins/fancy/fancy_prefs.h  |    5 +--
 src/plugins/fancy/fancy_viewer.c |   11 ++++--
 src/plugins/fancy/fancy_viewer.h |    4 ++-
 4 files changed, 82 insertions(+), 10 deletions(-)


- Log -----------------------------------------------------------------
commit 1a51762c493c8b1cf109d138e6619a3f9dca391e
Author: Paul <paul at claws-mail.org>
Date:   Wed Jul 16 15:38:46 2014 +0100

    add user specified stylesheet option

diff --git a/src/plugins/fancy/fancy_prefs.c b/src/plugins/fancy/fancy_prefs.c
index eae11c6..bc3369f 100644
--- a/src/plugins/fancy/fancy_prefs.c
+++ b/src/plugins/fancy/fancy_prefs.c
@@ -1,8 +1,8 @@
 /*
  * Claws Mail -- A GTK+ based, lightweight, and fast e-mail client
- * Copyright(C) 1999-2013 the Claws Mail Team
+ * Copyright(C) 1999-2014 the Claws Mail Team
  * == Fancy Plugin ==
- * This file Copyright (C) 2009-2013 Salvatore De Paolis
+ * This file Copyright (C) 2009-2014 Salvatore De Paolis
  * <iwkse at claws-mail.org> and the Claws Mail Team
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,8 +29,6 @@
 #include "version.h"
 #include "claws.h"
 #include "plugin.h"
-
-
 #include "gtkutils.h"
 #include "utils.h"
 #include "prefs.h"
@@ -39,6 +37,7 @@
 #include "prefswindow.h"
 #include "combobox.h"
 #include "addressbook.h"
+#include "filesel.h"
 
 #include "fancy_prefs.h"
 
@@ -66,6 +65,7 @@ struct _FancyPrefsPage {
 #endif
 	GtkWidget *proxy_checkbox;
 	GtkWidget *proxy_str;
+	GtkWidget *stylesheet;
 };
 
 static PrefParam param[] = {
@@ -91,11 +91,15 @@ static PrefParam param[] = {
 		NULL, NULL, NULL},
 		{"proxy_server", "http://SERVERNAME:PORT", &fancy_prefs.proxy_str, P_STRING,
 		NULL, NULL, NULL},
+		{"stylesheet", "", &fancy_prefs.stylesheet, P_STRING, NULL, NULL, NULL},
 		{0,0,0,0}
 };
 
 static FancyPrefsPage fancy_prefs_page;
 
+static void fancy_prefs_stylesheet_browse_cb	(GtkWidget *widget, gpointer data);
+static void fancy_prefs_stylesheet_edit_cb	(GtkWidget *widget, gpointer data);
+
 static void create_fancy_prefs_page     (PrefsPage *page, GtkWindow *window, gpointer   data);
 static void destroy_fancy_prefs_page    (PrefsPage *page);
 static void save_fancy_prefs_page       (PrefsPage *page);
@@ -190,6 +194,10 @@ static void create_fancy_prefs_page(PrefsPage *page, GtkWindow *window,
 	GtkWidget *enable_scripts;
 	GtkWidget *enable_plugins;
 	GtkWidget *enable_java;
+	GtkWidget *stylesheet_label;
+	GtkWidget *stylesheet;
+	GtkWidget *stylesheet_browse_button;
+	GtkWidget *stylesheet_edit_button;
 
 	vbox = gtk_vbox_new(FALSE, 3);
 	gtk_container_set_border_width(GTK_CONTAINER(vbox), VBOX_BORDER);
@@ -281,6 +289,34 @@ static void create_fancy_prefs_page(PrefsPage *page, GtkWindow *window,
 
 	combobox_select_by_data(GTK_COMBO_BOX(optmenu_open_external),
 			fancy_prefs.open_external);
+	
+	GtkWidget *hbox_css = gtk_hbox_new(FALSE, 8);
+	gtk_widget_show(hbox_css);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox_css, FALSE, FALSE, 0);
+
+	CLAWS_SET_TIP(hbox_css, _("The CSS in this file will be applied to all HTML parts"));
+
+	stylesheet_label = gtk_label_new(_("Stylesheet:"));
+	gtk_widget_show(stylesheet_label);
+	gtk_box_pack_start(GTK_BOX(hbox_css), stylesheet_label, FALSE, FALSE, 0);
+	
+	stylesheet = gtk_entry_new();
+	gtk_widget_show(stylesheet);
+	gtk_box_pack_start(GTK_BOX(hbox_css), stylesheet, TRUE, TRUE, 0);
+
+	stylesheet_browse_button = gtkut_get_browse_file_btn(_("Bro_wse"));
+	gtk_widget_show(stylesheet_browse_button);
+	gtk_box_pack_start(GTK_BOX(hbox_css), stylesheet_browse_button, FALSE, FALSE, 0);
+	g_signal_connect(G_OBJECT(stylesheet_browse_button), "clicked",
+			 G_CALLBACK(fancy_prefs_stylesheet_browse_cb), stylesheet);
+
+	stylesheet_edit_button = gtk_button_new_from_stock(GTK_STOCK_EDIT);
+	gtk_widget_show (stylesheet_edit_button);
+	gtk_box_pack_start(GTK_BOX(hbox_css), stylesheet_edit_button, FALSE, FALSE, 0);
+	g_signal_connect(G_OBJECT(stylesheet_edit_button), "clicked",
+			 G_CALLBACK(fancy_prefs_stylesheet_edit_cb), stylesheet);
+	pref_set_entry_from_pref(GTK_ENTRY(stylesheet), fancy_prefs.stylesheet);
+
 
 #ifdef HAVE_LIBSOUP_GNOME
 	prefs_page->gnome_proxy_checkbox = gnome_proxy_checkbox;
@@ -293,6 +329,7 @@ static void create_fancy_prefs_page(PrefsPage *page, GtkWindow *window,
 	prefs_page->enable_plugins = enable_plugins;
 	prefs_page->enable_java = enable_java;
 	prefs_page->open_external = optmenu_open_external;
+	prefs_page->stylesheet = stylesheet;
 	prefs_page->page.widget = vbox;
 
 	g_signal_connect(G_OBJECT(prefs_page->enable_remote_content), "toggled",
@@ -300,6 +337,32 @@ static void create_fancy_prefs_page(PrefsPage *page, GtkWindow *window,
 	remote_content_set_labels_cb(NULL, prefs_page);
 }
 
+static void fancy_prefs_stylesheet_browse_cb(GtkWidget *widget, gpointer data)
+{
+	gchar *filename;
+	gchar *utf8_filename;
+	GtkEntry *dest = GTK_ENTRY(data);
+
+	filename = filesel_select_file_open(_("Select stylesheet"), NULL);
+	if (!filename) return;
+
+	utf8_filename = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
+	if (!utf8_filename) {
+		g_warning("fancy_prefs_stylesheet_browse_cb(): failed to convert character set.");
+		utf8_filename = g_strdup(filename);
+	}
+	gtk_entry_set_text(GTK_ENTRY(dest), utf8_filename);
+	g_free(utf8_filename);
+}
+
+static void fancy_prefs_stylesheet_edit_cb(GtkWidget *widget, gpointer data)
+{
+	const gchar *stylesheet = gtk_entry_get_text(GTK_ENTRY(data));
+	if (!is_file_exist(stylesheet))
+		str_write_to_file(stylesheet, "");
+	open_txt_editor(stylesheet, prefs_common_get_ext_editor_cmd());
+}
+
 static void prefs_set_proxy_entry_sens(GtkWidget *button, GtkEntry *entry_str) {
 	gtk_widget_set_sensitive(GTK_WIDGET(entry_str),
 				 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)));
@@ -369,6 +432,7 @@ 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));
+		fancy_prefs.stylesheet = pref_get_pref_from_entry(GTK_ENTRY(prefs_page->stylesheet));
 
 		save_fancy_prefs(page);
 }
diff --git a/src/plugins/fancy/fancy_prefs.h b/src/plugins/fancy/fancy_prefs.h
index e09899a..2c95e8c 100644
--- a/src/plugins/fancy/fancy_prefs.h
+++ b/src/plugins/fancy/fancy_prefs.h
@@ -1,8 +1,8 @@
 /* 
  * Claws Mail -- A GTK+ based, lightweight, and fast e-mail client
- * Copyright(C) 1999-2013 the Claws Mail Team
+ * Copyright(C) 1999-2014 the Claws Mail Team
  * == Fancy Plugin ==
- * This file Copyright (C) 2009 -2013 Salvatore De Paolis
+ * This file Copyright (C) 2009 -2014 Salvatore De Paolis
  * <iwkse at claws-mail.org> and the Claws Mail Team
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -40,6 +40,7 @@ struct _FancyPrefs
 #endif
 	gboolean enable_proxy;
 	gchar *proxy_str;
+	gchar *stylesheet;
 };
 
 extern FancyPrefs fancy_prefs;
diff --git a/src/plugins/fancy/fancy_viewer.c b/src/plugins/fancy/fancy_viewer.c
index 60a75b0..da003f5 100644
--- a/src/plugins/fancy/fancy_viewer.c
+++ b/src/plugins/fancy/fancy_viewer.c
@@ -1,8 +1,8 @@
 /*
  * Claws Mail -- A GTK+ based, lightweight, and fast e-mail client
  * == Fancy Plugin ==
- * Copyright(C) 1999-2013 the Claws Mail Team
- * This file Copyright (C) 2009-2013 Salvatore De Paolis
+ * Copyright(C) 1999-2014 the Claws Mail Team
+ * This file Copyright (C) 2009-2014 Salvatore De Paolis
  * <iwkse at claws-mail.org> and the Claws Mail Team
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -91,6 +91,7 @@ static void fancy_apply_prefs(FancyViewer *viewer)
 		"enable-plugins", viewer->override_prefs_plugins,
 		"enable-java-applet", viewer->override_prefs_java,
 	        "enable-dns-prefetching", viewer->override_prefs_remote_content,
+	        "user-stylesheet-uri", viewer->override_stylesheet,
 #ifdef G_OS_WIN32
 		"default-font-family", "Arial",
 		"cursive-font-family", "Comic Sans MS",
@@ -99,7 +100,7 @@ static void fancy_apply_prefs(FancyViewer *viewer)
 		"sans-serif-font-family", "Arial",
 		"serif-font-family", "Times New Roman",
 #endif
-		NULL); 
+		NULL);
 	webkit_web_view_set_settings(viewer->view, viewer->settings);
 }
 
@@ -140,12 +141,15 @@ static void fancy_open_external_activated(GtkCheckMenuItem *item, FancyViewer *v
 
 static void fancy_set_defaults(FancyViewer *viewer)
 {
+	gchar *user_stylesheet = g_strconcat("file://", fancy_prefs.stylesheet, NULL);
+	
 	viewer->override_prefs_remote_content = fancy_prefs.enable_remote_content;
 	viewer->override_prefs_external = fancy_prefs.open_external;
 	viewer->override_prefs_images = fancy_prefs.enable_images;
 	viewer->override_prefs_scripts = fancy_prefs.enable_scripts;
 	viewer->override_prefs_plugins = fancy_prefs.enable_plugins;
 	viewer->override_prefs_java = fancy_prefs.enable_java;
+	viewer->override_stylesheet = user_stylesheet;
 
 	g_signal_handlers_block_by_func(G_OBJECT(viewer->enable_images),
 		fancy_auto_load_images_activated, viewer);
@@ -193,6 +197,7 @@ static void fancy_set_defaults(FancyViewer *viewer)
 		fancy_open_external_activated, viewer);
 
 	fancy_apply_prefs(viewer);
+	g_free(user_stylesheet);
 }
 
 static void fancy_load_uri(FancyViewer *viewer, const gchar *uri)
diff --git a/src/plugins/fancy/fancy_viewer.h b/src/plugins/fancy/fancy_viewer.h
index 283bd5a..093d971 100644
--- a/src/plugins/fancy/fancy_viewer.h
+++ b/src/plugins/fancy/fancy_viewer.h
@@ -94,6 +94,7 @@ struct _FancyViewer
 	GtkWidget	  *enable_java;
 	GtkWidget         *enable_remote_content;
 	GtkWidget         *open_external;
+	GtkWidget         *stylesheet;
 
 	GtkWidget         *progress;
 	WebKitWebSettings *settings;
@@ -103,7 +104,8 @@ struct _FancyViewer
 	gboolean          override_prefs_scripts;
 	gboolean          override_prefs_plugins;
 	gboolean          override_prefs_external;
-	gboolean		  override_prefs_java;
+	gboolean	  override_prefs_java;
+	gchar		 *override_stylesheet;
 
 	const gchar       *curlfile;
 	FILE              *stream;

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list