Also mark currently selected category in menu
This commit is contained in:
parent
98a8f84ad0
commit
88115e10b1
|
@ -305,8 +305,8 @@ class StatusMenu: NSObject {
|
||||||
for category in infrastructure.categories {
|
for category in infrastructure.categories {
|
||||||
let title = category.name.isEmpty ? L10n.Core.Global.Values.default : category.name.capitalized
|
let title = category.name.isEmpty ? L10n.Core.Global.Values.default : category.name.capitalized
|
||||||
let submenu = NSMenu()
|
let submenu = NSMenu()
|
||||||
let item = NSMenuItem(title: title, action: nil, keyEquivalent: "")
|
let itemCategory = NSMenuItem(title: title, action: nil, keyEquivalent: "")
|
||||||
item.indentationLevel = 1
|
itemCategory.indentationLevel = 1
|
||||||
|
|
||||||
for group in category.groups.sorted() {
|
for group in category.groups.sorted() {
|
||||||
let title = group.localizedCountry
|
let title = group.localizedCountry
|
||||||
|
@ -328,6 +328,7 @@ class StatusMenu: NSObject {
|
||||||
submenuGroup.addItem(item)
|
submenuGroup.addItem(item)
|
||||||
|
|
||||||
if pool.id == providerProfile.poolId {
|
if pool.id == providerProfile.poolId {
|
||||||
|
itemCategory.state = .on
|
||||||
itemGroup.state = .on
|
itemGroup.state = .on
|
||||||
item.state = .on
|
item.state = .on
|
||||||
}
|
}
|
||||||
|
@ -339,10 +340,10 @@ class StatusMenu: NSObject {
|
||||||
|
|
||||||
submenu.addItem(itemGroup)
|
submenu.addItem(itemGroup)
|
||||||
}
|
}
|
||||||
menu.setSubmenu(submenu, for: item)
|
menu.setSubmenu(submenu, for: itemCategory)
|
||||||
menu.insertItem(item, at: i)
|
menu.insertItem(itemCategory, at: i)
|
||||||
i += 1
|
i += 1
|
||||||
itemsProfile.append(item)
|
itemsProfile.append(itemCategory)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue