main.cpp

00001 
00002 /***************************************************************************
00003  *  main.cpp - Fawkes Config Editor
00004  *
00005  *  Created: Tue Sep 23 13:26:18 2008
00006  *  Copyright  2008  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/config_editor/config_editor.h>
00025 #include <libglademm/xml.h>
00026 #include <iostream>
00027 
00028 using namespace std;
00029 
00030 int main(int argc, char** argv)
00031 {
00032   std::locale::global( std::locale( "" ) ); 
00033 
00034   try
00035     {
00036       Gtk::Main kit(argc, argv);
00037 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00038       Glib::RefPtr<Gnome::Glade::Xml> ref_xml = Gnome::Glade::Xml::create(RESDIR"/guis/config_editor/config_editor.glade");
00039 #else
00040       std::auto_ptr<Gnome::Glade::XmlError> error;
00041       Glib::RefPtr<Gnome::Glade::Xml> ref_xml = Gnome::Glade::Xml::create(RESDIR"/guis/config_editor/config_editor.glade", "", "", error);
00042       if (error.get()) {
00043         throw fawkes::Exception("Failed to load Glade file: %s", error->what().c_str());
00044       }
00045 #endif
00046 
00047       FawkesConfigEditor fce(ref_xml);
00048 
00049       kit.run( fce.get_window() );
00050     }
00051   catch (const std::exception& e)
00052     {
00053       cerr << "Error: " << e.what() << endl;
00054     }
00055   
00056   return 0;
00057 }