From b7d95f97d1f101d9bcb891b1421a4074822c39ce Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Wed, 19 Nov 2003 00:35:41 +0000 Subject: [PATCH 1/1] =?utf8?q?=20Se=20implementa=20una=20se=C3=B1al=20entr?= =?utf8?q?e=20Thread=20con=20Glib::Dispatch=20..=20no=20se=20si=20solucion?= =?utf8?q?a=20el=20problema=20=20pero=20ahora=20se=20me=20trunca=20menos?= =?utf8?q?=20la=20aplicacion.=20TEST=20PLEASE!?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Client/include/principal.h | 5 ++++- Client/src/principal.cpp | 14 +++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Client/include/principal.h b/Client/include/principal.h index 7dbf3e7..8cfe7f2 100644 --- a/Client/include/principal.h +++ b/Client/include/principal.h @@ -25,7 +25,7 @@ protected: // Funciones de carga del XML bool is_xml_loaded; - void loadXML(const std::string &s); + void loadXML(); void loadBomba(xmlNodePtr nodo); void loadCodo(xmlNodePtr nodo); void loadConduct(xmlNodePtr nodo); @@ -34,6 +34,9 @@ protected: void loadUnion(xmlNodePtr nodo); void loadDrain(xmlNodePtr nodo); + Glib::Dispatcher load_xml_dispatch; + std::string xml_body; + // Archivo XML del Padre Glib::RefPtr refXml; diff --git a/Client/src/principal.cpp b/Client/src/principal.cpp index 5c53e35..2b04e38 100644 --- a/Client/src/principal.cpp +++ b/Client/src/principal.cpp @@ -50,6 +50,8 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr & conexion = NULL; is_xml_loaded = false; + + load_xml_dispatch.connect( SigC::slot(*this, &Principal::loadXML ) ); } Principal::~Principal() @@ -173,12 +175,16 @@ void Principal::on_conexion_finished() conexion = NULL; } +#include + void Principal::on_conexion_ok(const std::string &body) { /* lo paso a la carga del XML */ /* verifico que body este completo */ if ((body.find("")>0) && (body.find("")>0)) { - loadXML(body); + //loadXML(body); + xml_body = body; + load_xml_dispatch(); } else { txt_view->get_buffer()->insert_at_cursor("\n"); txt_view->get_buffer()->insert_at_cursor(Glib::locale_to_utf8(body)); @@ -218,15 +224,14 @@ void Principal::on_get_clicked() } -void Principal::loadXML(const std::string &s) +void Principal::loadXML() { // ya lo cargue if (is_xml_loaded) return; /* Parseo de ejemplo de un XML desde archivo */ xmlDocPtr document; - std::cout << s.c_str() << std::endl; - document = xmlParseMemory(s.c_str(),s.size()); + document = xmlParseMemory(xml_body.c_str(),xml_body.size()); if (document == NULL) { std::cout << "EEERRRRRRROOOOOOOOOO" << std::endl; return; @@ -257,7 +262,6 @@ void Principal::loadXML(const std::string &s) } } - sleep(2); items = items->next; } } -- 2.43.0