Skip to content

Commit

Permalink
Make 'reconnect to jukebox' visable at all times
Browse files Browse the repository at this point in the history
  • Loading branch information
whomwah committed Jan 19, 2016
1 parent 725d2b0 commit 13e7270
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions app/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ def build_menu(menu)
menu = setup_build_menu if menu.nil?
menu.removeAllItems

flags = (NSEvent.modifierFlags & NSDeviceIndependentModifierFlagsMask)

# If you hold the ALT key and display the
# menu it will show an extra item that lets
# you refersh your connection to the jukebox
#
if flags == NSAlternateKeyMask
menu.addItem(build_secret_refresh)
add_seperator_for(menu)
end

if jukebox_available?
build_now_playing(menu)
build_upcoming_tracks(menu)
Expand All @@ -45,7 +34,9 @@ def build_menu(menu)
m = NSMenuItem.new
m.title = data.first
m.tag = i
m.setImage( NSImage.imageNamed(data.first.downcase) )
icon_img = NSImage.imageNamed(data.first.downcase)
icon_img.template = true
m.image = icon_img
m.action = 'open_link:'
@menu.addItem m
end
Expand Down Expand Up @@ -78,6 +69,13 @@ def build_submenu
mi.tag = MENU_ABOUT
sub_menu.addItem mi

mi = NSMenuItem.new
mi.title = 'Force reconnect to Jukebox!'
mi.action = 'force_reconnect_to_websocket_server'
mi.tag = MENU_FORCE_REFRESH
mi.toolTip = RECONNECT_TXT
sub_menu.addItem mi

add_seperator_for(sub_menu)

mi = NSMenuItem.new
Expand Down Expand Up @@ -113,16 +111,6 @@ def build_upcoming_tracks(menu)
add_seperator_for(menu)
end

def build_secret_refresh
NSMenuItem.new.tap do |mi|
mi.title = 'Force Refresh!'
mi.action = 'force_reconnect_to_websocket_server'
mi.tag = MENU_FORCE_REFRESH
mi.setKeyEquivalent("r")
mi.setKeyEquivalentModifierMask(NSCommandKeyMask)
end
end

def build_console_status(menu)
butt = NSMenuItem.new
butt.tag = MENU_CONSOLE_BUTT
Expand Down Expand Up @@ -154,7 +142,7 @@ def add_seperator_for(menu)

def links
[
["Timesheet" , "https://gapps.harvestapp.com/gapp_company?domain=kyanmedia.com"],
["Timesheet" , "https://id.getharvest.com/accounts"],
["Pivotal" , "https://www.pivotaltracker.com/google_domain_openid/redirect_for_auth?domain=kyanmedia.com"],
["Support" , "https://kyan.sirportly.com"],
["Holiday" , "https://app.timetastic.co.uk"],
Expand Down

0 comments on commit 13e7270

Please sign in to comment.