Skip to content

Commit

Permalink
dbusMenu: random cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
3v1n0 committed Sep 30, 2021
1 parent 13efb2e commit 104fa1a
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions dbusMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,21 +517,26 @@ const MenuItemFactory = {

// initially create children
if (shellItem instanceof PopupMenu.PopupSubMenuMenuItem) {
let children = dbusItem.getChildren();
for (let i = 0; i < children.length; ++i)
shellItem.menu.addMenuItem(MenuItemFactory.createItem(client, children[i]));

dbusItem.getChildren().forEach(c =>
shellItem.menu.addMenuItem(MenuItemFactory.createItem(client, c)));
}

// now, connect various events
Util.connectSmart(dbusItem, 'property-changed', shellItem, MenuItemFactory._onPropertyChanged);
Util.connectSmart(dbusItem, 'child-added', shellItem, MenuItemFactory._onChildAdded);
Util.connectSmart(dbusItem, 'child-removed', shellItem, MenuItemFactory._onChildRemoved);
Util.connectSmart(dbusItem, 'child-moved', shellItem, MenuItemFactory._onChildMoved);
Util.connectSmart(shellItem, 'activate', shellItem, MenuItemFactory._onActivate);

if (shellItem.menu)
Util.connectSmart(shellItem.menu, 'open-state-changed', shellItem, MenuItemFactory._onOpenStateChanged);
Util.connectSmart(dbusItem, 'property-changed',
shellItem, MenuItemFactory._onPropertyChanged);
Util.connectSmart(dbusItem, 'child-added',
shellItem, MenuItemFactory._onChildAdded);
Util.connectSmart(dbusItem, 'child-removed',
shellItem, MenuItemFactory._onChildRemoved);
Util.connectSmart(dbusItem, 'child-moved',
shellItem, MenuItemFactory._onChildMoved);
Util.connectSmart(shellItem, 'activate',
shellItem, MenuItemFactory._onActivate);

if (shellItem.menu) {
Util.connectSmart(shellItem.menu, 'open-state-changed',
shellItem, MenuItemFactory._onOpenStateChanged);
}

return shellItem;
},
Expand Down Expand Up @@ -751,8 +756,7 @@ var Client = class AppIndicatorsClient {

// fill the menu for the first time
this._rootItem.getChildren().forEach(child =>
this._rootMenu.addMenuItem(MenuItemFactory.createItem(this, child)),
);
this._rootMenu.addMenuItem(MenuItemFactory.createItem(this, child)));
}

_setOpenedSubmenu(submenu) {
Expand Down

0 comments on commit 104fa1a

Please sign in to comment.