~noskcaj/ubuntu/trusty/gnome-documents/3.10.2

« back to all changes in this revision

Viewing changes to src/trackerController.js

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson, Jeremy Bicha
  • Date: 2013-06-17 22:24:54 UTC
  • mfrom: (3.1.5 experimental)
  • Revision ID: package-import@ubuntu.com-20130617222454-biw3dmaqdd9qpbh7
Tags: 3.8.3.1-1
[ Jeremy Bicha ]
* New upstream release
* debian/control.in:
  - Add missing dependency on gir1.2-gnomedesktop-3.0
  - Bump minimum GTK for newer libgd
  - Build-depend on gtk-doc-tools and yelp-tools
  - Build-depend on inkscape and poppler-utils to generate
    getting-started PDF
* debian/rules: --enable-getting-started

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2011 Red Hat, Inc.
 
2
 * Copyright (c) 2011, 2013 Red Hat, Inc.
3
3
 *
4
4
 * Gnome Documents is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by the
25
25
const Application = imports.application;
26
26
const Query = imports.query;
27
27
const Utils = imports.utils;
 
28
const WindowMode = imports.windowMode;
28
29
 
29
30
const Gio = imports.gi.Gio;
30
31
const GLib = imports.gi.GLib;
117
118
        this._queryQueuedFlags = RefreshFlags.NONE;
118
119
        this._querying = false;
119
120
        this._isStarted = false;
 
121
        this._refreshPending = false;
120
122
 
121
123
        // useful for debugging
122
124
        this._lastQueryTime = 0;
125
127
        Application.sourceManager.connect('item-removed', Lang.bind(this, this._onSourceAddedRemoved));
126
128
        Application.sourceManager.connect('active-changed', Lang.bind(this, this._refreshForObject));
127
129
 
 
130
        Application.modeController.connect('window-mode-changed', Lang.bind(this,
 
131
            function(object, newMode) {
 
132
                if (this._refreshPending && newMode == WindowMode.WindowMode.OVERVIEW)
 
133
                    this._refreshForSource();
 
134
            }));
 
135
 
128
136
        Application.offsetController.connect('offset-changed', Lang.bind(this, this._performCurrentQuery));
129
137
 
130
138
        Application.collectionManager.connect('active-changed', Lang.bind(this, this._refreshForObject));
243
251
        this._refreshInternal(RefreshFlags.RESET_OFFSET);
244
252
    },
245
253
 
246
 
    _onSearchMatchChanged: function() {
247
 
        // when the "match" search setting changes, refresh only if
248
 
        // the search string is not empty
249
 
        if (Application.searchController.getString() != '')
250
 
            this._refreshInternal(RefreshFlags.RESET_OFFSET);
251
 
    },
252
 
 
253
 
    _onSourceAddedRemoved: function(manager, item) {
 
254
    _refreshForSource: function() {
254
255
        // When a source is added or removed, refresh the model only if
255
256
        // the current source is All.
256
257
        // If it was the current source to be removed, we will get an
258
259
        if (this._currentQuery.activeSource &&
259
260
            this._currentQuery.activeSource.id == 'all')
260
261
            this._refreshInternal(RefreshFlags.NONE);
 
262
 
 
263
        this._refreshPending = false;
 
264
    },
 
265
 
 
266
    _onSearchMatchChanged: function() {
 
267
        // when the "match" search setting changes, refresh only if
 
268
        // the search string is not empty
 
269
        if (Application.searchController.getString() != '')
 
270
            this._refreshInternal(RefreshFlags.RESET_OFFSET);
 
271
    },
 
272
 
 
273
    _onSourceAddedRemoved: function(manager, item) {
 
274
        let mode = Application.modeController.getWindowMode();
 
275
 
 
276
        if (mode == WindowMode.WindowMode.OVERVIEW)
 
277
            this._refreshForSource();
 
278
        else
 
279
            this._refreshPending = true;
261
280
    },
262
281
 
263
282
    start: function() {