Fawkes API  Fawkes Development Version
main.cpp
00001 
00002 /***************************************************************************
00003  *  main.cpp - Network camera viewer Gui
00004  *
00005  *  Created: Thu Dec 18 14:13:45 2008
00006  *  Copyright 2008 Christof Rath <c.rath@student.tugraz.at>
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 "fuse_viewer_gui.h"
00024 
00025 #include <core/exception.h>
00026 
00027 #include <iostream>
00028 
00029 using namespace std;
00030 
00031 int main(int argc, char** argv)
00032 {
00033   Glib::thread_init();
00034 
00035   try
00036   {
00037     Gtk::Main kit(argc, argv);
00038 
00039 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00040     Glib::RefPtr<Gtk::Builder> builder =
00041       Gtk::Builder::create_from_file(RESDIR"/guis/fuse_viewer/fuse_viewer.ui");
00042 #else
00043     std::auto_ptr<Gtk::BuilderError> error;
00044     Glib::RefPtr<Gtk::Builder> builder =
00045       Gtk::Builder::create_from_file(RESDIR"/guis/fuse_viewer/fuse_viewer.ui", error);
00046     if (error.get()) {
00047       throw fawkes::Exception("Failed to load UI file: %s", error->what().c_str());
00048     }
00049 #endif
00050 
00051     FuseViewerGtkWindow *window = NULL;
00052     builder->get_widget_derived("wndMain", window);
00053                         
00054     kit.run( *window );
00055 
00056     delete window;
00057   }
00058   catch (std::exception const& e)
00059   {
00060     std::cerr << "Error: " << e.what() << std::endl;
00061   }
00062 
00063   return 0;
00064 }