[balsa/popover: 16/20] balsa-message: Improve the GtkPopover popup
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/popover: 16/20] balsa-message: Improve the GtkPopover popup
- Date: Sun, 10 May 2020 20:11:52 +0000 (UTC)
commit 6fe1d1ca1eacbf5d945e969c2ca81b96a40a3ab0
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Fri May 8 15:42:01 2020 -0400
balsa-message: Improve the GtkPopover popup
• Actually pop it up, by setting it relative to the tree-view, not the
(hidden) mime-widget.
• When it is popped up in response to a click, position it above the
pointer.
src/balsa-message.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/src/balsa-message.c b/src/balsa-message.c
index 849f9fc5b..239174f3b 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -901,6 +901,17 @@ tree_mult_selection_popup(BalsaMessage * balsa_message, GdkEventButton * event,
if (selected == 1) {
BalsaPartInfo *info = BALSA_PART_INFO(balsa_message->save_all_list->data);
if (info->popup_menu != NULL) {
+ if (event != NULL) {
+ 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));
}
g_list_free(balsa_message->save_all_list);
@@ -954,8 +965,6 @@ tree_button_press_cb(GtkWidget * widget, GdkEventButton * event,
GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
GtkTreePath *path;
- g_return_val_if_fail(balsa_message, FALSE);
- g_return_val_if_fail(event, FALSE);
if (!gdk_event_triggers_context_menu((GdkEvent *) event)
|| event->window != gtk_tree_view_get_bin_window(tree_view))
return FALSE;
@@ -984,13 +993,24 @@ tree_button_press_cb(GtkWidget * widget, GdkEventButton * event,
gtk_tree_model_get(model, &iter, PART_INFO_COLUMN, &info, -1);
if (info != NULL) {
if (info->popup_menu != NULL) {
+ 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));
}
g_object_unref(info);
}
}
- } else
+ } else {
tree_mult_selection_popup(balsa_message, event, selection);
+ }
gtk_tree_path_free(path);
}
@@ -1660,7 +1680,7 @@ part_create_menu(BalsaMessage *balsa_message, BalsaPartInfo *info)
g_free(content_type);
info->popup_menu =
- gtk_popover_new_from_model(GTK_WIDGET(info->mime_widget), G_MENU_MODEL(menu));
+ gtk_popover_new_from_model(balsa_message->treeview, G_MENU_MODEL(menu));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]