]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/ghelpers.C
Wrap most of the frontend code up inside namespace lyx::frontend.
[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 =
30                 lyx::support::LibFileSearch("glade", name, "glade");
31
32         if (!filename.empty())
33                 return filename;
34
35         // Second, search in the src tree.
36         string const dir =
37                 lyx::support::AddPath(lyx::support::top_srcdir(),
38                                       "src/frontends/gtk/glade");
39
40         filename = lyx::support::ChangeExtension(name, ".glade");
41         filename = lyx::support::AddName(dir, filename);
42
43         if (!lyx::support::IsFileReadable(filename)) {
44                 lyxerr << "Unable to find glade file \"" << name
45                        << "\". libglade is going to crash..." << std::endl;
46         }
47
48         return filename;
49 }
50
51 } // namespace frontend
52 } // namespace lyx