283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
# File 'lib/wiki_lyrics/gui/gui-gtk.rb', line 283
def initialize( values )
super( values )
set_border_width( 5 )
set_resizable( true )
set_default_size( 300, 50 )
set_title( I18n.get( "gui.wikiplugin.title", values["site_name"] ) )
general_group = Gtk::Frame.new( I18n.get( "gui.wikiplugin.general" ) )
@submit_checkbox = Gtk::CheckButton.new( I18n.get( "gui.wikiplugin.general.submit", values["site_name"] ) )
@submit_checkbox.set_active( values["submit"].to_s() == "true" )
@review_checkbox = Gtk::CheckButton.new( I18n.get( "gui.wikiplugin.general.review" ) )
@review_checkbox.set_sensitive( @submit_checkbox.active?() )
@review_checkbox.set_active( @review_checkbox.sensitive?() && values["review"].to_s() == "true" )
@prompt_autogen_checkbox = Gtk::CheckButton.new( I18n.get( "gui.wikiplugin.general.autogen" ) )
@prompt_autogen_checkbox.set_sensitive( @review_checkbox.active?() )
@prompt_autogen_checkbox.set_active( @prompt_autogen_checkbox.sensitive?() && values["prompt_autogen"].to_s() == "true" )
@prompt_no_lyrics_checkbox = Gtk::CheckButton.new( I18n.get( "gui.wikiplugin.general.nolyrics" ) )
@prompt_no_lyrics_checkbox.set_sensitive( @review_checkbox.active?() )
@prompt_no_lyrics_checkbox.set_active( @prompt_no_lyrics_checkbox.sensitive?() && values["prompt_no_lyrics"].to_s() == "true" )
login_group = Gtk::Frame.new( I18n.get( "gui.wikiplugin.login" ) )
username_label = Gtk::Label.new( I18n.get( "gui.wikiplugin.login.username" ) );
username_label.set_xalign( 0 )
@username_lineedit = Gtk::Entry.new()
@username_lineedit.set_text( values["username"] )
password_label = Gtk::Label.new( I18n.get( "gui.wikiplugin.login.password" ) );
password_label.set_xalign( 0 )
@password_lineedit = Gtk::Entry.new()
@password_lineedit.set_text( values["password"] )
@password_lineedit.visibility = false
@username_lineedit.signal_connect( "changed" ) { update_accept_button_state() }
@submit_checkbox.signal_connect( "toggled" ) { toggle_submit_checked() }
@review_checkbox.signal_connect( "toggled" ) { toggle_review_checked() }
buttons = create_action_buttons()
update_accept_button_state()
general_grid = Gtk::Table.new( 4, 4, false )
general_grid.set_row_spacings( 3 )
general_grid.set_column_spacings( 3 )
general_grid.attach( @submit_checkbox, 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, 0 )
general_grid.attach( @review_checkbox, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, 0, 0 )
general_grid.attach( @prompt_autogen_checkbox, 0, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, 0 )
general_grid.attach( @prompt_no_lyrics_checkbox, 0, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, 0 )
general_group.add( general_grid )
login_grid = Gtk::Table.new( 4, 4, false )
login_grid.set_row_spacings( 3 )
login_grid.set_column_spacings( 3 )
login_grid.attach( username_label, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, 0, 5 )
login_grid.attach( @username_lineedit, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, 0 )
login_grid.attach( password_label, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, 0, 5 )
login_grid.attach( @password_lineedit, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, 0 )
login_group.add( login_grid )
vbox = Gtk::VBox.new( false, 3 );
vbox.add( general_group )
vbox.add( login_group )
vbox.pack_start( buttons, false )
add( vbox )
end
|