50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/druzy/little_frame/file_chooser.rb', line 50
def initialize(controller)
super(controller)
Gtk.init
@window =Gtk::Window.new
@window.signal_connect('delete-event') do
Thread.new do
@controller.notify_action(self,:push_cross)
end
end
@open = Gtk::Button.new(:label => "Ouvrir")
@open.signal_connect("clicked") do
Thread.new do
@controller.notify_action(self,:push_open, :files => @chooser.filenames)
end
end
@cancel = Gtk::Button.new(:label => "Annuler")
@cancel.signal_connect("clicked") do
Thread.new do
@controller.notify_action(self,:push_cancel)
end
end
@chooser = Gtk::FileChooserWidget.new(Gtk::FileChooser::Action::OPEN)
@chooser.select_multiple = true
@chooser.current_folder = File.expand_path('~')
for filter in @controller.model.filters_mime_type
f=Gtk::FileFilter.new
f.add_mime_type(filter)
f.name = filter
@chooser.add_filter(f)
end
@main_vbox = Gtk::Box.new(:vertical,0)
@button_hbox = Gtk::Box.new(:horizontal,0)
@window.add(@main_vbox)
@main_vbox.pack_start(@chooser)
@main_vbox.pack_start(@button_hbox, :expand => false, :padding => 20)
@button_hbox.pack_end(@open, :expand => false, :padding => 20)
@button_hbox.pack_end(@cancel, :expand => false)
end
|