From 9131da56233e174e83afab8a116862f841789691 Mon Sep 17 00:00:00 2001 From: xSmurf Date: Sun, 7 Jan 2018 15:14:52 +0000 Subject: [PATCH] Push_modal failure tentative four... --- gnome-shell/firewall@subgraph.com/dialog.js | 9 +-------- gnome-shell/firewall@subgraph.com/extension.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/gnome-shell/firewall@subgraph.com/dialog.js b/gnome-shell/firewall@subgraph.com/dialog.js index b0ead3d..ceef49d 100644 --- a/gnome-shell/firewall@subgraph.com/dialog.js +++ b/gnome-shell/firewall@subgraph.com/dialog.js @@ -527,8 +527,7 @@ const PromptDialog = new Lang.Class({ Name: 'PromptDialog', Extends: ModalDialog.ModalDialog, - _init: function(invocation, pid_known, sandboxed, tlsguard, cbClose) { - this.cbClose = cbClose; + _init: function(invocation, pid_known, sandboxed, tlsguard) { this.parent({ styleClass: 'fw-prompt-dialog' }); this._invocation = invocation; this.header = new PromptDialogHeader(); @@ -603,17 +602,11 @@ const PromptDialog = new Lang.Class({ }, onAllow: function() { - //if (this.cbClose !== undefined && this.cbClose !== null) { - // this.cbClose(); - //} this.close(); this.sendReturnValue(true); }, onDeny: function() { - //if (this.cbClose !== undefined && this.cbClose !== null) { - // this.cbClose(); - //} this.close(); this.sendReturnValue(false); }, diff --git a/gnome-shell/firewall@subgraph.com/extension.js b/gnome-shell/firewall@subgraph.com/extension.js index e5a0db7..d8d8639 100644 --- a/gnome-shell/firewall@subgraph.com/extension.js +++ b/gnome-shell/firewall@subgraph.com/extension.js @@ -6,6 +6,7 @@ const Meta = imports.gi.Meta; const Shell = imports.gi.Shell; const Gio = imports.gi.Gio; +const GLib = imports.gi.GLib; const Extension = imports.misc.extensionUtils.getCurrentExtension(); const Convenience = Extension.imports.convenience; @@ -176,14 +177,16 @@ const FirewallPromptHandler = new Lang.Class({ try { let params = this._dialogs.shift(); let [app, icon, path, address, port, ip, origin, proto, uid, gid, user, group, pid, sandbox, tlsguard, optstring, expanded, expert, action, invocation] = params; - let cbfn = function(self) { - return function() { return self.onCloseDialog(); } - }(this) - this._dialog = new Dialog.PromptDialog(invocation, (pid >= 0), (sandbox != ""), tlsguard, cbfn); + this._dialog = new Dialog.PromptDialog(invocation, (pid >= 0), (sandbox != ""), tlsguard); this._dialog.update(app, icon, path, address, port, ip, origin, uid, gid, user, group, pid, proto, tlsguard, optstring, sandbox, expanded, expert, action); this._dialog.connect("closed", Lang.bind(this, this.onCloseDialog)); - this._dialog.open(); + let dio = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, Lang.bind(this, function() { + if (this._dialog.open()) { + GLib.source_remove(dio); + dio = null; + } + })); } catch (err) { log("SGFW: Error while creating prompt: " + err); }