[sushi/alex-changes: 11/11] Add closeIfAlreadyShown argument to ShowFile



commit 893e9347d10dc1926374978d5461cf128cdb1fc1
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Apr 29 11:55:15 2011 +0200

    Add closeIfAlreadyShown argument to ShowFile

 src/js/ui/application.js |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/js/ui/application.js b/src/js/ui/application.js
index f5ee788..8fcca25 100644
--- a/src/js/ui/application.js
+++ b/src/js/ui/application.js
@@ -21,7 +21,7 @@ const SushiIface = {
                  inSignature: '',
                  outSignature: '' },
                { name: "ShowFile",
-                 inSignature: 'si',
+                 inSignature: 'sib',
                  outSignature: '' } ],
 
     signals: [],
@@ -85,12 +85,19 @@ Application.prototype = {
     activate : function() {
     },
 
-    ShowFile : function(uri, xid) {
+    ShowFile : function(uri, xid, closeIfAlreadyShown) {
+	let file = Gio.file_new_for_uri(uri);
+	if (closeIfAlreadyShown &&
+	    this._mainWindow.file &&
+	    this._mainWindow.file.equal(file)) {
+	    this._mainWindow.close();
+	    return;
+	}
         this._mainWindow.setParent(xid);
-        this._mainWindow.setFile(Gio.file_new_for_uri(uri));
+        this._mainWindow.setFile(file);
     },
 
     quit : function() {
         Gtk.main_quit();
     }
-}
\ No newline at end of file
+}



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