ibusManager: Simplify code a bit
ibus_bus_request_name_async_finish() will throw an error on failure, so we can move the error handling there instead of checking for the return value, which saves one level of indentation. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1122
This commit is contained in:
parent
3dd8ffc2bb
commit
13f3f75303
@ -127,18 +127,20 @@ var IBusManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_initPanelService(ibus, result) {
|
_initPanelService(ibus, result) {
|
||||||
let success = false;
|
|
||||||
try {
|
try {
|
||||||
success = !!this._ibus.request_name_async_finish(result);
|
this._ibus.request_name_async_finish(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||||
return;
|
|
||||||
logError(e);
|
logError(e);
|
||||||
|
this._clear();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
this._panelService = new IBus.PanelService({
|
||||||
this._panelService = new IBus.PanelService({ connection: this._ibus.get_connection(),
|
connection: this._ibus.get_connection(),
|
||||||
object_path: IBus.PATH_PANEL });
|
object_path: IBus.PATH_PANEL,
|
||||||
|
});
|
||||||
this._candidatePopup.setPanelService(this._panelService);
|
this._candidatePopup.setPanelService(this._panelService);
|
||||||
this._panelService.connect('update-property', this._updateProperty.bind(this));
|
this._panelService.connect('update-property', this._updateProperty.bind(this));
|
||||||
this._panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
|
this._panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
|
||||||
@ -174,9 +176,6 @@ var IBusManager = class {
|
|||||||
this._engineChanged(this._ibus, engine.get_name());
|
this._engineChanged(this._ibus, engine.get_name());
|
||||||
});
|
});
|
||||||
this._updateReadiness();
|
this._updateReadiness();
|
||||||
} else {
|
|
||||||
this._clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateReadiness() {
|
_updateReadiness() {
|
||||||
|
Loading…
Reference in New Issue
Block a user