]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/ghelpers.C
Add ShowFile dialog
[lyx.git] / src / frontends / gtk / ghelpers.C
1 /**
2  * \file ghelpers.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "ghelpers.h"
14
15 #include "debug.h"
16
17 #include "support/filetools.h"
18 #include "support/path_defines.h"
19
20 using std::string;
21
22 namespace lyx {
23 namespace frontend {
24
25 string const findGladeFile(string const & name)
26 {
27         // First, search in the installation directories.
28
29         string filename = lyx::support::LibFileSearch("glade", name, "glade");
30
31         if (!filename.empty())
32                 return filename;
33
34         // Second, search in the src tree.
35         string const dir =
36                 lyx::support::AddPath(lyx::support::top_srcdir(),
37                                       "src/frontends/gtk/glade");
38
39         filename = lyx::support::ChangeExtension(name, ".glade");
40         filename = lyx::support::AddName(dir, filename);
41
42         if (!lyx::support::IsFileReadable(filename)) {
43                 lyxerr << "Unable to find glade file \"" << name
44                        << "\". libglade is going to crash..." << std::endl;
45         }
46
47         return filename;
48 }
49
50 } // namespace frontend
51 } // namespace lyx