]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GLog.C
some tabular fixes for the problems reported by Helge
[lyx.git] / src / frontends / gtk / GLog.C
1 /**
2  * \file GLog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Spray
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 // Too hard to make concept checks work with this file
12 #ifdef _GLIBCXX_CONCEPT_CHECKS
13 #undef _GLIBCXX_CONCEPT_CHECKS
14 #endif
15
16 #include "GLog.h"
17 #include "ControlLog.h"
18
19 #include "ghelpers.h"
20
21 #include <sstream>
22
23 using std::string;
24
25 namespace lyx {
26 namespace frontend {
27
28 GLog::GLog(Dialog & parent)
29         : GViewCB<ControlLog, GViewGladeB>(parent, _("Log Viewer"), false)
30 {}
31
32
33 void GLog::doBuild()
34 {
35         string const gladeName = findGladeFile("log");
36         xml_ = Gnome::Glade::Xml::create(gladeName);
37
38         Gtk::Button * button;
39         xml_->get_widget("Close", button);
40         setCancel(button);
41
42         xml_->get_widget("Refresh", button);
43         button->signal_clicked().connect(
44                 sigc::mem_fun(*this, &GLog::update));
45
46         Gtk::TextView * contentview;
47         xml_->get_widget("ContentView", contentview);
48         contentbuffer_ = contentview->get_buffer();
49 }
50
51
52 void GLog::update()
53 {
54         string const title = controller().title();
55
56         if (!title.empty())
57                 setTitle(title);
58
59         std::ostringstream contents;
60         controller().getContents(contents);
61
62         if (!contents.str().empty())
63                 contentbuffer_->set_text(contents.str());
64         else
65                 contentbuffer_->set_text(_("Error reading file!"));
66 }
67
68 } // namespace frontend
69 } // namespace lyx