[gnome-documents/wip/split-view: 15/15] LoadMoreButton
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/wip/split-view: 15/15] LoadMoreButton
- Date: Fri, 17 Oct 2014 13:31:06 +0000 (UTC)
commit ef40670e5b3c12d2b0676a94fd1b061bd57e76dc
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Oct 17 15:01:18 2014 +0200
LoadMoreButton
src/view.js | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
---
diff --git a/src/view.js b/src/view.js
index c1a4f95..9056f0a 100644
--- a/src/view.js
+++ b/src/view.js
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2011, 2014 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
@@ -37,13 +37,38 @@ const TrackerUtils = imports.trackerUtils;
const WindowMode = imports.windowMode;
const Utils = imports.utils;
+function getController(windowMode) {
+ let offsetController;
+ let trackerController;
+
+ switch (windowMode) {
+ case WindowMode.WindowMode.COLLECTIONS:
+ offsetController = Application.offsetCollectionsController;
+ trackerController = Application.trackerCollectionsController;
+ break;
+ case WindowMode.WindowMode.DOCUMENTS:
+ offsetController = Application.offsetDocumentsController;
+ trackerController = Application.trackerDocumentsController;
+ break;
+ case WindowMode.WindowMode.SEARCH:
+ offsetController = Application.offsetSearchController;
+ trackerController = Application.trackerSearchController;
+ break;
+ default:
+ throw(new Error('Not handled'));
+ break;
+ }
+
+ return [ offsetController, trackerController ];
+}
+
const LoadMoreButton = new Lang.Class({
Name: 'LoadMoreButton',
- _init: function() {
+ _init: function(mode) {
this._block = false;
- this._controller = Application.offsetController;
+ this._controller = getController(mode)[0];
this._controllerId =
this._controller.connect('item-count-changed',
Lang.bind(this, this._onItemCountChanged));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]