Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

main.c

Go to the documentation of this file.
00001 /*
00002  *This file is part of GNU MlView
00003  *
00004  *GNU MlView is free software; you can redistribute it and/or modify it under the terms of 
00005  *the GNU General Public License as published by the Free Software Foundation; either version 2, 
00006  *or (at your option) any later version.
00007  *
00008  *GNU MlView is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
00009  *without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00010  *See the GNU General Public License for more details.
00011  *
00012  *You should have received a copy of the GNU General Public License along with MlView; 
00013  *see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00014  *
00015  *
00016  *Copyright 2001-2002 dodji seketeli
00017  */
00018 
00027 #include <stdio.h>
00028 #include <gnome.h>
00029 #include <libxml/parser.h>
00030 #include <libxml/catalog.h>
00031 #include "config.h"
00032 
00033 #include "utils.h"
00034 #include "mlview-app.h"
00035         
00036 
00041 int main (int argc, char** argv) {
00042 
00043   GnomeApp *mlview_application = NULL ;
00044 
00045   gchar ** args = NULL ;
00046   poptContext popt_context = {0} ;
00047   gboolean show_version = FALSE, show_info = FALSE ;
00048  
00049   struct poptOption cmd_options_table [] = {
00050                 {
00051                         "version",
00052                         'v',
00053                         POPT_ARG_NONE,
00054                         &show_version,
00055                         0,
00056                         N_("Prints The version of gnome-mlview you are using"),
00057                         NULL
00058                 },
00059                 {
00060                         "about",
00061                         'a',
00062                         POPT_ARG_NONE,
00063                         &show_info,
00064                         0,
00065                         N_("Prints some information about gnome-mlview"),
00066                         NULL
00067                 },
00068                 {0}
00069   } ;
00070 
00071   /*init gnome*/
00072   gnome_init_with_popt_table (PACKAGE, VERSION, argc, argv,
00073                               cmd_options_table, 0 , &popt_context) ;
00074 
00075   /*init 18n libs*/
00076 
00077   init_i18n () ;
00078 
00079   /*Then, parse the non option command arguments*/
00080   args = (gchar**) poptGetArgs (popt_context) ;
00081 
00082   if (show_version == TRUE) {
00083           g_print ("%s\n", VERSION) ;
00084           poptFreeContext (popt_context) ;
00085           return 0 ;
00086   }
00087 
00088   if (show_info == TRUE) {
00089           g_print ("%s\n", _("No usefull info yest")) ;
00090           poptFreeContext (popt_context) ;
00091           return 0 ;
00092   }
00093 
00094   /*instanciate an mlview application*/
00095   mlview_application = mlview_app_new (PACKAGE) ;
00096 
00097   gtk_widget_set_usize (GTK_WIDGET (mlview_application),
00098                        800, 600) ;
00099 
00100   gtk_window_set_wmclass (GTK_WINDOW (mlview_application), 
00101                           "main-application-window", "MlView") ;
00102 
00103   gtk_widget_realize (GTK_WIDGET (mlview_application)) ;
00104 
00105   mlview_app_set_icon (mlview_application) ;
00106 
00107   gtk_widget_show_all (GTK_WIDGET (mlview_application)) ;
00108 
00109   
00110   if ( args ) { /*they are some argument on the comment line. Treat them like files to open*/
00111           MlViewEditor * mlview_editor = mlview_app_get_editor (mlview_application) ;
00112           if ( mlview_editor ) {
00113                   int i ;
00114                   for (i=0 ; args[i] != NULL ; i++) {
00115                           mlview_editor_load_xml_file (mlview_editor, (gchar *)args[i]) ;
00116                   }
00117           }
00118   }
00119 
00120   poptFreeContext (popt_context) ;
00121 
00122   gtk_main();
00123   return 0 ;
00124 }//end main

Generated on Sat Jul 6 09:57:30 2002 for Gnome-MlView by doxygen1.2.16