Skip to content

Commit

Permalink
Merge last changes in master
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-costas committed Jun 24, 2024
1 parent 8004637 commit 6a30b81
Show file tree
Hide file tree
Showing 4 changed files with 768 additions and 10 deletions.
15 changes: 8 additions & 7 deletions docking.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const Labels = Object.freeze({
MAIN_DASH: Symbol('main-dash'),
OLD_DASH_CHANGES: Symbol('old-dash-changes'),
SETTINGS: Symbol('settings'),
STARTUP_ANIMATION: Symbol('startup-animation'),
WORKSPACE_SWITCH_SCROLL: Symbol('workspace-switch-scroll'),
});

Expand Down Expand Up @@ -467,7 +468,6 @@ const DockedDash = GObject.registerClass({
if (Main.overview.visibleTarget)
this._onOverviewShowing();


this._updateAutoHideBarriers();
}

Expand Down Expand Up @@ -2421,11 +2421,12 @@ export class DockManager {
if (this._settings.disableOverviewOnStartup)
Main.sessionMode.hasOverview = false;

const id = Main.layoutManager.connect('startup-complete', () => {
Main.sessionMode.hasOverview = hadOverview;
Main.layoutManager.disconnect(id);
this._runStartupAnimation();
});
this._signalsHandler.addWithLabel(Labels.STARTUP_ANIMATION,
Main.layoutManager, 'startup-complete', () => {
this._signalsHandler.removeWithLabel(Labels.STARTUP_ANIMATION);
Main.sessionMode.hasOverview = hadOverview;
this._runStartupAnimation();
});
}
}

Expand Down Expand Up @@ -2550,7 +2551,7 @@ export class DockManager {
this._appSwitcherSettings = null;
this._oldDash = null;

this._desktopIconsUsableArea.destroy();
this._desktopIconsUsableArea?.destroy();
this._desktopIconsUsableArea = null;
this._extension = null;
DockManager._singleton = null;
Expand Down
46 changes: 44 additions & 2 deletions locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const LocationAppInfo = GObject.registerClass({
Gio.Icon.$gtype),
'cancellable': GObject.ParamSpec.object(
'cancellable', 'cancellable', 'cancellable',
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
GObject.ParamFlags.READWRITE,
Gio.Cancellable.$gtype),
},
}, class LocationAppInfo extends Gio.DesktopAppInfo {
Expand Down Expand Up @@ -274,7 +274,8 @@ export const LocationAppInfo = GObject.registerClass({
iconsQuery.join(','),
Gio.FileQueryInfoFlags.NONE,
GLib.PRIORITY_LOW, cancellable);
icons.standard = info.get_icon();
if (info.has_attribute(Gio.FILE_ATTRIBUTE_STANDARD_ICON))
icons.standard = info.get_icon();
} catch (e) {
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND) ||
e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED))
Expand Down Expand Up @@ -655,6 +656,12 @@ class MountableVolumeAppInfo extends LocationAppInfo {
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED))
this._notifyActionError(action, e.message);

if (action === 'mount' && this._isEncryptedMountError(e)) {
delete this._currentAction;
operation.close();
return this.launchAction(action);
}

if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
logError(e, 'Impossible to %s removable %s'.format(action,
removable.get_name()));
Expand All @@ -668,6 +675,39 @@ class MountableVolumeAppInfo extends LocationAppInfo {
operation.close();
}
}

_isEncryptedMountError(error) {
// FIXME: we will always get G_IO_ERROR_FAILED from the gvfs udisks
// backend, see https://bugs.freedesktop.org/show_bug.cgi?id=51271

if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED))
return false;

// cryptsetup
if (error.message.includes('No key available with this passphrase'))
return true;

// udisks (no password)
if (error.message.includes('No key available to unlock device'))
return true;

// libblockdev wrong password opening LUKS device
if (error.message.includes('Failed to activate device: Incorrect passphrase'))
return true;

// cryptsetup returns EINVAL in many cases, including wrong TCRYPT password/parameters
if (error.message.includes('Failed to load device\'s parameters: Invalid argument') ||
error.message.includes(`Failed to load device's parameters: ${GLib.strerror(22 /* EINVAL */)}`))
return true;

// cryptsetup returns EPERM when the TCRYPT header can't be decrypted
// with the provided password/parameters.
if (error.message.includes('Failed to load device\'s parameters: Operation not permitted') ||
error.message.includes(`Failed to load device's parameters: ${GLib.strerror(1 /* EPERM */)}`))
return true;

return false;
}
});

const TrashAppInfo = GObject.registerClass({
Expand Down Expand Up @@ -1410,6 +1450,8 @@ export class Removables {
appInfo.volume === volume);
if (volumeIndex !== -1) {
const [volumeApp] = this._volumeApps.splice(volumeIndex, 1);
// We don't care about cancelling the ongoing operations from now on.
volumeApp.appInfo.cancellable = null;
volumeApp.destroy();
this.emit('changed');
}
Expand Down
2 changes: 1 addition & 1 deletion notificationsMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class NotificationsMonitor {

destroy() {
this.emit('destroy');
this._signalsHandler.destroy();
this?._signalsHandler.destroy();
this._signalsHandler = null;
this._appNotifications = null;
this._settings = null;
Expand Down
Loading

0 comments on commit 6a30b81

Please sign in to comment.