+
+#include "menu_bar.h"
+#include <iostream>
+#include "dlg_conectar.h"
+
+MiMenuBar::MiMenuBar(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::MenuBar(co),refXml(rg)
+{
+ Gtk::MenuItem *conect=0, *exit=0, *about=0;
+ rg->get_widget("mnu_file_connect", conect);
+ rg->get_widget("mnu_file_exit", exit);
+ rg->get_widget("mnu_help_about", about);
+ conect->signal_activate().connect( SigC::slot(*this, &MiMenuBar::on_mnu_file_connect));
+ exit->signal_activate().connect( SigC::slot(*this, &MiMenuBar::on_mnu_file_exit));
+ about->signal_activate().connect( SigC::slot(*this, &MiMenuBar::on_mnu_help_about));
+}
+
+MiMenuBar::~MiMenuBar()
+{
+}
+
+void MiMenuBar::on_mnu_file_exit()
+{
+ Gtk::Main::quit();
+}
+
+void MiMenuBar::on_mnu_file_connect()
+{
+ // preparo para leer el archivo ChangeLog
+ Glib::RefPtr<Gnome::Glade::Xml> xml;
+
+ try {
+ xml = Gnome::Glade::Xml::create("client.glade", "dlgConectar");
+ }
+ catch(const Gnome::Glade::XmlError &ex) {
+ std::cerr << ex.what() << std::endl;
+ return;
+ }
+ DlgConectar *dlg = 0;
+ xml->get_widget_derived("dlgConectar", dlg);
+ dlg->show();
+}
+
+void MiMenuBar::on_mnu_help_about()
+{
+ // preparo para leer el archivo ChangeLog
+ Glib::RefPtr<Gnome::Glade::Xml> xml;
+ Glib::ustring line;
+ Glib::RefPtr<Gtk::TextBuffer> log_buffer;
+ Glib::RefPtr<Glib::IOChannel> log_io;
+
+ log_buffer = Gtk::TextBuffer::create();
+ log_io = Glib::IOChannel::create_from_file("../ChangeLog", "r");
+ while (log_io->read_line(line) != Glib::IO_STATUS_EOF) {
+ log_buffer->insert_at_cursor(line);
+ }
+
+ try {
+ xml = Gnome::Glade::Xml::create("client.glade", "dlgAbout");
+ }
+ catch(const Gnome::Glade::XmlError &ex) {
+ std::cerr << ex.what() << std::endl;
+ return;
+ }
+ Gtk::Window *dlg = 0;
+ Gtk::Button *btn_cerrar = 0;
+ Gtk::TextView *txt_changelog = 0;
+ xml->get_widget("dlgAbout", dlg);
+ xml->get_widget("btn_close", btn_cerrar);
+ xml->get_widget("txt_changelog", txt_changelog);
+ btn_cerrar->signal_clicked().connect(SigC::slot(*dlg, &Gtk::Dialog::hide));
+ txt_changelog->set_buffer(log_buffer);
+ dlg->show();
+}
+