Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Menu programatically #13

Merged
merged 10 commits into from
Oct 26, 2016
Merged

Update Menu programatically #13

merged 10 commits into from
Oct 26, 2016

Conversation

captncraig
Copy link

Added osx code to clear menu. Still needs windows/linux

@captncraig
Copy link
Author

@captncraig
Copy link
Author

Works on windows. Now. At a loss where to start with the gtk version. Maybe someone else can take over?

@captncraig
Copy link
Author

captncraig commented Oct 25, 2016

Might be as simple as menu = gtk_menu_new(); in clear_menu_items, but I don't have a good env to test it in.

Possibly also app_indicator_set_menu (indicator, GTK_MENU (menu)); and declare indicator outside create_indicator.

Copy link
Member

@dmitshur dmitshur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. This looks good. See minor review comments.

@@ -184,3 +184,12 @@ func (n Notification) Display() {

C.display_notification(notificationId, cTitle, cBody, img, C.double(n.Timeout.Seconds()))
}

//UpdateMenu will remove all menu items and add the new menu items
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//UpdateMenu will remove all menu items and add the new menu items
func UpdateMenu(newMenu []MenuItem) {
menuItems = newMenu
C.clear_menu_items()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would swap the two lines above. I think either way, the behavior is the same, but logically, it makes sense to clear items first (C.clear_menu_items()), and only then add new items:

C.clear_menu_items()

menuItems = newMenu
for id, item := range newMenu {
...

@dmitshur
Copy link
Member

dmitshur commented Oct 25, 2016

It's fine not to implement OSes that you don't normally use and don't have an easy way to test with. Someone else who uses them can do that work. Just leave a // TODO: Implement. comment so it's obvious that it's not implemented.

I only support macOS side myself.

@captncraig
Copy link
Author

Addressed those comments.

Matches the same comments above and below.
Make it clear this functionality isn't implemented here.
For consistency with the rest of the documentation here.
This reads better in context of all other comments.
@dmitshur
Copy link
Member

Thanks!

I've followed up with some minor consistency, style and wording improvements.

LGTM.

@dmitshur dmitshur merged commit 0ed4d04 into shurcooL:master Oct 26, 2016
This was referenced Jan 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants