extensions-app: Use console for logging
This allows us to use different log levels, and an appropriate log domain. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3067>
This commit is contained in:
parent
b66dee80f6
commit
fa587b4b9e
@ -5,6 +5,7 @@ import GObject from 'gi://GObject';
|
|||||||
import Gtk from 'gi://Gtk?version=4.0';
|
import Gtk from 'gi://Gtk?version=4.0';
|
||||||
import Shew from 'gi://Shew';
|
import Shew from 'gi://Shew';
|
||||||
|
|
||||||
|
import {setConsoleLogDomain} from 'console';
|
||||||
import * as Gettext from 'gettext';
|
import * as Gettext from 'gettext';
|
||||||
const Package = imports.package;
|
const Package = imports.package;
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ function loadInterfaceXML(iface) {
|
|||||||
let [ok_, bytes] = f.load_contents(null);
|
let [ok_, bytes] = f.load_contents(null);
|
||||||
return new TextDecoder().decode(bytes);
|
return new TextDecoder().decode(bytes);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(`Failed to load D-Bus interface ${iface}`);
|
console.error(`Failed to load D-Bus interface ${iface}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -54,7 +55,7 @@ class Application extends Adw.Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vfunc_activate() {
|
vfunc_activate() {
|
||||||
this._shellProxy.CheckForUpdatesAsync().catch(logError);
|
this._shellProxy.CheckForUpdatesAsync().catch(console.error);
|
||||||
this._window.present();
|
this._window.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +182,7 @@ var ExtensionsWindow = GObject.registerClass({
|
|||||||
|
|
||||||
dialog.connect('response', (dlg, response) => {
|
dialog.connect('response', (dlg, response) => {
|
||||||
if (response === Gtk.ResponseType.ACCEPT)
|
if (response === Gtk.ResponseType.ACCEPT)
|
||||||
this._shellProxy.UninstallExtensionAsync(uuid).catch(logError);
|
this._shellProxy.UninstallExtensionAsync(uuid).catch(console.error);
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
});
|
});
|
||||||
dialog.present();
|
dialog.present();
|
||||||
@ -192,13 +193,13 @@ var ExtensionsWindow = GObject.registerClass({
|
|||||||
try {
|
try {
|
||||||
this._exportedHandle = await this._exporter.export();
|
this._exportedHandle = await this._exporter.export();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(`Failed to export window: ${e.message}`);
|
console.warn(`Failed to export window: ${e.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._shellProxy.OpenExtensionPrefsAsync(uuid,
|
this._shellProxy.OpenExtensionPrefsAsync(uuid,
|
||||||
this._exportedHandle,
|
this._exportedHandle,
|
||||||
{modal: new GLib.Variant('b', true)}).catch(logError);
|
{modal: new GLib.Variant('b', true)}).catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
_showAbout() {
|
_showAbout() {
|
||||||
@ -297,7 +298,7 @@ var ExtensionsWindow = GObject.registerClass({
|
|||||||
this._extensionsLoaded();
|
this._extensionsLoaded();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof Gio.DBusError) {
|
if (e instanceof Gio.DBusError) {
|
||||||
log(`Failed to connect to shell proxy: ${e}`);
|
console.log(`Failed to connect to shell proxy: ${e}`);
|
||||||
this._mainStack.visible_child_name = 'noshell';
|
this._mainStack.visible_child_name = 'noshell';
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
@ -418,9 +419,9 @@ var ExtensionRow = GObject.registerClass({
|
|||||||
action.connect('activate', toggleState);
|
action.connect('activate', toggleState);
|
||||||
action.connect('change-state', (a, state) => {
|
action.connect('change-state', (a, state) => {
|
||||||
if (state.get_boolean())
|
if (state.get_boolean())
|
||||||
this._app.shellProxy.EnableExtensionAsync(this.uuid).catch(logError);
|
this._app.shellProxy.EnableExtensionAsync(this.uuid).catch(console.error);
|
||||||
else
|
else
|
||||||
this._app.shellProxy.DisableExtensionAsync(this.uuid).catch(logError);
|
this._app.shellProxy.DisableExtensionAsync(this.uuid).catch(console.error);
|
||||||
});
|
});
|
||||||
this._actionGroup.add_action(action);
|
this._actionGroup.add_action(action);
|
||||||
|
|
||||||
@ -565,6 +566,7 @@ function initEnvironment() {
|
|||||||
export async function main(argv) {
|
export async function main(argv) {
|
||||||
initEnvironment();
|
initEnvironment();
|
||||||
Package.initGettext();
|
Package.initGettext();
|
||||||
|
setConsoleLogDomain('Extensions');
|
||||||
|
|
||||||
await new Application().runAsync(argv);
|
await new Application().runAsync(argv);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user