class MittensUi::FilePicker
Attributes
path[R]
Public Class Methods
new(options={})
click to toggle source
# File lib/mittens_ui/file_picker.rb, line 5 def initialize(options={}) @path = "" dialog_options = { title: "Select File", parent: $app_window, action: options[:action] || :open, buttons: [ [Gtk::Stock::OPEN, Gtk::ResponseType::ACCEPT], [Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL] ] }.freeze @dialog = Gtk::FileChooserDialog.new(dialog_options) end
Public Instance Methods
render()
click to toggle source
# File lib/mittens_ui/file_picker.rb, line 21 def render if @dialog.run == :accept @path = @dialog.filename end @dialog.destroy end