Fix fsselect

Selecting files through fsselect was broken at some point.  This commit
fixes it.
This commit is contained in:
Bryan Schumaker 2010-11-28 00:37:02 -05:00
parent 1c58e948b8
commit 6e429d1fd2
1 changed files with 7 additions and 9 deletions

View File

@ -15,18 +15,16 @@ gtk = ocarina.gtk
chooser_window = None
chooser_widget = None
def make_chooser(title, action):
buttons = (gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OK, gtk.RESPONSE_OK)
chooser = gtk.FileChooserDialog(title, action=action, buttons=buttons)
chooser.connect("response", response)
return chooser
def make_chooser2(title, callback):
global chooser_window
global chooser_widget
chooser_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
chooser_box = gtk.VBox(spacing = 0)
button_box = gtk.HBox()
chooser_widget = gtk.FileChooserWidget()
@ -75,16 +73,16 @@ def run_chooser(chooser):
# Use for selecting a file through the GUI
def file(title="Select a song"):
chooser = makeChooser(title, gtk.FILE_CHOOSER_ACTION_OPEN)
return runChooser(chooser)
chooser = make_chooser(title, gtk.FILE_CHOOSER_ACTION_OPEN)
return run_chooser(chooser)
# Use for selecting a directory through the GUI
def dir(title="Select a directory"):
chooser = makeChooser(title, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
return runChooser(chooser)
chooser = make_chooser(title, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
return run_chooser(chooser)
def save(title="Select a location"):
chooser = makeChooser(title, gtk.FILE_CHOOSER_ACTION_SAVE)
return runChooser(chooser)
chooser = make_chooser(title, gtk.FILE_CHOOSER_ACTION_SAVE)
return run_chooser(chooser)