[balsa/popover: 10/28] compose window: Break the attachment context menu



commit c3f0addae2f4e11f123d6c15ff0ea6462908ee70
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 ba51c2432..06bb54476 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -353,8 +353,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);
@@ -1679,6 +1677,7 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
         {"launch-app", libbalsa_radio_activated, "s", "''", attachment_menu_vfs_cb}
     };
     GMenu *menu;
+    GMenu *section;
 
     if (balsa_app.debug)
        fprintf(stderr, "Trying to attach '%s'\n", filename);
@@ -1819,7 +1818,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();
@@ -1828,8 +1830,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]