Code review updates

This commit is contained in:
Ox Cart
2020-03-16 07:25:48 -05:00
parent 707d447c87
commit 5b4346dabe
3 changed files with 10 additions and 16 deletions
+2
View File
@@ -62,11 +62,13 @@ func onReady() {
toggle := func() {
if shown {
subMenuBottom.Check()
subMenuBottom2.Hide()
mQuitOrig.Hide()
mEnabled.Hide()
shown = false
} else {
subMenuBottom.Uncheck()
subMenuBottom2.Show()
mQuitOrig.Show()
mEnabled.Show()
shown = true
+2 -4
View File
@@ -114,8 +114,7 @@ func Quit() {
}
}
// AddMenuItem adds menu item with designated title and tooltip, returning a channel
// that notifies whenever that menu item is clicked.
// AddMenuItem adds a menu item with the designated title and tooltip.
//
// It can be safely invoked from different goroutines.
func AddMenuItem(title string, tooltip string) *MenuItem {
@@ -129,8 +128,7 @@ func AddSeparator() {
addSeparator(atomic.AddInt32(&currentID, 1))
}
// AddSubMenuItem adds nested sub-menu item with designated title and tooltip, returning a channel
// that notifies whenever that menu item is clicked.
// AddSubMenuItem adds a nested sub-menu item with the designated title and tooltip.
//
// It can be safely invoked from different goroutines.
func (item *MenuItem) AddSubMenuItem(title string, tooltip string) *MenuItem {
+6 -12
View File
@@ -181,13 +181,10 @@ NSMenuItem *find_menu_item(NSMenu *ourMenu, NSNumber *menuId) {
- (void) hide_menu_item:(NSNumber*) menuId
{
NSMenuItem* menuItem;
int existedMenuIndex = [menu indexOfItemWithRepresentedObject: menuId];
if (existedMenuIndex == -1) {
return;
NSMenuItem* menuItem = find_menu_item(menu, menuId);
if (menuItem != NULL) {
[menuItem setHidden:TRUE];
}
menuItem = [menu itemAtIndex: existedMenuIndex];
[menuItem setHidden:TRUE];
}
- (void) setMenuItemIcon:(NSArray*)imageAndMenuId {
@@ -204,13 +201,10 @@ NSMenuItem *find_menu_item(NSMenu *ourMenu, NSNumber *menuId) {
- (void) show_menu_item:(NSNumber*) menuId
{
NSMenuItem* menuItem;
int existedMenuIndex = [menu indexOfItemWithRepresentedObject: menuId];
if (existedMenuIndex == -1) {
return;
NSMenuItem* menuItem = find_menu_item(menu, menuId);
if (menuItem != NULL) {
[menuItem setHidden:FALSE];
}
menuItem = [menu itemAtIndex: existedMenuIndex];
[menuItem setHidden:FALSE];
}
- (void) quit