From b842658222350b0e88a7eecc5eeacd46ee494260 Mon Sep 17 00:00:00 2001 From: Romain Vigier Date: Sun, 24 Nov 2019 14:12:41 +0100 Subject: [PATCH] Use main notifications to display and log errors --- src/extension.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/extension.js b/src/extension.js index 48b3a2b..6f69dea 100644 --- a/src/extension.js +++ b/src/extension.js @@ -18,9 +18,11 @@ this program. If not, see . '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); } }