]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Client/include/mnu_help_about.h
168bd3da5439fb9379bd51eedbbfaf2b098da784
[z.facultad/75.42/plaqui.git] / Client / include / mnu_help_about.h
1
2 /* Maneja el Ayuda->Acerca de */
3
4 #include <gtkmm.h>
5 #include <glibmm/iochannel.h>
6 #include <iostream>
7
8 class MnuHelpAbout:public Gtk::MenuItem {
9 public:
10         MnuHelpAbout(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):Gtk::MenuItem(cobject) {
11         }
12         virtual ~MnuHelpAbout() {}
13
14 protected:
15         Glib::RefPtr<Gnome::Glade::Xml> refXml;
16
17         virtual void on_activate() {
18                 // preparo para leer el archivo ChangeLog
19                 Glib::ustring line;
20                 Glib::RefPtr<Gtk::TextBuffer> log_buffer;
21                 Glib::RefPtr<Glib::IOChannel> log_io;
22
23                 log_buffer = Gtk::TextBuffer::create();
24                 log_io = Glib::IOChannel::create_from_file("../ChangeLog", "r");
25                 while (log_io->read_line(line) != Glib::IO_STATUS_EOF) {
26                         log_buffer->insert_at_cursor(line);
27                 }
28
29                 try {
30                         refXml = Gnome::Glade::Xml::create("client.glade", "dlgAbout");
31                 }
32                 catch(const Gnome::Glade::XmlError &ex) {
33                         std::cerr << ex.what() << std::endl;
34                         return;
35                 }
36                 Gtk::Window *dlg = 0;
37                 Gtk::Button *btn_cerrar = 0;
38                 Gtk::TextView *txt_changelog = 0;
39                 refXml->get_widget("dlgAbout", dlg);
40                 refXml->get_widget("btn_close", btn_cerrar);
41                 refXml->get_widget("txt_changelog", txt_changelog);
42                 btn_cerrar->signal_clicked().connect(SigC::slot(*dlg, &Gtk::Dialog::hide));
43                 txt_changelog->set_buffer(log_buffer);
44                 dlg->show();
45         }
46 };
47