Browse Source

Changing how the fileChanged signal works.

Brian E. Granger 8 years ago
parent
commit
e79979edfc
2 changed files with 9 additions and 9 deletions
  1. 2 2
      src/filebrowser/browser.ts
  2. 7 7
      src/filebrowser/model.ts

+ 2 - 2
src/filebrowser/browser.ts

@@ -113,9 +113,9 @@ class FileBrowserWidget extends Widget {
 
     model.fileChanged.connect((fbModel, args) => {
       if (args.newValue) {
-        manager.handleRename(args.oldValue, args.newValue);
+        manager.handleRename(args.oldValue.path, args.newValue.path);
       } else {
-        manager.handleDelete(args.oldValue);
+        manager.handleDelete(args.oldValue.path);
       }
     });
 

+ 7 - 7
src/filebrowser/model.ts

@@ -55,7 +55,7 @@ class FileBrowserModel implements IDisposable {
   /**
    * Get the file path changed signal.
    */
-  fileChanged: ISignal<FileBrowserModel, IChangedArgs<string>>;
+  fileChanged: ISignal<FileBrowserModel, IChangedArgs<Contents.IModel>>;
 
   /**
    * Get the current path.
@@ -179,7 +179,7 @@ class FileBrowserModel implements IDisposable {
       this.fileChanged.emit({
         name: 'file',
         oldValue: void 0,
-        newValue: contents.path
+        newValue: contents
       });
       return contents;
     });
@@ -198,7 +198,7 @@ class FileBrowserModel implements IDisposable {
     return this._manager.contents.delete(path).then(() => {
       this.fileChanged.emit({
         name: 'file',
-        oldValue: path,
+        oldValue: {path: path},
         newValue: void 0
       });
     });
@@ -236,7 +236,7 @@ class FileBrowserModel implements IDisposable {
       this.fileChanged.emit({
         name: 'file',
         oldValue: void 0,
-        newValue: contents.path
+        newValue: contents
       });
       return contents;
     });
@@ -259,8 +259,8 @@ class FileBrowserModel implements IDisposable {
     return this._manager.contents.rename(path, newPath).then(contents => {
       this.fileChanged.emit({
         name: 'file',
-        oldValue: path,
-        newValue: newPath
+        oldValue: {type: contents.type , path: path},
+        newValue: contents
       });
       return contents;
     });
@@ -340,7 +340,7 @@ class FileBrowserModel implements IDisposable {
           this.fileChanged.emit({
             name: 'file',
             oldValue: void 0,
-            newValue: contents.path
+            newValue: contents
           });
           resolve(contents);
         });