def cb_options
    dialog=OptionsDialog::new
    if dialog.run==Gtk::Dialog::RESPONSE_OK
	dialog.apply
    end
    dialog.destroy
end

class OptionsDialog < Gtk::Dialog
    def initialize
	super("Réglage des options",
	      $main_window,
	      Gtk::Dialog::MODAL|Gtk::Dialog::DESTROY_WITH_PARENT,
              [Gtk::Stock::CANCEL,Gtk::Dialog::RESPONSE_CANCEL],
              [Gtk::Stock::OK,Gtk::Dialog::RESPONSE_OK]
             )
	@tooltips=Gtk::Tooltips::new

	hbox=Gtk::HBox::new(false,0)
	vbox.pack_start(hbox,true,true,0)
	img=Gtk::Image::new(Gtk::Stock::DIALOG_QUESTION,Gtk::IconSize::DIALOG)
        hbox.pack_start(img,false,false,0)
        vboxr=Gtk::VBox::new(false,10)
        hbox.pack_start(vboxr,true,true,0)

	notebook=Gtk::Notebook::new
	vboxr.pack_start(notebook,true,true,0)

	notebook.append_page(create_location_page,Gtk::Label::new($lang.menu("7100")))
	notebook.append_page(create_search_page,Gtk::Label::new($lang.menu("7200")))

	resize(350,400)

	hbox.show_all
	@tooltips.enable
    end
    def create_location_page
	vbox=Gtk::VBox::new(false,0)

	@save_location_button=Gtk::CheckButton::new($lang.menu("7110"))
	@save_location_button.active=$general_options["save_location"]
	vbox.pack_start(@save_location_button,false,false,0)
	@save_size_button=Gtk::CheckButton::new($lang.menu("7120"))
	@save_size_button.active=$general_options["save_size"]
	vbox.pack_start(@save_size_button,false,false,0)

	vbox
    end
    def create_search_page
	vbox=Gtk::VBox::new(false,0)

        @regexps_button=Gtk::CheckButton::new($lang.menu("7210"))
        @regexps_button.active=$general_options["regexps"]
        vbox.pack_start(@regexps_button,false,false,0)
	@tooltips.set_tip(@regexps_button,$lang.tip("7210"),"")

	vbox
    end

    def apply
	$general_options["save_location"]=@save_location_button.active?
	$general_options["save_size"]=@save_size_button.active?
	$general_options["regexps"]=@regexps_button.active?
    end
end
