Fawkes API  Fawkes Development Version
main.cpp
1 
2 /***************************************************************************
3  * main.cpp - Fawkes Config Editor
4  *
5  * Created: Tue Sep 23 13:26:18 2008
6  * Copyright 2008 Daniel Beck
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #include <core/exception.h>
24 #include <tools/config_editor/config_editor.h>
25 #include <iostream>
26 
27 #if GTK_VERSION_GE(3,0)
28 # define UI_FILE RESDIR"/guis/config_editor/config_editor.ui"
29 #else
30 # define UI_FILE RESDIR"/guis/config_editor/config_editor_gtk2.ui"
31 #endif
32 
33 using namespace std;
34 
35 int main(int argc, char** argv)
36 {
37  std::locale::global( std::locale( "" ) );
38 
39  try
40  {
41  Gtk::Main kit(argc, argv);
42 #ifdef GLIBMM_EXCEPTIONS_ENABLED
43  Glib::RefPtr<Gtk::Builder> builder =
44  Gtk::Builder::create_from_file(UI_FILE);
45 #else
46  std::auto_ptr<Gtk::BuilderError> error;
47  Glib::RefPtr<Gtk::Builder> builder =
48  Gtk::Builder::create_from_file(UI_FILE, error);
49  if (error.get()) {
50  printf("Failed to load UI file: %s", error->what().c_str());
51  exit(-1);
52  }
53 #endif
54 
55  FawkesConfigEditor fce(builder);
56 
57  kit.run(fce.get_window());
58  }
59  catch (Gtk::BuilderError &e)
60  {
61  printf("Failed to instantiate window: %s\n", e.what().c_str());
62  }
63  catch (const std::exception& e)
64  {
65  cerr << "Error: " << e.what() << endl;
66  }
67 
68  return 0;
69 }
STL namespace.
Graphical configuration editor.
Definition: config_editor.h:35