[gnome-shell-extensions/wip/fmuellner/misc-cleanups: 5/12] placesMenu: Add early return to reduce indentation level
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/wip/fmuellner/misc-cleanups: 5/12] placesMenu: Add early return to reduce indentation level
- Date: Mon, 4 Mar 2019 18:37:14 +0000 (UTC)
commit 56d19ad4808b448553a886dc5405677b987b3b1d
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Mar 3 00:19:15 2019 +0100
placesMenu: Add early return to reduce indentation level
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60
extensions/places-menu/placeDisplay.js | 53 +++++++++++++++++-----------------
1 file changed, 27 insertions(+), 26 deletions(-)
---
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index 16f5417..991dae8 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -43,34 +43,35 @@ class PlaceInfo {
try {
Gio.AppInfo.launch_default_for_uri_finish(result);
} catch (e) {
- if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) {
- let source = {
- get_icon: () => this.icon
- };
- let op = new ShellMountOperation.ShellMountOperation(source);
- this.file.mount_enclosing_volume(0, op.mountOp, null, (file, result) => {
- try {
- op.close();
- file.mount_enclosing_volume_finish(result);
- } catch (e) {
- if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))
- // e.g. user canceled the password dialog
- return;
- Main.notifyError(_('Failed to mount volume for “%s”').format(this.name),
e.message);
- return;
- }
-
- if (tryMount) {
- let callback = this._createLaunchCallback(launchContext, false);
- Gio.AppInfo.launch_default_for_uri_async(file.get_uri(),
- launchContext,
- null,
- callback);
- }
- });
- } else {
+ if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) {
Main.notifyError(_('Failed to launch “%s”').format(this.name), e.message);
+ return;
}
+
+ let source = {
+ get_icon: () => this.icon
+ };
+ let op = new ShellMountOperation.ShellMountOperation(source);
+ this.file.mount_enclosing_volume(0, op.mountOp, null, (file, result) => {
+ try {
+ op.close();
+ file.mount_enclosing_volume_finish(result);
+ } catch (e) {
+ if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))
+ // e.g. user canceled the password dialog
+ return;
+ Main.notifyError(_('Failed to mount volume for “%s”').format(this.name), e.message);
+ return;
+ }
+
+ if (tryMount) {
+ let callback = this._createLaunchCallback(launchContext, false);
+ Gio.AppInfo.launch_default_for_uri_async(file.get_uri(),
+ launchContext,
+ null,
+ callback);
+ }
+ });
}
};
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]