Import upstream version 33+git20200317.b50bdcb, md5 0fcda50a3a78b529f51994c98ae6d54c
Debian Janitor
4 years ago
205 | 205 | var DBusClient = class AppIndicators_DBusClient { |
206 | 206 | |
207 | 207 | constructor(busName, busPath) { |
208 | this._proxy = new BusClientProxy(Gio.DBus.session, busName, busPath, this._clientReady.bind(this)) | |
208 | this._cancellable = new Gio.Cancellable(); | |
209 | this._proxy = new BusClientProxy(Gio.DBus.session, | |
210 | busName, | |
211 | busPath, | |
212 | this._clientReady.bind(this), | |
213 | this._cancellable) | |
209 | 214 | this._items = { 0: new DbusMenuItem(this, 0, { 'children-display': GLib.Variant.new_string('submenu') }, []) } |
210 | 215 | |
211 | 216 | // will be set to true if a layout update is requested while one is already in progress |
248 | 253 | } |
249 | 254 | |
250 | 255 | _beginRequestProperties() { |
251 | this._proxy.GetGroupPropertiesRemote(this._propertiesRequestedFor, [], this._endRequestProperties.bind(this)) | |
256 | this._proxy.GetGroupPropertiesRemote(this._propertiesRequestedFor, | |
257 | [], | |
258 | this._cancellable, | |
259 | this._endRequestProperties.bind(this)) | |
252 | 260 | |
253 | 261 | this._propertiesRequestedFor = [] |
254 | 262 | |
257 | 265 | |
258 | 266 | _endRequestProperties(result, error) { |
259 | 267 | if (error) { |
260 | Util.Logger.warn("Could not retrieve properties: "+error) | |
268 | if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | |
269 | Util.Logger.warn(`Could not retrieve properties: ${error}`); | |
261 | 270 | return |
262 | 271 | } |
263 | 272 | |
293 | 302 | _beginLayoutUpdate() { |
294 | 303 | // we only read the type property, because if the type changes after reading all properties, |
295 | 304 | // the view would have to replace the item completely which we try to avoid |
296 | this._proxy.GetLayoutRemote(0, -1, [ 'type', 'children-display' ], this._endLayoutUpdate.bind(this)) | |
305 | this._proxy.GetLayoutRemote(0, -1, | |
306 | [ 'type', 'children-display' ], | |
307 | this._cancellable, | |
308 | this._endLayoutUpdate.bind(this)) | |
297 | 309 | |
298 | 310 | this._flagLayoutUpdateRequired = false |
299 | 311 | this._flagLayoutUpdateInProgress = true |
301 | 313 | |
302 | 314 | _endLayoutUpdate(result, error) { |
303 | 315 | if (error) { |
304 | Util.Logger.warn("While reading menu layout on proxy '"+this._proxy.g_name_owner+": "+error) | |
316 | if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | |
317 | Util.Logger.warn(`While reading menu layout on proxy ${this._proxy.g_name_owner}: ${error}`); | |
305 | 318 | return |
306 | 319 | } |
307 | 320 | |
365 | 378 | |
366 | 379 | _clientReady(result, error) { |
367 | 380 | if (error) { |
368 | Util.Logger.warn("Could not initialize menu proxy: "+error) | |
381 | if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | |
382 | Util.Logger.warn(`Could not initialize menu proxy: ${error}`); | |
369 | 383 | return; |
370 | 384 | } |
371 | 385 | |
410 | 424 | if (!this._proxy) |
411 | 425 | return |
412 | 426 | |
413 | this._proxy.EventRemote(id, event, params, timestamp, function(result, error) { /* we don't care */ }) | |
427 | this._proxy.EventRemote(id, event, params, timestamp, this._cancellable, | |
428 | () => { /* we don't care */ }) | |
414 | 429 | } |
415 | 430 | |
416 | 431 | _onLayoutUpdated() { |
438 | 453 | destroy() { |
439 | 454 | this.emit('destroy') |
440 | 455 | |
456 | this._cancellable.cancel(); | |
441 | 457 | Signals._disconnectAll.apply(this._proxy) |
442 | 458 | |
443 | 459 | this._proxy = null |