[balsa] mime-widget-text: Connect to the "pressed" signal
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] mime-widget-text: Connect to the "pressed" signal
- Date: Wed, 3 Jun 2020 16:20:38 +0000 (UTC)
commit c344e9b1bb2908f68274bb312060b4d5d86a605a
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed Jun 3 12:19:41 2020 -0400
mime-widget-text: Connect to the "pressed" signal
Connect to the "pressed" signal of a GtkGestureMultiPress instead of the
"button-press-event" widget signal.
The HTML part context menu was the last user of an event signal.
* src/balsa-mime-widget-text.c (mwt_gesture_pressed_cb), (bm_widget_new_html):
ChangeLog | 11 +++++++++++
src/balsa-mime-widget-text.c | 37 ++++++++++++++++++++++++++++---------
2 files changed, 39 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 29c95ec7a..fa7b79a17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2020-06-03 Peter Bloomfield <pbloomfield bellsouth net>
+
+ mime-widget-text: Connect to the "pressed" signal of a
+ GtkGestureMultiPress instead of the "button-press-event" widget
+ signal.
+
+ The HTML part context menu was the last user of an event signal.
+
+ * src/balsa-mime-widget-text.c (mwt_gesture_pressed_cb),
+ (bm_widget_new_html):
+
2020-06-03 Peter Bloomfield <pbloomfield bellsouth net>
mime-widget-text: Use event-controllers instead of connecting to
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index b737b324c..2568e42af 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -1189,13 +1189,27 @@ balsa_gtk_html_popup(GtkWidget * html, BalsaMessage * bm)
return TRUE;
}
-static gboolean
-balsa_gtk_html_button_press_cb(GtkWidget * html, GdkEventButton * event,
- BalsaMessage * bm)
- {
- return(gdk_event_triggers_context_menu((GdkEvent *) event)
- ? balsa_gtk_html_popup(html, bm) : GDK_EVENT_PROPAGATE);
- }
+static void
+mwt_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer user_data)
+{
+ GtkGesture *gesture;
+ const GdkEvent *event;
+ BalsaMessage *bm = user_data;
+
+ gesture = GTK_GESTURE(multi_press);
+ event = gtk_gesture_get_last_event(gesture, gtk_gesture_get_last_updated_sequence(gesture));
+
+ if (gdk_event_triggers_context_menu(event)) {
+ GtkWidget *html;
+
+ html = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture));
+ balsa_gtk_html_popup(html, bm);
+ }
+}
static void
bmwt_populate_popup_cb(GtkWidget * widget, GtkMenu * menu, gpointer data)
@@ -1235,8 +1249,13 @@ bm_widget_new_html(BalsaMessage * bm, LibBalsaMessageBody * mime_body)
g_signal_connect(popup_menu, "populate-popup",
G_CALLBACK(bmwt_populate_popup_cb), widget);
} else {
- g_signal_connect(widget, "button-press-event",
- G_CALLBACK(balsa_gtk_html_button_press_cb), bm);
+ GtkGesture *gesture;
+
+ gesture = gtk_gesture_multi_press_new(widget);
+ gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 0);
+ g_signal_connect(gesture, "pressed",
+ G_CALLBACK(mwt_gesture_pressed_cb), bm);
+
g_signal_connect(widget, "popup-menu",
G_CALLBACK(balsa_gtk_html_popup), bm);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]