Add shell_global_report_error()

Move the "system notification error" handling out of
util.js, and add it to ShellGlobal so we can start
calling it from across the codebase better (including
C).

https://bugzilla.gnome.org/show_bug.cgi?id=644402
This commit is contained in:
Colin Walters
2011-03-15 18:31:16 -04:00
parent 61282737c5
commit b4f16c4df8
4 changed files with 62 additions and 7 deletions

View File

@ -86,6 +86,9 @@ function start() {
global.logError = _logError;
global.log = _logDebug;
// Chain up async errors reported from C
global.connect('notify-error', function (global, msg, detail) { notifyError(msg, detail); });
Gio.DesktopAppInfo.set_desktop_env('GNOME');
shellDBusService = new ShellDBus.GnomeShell();
@ -395,6 +398,27 @@ function loadTheme() {
themeContext.set_theme (theme);
}
/**
* notifyError:
* @msg: An error message
* @details: Additional information
*
* See shell_global_notify_problem().
*/
function notifyError(msg, details) {
// Also print to stderr so it's logged somewhere
if (details)
log("error: " + msg + ": " + details);
else
log("error: " + msg)
let source = new MessageTray.SystemNotificationSource();
messageTray.add(source);
let notification = new MessageTray.Notification(source, msg, details);
notification.setTransient(true);
source.notify(notification);
}
/**
* _log:
* @category: string message type ('info', 'error')