Fawkes API  Fawkes Development Version
main.cpp
1 
2 /***************************************************************************
3  * main.cpp - Plugin Tool Gui
4  *
5  * Created: Thu Nov 09 20:13:45 2007
6  * Copyright 2007 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/plugin_gui/plugin_gui.h>
25 #ifdef HAVE_GCONFMM
26 # include <gconfmm.h>
27 #endif
28 #include <iostream>
29 
30 #if GTK_VERSION_GE(3, 0)
31 # define UI_FILE RESDIR "/guis/plugin_tool/plugin_gui.ui"
32 #else
33 # define UI_FILE RESDIR "/guis/plugin_tool/plugin_gui_gtk2.ui"
34 #endif
35 
36 using namespace std;
37 
38 int
39 main(int argc, char **argv)
40 {
41  try {
42  Gtk::Main kit(argc, argv);
43 #ifdef HAVE_GCONFMM
44  Gnome::Conf::init();
45 #endif
46 
47  Glib::RefPtr<Gtk::Builder> builder;
48  try {
49  builder = Gtk::Builder::create_from_file(UI_FILE);
50  } catch (Gtk::BuilderError &e) {
51  printf("Failed to create GUI: %s\n", e.what().c_str());
52  }
53 
54  PluginGuiGtkWindow *window = NULL;
55  builder->get_widget_derived("wndMain", window);
56 
57  kit.run(*window);
58 
59  delete window;
60  } catch (std::exception const &e) {
61  std::cerr << "Error: " << e.what() << std::endl;
62  }
63 
64  return 0;
65 }
PluginGuiGtkWindow
Graphical plugin management tool.
Definition: plugin_gui.h:37