[gnome-documents] documents: consolidate setActiveItem code
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] documents: consolidate setActiveItem code
- Date: Tue, 26 Jun 2012 17:45:03 +0000 (UTC)
commit 1b92a39ad202578cae1cd6114907e245d28a3b17
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Jun 26 11:54:27 2012 -0400
documents: consolidate setActiveItem code
src/documents.js | 16 +++++++++++-----
src/embed.js | 1 -
2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index f766df6..7255ebc 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -993,13 +993,19 @@ const DocumentManager = new Lang.Class({
},
setActiveItem: function(doc) {
- if (this.parent(doc)) {
+ if (!this.parent(doc))
+ return;
- if (doc && !doc.collection) {
- let recentManager = Gtk.RecentManager.get_default();
- recentManager.add_item(doc.uri);
- }
+ if (!doc)
+ return;
+
+ if (doc.collection) {
+ Global.collectionManager.setActiveItem(doc);
+ return;
}
+
+ let recentManager = Gtk.RecentManager.get_default();
+ recentManager.add_item(doc.uri);
},
getModel: function() {
diff --git a/src/embed.js b/src/embed.js
index 962df96..1502e21 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -188,7 +188,6 @@ const ViewEmbed = new Lang.Class({
let collection = Global.collectionManager.getItemById(doc.id);
if (collection) {
- Global.collectionManager.setActiveItem(collection);
Global.modeController.setWindowMode(WindowMode.WindowMode.OVERVIEW);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]