[Commits] [SCM] claws branch, master, updated. 3.17.0-42-g288d3a7

ticho at claws-mail.org ticho at claws-mail.org
Wed Sep 5 17:32:57 CEST 2018


The branch, master has been updated
       via  288d3a7086693fbf79b5cfb6d05c80c956315104 (commit)
      from  cec15eadf8b260030ee5cff9ef7f977dbbf867da (commit)

Summary of changes:
 src/plugins/fancy/fancy_viewer.c |   46 +++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 18 deletions(-)


- Log -----------------------------------------------------------------
commit 288d3a7086693fbf79b5cfb6d05c80c956315104
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Wed Sep 5 17:32:17 2018 +0200

    Fix links not being opened in browser when Fancy menu is opened with a keyboard.

diff --git a/src/plugins/fancy/fancy_viewer.c b/src/plugins/fancy/fancy_viewer.c
index 42fc16c..5cb133c 100644
--- a/src/plugins/fancy/fancy_viewer.c
+++ b/src/plugins/fancy/fancy_viewer.c
@@ -580,17 +580,6 @@ static void load_finished_cb(WebKitWebView *view, gint progress,
 	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(viewer->progress), "");
 }
 
-static void over_link_cb(WebKitWebView *view, const gchar *wtf,
-			 const gchar *link, FancyViewer *viewer, void *wtfa)
-{
-	gtk_label_set_text(GTK_LABEL(viewer->l_link), link);
-	g_free(viewer->cur_link);
-	viewer->cur_link = NULL;
-	if(link) {
-		viewer->cur_link = g_strdup(link);
-	}
-}
-
 static void load_progress_cb(WebKitWebView *view, GParamSpec* pspec,
 			     FancyViewer *viewer)
 {
@@ -828,13 +817,35 @@ static void viewer_menu_handler(GtkWidget *menuitem, FancyViewer *viewer)
 	}
 }
 
-static gboolean populate_popup_cb (WebKitWebView *view, GtkWidget *menu,
-				   FancyViewer *viewer)
+static gboolean context_menu_cb (WebKitWebView *view, GtkWidget *menu,
+		WebKitHitTestResult *hit_test_result,
+		gboolean triggered_with_keyboard,
+		gpointer user_data)
 {
+	FancyViewer *viewer = (FancyViewer *)user_data;
 	Plugin *plugin = plugin_get_loaded_by_name("RSSyl");
+	WebKitHitTestResultContext context;
+	gchar *link_uri = NULL;
+
+	g_object_get(G_OBJECT(hit_test_result),
+			"context", &context,
+			"link-uri", &link_uri,
+			NULL);
+
+	debug_print("context %d, link-uri '%s'\n", context,
+			(link_uri != NULL ? link_uri : "(null)"));
+	if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK &&
+			link_uri != NULL) {
+		if (viewer->cur_link != NULL)
+			g_free(viewer->cur_link);
+		/* g_object_get() already made a copy, no need to strdup() here */
+		viewer->cur_link = link_uri;
+	}
+
 	gtk_container_foreach(GTK_CONTAINER(menu),
 			      (GtkCallback)viewer_menu_handler,
 			      viewer);
+
 	if (plugin) {
 		GtkWidget *rssyl = gtk_image_menu_item_new_with_label(_("Import feed"));
 		GtkWidget *img = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
@@ -845,7 +856,8 @@ static gboolean populate_popup_cb (WebKitWebView *view, GtkWidget *menu,
 				 G_CALLBACK(import_feed_cb),
 				 (gpointer *) viewer);
 	}
-	return TRUE;
+
+	return FALSE;
 }
 
 static gint keypress_events_cb (GtkWidget *widget, GdkEventKey *event,
@@ -1062,8 +1074,6 @@ static MimeViewer *fancy_viewer_create(void)
 			 G_CALLBACK(load_start_cb), viewer);
 	g_signal_connect(G_OBJECT(viewer->view), "load-finished",
 			 G_CALLBACK(load_finished_cb), viewer);
-	g_signal_connect(G_OBJECT(viewer->view), "hovering-over-link",
-			 G_CALLBACK(over_link_cb), viewer);
 
 	g_signal_connect(G_OBJECT(viewer->view), "notify::progress",
 			 G_CALLBACK(load_progress_cb), viewer);
@@ -1075,8 +1085,8 @@ static MimeViewer *fancy_viewer_create(void)
 
 	g_signal_connect(G_OBJECT(viewer->view), "resource-request-starting",
 			G_CALLBACK(resource_request_starting_cb), viewer);
-	g_signal_connect(G_OBJECT(viewer->view), "populate-popup",
-			 G_CALLBACK(populate_popup_cb), viewer);
+	g_signal_connect(G_OBJECT(viewer->view), "context-menu",
+			G_CALLBACK(context_menu_cb), viewer);
 	g_signal_connect(G_OBJECT(viewer->view), "button-press-event",
 			 G_CALLBACK(press_button_cb), viewer);
 	g_signal_connect(G_OBJECT(viewer->view), "button-release-event",

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list