Use main notifications to display and log errors

This commit is contained in:
Romain Vigier
2019-11-24 14:12:41 +01:00
parent b1001b6ada
commit b842658222
+6 -6
View File
@@ -18,9 +18,11 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
'use strict';
const { Gio, Notify } = imports.gi;
const { Gio } = imports.gi;
const { main } = imports.ui;
const EXT_NAME = 'Night Theme Switcher';
const GSETTINGS_SCHEMA = 'org.gnome.desktop.interface';
const GSETTINGS_PROPERTY = 'gtk-theme';
@@ -45,9 +47,8 @@ class Switcher {
this.nightlight.stop_listening();
}
catch(e) {
const message = 'Errors occured while disabling the extension, try removing it';
logError(`${EXT_NAME}: ${message}`);
new Notify.notification(EXT_NAME, message);
const message = 'Errors occured while disabling the extension, try removing it.';
main.notifyError(EXT_NAME, message);
}
finally
{
@@ -107,8 +108,7 @@ class Nightlighter {
this._connect_to_dbus();
}
catch(e) {
logError(`${EXT_NAME}: ${e}`);
new Notify.notification(EXT_NAME, e);
main.notifyError(EXT_NAME, e);
}
}