108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
# File 'lib/wiki_lyrics/gui/gui-gtk.rb', line 108
def initialize( values )
super( values )
set_border_width( 5 )
set_resizable( true )
set_default_size( 400, 280 )
set_title( I18n.get( "gui.pluginsmanager.title", @values["script_name"] ) )
sites_group = Gtk::Frame.new( I18n.get( "gui.pluginsmanager.sites" ) )
@move_up_button = Gtk::Button.new( I18n.get( "gui.pluginsmanager.sites.moveup" ) )
@move_down_button = Gtk::Button.new( I18n.get( "gui.pluginsmanager.sites.movedown" ) )
@used_plugins_store = Gtk::ListStore.new( String )
@used_plugins_view = Gtk::TreeView.new( @used_plugins_store )
column = Gtk::TreeViewColumn.new( I18n.get( "gui.pluginsmanager.sites.inuse" ), Gtk::CellRendererText.new(), :text => 0 )
@used_plugins_view.append_column( column )
used_plugins_viewport = Gtk::Viewport.new(
@used_plugins_view.focus_hadjustment(),
@used_plugins_view.focus_vadjustment()
)
used_plugins_viewport.set_shadow_type( Gtk::SHADOW_IN )
used_plugins_viewport.add( @used_plugins_view )
used_plugins_scrolledwindow = Gtk::ScrolledWindow.new()
used_plugins_scrolledwindow.add( used_plugins_viewport )
@values["used_plugins"].each() do |plugin|
iter = @used_plugins_store.append()
@used_plugins_store.set_value( iter, 0, plugin )
end
@add_button = Gtk::Button.new( I18n.get( "gui.pluginsmanager.sites.add" ) )
@remove_button = Gtk::Button.new( I18n.get( "gui.pluginsmanager.sites.remove" ) )
@unused_plugins_store = Gtk::ListStore.new( String )
@unused_plugins_view = Gtk::TreeView.new( @unused_plugins_store )
column = Gtk::TreeViewColumn.new( I18n.get( "gui.pluginsmanager.sites.available" ), Gtk::CellRendererText.new(), :text=>0 )
@unused_plugins_view.append_column( column )
unused_plugins_viewport = Gtk::Viewport.new(
@unused_plugins_view.focus_hadjustment(),
@unused_plugins_view.focus_vadjustment()
)
unused_plugins_viewport.set_shadow_type( Gtk::SHADOW_IN )
unused_plugins_viewport.add( @unused_plugins_view )
unused_plugins_scrolledwindow = Gtk::ScrolledWindow.new()
unused_plugins_scrolledwindow.add( unused_plugins_viewport )
@values["unused_plugins"].each() do |plugin|
iter = @unused_plugins_store.append()
@unused_plugins_store.set_value( iter, 0, plugin )
end
misc_group = Gtk::Frame.new( I18n.get( "gui.pluginsmanager.misc" ) )
@cleanup_lyrics_checkbox = Gtk::CheckButton.new( I18n.get( "gui.pluginsmanager.misc.cleanup" ) )
@cleanup_lyrics_checkbox.set_active( values["cleanup_lyrics"].to_s() == "true" )
@single_threaded_checkbox = Gtk::CheckButton.new( I18n.get( "gui.pluginsmanager.misc.singlethreaded" ) )
@single_threaded_checkbox.set_active( values["single_threaded"].to_s() == "true" )
@write_log_checkbox = Gtk::CheckButton.new( I18n.get( "gui.pluginsmanager.misc.writelog", "$HOME/.wikilyrics.log" ) )
@write_log_checkbox.set_active( values["write_log"].to_s() == "true" )
buttons = create_action_buttons()
group_grid = Gtk::Table.new( 4, 4, false )
group_grid.set_row_spacings( 5 )
group_grid.set_column_spacings( 5 )
group_grid.attach( @move_up_button, 0, 1, 1, 2, Gtk::FILL, 0 )
group_grid.attach( @move_down_button, 0, 1, 2, 3, Gtk::FILL, 0 )
group_grid.attach( used_plugins_scrolledwindow, 1, 2, 0, 4, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND )
group_grid.attach( @add_button, 2, 3, 1, 2, Gtk::FILL, 0 )
group_grid.attach( @remove_button, 2, 3, 2, 3, Gtk::FILL, 0 )
group_grid.attach( unused_plugins_scrolledwindow, 3, 4, 0, 4, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND )
sites_group.add( group_grid )
misc_group_vbox = Gtk::VBox.new( false, 0 );
misc_group_vbox.add( @cleanup_lyrics_checkbox )
misc_group_vbox.add( @single_threaded_checkbox )
misc_group_vbox.add( @write_log_checkbox )
misc_group.add( misc_group_vbox )
vbox = Gtk::VBox.new( false, 3 );
vbox.pack_start( sites_group, true )
vbox.pack_start( misc_group, false )
vbox.pack_start( buttons, false )
add( vbox )
@move_up_button.signal_connect( "clicked" ) { move_up() }
@move_down_button.signal_connect( "clicked" ) { move_down() }
@add_button.signal_connect( "clicked" ) { add_plugin() }
@remove_button.signal_connect( "clicked" ) { remove_plugin() }
update_accept_button()
end
|