From 9cc1e6b85ce72bd4c999b559cec310886aa2fc88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 19 Mar 2017 15:37:15 +0100 Subject: [PATCH] location: Split out PermissionStore It doesn't make sense to tie the proxy code for flatpak's permission store to the location indicator, just because that was the first component to use it, so split it into a separate module. https://bugzilla.gnome.org/show_bug.cgi?id=780252 --- js/js-resources.gresource.xml | 1 + js/misc/permissionStore.js | 30 ++++++++++++++++++++++++++++++ js/ui/status/location.js | 26 ++------------------------ 3 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 js/misc/permissionStore.js diff --git a/js/js-resources.gresource.xml b/js/js-resources.gresource.xml index b774299c8..a1a419686 100644 --- a/js/js-resources.gresource.xml +++ b/js/js-resources.gresource.xml @@ -23,6 +23,7 @@ misc/modemManager.js misc/objectManager.js misc/params.js + misc/permissionStore.js misc/smartcardManager.js misc/util.js misc/weather.js diff --git a/js/misc/permissionStore.js b/js/misc/permissionStore.js new file mode 100644 index 000000000..b1dbe8664 --- /dev/null +++ b/js/misc/permissionStore.js @@ -0,0 +1,30 @@ +// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- + +const Gio = imports.gi.Gio; + +const PermissionStoreIface = ' \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +'; + +const PermissionStoreProxy = Gio.DBusProxy.makeProxyWrapper(PermissionStoreIface); + +function PermissionStore(initCallback, cancellable) { + return new PermissionStoreProxy(Gio.DBus.session, + 'org.freedesktop.impl.portal.PermissionStore', + '/org/freedesktop/impl/portal/PermissionStore', + initCallback, cancellable); +}; diff --git a/js/ui/status/location.js b/js/ui/status/location.js index 668f93c2d..7988dd4fc 100644 --- a/js/ui/status/location.js +++ b/js/ui/status/location.js @@ -9,6 +9,7 @@ const Main = imports.ui.main; const PanelMenu = imports.ui.panelMenu; const PopupMenu = imports.ui.popupMenu; const ModalDialog = imports.ui.modalDialog; +const PermissionStore = imports.misc.permissionStore; const Shell = imports.gi.Shell; const Signals = imports.signals; const St = imports.gi.St; @@ -62,26 +63,6 @@ var AgentIface = ' \ \ '; -var PermissionStoreIface = ' \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -'; - -const PermissionStore = Gio.DBusProxy.makeProxyWrapper(PermissionStoreIface); - const Indicator = new Lang.Class({ Name: 'LocationIndicator', Extends: PanelMenu.SystemIndicator, @@ -253,10 +234,7 @@ const Indicator = new Lang.Class({ _connectToPermissionStore: function() { this._permStoreProxy = null; - new PermissionStore(Gio.DBus.session, - 'org.freedesktop.impl.portal.PermissionStore', - '/org/freedesktop/impl/portal/PermissionStore', - Lang.bind(this, this._onPermStoreProxyReady)); + new PermissionStore.PermissionStore(Lang.bind(this, this._onPermStoreProxyReady), null); }, _onPermStoreProxyReady: function(proxy, error) {