Skip to content

Commit

Permalink
dbusMenu: Handle missing AboutToShow gracefully
Browse files Browse the repository at this point in the history
It's not defined in all the implementations, so in case that we
have not, let's just ignore the error and avoid calling it again

Fixes: #502
  • Loading branch information
3v1n0 committed Apr 18, 2024
1 parent b5b9331 commit a4eb882
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dbusMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ export const DBusClient = GObject.registerClass({

// we don't need to cache and burst-send that since it will not happen that frequently
async sendAboutToShow(id) {
if (this._hasAboutToShow === false)
return;

/* Some indicators (you, dropbox!) don't use the right signature
* and don't return a boolean, so we need to support both cases */
try {
Expand All @@ -507,6 +510,11 @@ export const DBusClient = GObject.registerClass({
ret.is_of_type(new GLib.VariantType('()')))
this._requestLayoutUpdate();
} catch (e) {
if (e.matches(Gio.DBusError, Gio.DBusError.UNKNOWN_METHOD) ||
e.matches(Gio.DBusError, Gio.DBusError.FAILED)) {
this._hasAboutToShow = false;
return;
}
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
logError(e);
}
Expand Down

0 comments on commit a4eb882

Please sign in to comment.