Use shell notifyError
This commit is contained in:
@@ -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;
|
|
||||||
@@ -9,7 +9,6 @@ const Me = extensionUtils.getCurrentExtension();
|
|||||||
|
|
||||||
const e = Me.imports.extension;
|
const e = Me.imports.extension;
|
||||||
const utils = Me.imports.utils;
|
const utils = Me.imports.utils;
|
||||||
const { notifyError } = utils;
|
|
||||||
const { GtkVariants } = Me.imports.modules.GtkVariants;
|
const { GtkVariants } = Me.imports.modules.GtkVariants;
|
||||||
|
|
||||||
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
||||||
@@ -47,7 +46,7 @@ var GtkThemer = class {
|
|||||||
this._updateSystemGtkTheme();
|
this._updateSystemGtkTheme();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifyError(error);
|
main.notifyError(Me.metadata.name, error);
|
||||||
}
|
}
|
||||||
console.debug('GTK Themer enabled.');
|
console.debug('GTK Themer enabled.');
|
||||||
}
|
}
|
||||||
@@ -137,7 +136,7 @@ var GtkThemer = class {
|
|||||||
this._updateCurrentVariant();
|
this._updateCurrentVariant();
|
||||||
this._updateSystemGtkTheme();
|
this._updateSystemGtkTheme();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifyError(error);
|
main.notifyError(Me.metadata.name, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,12 @@
|
|||||||
|
|
||||||
const { Gio } = imports.gi;
|
const { Gio } = imports.gi;
|
||||||
const { extensionUtils } = imports.misc;
|
const { extensionUtils } = imports.misc;
|
||||||
const Signals = imports.signals;
|
|
||||||
const { main } = imports.ui;
|
const { main } = imports.ui;
|
||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
const e = Me.imports.extension;
|
const e = Me.imports.extension;
|
||||||
const utils = Me.imports.utils;
|
const utils = Me.imports.utils;
|
||||||
const { notifyError } = Me.imports.utils;
|
|
||||||
const { ShellVariants } = Me.imports.modules.ShellVariants;
|
const { ShellVariants } = Me.imports.modules.ShellVariants;
|
||||||
|
|
||||||
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
||||||
@@ -47,7 +45,7 @@ var ShellThemer = class {
|
|||||||
this._updateSystemShellTheme();
|
this._updateSystemShellTheme();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifyError(error);
|
main.notifyError(Me.metadata.name, error);
|
||||||
}
|
}
|
||||||
console.debug('Shell Themer enabled.');
|
console.debug('Shell Themer enabled.');
|
||||||
}
|
}
|
||||||
@@ -141,7 +139,7 @@ var ShellThemer = class {
|
|||||||
this._updateCurrentVariant();
|
this._updateCurrentVariant();
|
||||||
this._updateSystemShellTheme();
|
this._updateSystemShellTheme();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifyError(error);
|
main.notifyError(Me.metadata.name, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,24 +5,11 @@ const { Gdk, Gio, GLib, Gtk } = imports.gi;
|
|||||||
const { extensionUtils } = imports.misc;
|
const { extensionUtils } = imports.misc;
|
||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
const config = Me.imports.config;
|
|
||||||
|
|
||||||
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
||||||
const _ = Gettext.gettext;
|
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.
|
* Build the full settings schema from a subschema.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user