[gnome-documents] Don't freeze if a GOA account is disabled when previewing or editing



commit 155e6902693b6f0722895cbed386b5358063d71f
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu May 30 11:03:43 2013 +0200

    Don't freeze if a GOA account is disabled when previewing or editing
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701252

 src/application.js       |    2 +-
 src/trackerController.js |   35 +++++++++++++++++++++++++++--------
 2 files changed, 28 insertions(+), 9 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index b9f6b82..871b246 100644
--- a/src/application.js
+++ b/src/application.js
@@ -383,9 +383,9 @@ const Application = new Lang.Class({
 
         changeMonitor = new ChangeMonitor.TrackerChangeMonitor();
         documentManager = new Documents.DocumentManager();
+        modeController = new WindowMode.ModeController();
         trackerController = new TrackerController.TrackerController();
         selectionController = new Selections.SelectionController();
-        modeController = new WindowMode.ModeController();
 
         this._actionEntries = [
             { name: 'quit',
diff --git a/src/trackerController.js b/src/trackerController.js
index bc22206..2bf227b 100644
--- a/src/trackerController.js
+++ b/src/trackerController.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2011, 2013 Red Hat, Inc.
  *
  * Gnome Documents is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by the
@@ -25,6 +25,7 @@ const Signals = imports.signals;
 const Application = imports.application;
 const Query = imports.query;
 const Utils = imports.utils;
+const WindowMode = imports.windowMode;
 
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
@@ -117,6 +118,7 @@ const TrackerController = new Lang.Class({
         this._queryQueuedFlags = RefreshFlags.NONE;
         this._querying = false;
         this._isStarted = false;
+        this._refreshPending = false;
 
         // useful for debugging
         this._lastQueryTime = 0;
@@ -125,6 +127,12 @@ const TrackerController = new Lang.Class({
         Application.sourceManager.connect('item-removed', Lang.bind(this, this._onSourceAddedRemoved));
         Application.sourceManager.connect('active-changed', Lang.bind(this, this._refreshForObject));
 
+        Application.modeController.connect('window-mode-changed', Lang.bind(this,
+            function(object, newMode) {
+                if (this._refreshPending && newMode == WindowMode.WindowMode.OVERVIEW)
+                    this._refreshForSource();
+            }));
+
         Application.offsetController.connect('offset-changed', Lang.bind(this, this._performCurrentQuery));
 
         Application.collectionManager.connect('active-changed', Lang.bind(this, this._refreshForObject));
@@ -243,6 +251,18 @@ const TrackerController = new Lang.Class({
         this._refreshInternal(RefreshFlags.RESET_OFFSET);
     },
 
+    _refreshForSource: function() {
+        // When a source is added or removed, refresh the model only if
+        // the current source is All.
+        // If it was the current source to be removed, we will get an
+        // 'active-changed' signal, so avoid refreshing twice
+        if (this._currentQuery.activeSource &&
+            this._currentQuery.activeSource.id == 'all')
+            this._refreshInternal(RefreshFlags.NONE);
+
+        this._refreshPending = false;
+    },
+
     _onSearchMatchChanged: function() {
         // when the "match" search setting changes, refresh only if
         // the search string is not empty
@@ -251,13 +271,12 @@ const TrackerController = new Lang.Class({
     },
 
     _onSourceAddedRemoved: function(manager, item) {
-        // When a source is added or removed, refresh the model only if
-        // the current source is All.
-        // If it was the current source to be removed, we will get an
-        // 'active-changed' signal, so avoid refreshing twice
-        if (this._currentQuery.activeSource &&
-            this._currentQuery.activeSource.id == 'all')
-            this._refreshInternal(RefreshFlags.NONE);
+        let mode = Application.modeController.getWindowMode();
+
+        if (mode == WindowMode.WindowMode.OVERVIEW)
+            this._refreshForSource();
+        else
+            this._refreshPending = true;
     },
 
     start: function() {


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