data: Stop providing an Access portal backend
A portal review by the design team has concluded that it is better to have all portals as application-modal GTK dialogs, instead of mixing them with some system-modal shell dialogs. https://gitlab.gnome.org/GNOME/gnome-shell/issues/1994
This commit is contained in:
parent
1fb955b8da
commit
b0362945f4
@ -1,15 +0,0 @@
|
||||
<node>
|
||||
<interface name="org.freedesktop.impl.portal.Access">
|
||||
<method name="AccessDialog">
|
||||
<arg type="o" name="handle" direction="in"/>
|
||||
<arg type="s" name="app_id" direction="in"/>
|
||||
<arg type="s" name="parent_window" direction="in"/>
|
||||
<arg type="s" name="title" direction="in"/>
|
||||
<arg type="s" name="subtitle" direction="in"/>
|
||||
<arg type="s" name="body" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<arg type="u" name="response" direction="out"/>
|
||||
<arg type="a{sv}" name="results" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
@ -9,7 +9,6 @@
|
||||
<file preprocess="xml-stripblanks">org.freedesktop.DBus.xml</file>
|
||||
<file preprocess="xml-stripblanks">org.freedesktop.GeoClue2.Agent.xml</file>
|
||||
<file preprocess="xml-stripblanks">org.freedesktop.GeoClue2.Manager.xml</file>
|
||||
<file preprocess="xml-stripblanks">org.freedesktop.impl.portal.Access.xml</file>
|
||||
<file preprocess="xml-stripblanks">org.freedesktop.impl.portal.PermissionStore.xml</file>
|
||||
<file preprocess="xml-stripblanks">org.freedesktop.impl.portal.Request.xml</file>
|
||||
<file preprocess="xml-stripblanks">org.freedesktop.login1.Manager.xml</file>
|
||||
|
@ -1,4 +0,0 @@
|
||||
[portal]
|
||||
DBusName=org.freedesktop.impl.portal.desktop.gnome
|
||||
Interfaces=org.freedesktop.impl.portal.Access
|
||||
UseIn=gnome
|
@ -72,7 +72,6 @@ configure_file(
|
||||
)
|
||||
|
||||
|
||||
install_data('gnome-shell.portal', install_dir: portaldir)
|
||||
install_data('50-gnome-shell-system.xml', install_dir: keysdir)
|
||||
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
<file>perf/core.js</file>
|
||||
<file>perf/hwtest.js</file>
|
||||
|
||||
<file>ui/accessDialog.js</file>
|
||||
<file>ui/altTab.js</file>
|
||||
<file>ui/animation.js</file>
|
||||
<file>ui/appDisplay.js</file>
|
||||
|
@ -1,156 +0,0 @@
|
||||
/* exported AccessDialogDBus */
|
||||
const { Clutter, Gio, GLib, GObject, Shell, St } = imports.gi;
|
||||
|
||||
const CheckBox = imports.ui.checkBox;
|
||||
const Dialog = imports.ui.dialog;
|
||||
const ModalDialog = imports.ui.modalDialog;
|
||||
|
||||
const { loadInterfaceXML } = imports.misc.fileUtils;
|
||||
|
||||
const RequestIface = loadInterfaceXML('org.freedesktop.impl.portal.Request');
|
||||
const AccessIface = loadInterfaceXML('org.freedesktop.impl.portal.Access');
|
||||
|
||||
var DialogResponse = {
|
||||
OK: 0,
|
||||
CANCEL: 1,
|
||||
CLOSED: 2,
|
||||
};
|
||||
|
||||
var AccessDialog = GObject.registerClass(
|
||||
class AccessDialog extends ModalDialog.ModalDialog {
|
||||
_init(invocation, handle, title, description, body, options) {
|
||||
super._init({ styleClass: 'access-dialog' });
|
||||
|
||||
this._invocation = invocation;
|
||||
this._handle = handle;
|
||||
|
||||
this._requestExported = false;
|
||||
this._request = Gio.DBusExportedObject.wrapJSObject(RequestIface, this);
|
||||
|
||||
for (let option in options)
|
||||
options[option] = options[option].deep_unpack();
|
||||
|
||||
this._buildLayout(title, description, body, options);
|
||||
}
|
||||
|
||||
_buildLayout(title, description, body, options) {
|
||||
// No support for non-modal system dialogs, so ignore the option
|
||||
// let modal = options['modal'] || true;
|
||||
let denyLabel = options['deny_label'] || _("Deny Access");
|
||||
let grantLabel = options['grant_label'] || _("Grant Access");
|
||||
let choices = options['choices'] || [];
|
||||
|
||||
let content = new Dialog.MessageDialogContent({ title, description });
|
||||
this.contentLayout.add_actor(content);
|
||||
|
||||
this._choices = new Map();
|
||||
|
||||
for (let i = 0; i < choices.length; i++) {
|
||||
let [id, name, opts, selected] = choices[i];
|
||||
if (opts.length > 0)
|
||||
continue; // radio buttons, not implemented
|
||||
|
||||
let check = new CheckBox.CheckBox();
|
||||
check.getLabelActor().text = name;
|
||||
check.checked = selected == "true";
|
||||
content.add_child(check);
|
||||
|
||||
this._choices.set(id, check);
|
||||
}
|
||||
|
||||
let bodyLabel = new St.Label({
|
||||
text: body,
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
content.add_child(bodyLabel);
|
||||
|
||||
this.addButton({ label: denyLabel,
|
||||
action: () => {
|
||||
this._sendResponse(DialogResponse.CANCEL);
|
||||
},
|
||||
key: Clutter.KEY_Escape });
|
||||
this.addButton({ label: grantLabel,
|
||||
action: () => {
|
||||
this._sendResponse(DialogResponse.OK);
|
||||
} });
|
||||
}
|
||||
|
||||
open() {
|
||||
super.open();
|
||||
|
||||
let connection = this._invocation.get_connection();
|
||||
this._requestExported = this._request.export(connection, this._handle);
|
||||
}
|
||||
|
||||
CloseAsync(invocation, _params) {
|
||||
if (this._invocation.get_sender() != invocation.get_sender()) {
|
||||
invocation.return_error_literal(Gio.DBusError,
|
||||
Gio.DBusError.ACCESS_DENIED,
|
||||
'');
|
||||
return;
|
||||
}
|
||||
|
||||
this._sendResponse(DialogResponse.CLOSED);
|
||||
}
|
||||
|
||||
_sendResponse(response) {
|
||||
if (this._requestExported)
|
||||
this._request.unexport();
|
||||
this._requestExported = false;
|
||||
|
||||
let results = {};
|
||||
if (response == DialogResponse.OK) {
|
||||
for (let [id, check] of this._choices) {
|
||||
let checked = check.checked ? 'true' : 'false';
|
||||
results[id] = new GLib.Variant('s', checked);
|
||||
}
|
||||
}
|
||||
|
||||
// Delay actual response until the end of the close animation (if any)
|
||||
this.connect('closed', () => {
|
||||
this._invocation.return_value(new GLib.Variant('(ua{sv})',
|
||||
[response, results]));
|
||||
});
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
|
||||
var AccessDialogDBus = class {
|
||||
constructor() {
|
||||
this._accessDialog = null;
|
||||
|
||||
this._windowTracker = Shell.WindowTracker.get_default();
|
||||
|
||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(AccessIface, this);
|
||||
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/portal/desktop');
|
||||
|
||||
Gio.DBus.session.own_name('org.freedesktop.impl.portal.desktop.gnome', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||
}
|
||||
|
||||
AccessDialogAsync(params, invocation) {
|
||||
if (this._accessDialog) {
|
||||
invocation.return_error_literal(Gio.DBusError,
|
||||
Gio.DBusError.LIMITS_EXCEEDED,
|
||||
'Already showing a system access dialog');
|
||||
return;
|
||||
}
|
||||
|
||||
let [handle, appId, parentWindow_, title, description, body, options] = params;
|
||||
// We probably want to use parentWindow and global.display.focus_window
|
||||
// for this check in the future
|
||||
if (appId && `${appId}.desktop` != this._windowTracker.focus_app.id) {
|
||||
invocation.return_error_literal(Gio.DBusError,
|
||||
Gio.DBusError.ACCESS_DENIED,
|
||||
'Only the focused app is allowed to show a system access dialog');
|
||||
return;
|
||||
}
|
||||
|
||||
let dialog = new AccessDialog(
|
||||
invocation, handle, title, description, body, options);
|
||||
dialog.open();
|
||||
|
||||
dialog.connect('closed', () => (this._accessDialog = null));
|
||||
|
||||
this._accessDialog = dialog;
|
||||
}
|
||||
};
|
@ -2,7 +2,7 @@
|
||||
/* exported componentManager, notificationDaemon, windowAttentionHandler,
|
||||
ctrlAltTabManager, padOsdService, osdWindowManager,
|
||||
osdMonitorLabeler, shellMountOpDBusService, shellDBusService,
|
||||
shellAccessDialogDBusService, shellAudioSelectionDBusService,
|
||||
shellAudioSelectionDBusService,
|
||||
screenSaverDBus, screencastService, uiGroup, magnifier,
|
||||
xdndHandler, keyboard, kbdA11yDialog, introspectService,
|
||||
start, pushModal, popModal, activateWindow, createLookingGlass,
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
|
||||
|
||||
const AccessDialog = imports.ui.accessDialog;
|
||||
const AudioDeviceSelection = imports.ui.audioDeviceSelection;
|
||||
const Components = imports.ui.components;
|
||||
const CtrlAltTab = imports.ui.ctrlAltTab;
|
||||
@ -68,7 +67,6 @@ var padOsdService = null;
|
||||
var osdWindowManager = null;
|
||||
var osdMonitorLabeler = null;
|
||||
var sessionMode = null;
|
||||
var shellAccessDialogDBusService = null;
|
||||
var shellAudioSelectionDBusService = null;
|
||||
var shellDBusService = null;
|
||||
var shellMountOpDBusService = null;
|
||||
@ -137,7 +135,6 @@ function start() {
|
||||
St.Settings.get().connect('notify::gtk-theme', _loadDefaultStylesheet);
|
||||
_initializeUI();
|
||||
|
||||
shellAccessDialogDBusService = new AccessDialog.AccessDialogDBus();
|
||||
shellAudioSelectionDBusService = new AudioDeviceSelection.AudioDeviceSelectionDBus();
|
||||
shellDBusService = new ShellDBus.GnomeShell();
|
||||
shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
|
||||
|
@ -57,7 +57,6 @@ convertdir = join_paths(datadir, 'GConf', 'gsettings')
|
||||
desktopdir = join_paths(datadir, 'applications')
|
||||
ifacedir = join_paths(datadir, 'dbus-1', 'interfaces')
|
||||
localedir = join_paths(datadir, 'locale')
|
||||
portaldir = join_paths(datadir, 'xdg-desktop-portal', 'portals')
|
||||
schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
|
||||
servicedir = join_paths(datadir, 'dbus-1', 'services')
|
||||
|
||||
|
@ -12,7 +12,6 @@ js/gdm/util.js
|
||||
js/misc/systemActions.js
|
||||
js/misc/util.js
|
||||
js/portalHelper/main.js
|
||||
js/ui/accessDialog.js
|
||||
js/ui/appDisplay.js
|
||||
js/ui/appFavorites.js
|
||||
js/ui/audioDeviceSelection.js
|
||||
|
Loading…
Reference in New Issue
Block a user