ocarina: Move goto and clear functions

Now they are created right before the buttons are.  This makes it so I
can return buttons that do exactly what I want every time.
This commit is contained in:
Bryan Schumaker 2011-04-21 08:21:32 -04:00
parent f8c64e0f78
commit 864f64cc84
2 changed files with 10 additions and 12 deletions

View File

@ -76,10 +76,16 @@ def stop_button(show):
def next_button(show):
return make_button(gtk.STOCK_MEDIA_NEXT, controls.next, "Next", show)
def goto_button(goto_func, show):
def goto_button(show):
def goto_func():
from ocarina import body
body.cur_page_goto()
return make_button(gtk.STOCK_JUMP_TO, goto_func, "Go To Current Song", show)
def clear_button(clear_func, show):
def clear_button(show):
def clear_func():
from ocarina import body
body.cur_page_clear()
return make_button(gtk.STOCK_CLEAR, clear_func, "Clear Current Source", show)
def random_button(is_active, show):

View File

@ -13,21 +13,13 @@ header.pack_start(header_body)
header.pack_start(header_sep)
header.show_all()
def goto_func():
from ocarina import body
body.cur_page_goto()
def clear_func():
from ocarina import body
body.cur_page_clear()
def add_button(name, button):
globals()[name] = button
header_body.pack_start(button, False, False)
header_body.pack_start(entry.entry)
add_button( "GOTO", button.goto_button(goto_func, True))
add_button( "CLEAR", button.clear_button(clear_func, True))
add_button( "GOTO", button.goto_button(True))
add_button( "CLEAR", button.clear_button(True))
add_button("RANDOM", button.random_button(libsaria.prefs.get_pref("libsaria.random"), True))
#import ocarina