Fawkes API  Fawkes Development Version
main.cpp
00001 
00002 /***************************************************************************
00003  *  main.cpp - Plugin Tool Gui
00004  *
00005  *  Created: Thu Nov 09 20:13:45 2007
00006  *  Copyright  2007  Daniel Beck
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #include <core/exception.h>
00024 #include <tools/plugin_gui/plugin_gui.h>
00025 #ifdef HAVE_GCONFMM
00026 #  include <gconfmm.h>
00027 #endif
00028 #include <libglademm/xml.h>
00029 #include <iostream>
00030 
00031 using namespace std;
00032 
00033 int main(int argc, char** argv)
00034 {
00035   try
00036   {
00037     Gtk::Main kit(argc, argv);
00038 #ifdef HAVE_GCONFMM
00039     Gnome::Conf::init();
00040 #endif
00041 
00042 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00043     Glib::RefPtr<Gnome::Glade::Xml> refxml = Gnome::Glade::Xml::create(RESDIR"/guis/plugin_tool/plugin_tool.glade");
00044 #else
00045     std::auto_ptr<Gnome::Glade::XmlError> error;
00046     Glib::RefPtr<Gnome::Glade::Xml> refxml = Gnome::Glade::Xml::create(RESDIR"/guis/plugin_tool/plugin_tool.glade", "", "", error);
00047     if (error.get()) {
00048       throw fawkes::Exception("Failed to load Glade file: %s", error->what().c_str());
00049     }
00050 #endif
00051 
00052     PluginGuiGtkWindow *window = NULL;
00053     refxml->get_widget_derived("wndMain", window);
00054 
00055     kit.run( *window );
00056 
00057     delete window;
00058   }
00059   catch (std::exception const& e)
00060   {
00061     std::cerr << "Error: " << e.what() << std::endl;
00062   }
00063 
00064   return 0;
00065 }