[balsa/popover: 36/37] Fix some fallout from porting from *-event signals
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/popover: 36/37] Fix some fallout from porting from *-event signals
- Date: Thu, 4 Jun 2020 21:57:07 +0000 (UTC)
commit 8195bf9494259859ca2779f4a51ed450d2c426cd
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue Jun 2 11:15:12 2020 -0400
Fix some fallout from porting from *-event signals
to GtkEventControllers.
modified: src/balsa-mblist.c
modified: src/balsa-message.c
src/balsa-mblist.c | 10 +++++++---
src/balsa-message.c | 38 +++++++++++++++++---------------------
2 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index ff77b4075..2ddac6047 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -727,6 +727,7 @@ bmbl_do_popup(GtkTreeView *tree_view,
{
BalsaMailboxNode *mbnode = NULL;
GtkWidget *menu;
+ gdouble x, y;
if (path) {
GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
@@ -739,13 +740,16 @@ bmbl_do_popup(GtkTreeView *tree_view,
menu = balsa_mailbox_node_get_context_menu(mbnode, GTK_WIDGET(tree_view));
- if (event != NULL && gdk_event_triggers_context_menu((GdkEvent *) event)) {
+
+ if (event != NULL &&
+ gdk_event_triggers_context_menu(event) &&
+ gdk_event_get_coords(event, &x, &y)) {
GdkRectangle rectangle;
/* Pop up above the pointer */
- rectangle.x = event->x;
+ rectangle.x = (int) x;
rectangle.width = 0;
- rectangle.y = event->y;
+ rectangle.y = (int) y;
rectangle.height = 0;
gtk_popover_set_pointing_to(GTK_POPOVER(menu), &rectangle);
}
diff --git a/src/balsa-message.c b/src/balsa-message.c
index bfa5a7eef..cd36eeccc 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -1103,6 +1103,7 @@ tree_mult_selection_popup(BalsaMessage *balsa_message,
GtkTreeSelection *selection)
{
gint selected;
+ GtkWidget *popup_menu = NULL;
/* destroy left-over select list and popup... */
g_list_free(balsa_message->save_all_list);
@@ -1118,35 +1119,31 @@ tree_mult_selection_popup(BalsaMessage *balsa_message,
selected = g_list_length(balsa_message->save_all_list);
if (selected == 1) {
BalsaPartInfo *info = BALSA_PART_INFO(balsa_message->save_all_list->data);
- if (info->popup_menu != NULL) {
- if (event != NULL && gdk_event_triggers_context_menu((GdkEvent *) event)) {
- GdkRectangle rectangle;
-
- /* Pop up above the pointer */
- rectangle.x = event->x;
- rectangle.width = 0;
- rectangle.y = event->y;
- rectangle.height = 0;
- gtk_popover_set_pointing_to(GTK_POPOVER(info->popup_menu), &rectangle);
- }
- gtk_popover_popup(GTK_POPOVER(info->popup_menu));
- }
+ popup_menu = info->popup_menu;
g_list_free(balsa_message->save_all_list);
balsa_message->save_all_list = NULL;
} else if (selected > 1) {
- if (event != NULL && gdk_event_triggers_context_menu((GdkEvent *) event)) {
+ popup_menu = balsa_message->save_all_popup;
+ }
+
+ if (popup_menu != NULL) {
+ gdouble x, y;
+
+ if (event != NULL &&
+ gdk_event_triggers_context_menu(event) &&
+ gdk_event_get_coords(event, &x, &y)) {
GdkRectangle rectangle;
/* Pop up above the pointer */
- rectangle.x = event->x;
+ rectangle.x = (int) x;
rectangle.width = 0;
- rectangle.y = event->y;
+ rectangle.y = (int) y;
rectangle.height = 0;
- gtk_popover_set_pointing_to(GTK_POPOVER(balsa_message->save_all_popup), &rectangle);
+ gtk_popover_set_pointing_to(GTK_POPOVER(popup_menu), &rectangle);
}
- gtk_popover_popup(GTK_POPOVER(balsa_message->save_all_popup));
+ gtk_popover_popup(GTK_POPOVER(popup_menu));
}
}
@@ -1155,7 +1152,6 @@ tree_menu_popup_key_cb(GtkWidget *widget, gpointer user_data)
{
BalsaMessage * balsa_message = (BalsaMessage *)user_data;
- g_return_val_if_fail(balsa_message, FALSE);
tree_mult_selection_popup(balsa_message, NULL,
gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)));
return TRUE;
@@ -1215,9 +1211,9 @@ tree_button_press_cb(GtkGestureMultiPress *multi_press_gesture,
GdkRectangle rectangle;
/* Pop up above the pointer */
- rectangle.x = event->x;
+ rectangle.x = (int) x;
rectangle.width = 0;
- rectangle.y = event->y;
+ rectangle.y = (int) y;
rectangle.height = 0;
gtk_popover_set_pointing_to(GTK_POPOVER(info->popup_menu),
&rectangle);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]