]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/ghelpers.C
gtk graphics 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 #include "lengthcommon.h"
17
18 #include "support/filetools.h"
19 #include "support/path_defines.h"
20
21 using std::string;
22 using std::vector;
23
24 namespace lyx {
25 namespace frontend {
26
27 vector<string> const buildLengthUnitList()
28 {
29         vector<string> data(unit_name_gui, unit_name_gui + num_units);
30
31         return data;
32 }
33
34
35 string const findGladeFile(string const & name)
36 {
37         // First, search in the installation directories.
38
39         string filename = lyx::support::LibFileSearch("glade", name, "glade");
40
41         if (!filename.empty())
42                 return filename;
43
44         // Second, search in the src tree.
45         string const dir =
46                 lyx::support::AddPath(lyx::support::top_srcdir(),
47                                       "src/frontends/gtk/glade");
48
49         filename = lyx::support::ChangeExtension(name, ".glade");
50         filename = lyx::support::AddName(dir, filename);
51
52         if (!lyx::support::IsFileReadable(filename)) {
53                 lyxerr << "Unable to find glade file \"" << name
54                        << "\". libglade is going to crash..." << std::endl;
55         }
56
57         return filename;
58 }
59
60 } // namespace frontend
61 } // namespace lyx