[polari] util: Drop timestamp argument from openURL()



commit b68cdb5dd03335e84760e00f4785e9a0d8571989
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 8 02:35:59 2021 +0200

    util: Drop timestamp argument from openURL()
    
    The function is only used in response to user interaction, so
    drop the additional parameter and always pass `GDK_CURRENT_TIME`.
    
    That's another bunch of `gtk_get_current_event_time()` calls gone :-)
    
    https://gitlab.gnome.org/GNOME/polari/-/merge_requests/212

 src/application.js | 2 +-
 src/chatView.js    | 4 ++--
 src/utils.js       | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 817a051e..a1d35019 100644
--- a/src/application.js
+++ b/src/application.js
@@ -798,7 +798,7 @@ export default GObject.registerClass({
     }
 
     _onShowHelp() {
-        Utils.openURL('help:polari', Gtk.get_current_event_time());
+        Utils.openURL('help:polari');
     }
 
     _onShowAbout() {
diff --git a/src/chatView.js b/src/chatView.js
index eaeac07b..09f6a364 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -811,7 +811,7 @@ export default GObject.registerClass({
 
         let item = new Gtk.MenuItem({ label: _('Open Link') });
         item.connect('activate', () => {
-            Utils.openURL(url, Gtk.get_current_event_time());
+            Utils.openURL(url);
         });
         menu.append(item);
 
@@ -1455,7 +1455,7 @@ export default GObject.registerClass({
             tag.foreground_rgba = tag.hover ? this._hoveredLinkColor : null;
         });
         tag.connect('clicked', () => {
-            Utils.openURL(url, Gtk.get_current_event_time());
+            Utils.openURL(url);
         });
         tag.connect('popup-menu', () => {
             this._showUrlContextMenu(url);
diff --git a/src/utils.js b/src/utils.js
index 32fad48f..e2ab02f7 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -22,6 +22,7 @@
 
 const ByteArray = imports.byteArray;
 
+import Gdk from 'gi://Gdk';
 import Gio from 'gi://Gio';
 import GLib from 'gi://GLib';
 import Gtk from 'gi://Gtk';
@@ -303,12 +304,11 @@ export function findChannels(str, server) {
 
 /**
  * @param {string} url - the url
- * @param {number} timestamp - a timestamp
  */
-export function openURL(url, timestamp) {
+export function openURL(url) {
     let app = Gio.Application.get_default();
     try {
-        Gtk.show_uri_on_window(app.active_window, url, timestamp);
+        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);


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