[gnome-maps/wip/contacts: 5/7] mainWindow: add markBusy method



commit bfdbc94e374c01c04099c124fe54a5c7c9eb35cf
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Tue Dec 16 04:37:58 2014 -0500

    mainWindow: add markBusy method

 src/mainWindow.js |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index d09ffe0..832d4cd 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -29,6 +29,7 @@ const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Application = imports.application;
+const BusyMarker = imports.busyMarker;
 const Config = imports.config;
 const ContextMenu = imports.contextMenu;
 const FavoritesPopover = imports.favoritesPopover;
@@ -91,6 +92,8 @@ const MainWindow = new Lang.Class({
         this._initSignals();
         this._restoreWindowGeometry();
 
+        this._busyId = 0;
+
         ui.grid.attach(this._sidebar, 1, 0, 1, 1);
 
         ui.grid.show_all();
@@ -339,5 +342,31 @@ const MainWindow = new Lang.Class({
         aboutDialog.show();
         aboutDialog.connect('response',
                             aboutDialog.destroy.bind(aboutDialog));
+    },
+
+    markBusy: function() {
+        if (this._busyId !== 0)
+            return;
+
+        if (!this._busy) {
+            this._busy = new BusyMarker.BusyMarker();
+            this._overlay.add_overlay(this._busy);
+        } else {
+            this._busy.show();
+        }
+
+        let stage = this.mapView.view.get_stage();
+        this._busyId = stage.connect('captured-event', function() {
+            return true;
+        });
+    },
+
+    unmarkBusy: function() {
+        if (this._busy)
+            this._busy.hide();
+
+        let stage = this.mapView.view.get_stage();
+        stage.disconnect(this._busyId);
+        this._busyId = 0;
     }
 });


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