[gnome-documents/gnome-3-4] Revert "tag: Porting Documents to Lang.Class()"



commit e19490e2195d99153c3fb9c89aca7d11a375ba81
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Jun 4 13:12:56 2012 -0400

    Revert "tag: Porting Documents to Lang.Class()"
    
    This reverts commit 62648df45e06c00faab7d1ca9214adc2148caf5b.

 src/application.js         |   11 ++---
 src/changeMonitor.js       |   30 +++++++-------
 src/documents.js           |   94 +++++++++++++++++++++++--------------------
 src/embed.js               |    9 ++--
 src/error.js               |    9 ++--
 src/errorBox.js            |   10 ++--
 src/gDataMiner.js          |   10 ++--
 src/loadMore.js            |   11 ++---
 src/mainToolbar.js         |   41 +++++++++----------
 src/mainWindow.js          |    9 ++--
 src/manager.js             |   29 +++++++-------
 src/notifications.js       |   22 +++++------
 src/offsetController.js    |   11 ++---
 src/preview.js             |   29 +++++++-------
 src/query.js               |   21 +++++-----
 src/searchbar.js           |   93 ++++++++++++++++++++++++-------------------
 src/selections.js          |   88 +++++++++++++++++++++++------------------
 src/shellSearchProvider.js |   36 +++++++++-------
 src/sources.js             |   22 ++++++----
 src/spinnerBox.js          |    9 ++--
 src/trackerController.js   |   18 +++++----
 src/view.js                |   18 +++++----
 src/windowMode.js          |   11 ++---
 23 files changed, 341 insertions(+), 300 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index ace2442..afab1f4 100644
--- a/src/application.js
+++ b/src/application.js
@@ -55,12 +55,11 @@ const WindowMode = imports.windowMode;
 
 const MINER_REFRESH_TIMEOUT = 60; /* seconds */
 
+function Application() {
+    this._init();
+}
 
-
-const Application = new Lang.Class({
-    Name: 'Application',
-
-
+Application.prototype = {
     _init: function() {
         Gettext.bindtextdomain('gnome-documents', Path.LOCALE_DIR);
         Gettext.textdomain('gnome-documents');
@@ -224,4 +223,4 @@ const Application = new Lang.Class({
 
         return 0;
     }
-});
+};
diff --git a/src/changeMonitor.js b/src/changeMonitor.js
index 4d38f52..3276908 100644
--- a/src/changeMonitor.js
+++ b/src/changeMonitor.js
@@ -31,17 +31,17 @@ const TrackerResourcesServiceIface = {
                 inSignature: 'sa(iiii)a(iiii)' }]
 };
 
+function TrackerResourcesService() {
+    this._init();
+}
 
-const TrackerResourcesService = new Lang.Class({
-    Name: 'TrackerResourcesService',
-	
-
+TrackerResourcesService.prototype = {
     _init: function() {
         DBus.session.proxifyObject(this,
                                    'org.freedesktop.Tracker1',
                                    '/org/freedesktop/Tracker1/Resources');
     }
-});
+};
 DBus.proxifyPrototype(TrackerResourcesService.prototype, TrackerResourcesServiceIface);
 
 const ChangeEventType = {
@@ -52,10 +52,11 @@ const ChangeEventType = {
 
 const _RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";;
 
+function ChangeEvent(urn, predicate, isDelete) {
+    this._init(urn, predicate, isDelete);
+}
 
-const ChangeEvent = new Lang.Class({
-    Name: 'ChangeEvent',
-
+ChangeEvent.prototype = {
     _init: function(urn, predicate, isDelete) {
         this.urn = urn;
 
@@ -76,14 +77,13 @@ const ChangeEvent = new Lang.Class({
             this.type = event.type;
         }
     }
-});
-
+};
 
+function TrackerChangeMonitor() {
+    this._init();
+}
 
-const TrackerChangeMonitor = new Lang.Class({
-    Name: 'TrackerChangeMonitor',
-	
-	
+TrackerChangeMonitor.prototype = {
     _init: function() {
         this._outstandingOps = 0;
         this._pendingChanges = [];
@@ -153,5 +153,5 @@ const TrackerChangeMonitor = new Lang.Class({
             this._pendingChanges = {};
         }
     }
-});
+};
 Signals.addSignalMethods(TrackerChangeMonitor.prototype);
diff --git a/src/documents.js b/src/documents.js
index c3ec8a8..b12090b 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -41,10 +41,11 @@ const Searchbar = imports.searchbar;
 const TrackerUtils = imports.trackerUtils;
 const Utils = imports.utils;
 
+function SingleItemJob(doc) {
+    this._init(doc);
+}
 
-const SingleItemJob = new Lang.Class({
-    Name: 'SingleItemJob',
-
+SingleItemJob.prototype = {
     _init: function(urn) {
         this._urn = urn;
         this._cursor = null;
@@ -90,13 +91,14 @@ const SingleItemJob = new Lang.Class({
     _emitCallback: function() {
         this._callback(this._cursor);
     }
-});
+};
 
+function DeleteItemJob(urn) {
+    this._init(urn);
+}
 
-const DeleteItemJob = new Lang.Class({
-    Name: 'DeleteItemJob',
-	
 // deletes the given resource
+DeleteItemJob.prototype = {
     _init: function(urn) {
         this._urn = urn;
     },
@@ -117,12 +119,13 @@ const DeleteItemJob = new Lang.Class({
                     this._callback();
             }));
     }
-});
-
+};
 
-const CollectionIconWatcher = new Lang.Class({
-    Name: 'CollectionIconWatcher',
+function CollectionIconWatcher(collection) {
+    this._init(collection);
+}
 
+CollectionIconWatcher.prototype = {
     _init: function(collection) {
         this._collection = collection;
         this._pixbuf = null;
@@ -262,13 +265,14 @@ const CollectionIconWatcher = new Lang.Class({
         this.destroy();
         this._start();
     }
-});
+};
 Signals.addSignalMethods(CollectionIconWatcher.prototype);
 
+function DocCommon(cursor) {
+    this._init(cursor);
+}
 
-const DocCommon = new Lang.Class({
-    Name: 'DocCommon',
-
+DocCommon.prototype = {
     _init: function(cursor) {
         this.id = null;
         this.uri = null;
@@ -600,20 +604,21 @@ const DocCommon = new Lang.Class({
 
         return retval;
     }
-});
+};
 Signals.addSignalMethods(DocCommon.prototype);
 
+function LocalDocument(cursor) {
+    this._init(cursor);
+}
 
-const LocalDocument = new Lang.Class({
-    Name: 'LocalDocument',
-    Extends: DocCommon,
-
+LocalDocument.prototype = {
+    __proto__: DocCommon.prototype,
 
     _init: function(cursor) {
         this._failedThumbnailing = false;
         this._triedThumbnailing = false;
 
-        this.parent(cursor);
+        DocCommon.prototype._init.call(this, cursor);
 
         this.sourceName = _("Local");
 
@@ -652,22 +657,23 @@ const LocalDocument = new Lang.Class({
             job.run(null);
         }
     }
-});
+};
 
 const _GOOGLE_DOCS_SCHEME_LABELS = "http://schemas.google.com/g/2005/labels";;
 const _GOOGLE_DOCS_TERM_STARRED = "http://schemas.google.com/g/2005/labels#starred";;
 
+function GoogleDocument(cursor) {
+    this._init(cursor);
+}
 
-const GoogleDocument = new Lang.Class({
-    Name: 'GoogleDocument',
-    Extends: DocCommon,
-	
+GoogleDocument.prototype = {
+    __proto__: DocCommon.prototype,
 
     _init: function(cursor) {
         this._triedThumbnailing = true;
         this._failedThumbnailing = true;
 
-        this.parent(cursor);
+        DocCommon.prototype._init.call(this, cursor);
 
         // overridden
         this.defaultAppName = _("Google Docs");
@@ -754,11 +760,11 @@ const GoogleDocument = new Lang.Class({
     populateFromCursor: function(cursor) {
         this.shared = cursor.get_boolean(Query.QueryColumns.SHARED);
 
-        this.parent(cursor);
+        DocCommon.prototype.populateFromCursor.call(this, cursor);
     },
 
     setFavorite: function(favorite) {
-        this.parent(favorite);
+        DocCommon.prototype.setFavorite.call(this, favorite);
 
         this._createGDataEntry(null, Lang.bind(this,
             function(entry, service, exception) {
@@ -800,17 +806,17 @@ const GoogleDocument = new Lang.Class({
     canTrash: function() {
         return false;
     }
-});
+};
 
+function DocumentManager() {
+    this._init();
+}
 
-
-const DocumentManager = new Lang.Class({
-    Name: 'DocumentManager',
-    Extends: Manager.BaseManager,
-
+DocumentManager.prototype = {
+    __proto__: Manager.BaseManager.prototype,
 
     _init: function() {
-        this.parent();
+        Manager.BaseManager.prototype._init.call(this);
 
         this._model = new DocumentModel();
 
@@ -890,12 +896,12 @@ const DocumentManager = new Lang.Class({
             items[idx].destroy();
         };
 
-        this.parent();
+        Manager.BaseManager.prototype.clear.call(this);
         this._model.clear();
     },
 
     setActiveItem: function(doc) {
-        if (this.parent(doc)) {
+        if (Manager.BaseManager.prototype.setActiveItem.call(this, doc)) {
 
             if (doc && !doc.collection) {
                 let recentManager = Gtk.RecentManager.get_default();
@@ -907,13 +913,13 @@ const DocumentManager = new Lang.Class({
     getModel: function() {
         return this._model;
     }
-});
-
+};
 
-const DocumentModel = new Lang.Class({
-    Name: 'DocumentModel',
-	
+function DocumentModel() {
+    this._init();
+}
 
+DocumentModel.prototype = {
     _init: function() {
         this.model = Gd.create_list_store();
         this.model.set_sort_column_id(Gd.MainColumns.MTIME,
@@ -963,4 +969,4 @@ const DocumentModel = new Lang.Class({
                 return false;
             }));
     }
-});
+};
diff --git a/src/embed.js b/src/embed.js
index 2cc9632..4f93438 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -43,10 +43,11 @@ const GtkClutter = imports.gi.GtkClutter;
 
 const _PDF_LOADER_TIMEOUT = 400;
 
+function ViewEmbed() {
+    this._init();
+}
 
-const ViewEmbed = new Lang.Class({
-    Name: 'ViewEmbed',
-
+ViewEmbed.prototype  = {
     _init: function() {
         this._adjustmentValueId = 0;
         this._adjustmentChangedId = 0;
@@ -380,4 +381,4 @@ const ViewEmbed = new Lang.Class({
         let errorBox = new ErrorBox.ErrorBox(message, exception.message);
         this._scrolledWinPreview.add_with_viewport(errorBox.widget);
     }
-});
+};
diff --git a/src/error.js b/src/error.js
index 8c11f2f..bdb8baa 100644
--- a/src/error.js
+++ b/src/error.js
@@ -24,10 +24,11 @@ const Signals = imports.signals;
 
 const _ = imports.gettext.gettext;
 
+function ErrorHandler() {
+    this._init();
+}
 
-const ErrorHandler = new Lang.Class({
-    Name: 'ErrorHandler',
-
+ErrorHandler.prototype = {
     _init: function() {
     },
 
@@ -53,5 +54,5 @@ const ErrorHandler = new Lang.Class({
 
         this.emit('query-error', message, exception);
     }
-});
+};
 Signals.addSignalMethods(ErrorHandler.prototype);
diff --git a/src/errorBox.js b/src/errorBox.js
index d4deecb..7a48237 100644
--- a/src/errorBox.js
+++ b/src/errorBox.js
@@ -21,14 +21,14 @@
 
 const GLib = imports.gi.GLib;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 
 const _ICON_SIZE = 128;
 
+function ErrorBox(primary, secondary) {
+    this._init(primary, secondary);
+}
 
-const ErrorBox = new Lang.Class({
-    Name: 'ErrorBox',
-
+ErrorBox.prototype = {
     _init: function(primary, secondary) {
         this.widget = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
                                      row_spacing: 12,
@@ -60,4 +60,4 @@ const ErrorBox = new Lang.Class({
 
         this.widget.show_all();
     }
-});
+};
diff --git a/src/gDataMiner.js b/src/gDataMiner.js
index 3172aa5..8ce9a5c 100644
--- a/src/gDataMiner.js
+++ b/src/gDataMiner.js
@@ -20,7 +20,6 @@
  */
 
 const DBus = imports.dbus;
-const Lang = imports.lang;
 
 const GDataMinerIface = {
     name: 'org.gnome.Documents.GDataMiner',
@@ -28,14 +27,15 @@ const GDataMinerIface = {
                 inSignature: '' }]
 };
 
+const GDataMiner = function() {
+    this._init();
+};
 
-const GDataMiner = new Lang.Class({
-    Name: 'GDataMiner',
-
+GDataMiner.prototype = {
     _init: function() {
         DBus.session.proxifyObject(this,
                                    'org.gnome.Documents.GDataMiner',
                                    '/org/gnome/Documents/GDataMiner');
     }
-});
+};
 DBus.proxifyPrototype(GDataMiner.prototype, GDataMinerIface);
diff --git a/src/loadMore.js b/src/loadMore.js
index f59bde8..149e8c6 100644
--- a/src/loadMore.js
+++ b/src/loadMore.js
@@ -27,12 +27,11 @@ const _ = imports.gettext.gettext;
 
 const Lang = imports.lang;
 
+function LoadMoreButton() {
+    this._init();
+};
 
-
-const LoadMoreButton = new Lang.Class({
-    Name: 'LoadMoreButton',
-	
-	
+LoadMoreButton.prototype = {
     _init: function() {
         this._block = false;
 
@@ -81,4 +80,4 @@ const LoadMoreButton = new Lang.Class({
         this._block = block;
         this._onItemCountChanged();
     }
-});
+};
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 40a5ddb..7c074a6 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -38,11 +38,11 @@ const Searchbar = imports.searchbar;
 const Tweener = imports.util.tweener;
 const WindowMode = imports.windowMode;
 
+function MainToolbar() {
+    this._init();
+}
 
-const MainToolbar = new Lang.Class({
-    Name: 'MainToolbar',
-
-
+MainToolbar.prototype = {
     _init: function() {
         this._model = null;
 
@@ -291,18 +291,17 @@ const MainToolbar = new Lang.Class({
 
         this._setToolbarTitle();
     }
-});
-
-;
-
-const PreviewToolbar = new Lang.Class({
-    Name: 'PreviewToolbar',
-    Extends: MainToolbar,
+};
 
+function PreviewToolbar() {
+    this._init();
+};
 
+PreviewToolbar.prototype = {
+    __proto__: MainToolbar.prototype,
 
     _init: function() {
-        this.parent();
+        MainToolbar.prototype._init.call(this);
 
         this.actor.y = -(this.widget.get_preferred_height()[1]);
     },
@@ -320,17 +319,17 @@ const PreviewToolbar = new Lang.Class({
                            time: 0.20,
                            transition: 'easeOutQuad' });
     }
-});
-
-
+};
 
-const OverviewToolbar = new Lang.Class({
-    Name: 'OverviewToolbar',
-    Extends: MainToolbar,
+function OverviewToolbar() {
+    this._init();
+};
 
+OverviewToolbar.prototype = {
+    __proto__: MainToolbar.prototype,
 
     _init: function() {
-        this.parent();
+        MainToolbar.prototype._init.call(this);
 
         this.searchbar = new Searchbar.Searchbar();
         this.layout.pack_start = true;
@@ -339,7 +338,7 @@ const OverviewToolbar = new Lang.Class({
     },
 
     _onWindowModeChanged: function() {
-        this.parent();
+        MainToolbar.prototype._onWindowModeChanged.call(this);
 
         let mode = Global.modeController.getWindowMode();
 
@@ -349,4 +348,4 @@ const OverviewToolbar = new Lang.Class({
                    Global.searchController.getString() != '')
             this.searchbar.show();
     }
-});
+};
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 9a3a64a..04722e9 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -39,10 +39,11 @@ const _ = imports.gettext.gettext;
 
 const _CONFIGURE_ID_TIMEOUT = 100; // msecs
 
+function MainWindow(app) {
+    this._init(app);
+}
 
-const MainWindow = new Lang.Class({
-    Name: 'MainWindow',
-
+MainWindow.prototype = {
     _init: function(app) {
         this._configureId = 0;
 
@@ -246,4 +247,4 @@ const MainWindow = new Lang.Class({
             aboutDialog.destroy();
         });
     }
-});
+};
diff --git a/src/manager.js b/src/manager.js
index 70613ec..c6edb9b 100644
--- a/src/manager.js
+++ b/src/manager.js
@@ -27,11 +27,11 @@ const Pango = imports.gi.Pango;
 const Lang = imports.lang;
 const Signals = imports.signals;
 
+function BaseManager(title) {
+    this._init(title);
+};
 
-
-const BaseManager = new Lang.Class({
-    Name: 'BaseManager',
-
+BaseManager.prototype = {
     _init: function(title) {
         this._items = {};
         this._activeItem = null;
@@ -164,7 +164,7 @@ const BaseManager = new Lang.Class({
 
         // TODO: merge existing item properties with new values
     }
-});
+};
 Signals.addSignalMethods(BaseManager.prototype);
 
 // GTK+ implementations
@@ -175,11 +175,11 @@ const BaseModelColumns = {
     HEADING_TEXT: 2
 };
 
+function BaseModel(manager) {
+    this._init(manager);
+}
 
-
-const BaseModel = new Lang.Class({
-    Name: 'BaseModel',
-
+BaseModel.prototype = {
     _init: function(manager) {
         this.model = Gd.create_item_store();
         this._manager = manager;
@@ -209,12 +209,13 @@ const BaseModel = new Lang.Class({
                               item.id, item.name, '');
         }
     }
-});
+};
 
+function BaseView(manager) {
+    this._init(manager);
+}
 
-const BaseView = new Lang.Class({
-    Name: 'BaseView',
-	
+BaseView.prototype = {
     _init: function(manager) {
         this._model = new BaseModel(manager);
         this._manager = manager;
@@ -285,5 +286,5 @@ const BaseView = new Lang.Class({
         if (additionalFunc)
             additionalFunc(col, cell, model, iter);
     }
-});
+};
 Signals.addSignalMethods(BaseView.prototype);
diff --git a/src/notifications.js b/src/notifications.js
index 7b6ab6d..0607a05 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -30,12 +30,11 @@ const Global = imports.global;
 const Lang = imports.lang;
 const Signals = imports.signals;
 
+function PrintNotification(printOp, doc) {
+    this._init(printOp, doc);
+}
 
-
-const PrintNotification = new Lang.Class({
-    Name: 'PrintNotification',
-
-
+PrintNotification.prototype = {
     _init: function(printOp, doc) {
         this.widget = null;
         this._printOp = printOp;
@@ -91,14 +90,13 @@ const PrintNotification = new Lang.Class({
         if (fraction == 1)
             this.widget.destroy();
     }
-});
-
-
-
-const NotificationManager = new Lang.Class({
-    Name: 'NotificationManager',
+};
 
+function NotificationManager() {
+    this._init();
+}
 
+NotificationManager.prototype = {
     _init: function() {
         this.widget = new Gd.Notification({ timeout: -1,
                                             show_close_button: false });
@@ -134,5 +132,5 @@ const NotificationManager = new Lang.Class({
 
     _onNotificationDismissed: function() {
     }
-});
+};
 Signals.addSignalMethods(NotificationManager.prototype);
diff --git a/src/offsetController.js b/src/offsetController.js
index 0251eec..5160225 100644
--- a/src/offsetController.js
+++ b/src/offsetController.js
@@ -30,12 +30,11 @@ const GLib = imports.gi.GLib;
 
 const _OFFSET_STEP = 50;
 
+function OffsetController() {
+    this._init();
+};
 
-
-const OffsetController = new Lang.Class({
-    Name: 'OffsetController',
-
-
+OffsetController.prototype = {
     _init: function() {
         this._offset = 0;
         this._itemCount = 0;
@@ -92,5 +91,5 @@ const OffsetController = new Lang.Class({
     getOffset: function() {
         return this._offset;
     }
-});
+};
 Signals.addSignalMethods(OffsetController.prototype);
diff --git a/src/preview.js b/src/preview.js
index 7eb6674..f588867 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -36,11 +36,11 @@ const View = imports.view;
 
 const _FULLSCREEN_TOOLBAR_TIMEOUT = 2; // seconds
 
+function PreviewView(model) {
+    this._init(model);
+}
 
-
-const PreviewView = new Lang.Class({
-    Name: 'PreviewView',
-
+PreviewView.prototype = {
     _init: function(model) {
         this._model = model;
 
@@ -97,12 +97,13 @@ const PreviewView = new Lang.Class({
     destroy: function() {
         this.widget.destroy();
     }
-});
-
+};
 
-const PreviewThumbnails = new Lang.Class({
-    Name: 'PreviewThumbnails',
+function PreviewThumbnails(model) {
+    this._init(model);
+}
 
+PreviewThumbnails.prototype = {
     _init: function(model) {
         this.view = new Gd.SidebarThumbnails({ model: model });
         this.widget = new Gd.ThumbNav({ thumbview: this.view });
@@ -131,13 +132,13 @@ const PreviewThumbnails = new Lang.Class({
               },
               onCompleteScope: this });
     }
-});
-
-
+};
 
-const PreviewEmbed = new Lang.Class({
-    Name: 'PreviewEmbed',
+function PreviewEmbed(model, layout, parentActor, scrolledWindow) {
+    this._init(model, layout, parentActor, scrolledWindow);
+}
 
+PreviewEmbed.prototype = {
     _init: function(model, layout, parentActor, scrolledWindow) {
         this._layout = layout;
         this._parentActor = parentActor;
@@ -249,4 +250,4 @@ const PreviewEmbed = new Lang.Class({
                     return false;
             }));
     }
-});
+};
diff --git a/src/query.js b/src/query.js
index 3c1b0b3..7596512 100644
--- a/src/query.js
+++ b/src/query.js
@@ -24,7 +24,6 @@ const Global = imports.global;
 const Gd = imports.gi.Gd;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
-const Lang = imports.lang;
 
 const QueryColumns = {
     URN: 0,
@@ -48,20 +47,22 @@ const QueryFlags = {
 
 const LOCAL_COLLECTIONS_IDENTIFIER = 'gd:collection:local:';
 
-const Query = new Lang.Class({
-    Name: 'Query',
-	
+function Query(sparql) {
+    this._init(sparql);
+}
+
+Query.prototype = {
     _init: function(sparql) {
         this.sparql = sparql;
         this.activeSource = Global.sourceManager.getActiveItem();
     }
-});
-
+};
 
+function QueryBuilder() {
+    this._init();
+}
 
-const QueryBuilder = new Lang.Class({
-    Name: 'QueryBuilder',
-	
+QueryBuilder.prototype = {
     _init: function() {
     },
 
@@ -261,4 +262,4 @@ const QueryBuilder = new Lang.Class({
 
         return new Query(sparql);
     }
-});
+};
diff --git a/src/searchbar.js b/src/searchbar.js
index 13a8767..4a8d53d 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -45,10 +45,11 @@ const SearchCategoryStock = {
     PRIVATE: 'private'
 };
 
+function SearchCategory(params) {
+    this._init(params);
+};
 
-const SearchCategory = new Lang.Class({
-    Name: 'SearchCategory',
-
+SearchCategory.prototype = {
     _init: function(params) {
         this.id = params.id;
         this.name = params.name;
@@ -73,16 +74,17 @@ const SearchCategory = new Lang.Class({
 
         return '(true)';
     }
-});
-
+};
 
+function SearchCategoryManager() {
+    this._init();
+};
 
-const SearchCategoryManager = new Lang.Class({
-    Name: 'SearchCategoryManager',
-    Extends: Manager.BaseManager,
+SearchCategoryManager.prototype = {
+    __proto__: Manager.BaseManager.prototype,
 
     _init: function() {
-        this.parent(_("Category"));
+        Manager.BaseManager.prototype._init.call(this, _("Category"));
 
         let category, recent;
         // Translators: this refers to new and recent documents
@@ -108,12 +110,13 @@ const SearchCategoryManager = new Lang.Class({
 
         this.setActiveItem(recent);
     }
-});
-
+};
 
-const SearchType = new Lang.Class({
-    Name: 'SearchType',
+function SearchType(params) {
+    this._init(params);
+}
 
+SearchType.prototype = {
     _init: function(params) {
         this.id = params.id;
         this.name = params.name;
@@ -123,15 +126,17 @@ const SearchType = new Lang.Class({
     getFilter: function() {
         return this._filter;
     }
-});
+};
 
+function SearchTypeManager() {
+    this._init();
+}
 
-const SearchTypeManager = new Lang.Class({
-    Name: 'SearchTypeManager',
-    Extends: Manager.BaseManager,
+SearchTypeManager.prototype = {
+    __proto__: Manager.BaseManager.prototype,
 
     _init: function() {
-        this.parent(_("Type"));
+        Manager.BaseManager.prototype._init.call(this, _("Type"));
 
         this.addItem(new SearchType({ id: 'all',
                                       name: _("All") }));
@@ -154,7 +159,7 @@ const SearchTypeManager = new Lang.Class({
 
         this.setActiveItemById('all');
     }
-});
+};
 
 const SearchMatchStock = {
     ALL: 'all',
@@ -162,10 +167,11 @@ const SearchMatchStock = {
     AUTHOR: 'author'
 };
 
+function SearchMatch(params) {
+    this._init(params);
+}
 
-const SearchMatch = new Lang.Class({
-    Name: 'SearchMatch',
-	
+SearchMatch.prototype = {
     _init: function(params) {
         this.id = params.id;
         this.name = params.name;
@@ -187,17 +193,19 @@ const SearchMatch = new Lang.Class({
                     '"%s")').format(this._term);
         return '';
     }
-});
+};
 
+function SearchMatchManager() {
+    this._init();
+}
 
-const SearchMatchManager = new Lang.Class({
-    Name: 'SearchMatchManager',
-    Extends: Manager.BaseManager,
+SearchMatchManager.prototype = {
+    __proto__: Manager.BaseManager.prototype,
 
     _init: function() {
         // Translators: this is a verb that refers to "All", "Title" and "Author",
         // as in "Match All", "Match Title" and "Match Author"
-        this.parent(_("Match"));
+        Manager.BaseManager.prototype._init.call(this, _("Match"));
 
         this.addItem(new SearchMatch({ id: SearchMatchStock.ALL,
                                        name: _("All") }));
@@ -217,16 +225,17 @@ const SearchMatchManager = new Lang.Class({
             this.forEachItem(function(item) {
                 item.setFilterTerm(terms[i]);
             });
-            filters.push(this.parent());
+            filters.push(Manager.BaseManager.prototype.getFilter.call(this));
         }
         return filters.length ? '( ' + filters.join(' && ') + ')' : '';
     }
-});
+};
 
+function SearchController() {
+    this._init();
+};
 
-const SearchController = new Lang.Class({
-    Name: 'SearchController',
-	
+SearchController.prototype = {
     _init: function() {
         this._dropdownState = false;
         this._string = '';
@@ -260,13 +269,14 @@ const SearchController = new Lang.Class({
     getDropdownState: function() {
         return this._dropdownState;
     }
-});
+};
 Signals.addSignalMethods(SearchController.prototype);
 
+function Dropdown() {
+    this._init();
+}
 
-const Dropdown = new Lang.Class({
-    Name: 'Dropdown',
-	
+Dropdown.prototype = {
     _init: function() {
         this._sourceView = new Manager.BaseView(Global.sourceManager);
         this._typeView = new Manager.BaseView(Global.searchTypeManager);
@@ -331,12 +341,13 @@ const Dropdown = new Lang.Class({
                                        },
                                        onCompleteScope: this });
     }
-});
+};
 
+function Searchbar() {
+    this._init();
+}
 
-const Searchbar = new Lang.Class({
-    Name: 'Searchbar',
-	
+Searchbar.prototype = {
     _init: function() {
         this._searchEventId = 0;
         this._searchFocusId = 0;
@@ -605,4 +616,4 @@ const Searchbar = new Lang.Class({
                                        },
                                        onCompleteScope: this });
     }
-});
+};
diff --git a/src/selections.js b/src/selections.js
index c499a3b..5153221 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -41,9 +41,11 @@ const Signals = imports.signals;
 const _COLLECTION_PLACEHOLDER_ID = 'collection-placeholder';
 
 // fetch all the collections a given item is part of
-const FetchCollectionsJob = new Lang.Class({
-    Name: 'FetchCollectionsJob',
+function FetchCollectionsJob(urn) {
+    this._init(urn);
+}
 
+FetchCollectionsJob.prototype = {
     _init: function(urn) {
         this._urn = urn;
         this._collections = [];
@@ -93,7 +95,7 @@ const FetchCollectionsJob = new Lang.Class({
         if (this._callback)
             this._callback(this._collections);
     }
-});
+};
 
 // fetch the state of every collection applicable to the selected items
 const OrganizeCollectionState = {
@@ -103,11 +105,11 @@ const OrganizeCollectionState = {
     HIDDEN: 1 << 2
 };
 
+function FetchCollectionStateForSelectionJob() {
+    this._init();
+}
 
-
-const FetchCollectionStateForSelectionJob = new Lang.Class({
-    Name: 'FetchCollectionStateForSelectionJob',
-
+FetchCollectionStateForSelectionJob.prototype = {
     _init: function() {
         this._collectionsForItems = {};
         this._runningJobs = 0;
@@ -190,12 +192,14 @@ const FetchCollectionStateForSelectionJob = new Lang.Class({
         if (this._callback)
             this._callback(collectionState);
     }
-});
+};
 
 // updates the mtime for the given resource to the current system time
-const UpdateMtimeJob = new Lang.Class({
-    Name: 'UpdateMtimeJob',
+function UpdateMtimeJob(urn) {
+    this._init(urn);
+}
 
+UpdateMtimeJob.prototype = {
     _init: function(urn) {
         this._urn = urn;
     },
@@ -216,12 +220,14 @@ const UpdateMtimeJob = new Lang.Class({
                     this._callback();
             }));
     }
-});
+};
 
 // adds or removes the selected items to the given collection
-const SetCollectionForSelectionJob = new Lang.Class({
-    Name: 'SetCollectionForSelectionJob',
+function SetCollectionForSelectionJob(collectionUrn, setting) {
+    this._init(collectionUrn, setting);
+}
 
+SetCollectionForSelectionJob.prototype = {
     _init: function(collectionUrn, setting) {
         this._collectionUrn = collectionUrn;
         this._setting = setting;
@@ -268,12 +274,14 @@ const SetCollectionForSelectionJob = new Lang.Class({
                 }));
         }
     }
-});
+};
 
 // creates an (empty) collection with the given name
-const CreateCollectionJob = new Lang.Class({
-    Name: 'CreateCollectionJob',
+function CreateCollectionJob(name) {
+    this._init(name);
+}
 
+CreateCollectionJob.prototype = {
     _init: function(name) {
         this._name = name;
         this._createdUrn = null;
@@ -306,7 +314,7 @@ const CreateCollectionJob = new Lang.Class({
                     this._callback(this._createdUrn);
             }));
     }
-});
+};
 
 const OrganizeModelColumns = {
     ID: 0,
@@ -314,10 +322,11 @@ const OrganizeModelColumns = {
     STATE: 2
 };
 
+function OrganizeCollectionModel() {
+    this._init();
+}
 
-const OrganizeCollectionModel = new Lang.Class({
-    Name: 'OrganizeCollectionModel',
-
+OrganizeCollectionModel.prototype = {
     _init: function() {
         this.model = Gd.create_organize_store();
         this._placeholderRef = null;
@@ -443,12 +452,13 @@ const OrganizeCollectionModel = new Lang.Class({
             this._collRemovedId = 0;
         }
     }
-});
-
+};
 
-const OrganizeCollectionView = new Lang.Class({
-    Name: 'OrganizeCollectionView',
+function OrganizeCollectionView() {
+    this._init();
+}
 
+OrganizeCollectionView.prototype = {
     _init: function() {
         this._choiceConfirmed = false;
 
@@ -593,17 +603,17 @@ const OrganizeCollectionView = new Lang.Class({
     confirmedChoice: function() {
         this._choiceConfirmed = true;
     }
-});
+};
 
 const OrganizeCollectionDialogResponse = {
     ADD: 1
 };
 
+function OrganizeCollectionDialog(toplevel) {
+    this._init(toplevel);
+};
 
-const OrganizeCollectionDialog = new Lang.Class({
-    Name: 'OrganizeCollectionDialog',
-
-
+OrganizeCollectionDialog.prototype = {
     _init: function(toplevel) {
         this.widget = new Gtk.Dialog({ transient_for: toplevel,
                                        modal: true,
@@ -647,12 +657,13 @@ const OrganizeCollectionDialog = new Lang.Class({
 
         this.widget.show_all();
     }
-});
-
+};
 
-const SelectionController = new Lang.Class({
-    Name: 'SelectionController',
+function SelectionController() {
+    this._init();
+};
 
+SelectionController.prototype = {
     _init: function() {
         this._selection = [];
         this._selectionMode = false;
@@ -711,13 +722,14 @@ const SelectionController = new Lang.Class({
     getSelectionMode: function() {
         return this._selectionMode;
     }
-});
+};
 Signals.addSignalMethods(SelectionController.prototype);
 
+function SelectionToolbar() {
+    this._init();
+}
 
-const SelectionToolbar = new Lang.Class({
-    Name: 'SelectionToolbar',
-	
+SelectionToolbar.prototype = {
     _init: function() {
         this._itemListeners = {};
         this._insideRefresh = false;
@@ -981,4 +993,4 @@ const SelectionToolbar = new Lang.Class({
               },
               onCompleteScope: this });
     }
-});
+};
diff --git a/src/shellSearchProvider.js b/src/shellSearchProvider.js
index e84dba0..6ddcb05 100644
--- a/src/shellSearchProvider.js
+++ b/src/shellSearchProvider.js
@@ -113,10 +113,11 @@ function _createGIcon(cursor) {
     return gicon;
 }
 
+function CreateCollectionIconJob(id) {
+    this._init(id);
+}
 
-const CreateCollectionIconJob = new Lang.Class({
-    Name: 'CreateCollectionIconJob',
-
+CreateCollectionIconJob.prototype = {
     _init: function(id) {
         this._id = id;
         this._itemIcons = [];
@@ -224,12 +225,13 @@ const CreateCollectionIconJob = new Lang.Class({
     _returnPixbuf: function() {
         this._callback(Gd.create_collection_icon(_SHELL_SEARCH_ICON_SIZE, this._itemIcons));
     }
-});
+};
 
+function FetchMetasJob(ids) {
+    this._init(ids);
+}
 
-const FetchMetasJob = new Lang.Class({
-    Name: 'FetchMetasJob',
-
+FetchMetasJob.prototype = {
     _init: function(ids) {
         this._ids = ids;
         this._metas = [];
@@ -293,12 +295,13 @@ const FetchMetasJob = new Lang.Class({
                     }));
             }));
     }
-});
+};
 
+function FetchIdsJob(terms) {
+    this._init(terms);
+}
 
-const FetchIdsJob = new Lang.Class({
-    Name: 'FetchIdsJob',
-
+FetchIdsJob.prototype = {
     _init: function(terms) {
         this._terms = terms;
         this._ids = [];
@@ -344,12 +347,13 @@ const FetchIdsJob = new Lang.Class({
             this._callback(this._ids);
         }
     }
-});
+};
 
+function ShellSearchProvider() {
+    this._init();
+}
 
-const ShellSearchProvider = new Lang.Class({
-    Name: 'ShellSearchProvider',
-
+ShellSearchProvider.prototype = {
     _init: function() {
         Gio.DBus.own_name(Gio.BusType.SESSION,
                           SEARCH_PROVIDER_NAME,
@@ -515,7 +519,7 @@ const ShellSearchProvider = new Lang.Class({
     run: function() {
         Mainloop.run(MAINLOOP_ID);
     }
-});
+};
 
 function start() {
     let searchProvider = new ShellSearchProvider();
diff --git a/src/sources.js b/src/sources.js
index 7361924..c2e5331 100644
--- a/src/sources.js
+++ b/src/sources.js
@@ -31,11 +31,13 @@ const Manager = imports.manager;
 const SourceStock = {
     ALL: 'all',
     LOCAL: 'local'
-};
+}
 
-const Source = new Lang.Class({
-    Name: 'Source',
+function Source(params) {
+    this._init(params);
+};
 
+Source.prototype = {
     _init: function(params) {
         this.id = null;
         this.name = null;
@@ -75,15 +77,17 @@ const Source = new Lang.Class({
 
         return filter;
     }
-});
+};
 
+function SourceManager() {
+    this._init();
+};
 
-const SourceManager = new Lang.Class({
-    Name: 'SourceManager',
-    Extends: Manager.BaseManager,
+SourceManager.prototype = {
+    __proto__: Manager.BaseManager.prototype,
 
     _init: function() {
-        this.parent(_("Sources"));
+        Manager.BaseManager.prototype._init.call(this, _("Sources"));
 
         // Translators: this refers to documents
         let source = new Source({ id: SourceStock.ALL,
@@ -123,4 +127,4 @@ const SourceManager = new Lang.Class({
 
         this.processNewItems(newItems);
     }
-});
+};
diff --git a/src/spinnerBox.js b/src/spinnerBox.js
index a8d0629..cf101da 100644
--- a/src/spinnerBox.js
+++ b/src/spinnerBox.js
@@ -30,10 +30,11 @@ const Mainloop = imports.mainloop;
 
 const _SPINNER_SIZE = 128;
 
+function SpinnerBox() {
+    this._init();
+}
 
-const SpinnerBox = new Lang.Class({
-    Name: 'SpinnerBox',
-
+SpinnerBox.prototype = {
     _init: function() {
         this._delayedMoveId = 0;
 
@@ -100,4 +101,4 @@ const SpinnerBox = new Lang.Class({
                 return false;
             }));
     }
-});
+};
diff --git a/src/trackerController.js b/src/trackerController.js
index 23798ae..045122f 100644
--- a/src/trackerController.js
+++ b/src/trackerController.js
@@ -35,10 +35,11 @@ const QueryType = {
     UPDATE_BLANK: 2
 };
 
+function TrackerConnectionQueue() {
+    this._init();
+}
 
-const TrackerConnectionQueue = new Lang.Class({
-    Name: 'TrackerConnectionQueue',
-	
+TrackerConnectionQueue.prototype = {
     _init: function() {
         this._queue = [];
         this._running = false;
@@ -100,17 +101,18 @@ const TrackerConnectionQueue = new Lang.Class({
         this._running = false;
         this._checkQueue();
     }
-});
+};
 
 const RefreshFlags = {
     NONE: 0,
     RESET_OFFSET: 1 << 0
 };
 
+function TrackerController() {
+    this._init();
+}
 
-const TrackerController = new Lang.Class({
-    Name: 'TrackerController',
-
+TrackerController.prototype = {
     _init: function() {
         this._currentQuery = null;
         this._cancellable = new Gio.Cancellable();
@@ -268,5 +270,5 @@ const TrackerController = new Lang.Class({
 
         this._refreshInternal(RefreshFlags.NONE);
     }
-});
+};
 Signals.addSignalMethods(TrackerController.prototype);
diff --git a/src/view.js b/src/view.js
index ba4158b..e5923a8 100644
--- a/src/view.js
+++ b/src/view.js
@@ -35,10 +35,11 @@ const TrackerUtils = imports.trackerUtils;
 const WindowMode = imports.windowMode;
 const Utils = imports.utils;
 
+function ContextMenu(urns) {
+    this._init(urns);
+}
 
-const ContextMenu = new Lang.Class({
-    Name: 'ContextMenu',
-	
+ContextMenu.prototype = {
     _init: function(urns) {
         let favCount = 0;
         let apps = [];
@@ -102,12 +103,13 @@ const ContextMenu = new Lang.Class({
 
         this.widget.show_all();
     }
-});
+};
 
+function View() {
+    this._init();
+}
 
-const View = new Lang.Class({
-    Name: 'View',
-
+View.prototype = {
     _init: function() {
         this.widget = new Gd.MainView();
 
@@ -294,4 +296,4 @@ const View = new Lang.Class({
                                                   this._treeModel);
         Global.selectionController.setSelection(selectedURNs);
     }
-});
+};
diff --git a/src/windowMode.js b/src/windowMode.js
index d1e09f2..b489163 100644
--- a/src/windowMode.js
+++ b/src/windowMode.js
@@ -20,7 +20,6 @@
  */
 
 const Signals = imports.signals;
-const Lang = imports.lang;
 
 const WindowMode = {
     NONE: 0,
@@ -28,11 +27,11 @@ const WindowMode = {
     PREVIEW: 2
 };
 
+function ModeController() {
+    this._init();
+};
 
-
-const ModeController = new Lang.Class({
-    Name: 'ModeController',
-
+ModeController.prototype = {
     _init: function() {
         this._mode = WindowMode.NONE;
         this._fullscreen = false;
@@ -90,5 +89,5 @@ const ModeController = new Lang.Class({
     getCanFullscreen: function() {
         return this._canFullscreen;
     }
-});
+};
 Signals.addSignalMethods(ModeController.prototype);



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