Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## Defined OpenFileDialog require 'gtk2' class OpenFileDialog < Gtk::FileChooserDialog @@CWD = nil def initialize(parent_window) super("Open file", parent_window, Gtk::FileChooser::ACTION_OPEN, nil, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_OK]) self.default_response = Gtk::Dialog::RESPONSE_OK self.current_folder = @@CWD unless @@CWD.nil? signal_connect :response do |dialog, response| @@CWD = self.current_folder if response == Gtk::Dialog::RESPONSE_OK end end end ## Using OpenFileDialog 2.times do d = OpenFileDialog.new(nil) d.run do |response| puts "filename = #{d.filename}" if response == Gtk::Dialog::RESPONSE_OK end d.destroy end
This paste will be private.
From the Design Piracy series on my blog: