Commit 68b2af6f authored by Kai Willadsen's avatar Kai Willadsen

ui.filechooser: Make our button handling a little less verbose

parent 3ff5b3cb
......@@ -31,18 +31,17 @@ class MeldFileChooserDialog(Gtk.FileChooserDialog):
__gtype_name__ = 'MeldFileChooserDialog'
def __init__(self, title=None, transient_for=None,
action=Gtk.FileChooserAction.OPEN):
def __init__(
self, title=None, transient_for=None,
action=Gtk.FileChooserAction.OPEN):
Gtk.FileChooserDialog.__init__(
self, title=title, transient_for=transient_for, action=action)
self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
if action == Gtk.FileChooserAction.SAVE:
buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE, Gtk.ResponseType.ACCEPT)
self.add_button(Gtk.STOCK_SAVE, Gtk.ResponseType.ACCEPT)
else:
buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.ACCEPT)
self.add_buttons(*buttons)
self.add_button(Gtk.STOCK_OPEN, Gtk.ResponseType.ACCEPT)
self.encoding_store = Gtk.ListStore(str, str)
self.connect("notify::action", self.action_changed_cb)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment