]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GLog.C
Change glob() API to accept a dir parameter.
[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 #include "GLog.h"
12 #include "ControlLog.h"
13
14 #include "ghelpers.h"
15
16 #include <sstream>
17
18 using std::string;
19
20 namespace lyx {
21 namespace frontend {
22
23 GLog::GLog(Dialog & parent)
24         : GViewCB<ControlLog, GViewGladeB>(parent, _("Log Viewer"), false)
25 {}
26
27
28 void GLog::doBuild()
29 {
30         string const gladeName = findGladeFile("log");
31         xml_ = Gnome::Glade::Xml::create(gladeName);
32
33         Gtk::Button * button;
34         xml_->get_widget("Close", button);
35         setCancel(button);
36
37         xml_->get_widget("Refresh", button);
38         button->signal_clicked().connect(
39                 sigc::mem_fun(*this, &GLog::update));
40
41         Gtk::TextView * contentview;
42         xml_->get_widget("ContentView", contentview);
43         contentbuffer_ = contentview->get_buffer();
44 }
45
46
47 void GLog::update()
48 {
49         string const title = controller().title();
50
51         if (!title.empty())
52                 setTitle(title);
53
54         std::ostringstream contents;
55         controller().getContents(contents);
56
57         if (!contents.str().empty())
58                 contentbuffer_->set_text(contents.str());
59         else
60                 contentbuffer_->set_text(_("Error reading file!"));
61 }
62
63 } // namespace frontend
64 } // namespace lyx