X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/33a5f978014e65a402a3d376c7e47bd8ee8ab8ab..a5853e30ca27518a7a3a33e4f97588f7b1e9ffe3:/Constructor/src/constructor.cpp diff --git a/Constructor/src/constructor.cpp b/Constructor/src/constructor.cpp index facfd8d..5fa6ae0 100644 --- a/Constructor/src/constructor.cpp +++ b/Constructor/src/constructor.cpp @@ -70,6 +70,9 @@ Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtrget_widget("edit_menu_delete_all", edit_menu_delete_all); refGlade->get_widget("btn_find", btn_find); refGlade->get_widget("status_bar", status_bar); + refGlade->get_widget("dlg_quit", dlg_quit); + refGlade->get_widget("btn_dlg_quit_ok", btn_dlg_quit_ok); + refGlade->get_widget("btn_dlg_quit_cancel", btn_dlg_quit_cancel); //Obtengo el area de trabajo, la cual tiene definida su propia clase. refGlade->get_widget_derived("workplace", workplace); //fixed @@ -112,6 +115,8 @@ Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtrsignal_clicked().connect(SigC::slot(*this, &Constructor::on_quick_btn_new_clicked)); quick_btn_save->signal_clicked().connect(SigC::slot(*this, &Constructor::on_quick_btn_save_clicked)); quick_btn_open->signal_clicked().connect(SigC::slot(*this, &Constructor::on_main_menu_open)); + btn_dlg_quit_ok->signal_clicked().connect(SigC::slot(*this, &Constructor::on_btn_dlg_quit_ok_clicked)); + btn_dlg_quit_cancel->signal_clicked().connect(SigC::slot(*this, &Constructor::on_btn_dlg_quit_cancel_clicked)); main_menu_quit->signal_activate().connect(SigC::slot(*this, &Constructor::on_main_menu_quit)); main_menu_new->signal_activate().connect(SigC::slot(*this, &Constructor::on_quick_btn_new_clicked)); @@ -207,14 +212,30 @@ void Constructor::on_btn_not_drag_get(const Glib::RefPtr& cont gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"not_e.png",9); } -//Sale del programa. +//Sale del programa. Pregunta si desea salvar antes de salir. void Constructor::on_main_menu_quit() { - delete this; + if ( !saved ) + dlg_quit->show(); + else + Gtk::Main::quit(); +} + +//Sale del programa guardando el archivo. +void Constructor::on_btn_dlg_quit_ok_clicked() +{ + dlg_quit->hide(); + on_quick_btn_save_clicked(); +} + +//Sale del programa sin guardar el archivo. +void Constructor::on_btn_dlg_quit_cancel_clicked() +{ + dlg_quit->hide(); Gtk::Main::quit(); - //hide(); } + // Carga de un archivo XML void Constructor::on_main_menu_open() {