[balsa/gtk3] Use our own context menu
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Use our own context menu
- Date: Sat, 6 Apr 2013 03:51:41 +0000 (UTC)
commit 19aecd5a5e8512460a90651d2840a5a6bce19353
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Fri Apr 5 23:50:52 2013 -0400
Use our own context menu
* libbalsa/html.c (lbh_context_menu_cb), (libbalsa_html_new):
catch WebKit's "context-menu" signal, and emit "popup-menu" on
the parent widget instead.
* src/balsa-mime-widget-text.c (balsa_gtk_html_popup): do not
unref the popup menu.
ChangeLog | 8 ++++++++
libbalsa/html.c | 21 +++++++++++++++++++++
src/balsa-mime-widget-text.c | 2 --
3 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b5b6546..85db419 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-04-05 Peter Bloomfield
+
+ * libbalsa/html.c (lbh_context_menu_cb), (libbalsa_html_new):
+ catch WebKit's "context-menu" signal, and emit "popup-menu" on
+ the parent widget instead.
+ * src/balsa-mime-widget-text.c (balsa_gtk_html_popup): do not
+ unref the popup menu.
+
2013-04-04 Peter Bloomfield
* libbalsa/html.c (lbh_info_bar_response_cb): no need to reload;
diff --git a/libbalsa/html.c b/libbalsa/html.c
index c29aada..ebe0b22 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -434,6 +434,25 @@ lbh_cid_cb(WebKitURISchemeRequest * request,
}
}
+/*
+ * Callback for the "context-menu" signal
+ */
+static gboolean
+lbh_context_menu_cb(WebKitWebView * web_view,
+ WebKitContextMenu * context_menu,
+ GdkEvent * event,
+ WebKitHitTestResult * hit_test_result,
+ gpointer data)
+{
+ GtkWidget *parent;
+ gboolean retval;
+
+ parent = gtk_widget_get_parent(GTK_WIDGET(web_view));
+ g_signal_emit_by_name(parent, "popup-menu", &retval);
+
+ return retval;
+}
+
/* Create a new WebKitWebView widget:
* body LibBalsaMessageBody that belongs to the
* LibBalsaMessage from which to extract any
@@ -509,6 +528,8 @@ libbalsa_html_new(LibBalsaMessageBody * body,
G_CALLBACK(lbh_resource_load_started_cb), info);
g_signal_connect(web_view, "web-process-crashed",
G_CALLBACK(lbh_web_process_crashed_cb), info);
+ g_signal_connect(web_view, "context-menu",
+ G_CALLBACK(lbh_context_menu_cb), info);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
g_object_set_data(G_OBJECT(vbox), "libbalsa-html-web-view", web_view);
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index 11f72ac..4693915 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -1090,10 +1090,8 @@ balsa_gtk_html_popup(GtkWidget * html, BalsaMessage * bm)
bmwt_populate_popup_menu(bm, html, GTK_MENU(menu));
gtk_widget_show_all(menu);
- g_object_ref_sink(menu);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
0, gtk_get_current_event_time());
- g_object_unref(menu);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]