lyx_mirror/src/frontends/gtk/GShowFile.C
Angus Leeming aabd481ab6 Consistent use of preprocessor guards;
include <config.h> in .C files, not .h ones;
licence blurb.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9876 a592a061-630c-0410-9148-cb99ea01b6c8
2005-04-26 10:30:24 +00:00

68 lines
1.4 KiB
C

/**
* \file GShowFile.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Spray
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
// Too hard to make concept checks work with this file
#ifdef _GLIBCXX_CONCEPT_CHECKS
#undef _GLIBCXX_CONCEPT_CHECKS
#endif
#ifdef _GLIBCPP_CONCEPT_CHECKS
#undef _GLIBCPP_CONCEPT_CHECKS
#endif
#include "GShowFile.h"
#include "ControlShowFile.h"
#include "ghelpers.h"
using std::string;
namespace lyx {
namespace frontend {
GShowFile::GShowFile(Dialog & parent)
: GViewCB<ControlShowFile, GViewGladeB>(parent, _("Show File"), false)
{}
void GShowFile::doBuild()
{
string const gladeName = findGladeFile("showfile");
xml_ = Gnome::Glade::Xml::create(gladeName);
Gtk::Button * closebutton;
xml_->get_widget("Close", closebutton);
setCancel(closebutton);
Gtk::TextView * contentview;
xml_->get_widget("ContentView", contentview);
contentbuffer_ = contentview->get_buffer();
}
void GShowFile::update()
{
string const title = controller().getFileName();
if (!title.empty())
setTitle(title);
string const contents = controller().getFileContents();
if (!contents.empty())
contentbuffer_->set_text(contents);
else
contentbuffer_->set_text(_("Error reading file!"));
}
} // namespace frontend
} // namespace lyx