summaryrefslogtreecommitdiff
path: root/src/text.c
diff options
context:
space:
mode:
authorKernc <kerncece@gmail.com>2014-08-30 17:07:52 +0200
committerArx Cruz <arxcruz@gnome.org>2014-10-22 15:44:38 +0200
commit5b0553e9ef4fcabebefbc510a088b009af73d4ab (patch)
treefeabcb514d3bc1aa0cc91f951c527b17f91b5239 /src/text.c
parentBug #700249 - Progress dialog does not wrap (diff)
downloadzenity-5b0553e9ef4fcabebefbc510a088b009af73d4ab.tar.gz
zenity-5b0553e9ef4fcabebefbc510a088b009af73d4ab.tar.bz2
zenity-5b0553e9ef4fcabebefbc510a088b009af73d4ab.zip
Allow user to interact with --text-info --html WebView
This commit changes the default --text-view behavior (when --html is also in effect) so that the clicked links are opened in the default browser (closes #732626). Additionally, a new option is introduced, --prevent-interaction, which disables above behavior.
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/text.c b/src/text.c
index 9f1041c3..8f383b9c 100644
--- a/src/text.c
+++ b/src/text.c
@@ -23,6 +23,7 @@
#include "config.h"
+#include <gio/gio.h>
#include "zenity.h"
#include "util.h"
@@ -114,6 +115,11 @@ zenity_text_webview_decision_request (WebKitWebView *webkitwebview,
gpointer user_data)
{
webkit_web_policy_decision_ignore (policy_decision);
+ if (!zen_text_data->no_interaction &&
+ webkit_web_navigation_action_get_reason (navigation_action) == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
+ g_app_info_launch_default_for_uri (webkit_web_navigation_action_get_original_uri(navigation_action),
+ NULL, NULL);
+ }
return TRUE;
}
@@ -333,7 +339,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
}
// We don't want user to click on links and navigate to another page.
- // So, when page finish load, we block requests.
+ // So, when the page finishes loading, we take handle of the requests.
g_signal_connect (G_OBJECT (web_kit), "document-load-finished",
G_CALLBACK (zenity_text_webview_load_finished), NULL);
bgstack15