[gnome-maps/wip/mlundblad/es6-modules: 24/28] mapMarker: Stop using imports.mainloop




commit 206878534bed251041e91dfbb044b23fd75b6cbb
Author: Marcus Lundblad <ml dfupdate se>
Date:   Thu May 26 16:59:17 2022 +0200

    mapMarker: Stop using imports.mainloop
    
    Replace with corresponding methods from GLib.

 src/mapMarker.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/mapMarker.js b/src/mapMarker.js
index 7e09befd..8e3842cc 100644
--- a/src/mapMarker.js
+++ b/src/mapMarker.js
@@ -23,9 +23,9 @@ import Cairo from 'cairo';
 import Champlain from 'gi://Champlain';
 import Clutter from 'gi://Clutter';
 import Gdk from 'gi://Gdk';
+import GLib from 'gi://GLib';
 import GObject from 'gi://GObject';
 import Gtk from 'gi://Gtk';
-const Mainloop = imports.mainloop;
 
 import {Application} from './application.js';
 import {MapBubble} from './mapBubble.js';
@@ -234,7 +234,7 @@ export class MapMarker extends Champlain.Marker {
         let sourceId = null;
         let signalId = this._view.connect(signal, () => {
             if (sourceId)
-                Mainloop.source_remove(sourceId);
+                GLib.source_remove(sourceId);
             else
                 this.hideBubble();
 
@@ -244,9 +244,9 @@ export class MapMarker extends Champlain.Marker {
             }).bind(this);
 
             if (duration)
-                sourceId = Mainloop.timeout_add(duration, callback);
+                sourceId = GLib.timeout_add(null, duration, callback);
             else
-                sourceId = Mainloop.idle_add(callback);
+                sourceId = GLib.idle_add(null, callback);
         });
 
         Utils.once(this.bubble, 'closed', () => {
@@ -260,7 +260,7 @@ export class MapMarker extends Champlain.Marker {
             // When the marker gets deselected, we need to ensure
             // that the timeout callback is not called anymore.
             if (sourceId) {
-                Mainloop.source_remove(sourceId);
+                GLib.source_remove(sourceId);
                 this._view.disconnect(signalId);
             }
         });


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