commit c0b5c9ffce11be9044d52c757d43edcf1ac6cef7
parent 9b045e6ffedb91981956d698e95edaa7868448d6
Author: Colin Leroy <colin@colino.net>
Date: Wed, 13 Mar 2013 13:34:14 +0000
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.
Diffstat:
7 files changed, 138 insertions(+), 83 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,13 @@
+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.
+
2013-03-13 [colin] 3.9.0cvs118
* src/summaryview.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -4616,3 +4616,4 @@
( cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/fancy/Makefile.am; cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/plugins/fancy/fancy_viewer.c; ) > 3.9.0cvs116.patchset
( cvs diff -u -r 1.29.2.15 -r 1.29.2.16 INSTALL; cvs diff -u -r 1.8.2.69 -r 1.8.2.70 README; ) > 3.9.0cvs117.patchset
( cvs diff -u -r 1.395.2.463 -r 1.395.2.464 src/summaryview.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/perl/tools/Makefile.am; ) > 3.9.0cvs118.patchset
+( cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/plugins/fancy/fancy_prefs.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/fancy/fancy_prefs.h; cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/plugins/fancy/fancy_viewer.c; cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/plugins/fancy/fancy_viewer.h; ) > 3.9.0cvs119.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=9
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=118
+EXTRA_VERSION=119
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/plugins/fancy/fancy_prefs.c b/src/plugins/fancy/fancy_prefs.c
@@ -55,7 +55,7 @@ typedef struct _FancyPrefsPage FancyPrefsPage;
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 @@ struct _FancyPrefsPage {
};
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 @@ static PrefParam param[] = {
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 @@ void fancy_prefs_done(void)
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 @@ static void create_fancy_prefs_page(PrefsPage *page, GtkWindow *window,
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);
-
- 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);
+ 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);
+
+ 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);
-
- 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_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);
+
+ 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 @@ static void create_fancy_prefs_page(PrefsPage *page, GtkWindow *window,
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 @@ static void save_fancy_prefs_page(PrefsPage *page)
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
diff --git a/src/plugins/fancy/fancy_prefs.h b/src/plugins/fancy/fancy_prefs.h
@@ -28,7 +28,7 @@ struct _FancyPrefs
{
WebKitWebSettings *web_settings;
- gboolean auto_load_images;
+ gboolean enable_images;
gboolean enable_remote_content;
gboolean enable_scripts;
gboolean enable_plugins;
diff --git a/src/plugins/fancy/fancy_viewer.c b/src/plugins/fancy/fancy_viewer.c
@@ -136,12 +136,12 @@ static void fancy_set_defaults(FancyViewer *viewer)
{
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 @@ static void fancy_set_defaults(FancyViewer *viewer)
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 @@ static void fancy_set_defaults(FancyViewer *viewer)
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 @@ navigation_requested_cb(WebKitWebView *view, WebKitWebFrame *frame,
}
}
-#if WEBKIT_CHECK_VERSION (1,1,14)
static void resource_request_starting_cb(WebKitWebView *view,
WebKitWebFrame *frame,
WebKitWebResource *resource,
@@ -423,8 +422,17 @@ static void resource_request_starting_cb(WebKitWebView *view,
}
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 gboolean fancy_prefs_cb(GtkWidget *widget, GdkEventButton *ev, FancyViewe
}
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 @@ static void fancy_create_popup_prefs_menu(FancyViewer *viewer) {
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 @@ static void fancy_create_popup_prefs_menu(FancyViewer *viewer) {
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 @@ static void fancy_create_popup_prefs_menu(FancyViewer *viewer) {
/* 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);
diff --git a/src/plugins/fancy/fancy_viewer.h b/src/plugins/fancy/fancy_viewer.h
@@ -89,10 +89,10 @@ struct _FancyViewer
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;