[Commits] fancy_prefs.c 1.1.2.5 1.1.2.6 fancy_prefs.h 1.1.2.3 1.1.2.4 fancy_viewer.c 1.1.2.6 1.1.2.7 fancy_viewer.h 1.1.2.5 1.1.2.6

colin at claws-mail.org colin at claws-mail.org
Wed Mar 13 14:34:16 CET 2013


Update of /home/claws-mail/claws/src/plugins/fancy
In directory srv:/tmp/cvs-serv24947/src/plugins/fancy

Modified Files:
      Tag: gtk2
	fancy_prefs.c fancy_prefs.h fancy_viewer.c fancy_viewer.h 
Log Message:
2013-03-13 [colin]	3.9.0cvs119

	* src/plugins/fancy/fancy_prefs.c
	* src/plugins/fancy/fancy_prefs.h
	* src/plugins/fancy/fancy_viewer.c
	* src/plugins/fancy/fancy_viewer.h
		More rework of the options to make things clear.
		Also, make Enable remote content actually do what
		it says.

Index: fancy_prefs.c
===================================================================
RCS file: /home/claws-mail/claws/src/plugins/fancy/Attic/fancy_prefs.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.5 -r1.1.2.6
--- fancy_prefs.c	13 Mar 2013 10:39:21 -0000	1.1.2.5
+++ fancy_prefs.c	13 Mar 2013 13:34:14 -0000	1.1.2.6
@@ -55,7 +55,7 @@
 
 struct _FancyPrefsPage {
 	PrefsPage page;
-	GtkWidget *auto_load_images;
+	GtkWidget *enable_images;
 	GtkWidget *enable_remote_content;
 	GtkWidget *enable_scripts;
 	GtkWidget *enable_plugins;
@@ -69,7 +69,7 @@
 };
 
 static PrefParam param[] = {
-		{"auto_load_images", "FALSE", &fancy_prefs.auto_load_images, P_BOOL, 
+		{"enable_images", "TRUE", &fancy_prefs.enable_images, P_BOOL, 
 		NULL, NULL, NULL},
 		{"enable_remote_content", "FALSE", &fancy_prefs.enable_remote_content, P_BOOL, 
 		NULL, NULL, NULL},
@@ -83,7 +83,7 @@
 		NULL, NULL, NULL},
 		{"enable_java", "FALSE", &fancy_prefs.enable_java, P_BOOL, 
 		NULL, NULL, NULL},
-#ifdef HAVE_LIBSOUP_GNOME    
+#ifdef HAVE_LIBSOUP_GNOME
 		{"enable_gnome_proxy","FALSE", &fancy_prefs.enable_gnome_proxy, P_BOOL, 
 		NULL, NULL, NULL},
 #endif
@@ -130,12 +130,32 @@
 	prefs_gtk_unregister_page((PrefsPage *) &fancy_prefs_page);
 }
 
-static void open_external_set_label_cb(GtkWidget *button, FancyPrefsPage *prefs_page)
+static void remote_content_set_labels_cb(GtkWidget *button, FancyPrefsPage *prefs_page)
 {
-	GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(prefs_page->open_external));
+	GtkTreeModel *model;
 	GtkTreeIter iter;
+	gboolean remote_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_page->enable_remote_content));
+
+	/* Enable images */
+	gtk_button_set_label(GTK_BUTTON(prefs_page->enable_images),
+			     remote_enabled ? _("Display images") : _("Display embedded images"));
+
+	/* Enable Javascript */
+	gtk_button_set_label(GTK_BUTTON(prefs_page->enable_scripts),
+			     remote_enabled ? _("Execute javascript") : _("Execute embedded javascript"));
+
+	/* Enable java */
+	gtk_button_set_label(GTK_BUTTON(prefs_page->enable_java),
+			     remote_enabled ? _("Execute Java applets") : _("Execute embedded Java applets"));
+
+	/* Enable plugins */
+	gtk_button_set_label(GTK_BUTTON(prefs_page->enable_plugins),
+			     remote_enabled ? _("Render objects using plugins") : _("Render embedded objects using plugins"));
+
+	/* Open links */
+	model = gtk_combo_box_get_model(GTK_COMBO_BOX(prefs_page->open_external));
 	if (gtk_tree_model_get_iter_first (model, &iter)) {
-		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_page->enable_remote_content)))
+		if (remote_enabled)
 			gtk_list_store_set(model, &iter, COMBOBOX_TEXT, _("Open in viewer (remote content is enabled)"), -1);
 		else
 			gtk_list_store_set(model, &iter, COMBOBOX_TEXT, _("Do nothing (remote content is disabled)"), -1);
@@ -148,76 +168,92 @@
 	FancyPrefsPage *prefs_page = (FancyPrefsPage *) page;
 
 	GtkWidget *vbox;
-#ifdef HAVE_LIBSOUP_GNOME    
+#ifdef HAVE_LIBSOUP_GNOME
 	GtkWidget *gnome_proxy_checkbox;
 #endif
 	GtkWidget *proxy_checkbox;
 	GtkWidget *proxy_str;
-	GtkWidget *checkbox1;
-	GtkWidget *checkbox2;
-	GtkWidget *checkbox3;
-	GtkWidget *checkbox4;
-	GtkWidget *checkbox6;
+	GtkWidget *vbox_proxy;
+	GtkWidget *frame_proxy;
+
+	GtkWidget *frame_remote;
+	GtkWidget *vbox_remote;
+	GtkWidget *remote_label;
+	GtkWidget *enable_remote_content;
+	GtkWidget *enable_images;
+	GtkWidget *enable_scripts;
+	GtkWidget *enable_plugins;
+	GtkWidget *enable_java;
 
 	vbox = gtk_vbox_new(FALSE, 3);
 	gtk_container_set_border_width(GTK_CONTAINER(vbox), VBOX_BORDER);
 	gtk_widget_show(vbox);
-	    
-	GtkWidget *block = gtk_vbox_new(FALSE, FALSE);
-	proxy_checkbox = gtk_check_button_new_with_label(_("Proxy Setting"));
-	proxy_str = gtk_entry_new();
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(proxy_checkbox),
-								 fancy_prefs.enable_proxy);
-	prefs_set_proxy_entry_sens(proxy_checkbox, GTK_ENTRY(proxy_str));
-	g_signal_connect(G_OBJECT(proxy_checkbox), "toggled",
-					 G_CALLBACK(prefs_set_proxy_entry_sens), proxy_str);
-	pref_set_entry_from_pref(GTK_ENTRY(proxy_str), fancy_prefs.proxy_str);
 
-	gtk_box_pack_start(GTK_BOX(block), proxy_checkbox, FALSE, FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(block), proxy_str, FALSE, FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(vbox), block, FALSE, FALSE, 0);
-	gtk_widget_show(proxy_checkbox);
-	gtk_widget_show(proxy_str);
-	gtk_widget_show(block);
+	GtkWidget *block = gtk_hbox_new(FALSE, FALSE);
+
+	vbox_proxy = gtkut_get_options_frame(vbox, &frame_proxy, _("Proxy"));
 #ifdef HAVE_LIBSOUP_GNOME
-	gnome_proxy_checkbox = gtk_check_button_new_with_label(_("Use GNOME proxy setting"));	
+	gnome_proxy_checkbox = gtk_check_button_new_with_label(_("Use GNOME's proxy settings"));	
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gnome_proxy_checkbox),
-								 fancy_prefs.enable_gnome_proxy);
+				     fancy_prefs.enable_gnome_proxy);
 	if (fancy_prefs.enable_gnome_proxy) 
 		gtk_widget_set_sensitive(proxy_checkbox, FALSE);
-	gtk_box_pack_start(GTK_BOX(vbox), gnome_proxy_checkbox, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox_proxy), gnome_proxy_checkbox, FALSE, FALSE, 0);
 	gtk_widget_show(gnome_proxy_checkbox);
 	g_signal_connect(G_OBJECT(gnome_proxy_checkbox), "toggled",
 					 G_CALLBACK(prefs_disable_fancy_proxy), block);
 #endif
-	checkbox1 = gtk_check_button_new_with_label(_("Auto-Load images"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox1),
-								 fancy_prefs.auto_load_images);
-	gtk_box_pack_start(GTK_BOX(vbox), checkbox1, FALSE, FALSE, 0);
-	gtk_widget_show(checkbox1);
+	proxy_checkbox = gtk_check_button_new_with_label(_("Use proxy:"));
+	proxy_str = gtk_entry_new();
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(proxy_checkbox),
+				     fancy_prefs.enable_proxy);
+	prefs_set_proxy_entry_sens(proxy_checkbox, GTK_ENTRY(proxy_str));
+	g_signal_connect(G_OBJECT(proxy_checkbox), "toggled",
+					 G_CALLBACK(prefs_set_proxy_entry_sens), proxy_str);
+	pref_set_entry_from_pref(GTK_ENTRY(proxy_str), fancy_prefs.proxy_str);
 
-	checkbox2 = gtk_check_button_new_with_label(_("Enable remote content"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox2),
-								 fancy_prefs.enable_remote_content);
-	gtk_box_pack_start(GTK_BOX(vbox), checkbox2, FALSE, FALSE, 0);
-	gtk_widget_show(checkbox2);
+	gtk_box_pack_start(GTK_BOX(block), proxy_checkbox, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(block), proxy_str, TRUE, TRUE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox_proxy), block, FALSE, FALSE, 0);
+	gtk_widget_show_all(vbox_proxy);
+
+	vbox_remote = gtkut_get_options_frame(vbox, &frame_remote, _("Remote resources"));
+	remote_label = gtk_label_new(_("Loading remote resources can lead to some privacy issues.\n"
+					"When remote content loading is disabled, nothing will be requested\n"
+					"from the network. Rendering of images, scripts, plugin objects or\n"
+					"Java applets can still be enabled for content that is attached\n"
+					"in the email."));
+	gtk_misc_set_alignment(GTK_MISC(remote_label), 0, 0);
+	enable_remote_content = gtk_check_button_new_with_label(_("Enable loading of remote content"));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_remote_content),
+				     fancy_prefs.enable_remote_content);
+	gtk_box_pack_start (GTK_BOX (vbox_remote), remote_label, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox_remote), enable_remote_content, FALSE, FALSE, 0);
+	gtk_widget_show_all(vbox_remote);
 	
-	checkbox3 = gtk_check_button_new_with_label(_("Enable Javascript"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox3),
-								 fancy_prefs.enable_scripts);
-	gtk_box_pack_start(GTK_BOX(vbox), checkbox3, FALSE, FALSE, 0);
-	gtk_widget_show(checkbox3);
+	enable_images = gtk_check_button_new_with_label(("IMAGES"));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_images),
+				     fancy_prefs.enable_images);
+	gtk_box_pack_start(GTK_BOX(vbox), enable_images, FALSE, FALSE, 0);
+	gtk_widget_show(enable_images);
 
-	checkbox4 = gtk_check_button_new_with_label(_("Enable Plugins"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox4),
-								 fancy_prefs.enable_plugins);
-	gtk_box_pack_start(GTK_BOX(vbox), checkbox4, FALSE, FALSE, 0);
-	gtk_widget_show(checkbox4);
-	checkbox6 = gtk_check_button_new_with_label(_("Enable Java"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox6),
-								 fancy_prefs.enable_java);
-	gtk_box_pack_start(GTK_BOX(vbox), checkbox6, FALSE, FALSE, 0);
-	gtk_widget_show(checkbox6);
+	enable_scripts = gtk_check_button_new_with_label("SCRIPTS");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_scripts),
+				     fancy_prefs.enable_scripts);
+	gtk_box_pack_start(GTK_BOX(vbox), enable_scripts, FALSE, FALSE, 0);
+	gtk_widget_show(enable_scripts);
+
+	enable_java = gtk_check_button_new_with_label("JAVA");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_java),
+				     fancy_prefs.enable_java);
+	gtk_box_pack_start(GTK_BOX(vbox), enable_java, FALSE, FALSE, 0);
+	gtk_widget_show(enable_java);
+
+	enable_plugins = gtk_check_button_new_with_label("PLUGINS");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_plugins),
+				     fancy_prefs.enable_plugins);
+	gtk_box_pack_start(GTK_BOX(vbox), enable_plugins, FALSE, FALSE, 0);
+	gtk_widget_show(enable_plugins);
 
 	GtkWidget *hbox_ext = gtk_hbox_new(FALSE, 8);
 	GtkWidget *open_external_label = gtk_label_new(_("When clicking on a link, by default:"));
@@ -238,22 +274,22 @@
 	combobox_select_by_data(GTK_COMBO_BOX(optmenu_open_external),
 			fancy_prefs.open_external);
 
-#ifdef HAVE_LIBSOUP_GNOME    
+#ifdef HAVE_LIBSOUP_GNOME
 	prefs_page->gnome_proxy_checkbox = gnome_proxy_checkbox;
 #endif
 	prefs_page->proxy_checkbox = proxy_checkbox;
 	prefs_page->proxy_str = proxy_str;
-	prefs_page->auto_load_images = checkbox1;
-	prefs_page->enable_remote_content = checkbox2;
-	prefs_page->enable_scripts = checkbox3;
-	prefs_page->enable_plugins = checkbox4;
-	prefs_page->enable_java = checkbox6;
+	prefs_page->enable_remote_content = enable_remote_content;
+	prefs_page->enable_images = enable_images;
+	prefs_page->enable_scripts = enable_scripts;
+	prefs_page->enable_plugins = enable_plugins;
+	prefs_page->enable_java = enable_java;
 	prefs_page->open_external = optmenu_open_external;
 	prefs_page->page.widget = vbox;
 
 	g_signal_connect(G_OBJECT(prefs_page->enable_remote_content), "toggled",
-					 G_CALLBACK(open_external_set_label_cb), prefs_page);
-	open_external_set_label_cb(NULL, prefs_page);
+					 G_CALLBACK(remote_content_set_labels_cb), prefs_page);
+	remote_content_set_labels_cb(NULL, prefs_page);
 }
 
 static void prefs_set_proxy_entry_sens(GtkWidget *button, GtkEntry *entry_str) {
@@ -310,8 +346,8 @@
 		fancy_prefs.enable_gnome_proxy = gtk_toggle_button_get_active
 				(GTK_TOGGLE_BUTTON(prefs_page->gnome_proxy_checkbox));
 #endif
-		fancy_prefs.auto_load_images = gtk_toggle_button_get_active
-				(GTK_TOGGLE_BUTTON(prefs_page->auto_load_images));
+		fancy_prefs.enable_images = gtk_toggle_button_get_active
+				(GTK_TOGGLE_BUTTON(prefs_page->enable_images));
 		fancy_prefs.enable_remote_content = gtk_toggle_button_get_active
 				(GTK_TOGGLE_BUTTON(prefs_page->enable_remote_content));
 		fancy_prefs.enable_scripts = gtk_toggle_button_get_active

Index: fancy_prefs.h
===================================================================
RCS file: /home/claws-mail/claws/src/plugins/fancy/Attic/fancy_prefs.h,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- fancy_prefs.h	13 Mar 2013 10:39:21 -0000	1.1.2.3
+++ fancy_prefs.h	13 Mar 2013 13:34:14 -0000	1.1.2.4
@@ -28,7 +28,7 @@
 {
 	WebKitWebSettings *web_settings;
 	
-	gboolean auto_load_images;
+	gboolean enable_images;
 	gboolean enable_remote_content;
 	gboolean enable_scripts;
 	gboolean enable_plugins;

Index: fancy_viewer.h
===================================================================
RCS file: /home/claws-mail/claws/src/plugins/fancy/Attic/fancy_viewer.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.5 -r1.1.2.6
--- fancy_viewer.h	13 Mar 2013 10:39:22 -0000	1.1.2.5
+++ fancy_viewer.h	13 Mar 2013 13:34:14 -0000	1.1.2.6
@@ -89,10 +89,10 @@
 	GtkWidget         *ev_fancy_prefs;
 	GtkWidget         *fancy_prefs_menu;
 	/* Menu Items */
-	GtkWidget         *auto_load_images;
+	GtkWidget         *enable_images;
 	GtkWidget         *enable_scripts;
 	GtkWidget         *enable_plugins;
-	GtkWidget		  *enable_java;
+	GtkWidget	  *enable_java;
 	GtkWidget         *enable_remote_content;
 	GtkWidget         *open_external;
 

Index: fancy_viewer.c
===================================================================
RCS file: /home/claws-mail/claws/src/plugins/fancy/Attic/fancy_viewer.c,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -d -r1.1.2.6 -r1.1.2.7
--- fancy_viewer.c	13 Mar 2013 10:56:13 -0000	1.1.2.6
+++ fancy_viewer.c	13 Mar 2013 13:34:14 -0000	1.1.2.7
@@ -136,12 +136,12 @@
 {
 	viewer->override_prefs_remote_content = fancy_prefs.enable_remote_content;
 	viewer->override_prefs_external = fancy_prefs.open_external;
-	viewer->override_prefs_images = fancy_prefs.auto_load_images;
+	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;
 
-	g_signal_handlers_block_by_func(G_OBJECT(viewer->auto_load_images),
+	g_signal_handlers_block_by_func(G_OBJECT(viewer->enable_images),
 		fancy_auto_load_images_activated, viewer);
 	g_signal_handlers_block_by_func(G_OBJECT(viewer->enable_remote_content),
 		fancy_enable_remote_content_activated, viewer);
@@ -155,7 +155,7 @@
 		fancy_open_external_activated, viewer);
 
 	gtk_check_menu_item_set_active(
-		GTK_CHECK_MENU_ITEM(viewer->auto_load_images),
+		GTK_CHECK_MENU_ITEM(viewer->enable_images),
 		viewer->override_prefs_images);
 	gtk_check_menu_item_set_active(
 		GTK_CHECK_MENU_ITEM(viewer->enable_scripts),
@@ -173,7 +173,7 @@
 		GTK_CHECK_MENU_ITEM(viewer->open_external),
 		viewer->override_prefs_external);
 
-	g_signal_handlers_unblock_by_func(G_OBJECT(viewer->auto_load_images),
+	g_signal_handlers_unblock_by_func(G_OBJECT(viewer->enable_images),
 		fancy_auto_load_images_activated, viewer);
 	g_signal_handlers_unblock_by_func(G_OBJECT(viewer->enable_remote_content),
 		fancy_enable_remote_content_activated, viewer);
@@ -387,7 +387,6 @@
 	}
 }
 
-#if WEBKIT_CHECK_VERSION (1,1,14)
 static void resource_request_starting_cb(WebKitWebView			*view, 
 										 WebKitWebFrame			*frame,
 										 WebKitWebResource		*resource,
@@ -423,8 +422,17 @@
 		}
 		g_free(image);
 	}
+	
+	/* refresh URI that may have changed */
+	uri = webkit_network_request_get_uri(request);
+	if (!viewer->override_prefs_remote_content
+	    && strncmp(uri, "file://", 7)) {
+		debug_print("Preventing load of %s\n", uri);
+		webkit_network_request_set_uri(request, "about:blank");
+	} else
+		debug_print("Starting request of %s\n", uri);
 }
-#endif
+
 static gboolean fancy_text_search(MimeViewer *_viewer, gboolean backward, 
 								  const gchar *str, gboolean case_sens)
 {
@@ -443,14 +451,14 @@
 }
 
 static void fancy_create_popup_prefs_menu(FancyViewer *viewer) {
-	GtkWidget *auto_load_images;
+	GtkWidget *enable_images;
 	GtkWidget *enable_remote_content;
 	GtkWidget *enable_scripts;
 	GtkWidget *enable_plugins;
 	GtkWidget *enable_java;
 	GtkWidget *open_external;
 
-	auto_load_images = gtk_check_menu_item_new_with_label(_("Load images"));
+	enable_images = gtk_check_menu_item_new_with_label(_("Load images"));
 
 	enable_remote_content = gtk_check_menu_item_new_with_label(_("Enable remote content"));
 
@@ -462,7 +470,7 @@
 
 	open_external = gtk_check_menu_item_new_with_label(_("Open links with external browser"));
 
-	gtk_menu_shell_append(GTK_MENU_SHELL(viewer->fancy_prefs_menu), auto_load_images);
+	gtk_menu_shell_append(GTK_MENU_SHELL(viewer->fancy_prefs_menu), enable_images);
 	gtk_menu_shell_append(GTK_MENU_SHELL(viewer->fancy_prefs_menu), enable_remote_content);
 	gtk_menu_shell_append(GTK_MENU_SHELL(viewer->fancy_prefs_menu), enable_scripts);
 	gtk_menu_shell_append(GTK_MENU_SHELL(viewer->fancy_prefs_menu), enable_plugins);
@@ -472,7 +480,7 @@
 	gtk_menu_attach_to_widget(GTK_MENU(viewer->fancy_prefs_menu), viewer->ev_fancy_prefs, NULL);
 	gtk_widget_show_all(viewer->fancy_prefs_menu);
 
-	viewer->auto_load_images = auto_load_images;
+	viewer->enable_images = enable_images;
 	viewer->enable_scripts = enable_scripts;
 	viewer->enable_plugins = enable_plugins;
 	viewer->enable_java = enable_java;
@@ -481,7 +489,7 @@
 
 	/* Set sensitivity according to preferences and overrides */
 
-	g_signal_connect(G_OBJECT(auto_load_images), "toggled",
+	g_signal_connect(G_OBJECT(enable_images), "toggled",
 					 G_CALLBACK (fancy_auto_load_images_activated), viewer);
 	g_signal_connect(G_OBJECT(enable_remote_content), "toggled",
 					 G_CALLBACK (fancy_enable_remote_content_activated), viewer);



More information about the Commits mailing list