]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Client/src/principal.cpp
062aa4b7455769b8c302ae2d0cfb4e606bb889bc
[z.facultad/75.42/plaqui.git] / Client / src / principal.cpp
1
2
3
4 #include "principal.h"
5 #include <iostream>
6
7 Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::Window(co),refXml(rg)
8 {
9         Gtk::MenuItem *conect=0, *exit=0, *about=0;
10         rg->get_widget("mnu_file_connect", conect);
11         rg->get_widget("mnu_file_exit", exit);
12         rg->get_widget("mnu_help_about", about);
13         rg->get_widget_derived("dlgConectar", dlg_conectar);
14
15         dlg_conectar->get_ok_button()->signal_clicked().connect( SigC::slot(*this, &Principal::on_dlg_connect_ok) );
16         conect->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_file_connect));
17         exit->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_file_exit));
18         about->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_help_about));
19 }
20
21 Principal::~Principal()
22 {
23 }
24
25 void Principal::on_dlg_connect_ok()
26 {
27         std::cout << "Conectando ..." << std::endl;
28         std::cout << dlg_conectar->get_server_name() << ":" << dlg_conectar->get_server_port() << std::endl;
29         dlg_conectar->hide();
30 }
31
32 void Principal::on_mnu_file_exit()
33 {
34         Gtk::Main::quit();
35 }
36
37 void Principal::on_mnu_file_connect()
38 {
39         dlg_conectar->show();
40 }
41
42 void Principal::on_mnu_help_about()
43 {
44         // preparo para leer el archivo ChangeLog
45 /*      Glib::RefPtr<Gnome::Glade::Xml> xml;
46         Glib::ustring line;
47         Glib::RefPtr<Gtk::TextBuffer> log_buffer;
48         Glib::RefPtr<Glib::IOChannel> log_io;
49
50         log_buffer = Gtk::TextBuffer::create();
51         log_io = Glib::IOChannel::create_from_file("../ChangeLog", "r");
52         while (log_io->read_line(line) != Glib::IO_STATUS_EOF) {
53                 log_buffer->insert_at_cursor(line);
54         }
55
56         try {
57                 xml = Gnome::Glade::Xml::create("client.glade", "dlgAbout");
58         }
59         catch(const Gnome::Glade::XmlError &ex) {
60                 std::cerr << ex.what() << std::endl;
61                 return;
62         }
63         Gtk::Window *dlg = 0;
64         Gtk::Button *btn_cerrar = 0;
65         Gtk::TextView *txt_changelog = 0;
66         xml->get_widget("dlgAbout", dlg);
67         xml->get_widget("btn_close", btn_cerrar);
68         xml->get_widget("txt_changelog", txt_changelog);
69         btn_cerrar->signal_clicked().connect(SigC::slot(*dlg, &Gtk::Dialog::hide));
70         txt_changelog->set_buffer(log_buffer);
71         dlg->show();*/
72 }
73