[balsa] compose-window: Make an "Open" menu option work



commit 4472271ac6101452b6e82c156929a3098e1e476b
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jun 28 11:32:45 2020 -0400

    compose-window: Make an "Open" menu option work
    
    Make the "Open" option on the urlref-attachment context menu work.
    
    * src/sendmsg-window.c
      (on_open_url_cb): Get the top-level window from the compose window;
        getting it from the menu-item leads to a Wayland error;
      (add_urlref_attachment): Populate BalsaAttachInfo:file_uri.

 ChangeLog            | 11 +++++++++++
 src/sendmsg-window.c |  3 ++-
 2 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6338c3ab9..439ec8b85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2020-06-28  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       compose-window: Make the "Open" option on the urlref-attachment
+       context menu work.
+
+       * src/sendmsg-window.cs
+         (on_open_url_cb): Get the top-level window from the compose
+         window; getting it from the menu-item leads to a Wayland
+         error;
+         (add_urlref_attachment): Populate BalsaAttachInfo:file_uri.
+
 2020-06-24  Peter Bloomfield  <pbloomfield bellsouth net>
 
        mime-widget-text: Actually pop up the context menu when
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 53ac38386..9edcd2d20 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -1425,7 +1425,7 @@ on_open_url_cb(GtkWidget * menu_item, BalsaAttachInfo * info)
     g_return_if_fail(uri != NULL);
 
     g_debug("open URL %s", uri);
-    toplevel = gtk_widget_get_toplevel(GTK_WIDGET(menu_item));
+    toplevel = gtk_widget_get_toplevel(info->bm->window);
     if (gtk_widget_is_toplevel(toplevel)) {
         gtk_show_uri_on_window(GTK_WINDOW(toplevel), uri,
                                gtk_get_current_event_time(), &err);
@@ -1875,6 +1875,7 @@ add_urlref_attachment(BalsaSendmsg * bsmsg, gchar *url)
     attach_data->force_mime_type = g_strdup("message/external-body");
     attach_data->delete_on_destroy = FALSE;
     attach_data->mode = LIBBALSA_ATTACH_AS_EXTBODY;
+    attach_data->file_uri = libbalsa_vfs_new_from_uri(url);
 
     /* build the attachment's popup menu - may only be removed */
     attach_data->popup_menu = gtk_menu_new();


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