PreferencesDialogImpl::PreferencesDialogImpl() : Gtk::Dialog() { m_editorEntry = NULL; m_ctagsEntry = NULL; // dialog properties set_title("Preferences"); set_position(GTK_WIN_POS_CENTER); set_modal(true); set_border_width(10); set_policy(false, false, true); // create the Default button Gtk::Button* defaultButton = manage(new Gtk::Button("Default")); defaultButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::defaultButtonCB)); defaultButton->set_usize(80, -1); defaultButton->set_flags(GTK_CAN_DEFAULT); defaultButton->show(); // create the Apply button Gtk::Button* applyButton = manage(new Gtk::Button("Apply")); applyButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::applyButtonCB)); applyButton->set_usize(80, -1); applyButton->set_flags(GTK_CAN_DEFAULT); applyButton->show(); // create the OK button and make it default Gtk::Button* okButton = manage(new Gtk::Button("OK")); okButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::okButtonCB)); okButton->set_usize(80, -1); okButton->set_flags(GTK_CAN_DEFAULT); okButton->grab_default(); okButton->show(); // create the Cancel button Gtk::Button* cancelButton = manage(new Gtk::Button("Cancel")); cancelButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::cancelButtonCB)); cancelButton->set_usize(80, -1); cancelButton->set_flags(GTK_CAN_DEFAULT); cancelButton->show(); // add the buttons to the hbox Gtk::HBox* hbox = get_action_area(); hbox->set_spacing(10); hbox->pack_start(*defaultButton, false, false); hbox->pack_start(*applyButton, false, false); hbox->pack_start(*okButton, false, false); hbox->pack_start(*cancelButton, false, false); // editor stuff Gtk::HBox* editorBox = manage(new Gtk::HBox()); Gtk::Label* editorLabel = manage(new Gtk::Label("Editor Command: ")); editorLabel->show(); editorBox->pack_start(*editorLabel, false, false); m_editorEntry = manage(new Gtk::Entry()); m_editorEntry->set_text(g_configMap[Config::EDITOR[0]]); m_editorEntry->show(); editorBox->pack_end(*m_editorEntry); editorBox->show(); // ctags stuff Gtk::HBox* ctagsBox = manage(new Gtk::HBox()); Gtk::Label* ctagsLabel = manage(new Gtk::Label("Ctags Command: ")); ctagsLabel->show(); ctagsBox->pack_start(*ctagsLabel, false, false); m_ctagsEntry = manage(new Gtk::Entry()); m_ctagsEntry->set_text(g_configMap[Config::CTAGS[0]]); m_ctagsEntry->show(); ctagsBox->pack_end(*m_ctagsEntry); ctagsBox->show(); // add everything to the vbox Gtk::VBox* vbox = get_vbox(); vbox->set_spacing(5); vbox->pack_start(*editorBox, false, false); vbox->pack_start(*ctagsBox, false, false); show(); Gtk::Main::run(); }