Skip to content

Commit

Permalink
[#328] Set sensitive on resources submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
claucece committed Sep 24, 2017
1 parent 7a89373 commit d03a201
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions gui/roster.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,11 @@ func (r *roster) createAccountPeerPopup(jid string, account *account, bt gdki.Ev

func (r *roster) appendResourcesAsMenuItems(jid string, account *account, menuItem gtki.MenuItem) {
peer, ok := r.ui.getPeer(account, jid)
hasResources := peer.HasResources()

if ok && peer.HasResources() {
menuItem.SetSensitive(hasResources)

if ok && hasResources {
innerMenu, _ := g.gtk.MenuNew()

for _, resource := range peer.Resources() {
Expand All @@ -269,18 +272,6 @@ func (r *roster) appendResourcesAsMenuItems(jid string, account *account, menuIt
}

menuItem.SetSubmenu(innerMenu)
} else if !peer.HasResources() {
prov, _ := g.gtk.CssProviderNew()

css := fmt.Sprintf(`
menuitem { color: #b5b5b4;
}
`)
_ = prov.LoadFromData(css)

styleContext, _ := menuItem.GetStyleContext()
styleContext.AddProvider(prov, 9999)

}
}

Expand Down

0 comments on commit d03a201

Please sign in to comment.