[balsa/gtk4: 9/248] compose window: Break the attachment context menu




commit b48a5ea47e0efb09d8185a7d4f2ac8bab5aef9e1
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue May 5 18:08:30 2020 -0400

    compose window: Break the attachment context menu
    
    into sections.

 src/sendmsg-window.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 2adc9ecd4..63d246ae2 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -351,8 +351,6 @@ balsa_attach_info_finalize(GObject * object)
     }
 
     /* clean up memory */
-    if (info->popup_menu)
-        gtk_widget_destroy(info->popup_menu);
     if (info->file_uri)
         g_object_unref(info->file_uri);
     g_free(info->force_mime_type);
@@ -1668,6 +1666,7 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
         {"launch-app", libbalsa_radio_activated, "s", "''", attachment_menu_vfs_cb}
     };
     GMenu *menu;
+    GMenu *section;
 
     g_debug("Trying to attach '%s'", filename);
     if (!(file_uri = libbalsa_vfs_new_from_uri(filename))) {
@@ -1807,7 +1806,10 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
     }
 
     /* an attachment can be removed */
-    g_menu_append(menu, _("Remove"), "attachment.remove");
+    section = g_menu_new();
+    g_menu_append(section, _("Remove"), "attachment.remove");
+    g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
+    g_object_unref(section);
 
     /* Insert another separator */
     menu_item = gtk_separator_menu_item_new();
@@ -1816,8 +1818,11 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
     /* add the usual vfs menu so the user can inspect what (s)he actually
        attached... (only for non-message attachments) */
     if (!is_fwd_message) {
-       libbalsa_vfs_fill_menu_by_content_type(menu, content_type,
+        section = g_menu_new();
+        libbalsa_vfs_fill_menu_by_content_type(section, content_type,
                                                "attachment.launch-app");
+        g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
+        g_object_unref(section);
     }
 
     attach_data->popup_menu =


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]