#include "constructor.h"
+#include <iostream>
Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):Gtk::Window(cobject)
{
rev = rev.substr(6, rev.length() - 8);
std::string s = "PlaQui Constructor versión " VERSION " (revisión ";
s += rev + ")";
- lbl_plaqui_version->set_text(Glib::locale_to_utf8(s));
+ lbl_plaqui_version->set_text(Glib::convert(s, "UTF-8", "ISO-8859-1"));
refGlade->get_widget("dlgAbout", dlg_about);
refGlade->get_widget("close_about", close_about);
refGlade->get_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
quick_btn_new->signal_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));
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();
+}
+bool Constructor::on_delete_event(GdkEventAny *e)
+{
+ std::cout<<"terminando constructor"<<std::endl;
+ on_main_menu_quit();
+ return true;
+}
+//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()
{