Compare commits
7 Commits
citadel
...
benzea/sys
Author | SHA1 | Date | |
---|---|---|---|
|
ff1b411f74 | ||
|
098114f4c8 | ||
|
9a49b20fac | ||
|
d9775e41b2 | ||
|
5796a5d193 | ||
|
afefc88e02 | ||
|
44cd1ae25b |
12
data/gnome-shell-extensions-disabled-warning.desktop.in.in
Normal file
12
data/gnome-shell-extensions-disabled-warning.desktop.in.in
Normal file
@ -0,0 +1,12 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=GNOME Shell Extensions Disabled Warning
|
||||
Comment=Warning shown if extensions were disabled due to a failure
|
||||
Exec=@bindir@/gnome-shell-extension-prefs --disabled-warning
|
||||
X-GNOME-Bugzilla-Bugzilla=GNOME
|
||||
X-GNOME-Bugzilla-Product=gnome-shell
|
||||
X-GNOME-Bugzilla-Component=general
|
||||
X-GNOME-Bugzilla-Version=@VERSION@
|
||||
OnlyShowIn=GNOME;
|
||||
AutostartCondition=if-exists gnome-shell-extensions-disabled-warning
|
||||
X-GNOME-HiddenUnderSystemd=@systemd_hidden@
|
13
data/gnome-shell-extensions-disabled-warning.service.in
Normal file
13
data/gnome-shell-extensions-disabled-warning.service.in
Normal file
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Warn about GNOME Shell extensions being disabled
|
||||
ConditionPathExists=%E/gnome-shell-extensions-disabled-warning
|
||||
|
||||
Requisite=gnome-session.target
|
||||
After=gnome-session.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=-/bin/rm %E/gnome-shell-extensions-disabled-warning
|
||||
ExecStart=@bindir@/gnome-shell-extension-prefs --disabled-warning
|
||||
Restart=no
|
||||
|
@ -8,3 +8,5 @@ Before=gnome-session-initialized.target
|
||||
|
||||
Requires=gnome-shell-wayland.service
|
||||
After=gnome-shell-wayland.service
|
||||
|
||||
Wants=gnome-shell-extensions-disabled-warning.service
|
||||
|
@ -8,3 +8,5 @@ Before=gnome-session-initialized.target
|
||||
|
||||
Requires=gnome-shell-x11.service
|
||||
After=gnome-shell-x11.service
|
||||
|
||||
Wants=gnome-shell-extensions-disabled-warning.service
|
||||
|
@ -31,6 +31,19 @@ foreach desktop_file : desktop_files
|
||||
)
|
||||
endforeach
|
||||
|
||||
i18n.merge_file('desktop',
|
||||
input: configure_file(
|
||||
input: 'gnome-shell-extensions-disabled-warning.desktop.in.in',
|
||||
output: 'gnome-shell-extensions-disabled-warning.desktop.in',
|
||||
configuration: desktopconf
|
||||
),
|
||||
output: 'gnome-shell-extension-disabled-warning.desktop',
|
||||
po_dir: po_dir,
|
||||
install: true,
|
||||
install_dir: autostartdir,
|
||||
type: 'desktop'
|
||||
)
|
||||
|
||||
serviceconf = configuration_data()
|
||||
serviceconf.set('libexecdir', libexecdir)
|
||||
foreach service_file : service_files
|
||||
|
@ -10,7 +10,7 @@ const _ = Gettext.gettext;
|
||||
|
||||
const Config = imports.misc.config;
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const { loadInterfaceXML } = imports.misc.fileUtils;
|
||||
const { loadInterfaceXML, deleteGFile } = imports.misc.fileUtils;
|
||||
|
||||
const { ExtensionState } = ExtensionUtils;
|
||||
|
||||
@ -219,10 +219,33 @@ var Application = GObject.registerClass({
|
||||
Gio.SettingsBindFlags.DEFAULT |
|
||||
Gio.SettingsBindFlags.INVERT_BOOLEAN);
|
||||
|
||||
let vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
|
||||
this._window.add(vbox);
|
||||
|
||||
this.disabledInfobar = new Gtk.InfoBar({
|
||||
message_type: Gtk.MessageType.ERROR,
|
||||
revealed: false,
|
||||
show_close_button: true
|
||||
});
|
||||
this.disabledInfobar.connect('response', () => {
|
||||
this.disabledInfobar.revealed = false;
|
||||
});
|
||||
let contentArea = this.disabledInfobar.get_content_area();
|
||||
let label = new Gtk.Label({
|
||||
label: _('A problem was detected and extensions were automatically disabled. It is recommended to disable or reconfigure any extensions that may have caused the issue before re-enabling them at the top.'),
|
||||
ellipsize: Pango.EllipsizeMode.END,
|
||||
wrap: true,
|
||||
lines: 2,
|
||||
xalign: 0,
|
||||
margin: 6
|
||||
});
|
||||
contentArea.add(label);
|
||||
vbox.add(this.disabledInfobar);
|
||||
|
||||
this._mainStack = new Gtk.Stack({
|
||||
transition_type: Gtk.StackTransitionType.CROSSFADE
|
||||
});
|
||||
this._window.add(this._mainStack);
|
||||
vbox.add(this._mainStack);
|
||||
|
||||
let scroll = new Gtk.ScrolledWindow({ hscrollbar_policy: Gtk.PolicyType.NEVER });
|
||||
|
||||
@ -338,6 +361,20 @@ var Application = GObject.registerClass({
|
||||
let args = commandLine.get_arguments();
|
||||
|
||||
if (args.length) {
|
||||
if (args[0] == '--disabled-warning') {
|
||||
if (!this._settings.is_writable('disable-user-extensions'))
|
||||
this.quit();
|
||||
|
||||
this.disabledInfobar.set_revealed(true);
|
||||
|
||||
let file = GLib.build_filenamev ([GLib.get_user_config_dir(), 'gnome-shell-extensions-disabled-warning']);
|
||||
let gfile = Gio.File.new_for_path(file);
|
||||
if (gfile.query_exists(null))
|
||||
deleteGFile(gfile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
let uuid = args[0];
|
||||
|
||||
this._skipMainWindow = true;
|
||||
@ -574,8 +611,11 @@ class ExtensionRow extends Gtk.ListBoxRow {
|
||||
|
||||
this._extension = ExtensionUtils.deserializeExtension(newState);
|
||||
let state = (this._extension.state == ExtensionState.ENABLED);
|
||||
this._switch.freeze_notify();
|
||||
this._switch.state = state;
|
||||
this._switch.active = this._extension.isRequested;
|
||||
this._switch.sensitive = this._canToggle();
|
||||
this._switch.thaw_notify();
|
||||
});
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
@ -644,7 +684,6 @@ class ExtensionRow extends Gtk.ListBoxRow {
|
||||
this._switch = new Gtk.Switch({
|
||||
valign: Gtk.Align.CENTER,
|
||||
sensitive: this._canToggle(),
|
||||
state: this._extension.state === ExtensionState.ENABLED
|
||||
});
|
||||
this._switch.connect('notify::active', () => {
|
||||
if (this._switch.active)
|
||||
@ -653,6 +692,11 @@ class ExtensionRow extends Gtk.ListBoxRow {
|
||||
this._app.shellProxy.DisableExtensionRemote(this.uuid);
|
||||
});
|
||||
this._switch.connect('state-set', () => true);
|
||||
this._switch.freeze_notify();
|
||||
this._switch.state = this._extension.state === ExtensionState.ENABLED;
|
||||
this._switch.active = this._extension.isRequested;
|
||||
this._switch.thaw_notify();
|
||||
|
||||
hbox.add(this._switch);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ var ExtensionState = {
|
||||
UNINSTALLED: 99
|
||||
};
|
||||
|
||||
const SERIALIZED_PROPERTIES = ['type', 'state', 'path', 'error', 'hasPrefs', 'canChange'];
|
||||
const SERIALIZED_PROPERTIES = ['type', 'state', 'path', 'error', 'hasPrefs', 'canChange', 'isRequested'];
|
||||
|
||||
/**
|
||||
* getCurrentExtension:
|
||||
|
@ -22,6 +22,7 @@ var ExtensionManager = class {
|
||||
|
||||
this._extensions = new Map();
|
||||
this._enabledExtensions = [];
|
||||
this._requestedExtensions = [];
|
||||
this._extensionOrder = [];
|
||||
|
||||
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
|
||||
@ -250,6 +251,9 @@ var ExtensionManager = class {
|
||||
// Default to error, we set success as the last step
|
||||
extension.state = ExtensionState.ERROR;
|
||||
|
||||
let requested = this._requestedExtensions.includes(extension.uuid);
|
||||
extension.isRequested = requested;
|
||||
|
||||
let checkVersion = !global.settings.get_boolean(EXTENSION_DISABLE_VERSION_CHECK_KEY);
|
||||
|
||||
if (checkVersion && ExtensionUtils.isOutOfDate(extension)) {
|
||||
@ -363,10 +367,7 @@ var ExtensionManager = class {
|
||||
? DISABLE_USER_EXTENSIONS_KEY
|
||||
: ENABLED_EXTENSIONS_KEY;
|
||||
|
||||
extension.canChange =
|
||||
!hasError &&
|
||||
global.settings.is_writable(changeKey) &&
|
||||
(isMode || !modeOnly);
|
||||
extension.canChange = global.settings.is_writable(ENABLED_EXTENSIONS_KEY);
|
||||
}
|
||||
|
||||
_getEnabledExtensions() {
|
||||
@ -380,6 +381,14 @@ var ExtensionManager = class {
|
||||
return extensions.filter(item => !disabledExtensions.includes(item));
|
||||
}
|
||||
|
||||
_getRequestedExtensions() {
|
||||
let extensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
|
||||
|
||||
// filter out 'disabled-extensions' which takes precedence
|
||||
let disabledExtensions = global.settings.get_strv(DISABLED_EXTENSIONS_KEY);
|
||||
return extensions.filter(item => !disabledExtensions.includes(item));
|
||||
}
|
||||
|
||||
_onUserExtensionsEnabledChanged() {
|
||||
this._onEnabledExtensionsChanged();
|
||||
this._onSettingsWritableChanged();
|
||||
@ -391,6 +400,16 @@ var ExtensionManager = class {
|
||||
if (!this._enabled)
|
||||
return;
|
||||
|
||||
// Updated requested state and emit change notifications
|
||||
this._requestedExtensions = this._getRequestedExtensions();
|
||||
for (let extension of this._extensions.values()) {
|
||||
let requested = this._requestedExtensions.includes(extension.uuid);
|
||||
if (extension.isRequested == requested)
|
||||
continue;
|
||||
extension.isRequested = requested;
|
||||
this.emit('extension-state-changed', extension);
|
||||
}
|
||||
|
||||
// Find and enable all the newly enabled extensions: UUIDs found in the
|
||||
// new setting, but not in the old one.
|
||||
newEnabledExtensions.filter(
|
||||
@ -451,6 +470,7 @@ var ExtensionManager = class {
|
||||
this._onSettingsWritableChanged.bind(this));
|
||||
|
||||
this._enabledExtensions = this._getEnabledExtensions();
|
||||
this._requestedExtensions = this._getRequestedExtensions();
|
||||
|
||||
let perUserDir = Gio.File.new_for_path(global.userdatadir);
|
||||
FileUtils.collectFromDatadirs('extensions', true, (dir, info) => {
|
||||
@ -512,8 +532,9 @@ var ExtensionManager = class {
|
||||
// property; it might make sense to make enabledExtensions independent
|
||||
// from allowExtensions in the future
|
||||
if (Main.sessionMode.allowExtensions) {
|
||||
if (this._initted)
|
||||
if (this._initted) {
|
||||
this._enabledExtensions = this._getEnabledExtensions();
|
||||
}
|
||||
this._enableAllExtensions();
|
||||
} else {
|
||||
this._disableAllExtensions();
|
||||
|
Loading…
Reference in New Issue
Block a user