[polari] Replace Gtk.show_uri_on_window()



commit c927bab5080b645bfce6dd27c36850429fa8d4e1
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 8 01:54:19 2021 +0200

    Replace Gtk.show_uri_on_window()
    
    It is gone in GTK4 in favor of a simple Gtk.show_uri() method for
    throw-away requests, and a more fully-featured Gtk.show_uri_full()
    that asynchronously reports errors.
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/228>

 src/utils.js | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/utils.js b/src/utils.js
index 76f2e13a..b046d645 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -26,7 +26,7 @@ import GLib from 'gi://GLib';
 import Gtk from 'gi://Gtk';
 import Secret from 'gi://Secret';
 
-import * as AppNotifications from './appNotifications.js';
+import { SimpleOutput as AppNotification } from './appNotifications.js';
 
 import gi from 'gi';
 let Soup;
@@ -310,13 +310,17 @@ export function findChannels(str, server) {
  */
 export function openURL(url) {
     let app = Gio.Application.get_default();
-    try {
-        Gtk.show_uri_on_window(app.active_window, url, Gdk.CURRENT_TIME);
-    } catch (e) {
-        let n = new AppNotifications.SimpleOutput(_('Failed to open link'));
-        app.notificationQueue.addNotification(n);
-        console.debug(`Failed to open ${url}: %o`, e);
-    }
+    Gtk.show_uri_full(
+        app.active_window, url, Gdk.CURRENT_TIME, null,
+        (o, res) => {
+            try {
+                Gtk.show_uri_full_finish(app.active_window, res);
+            } catch (e) {
+                let n = new AppNotification(_('Failed to open link'));
+                app.notificationQueue.addNotification(n);
+                console.debug(`Failed to open ${url}: %o`, e);
+            }
+        });
 }
 
 /**


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