[sushi] application: complete the port to use gdbus-codegen



commit ff2510db4333e0dabe689b2f810ae513e36b0e0a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Jun 17 12:18:25 2019 -0700

    application: complete the port to use gdbus-codegen
    
    Fix a few leftovers that prevented the program to work.

 src/ui/application.js | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/ui/application.js b/src/ui/application.js
index ccb7eda..6348be9 100644
--- a/src/ui/application.js
+++ b/src/ui/application.js
@@ -36,6 +36,9 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
 
     vfunc_dbus_register(connection, path) {
         this._skeleton = new NautilusPreviewerDBus.Skeleton();
+        this._skeleton.connect('handle-close', this._close.bind(this));
+        this._skeleton.connect('handle-show-file', this._showFile.bind(this));
+
         try {
             this._skeleton.export(connection, path);
         } catch (e) {
@@ -76,12 +79,15 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
         settings.gtk_application_prefer_dark_theme = true;
     }
 
-    Close() {
+    _close(skel, invocation) {
         if (this._mainWindow)
             this._mainWindow.destroy();
+
+        invocation.return_value(null);
+        return true;
     }
 
-    ShowFile(uri, xid, closeIfAlreadyShown) {
+    _showFile(skel, invocation, uri, xid, closeIfAlreadyShown) {
         this._ensureMainWindow();
 
         let file = Gio.file_new_for_uri(uri);
@@ -89,9 +95,12 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
             this._mainWindow.file &&
             this._mainWindow.file.equal(file)) {
             this._mainWindow.destroy();
-            return;
+        } else {
+            this._mainWindow.setParent(xid);
+            this._mainWindow.setFile(file);
         }
-        this._mainWindow.setParent(xid);
-        this._mainWindow.setFile(file);
+
+        invocation.return_value(null);
+        return true;
     }
 });


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