Ocarina: Added common menu items

Right now, it's just the "pause after current track" feature.
Eventually there may be more.
This commit is contained in:
Bryan Schumaker 2011-04-22 18:06:43 -04:00
parent 096564c942
commit de1fafcbc1
1 changed files with 10 additions and 1 deletions

View File

@ -1,17 +1,26 @@
# Bryan Schumaker (2 / 26 / 2011)
import gtk
import libsaria
common = [
("Pause after current song", libsaria.controls.do_pause_after)
]
class MenuItem(gtk.MenuItem):
def __init__(self, source, text, func):
gtk.MenuItem.__init__(self, text)
self.source = source
self.connect("activate", func)
if func:
self.connect("activate", func)
self.show()
class Menu(gtk.Menu):
def __init__(self, source, items):
gtk.Menu.__init__(self)
for (text, func) in common:
self.append(MenuItem(source, text, func))
self.append(MenuItem(source, None, None))
for (text, func) in items:
self.append(MenuItem(source, text, func))