Use shell notifyError

This commit is contained in:
Romain Vigier
2021-08-25 15:18:26 +02:00
parent dbb6275d35
commit c4be83f34e
4 changed files with 4 additions and 24 deletions
-4
View File
@@ -1,4 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
var debug = false;
+2 -3
View File
@@ -9,7 +9,6 @@ const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension;
const utils = Me.imports.utils;
const { notifyError } = utils;
const { GtkVariants } = Me.imports.modules.GtkVariants;
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
@@ -47,7 +46,7 @@ var GtkThemer = class {
this._updateSystemGtkTheme();
}
} catch (error) {
notifyError(error);
main.notifyError(Me.metadata.name, error);
}
console.debug('GTK Themer enabled.');
}
@@ -137,7 +136,7 @@ var GtkThemer = class {
this._updateCurrentVariant();
this._updateSystemGtkTheme();
} catch (error) {
notifyError(error);
main.notifyError(Me.metadata.name, error);
}
}
+2 -4
View File
@@ -3,14 +3,12 @@
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const { main } = imports.ui;
const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension;
const utils = Me.imports.utils;
const { notifyError } = Me.imports.utils;
const { ShellVariants } = Me.imports.modules.ShellVariants;
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
@@ -47,7 +45,7 @@ var ShellThemer = class {
this._updateSystemShellTheme();
}
} catch (error) {
notifyError(error);
main.notifyError(Me.metadata.name, error);
}
console.debug('Shell Themer enabled.');
}
@@ -141,7 +139,7 @@ var ShellThemer = class {
this._updateCurrentVariant();
this._updateSystemShellTheme();
} catch (error) {
notifyError(error);
main.notifyError(Me.metadata.name, error);
}
}
-13
View File
@@ -5,24 +5,11 @@ const { Gdk, Gio, GLib, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const config = Me.imports.config;
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
const _ = Gettext.gettext;
/**
* Log an error and show a notification if it has a message.
*
* @param {Error} error The error to log.
*/
function notifyError(error) {
if (config.debug)
logError(error, Me.metadata.name);
if (error.message && imports.ui)
imports.ui.main.notifyError(Me.metadata.name, error.message);
}
/**
* Build the full settings schema from a subschema.
*