[balsa/gtk4: 292/312] balsa-message: Use GtkButton for the attach button
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk4: 292/312] balsa-message: Use GtkButton for the attach button
- Date: Tue, 5 Oct 2021 20:01:28 +0000 (UTC)
commit 22ef2aa31a5945478b1e3246bb5394c32e329416
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed Nov 25 13:29:32 2020 -0500
balsa-message: Use GtkButton for the attach button
That way, we can put our paper-clip image in it; it's a bit less
convenient than GtkMenuButton (we need a "clicked" signal handler), but
it looks so much better--well, at least more familiar.
src/balsa-message.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/balsa-message.c b/src/balsa-message.c
index 3c7a29290..60304d845 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -244,6 +244,12 @@ balsa_message_class_init(BalsaMessageClass * klass)
/* Helpers for balsa_message_init. */
+static void
+balsa_headers_attachments_popup(GtkButton * button, BalsaMessage * balsa_message)
+{
+ if (balsa_message->parts_popup != NULL)
+ libbalsa_popup_widget_popup(balsa_message->parts_popup, NULL);
+}
/* Note: this function returns a NULL-terminated array of buttons for a top-level headers widget.
Currently, we return just a
* single item (the button for showing the menu for switching between attachments) so we /could/ change the
return type to
@@ -257,8 +263,9 @@ bm_header_tl_buttons(BalsaMessage * balsa_message)
array = g_ptr_array_new();
- balsa_message->attach_button = button = gtk_menu_button_new();
- gtk_menu_button_set_has_frame(GTK_MENU_BUTTON(button), FALSE);
+ balsa_message->attach_button = button =
+ gtk_button_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_ATTACHMENT));
+ g_signal_connect(button, "clicked", G_CALLBACK(balsa_headers_attachments_popup), balsa_message);
gtk_widget_set_tooltip_text(button, _("Select message part to display"));
@@ -1745,13 +1752,10 @@ display_content(BalsaMessage * balsa_message)
balsa_message->parts_menu = g_menu_new();
- balsa_message->parts_popup = libbalsa_popup_widget_new(NULL,
+ balsa_message->parts_popup = libbalsa_popup_widget_new(balsa_message->attach_button,
G_MENU_MODEL(balsa_message->parts_menu),
"message-menu");
- gtk_menu_button_set_popover(GTK_MENU_BUTTON(balsa_message->attach_button),
- balsa_message->parts_popup);
-
/* Populate the parts-menu */
display_parts(balsa_message, libbalsa_message_get_body_list(balsa_message->message), NULL, NULL);
g_clear_object(&balsa_message->parts_menu);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]