[balsa/gtk4: 234/311] mime-widget-message: Use gtk_show_uri_full()




commit a3d083861d7530a45e47c8a0c3d83b22ff7196c4
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Oct 24 17:34:14 2020 -0400

    mime-widget-message: Use gtk_show_uri_full()
    
    and report any error.

 src/balsa-mime-widget-message.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/src/balsa-mime-widget-message.c b/src/balsa-mime-widget-message.c
index 3a647e1ec..444f9177d 100644
--- a/src/balsa-mime-widget-message.c
+++ b/src/balsa-mime-widget-message.c
@@ -319,22 +319,32 @@ bmw_message_extbody_mail(LibBalsaMessageBody * mime_body)
     return mw;
 }
 
+static void
+extbody_call_url_finish(GObject      *source_object,
+                        GAsyncResult *res,
+                        gpointer      user_data)
+{
+    char *url = user_data;
+    GError *err = NULL;
+
+    if (!gtk_show_uri_full_finish(GTK_WINDOW(source_object), res, &err)) {
+        balsa_information(LIBBALSA_INFORMATION_WARNING,
+                          _("Error showing %s: %s\n"), url, err->message);
+        g_error_free(err);
+    }
+
+    g_free(url);
+}
 
 static void
 extbody_call_url(GtkWidget * button, gpointer data)
 {
-    gchar *url = g_object_get_data(G_OBJECT(button), "call_url");
+    char *url = g_object_get_data(G_OBJECT(button), "call_url");
     GtkRoot *root;
-    GError *err = NULL;
 
-    g_return_if_fail(url);
     root = gtk_widget_get_root(GTK_WIDGET(button));
-    gtk_show_uri(GTK_WINDOW(root), url, GDK_CURRENT_TIME);
-    if (err != NULL) {
-       balsa_information(LIBBALSA_INFORMATION_WARNING,
-                         _("Error showing %s: %s\n"), url, err->message);
-       g_error_free(err);
-    }
+    gtk_show_uri_full(GTK_WINDOW(root), url, GDK_CURRENT_TIME, NULL,
+                      extbody_call_url_finish, g_strdup(url));
 }
 
 static void


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