Code review updates

This commit is contained in:
Ox Cart
2020-05-07 01:14:10 -07:00
committed by Joesis
parent 9f5405fee8
commit ffed29bf1e
3 changed files with 10 additions and 16 deletions
+2
View File
@@ -63,11 +63,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
@@ -110,8 +110,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 {
@@ -125,8 +124,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
@@ -176,13 +176,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 {
@@ -199,13 +196,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