real_main & arg_parse patch 2nd try



Hi jpr,

Here's the same patch as an attachment.

Jeroen
Index: src/gide.c
===================================================================
RCS file: /cvs/gnome/gIDE/src/gide.c,v
retrieving revision 1.29
diff -u -r1.29 gide.c
--- src/gide.c	2001/06/21 03:01:33	1.29
+++ src/gide.c	2001/06/28 18:24:33
@@ -29,9 +29,7 @@
 #include <liboaf/liboaf.h>
 #include <bonobo.h>
 
-/* --- global vars --- */
-
-/* Widgets: Main-Window & Box */
+/* Main window */
 GideWindow *main_window;
 
 /* Paths */
@@ -39,17 +37,12 @@
 gchar tools_path[MAXLEN];
 gchar prj_path[MAXLEN];
 
-/* Command line args */
-static poptContext ctx;
-static gboolean disablefontstuff = FALSE;
-
 static const struct poptOption gide_popt_options [] = {
 	{ NULL, '\0', 0, NULL, 0 }
 };
 
-static void open_history( gchar *filename )
+/*static void open_history( gchar *filename )
 {
-/*
 	FILE* history;
 	gchar buf[MAXLEN];
 	gchar historywp[MAXLEN];
@@ -68,30 +61,49 @@
 			file_open_by_name( main_window, buf );
 		}
 		fclose( history );
-		} */
-}
+		}
+}*/
 
 /* doesn't seem to belong here. should be in gI_cfg.c or so */
-
-
 
-/* some things here happen also in prefs (since they change when prefs change).
-   so, should be in common function */
-static void real_main( gint argc, gchar *argv[] )
+gint main (gint argc, gchar **argv) 
 {
+	CORBA_ORB orb;
+	poptContext ctx;
 	gint nofargs = 0;
-	gchar* extra_dir;
-	gchar *filename;
-	GideShell *shell;
 	GtkWidget *splash;
+	
+	/* Internationalization */
+	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
+	textdomain (PACKAGE);
+	
+	/* Parse options */
+	gnomelib_register_popt_table (oaf_popt_options, _("Oaf options"));
+	gnome_init_with_popt_table (PACKAGE, VERSION, argc, argv, 
+				    gide_popt_options, 0, &ctx);
+				    
+	gnome_window_icon_set_default_from_file (GNOME_ICONDIR "/gide.png");
 
+	/* Initialize Bonobo */
+	orb = oaf_init (argc, argv);
+
+	if (!bonobo_init (orb, NULL, NULL))
+		g_error ("Failure starting Bonobo");
+
+	bonobo_activate ();
+
+	/* Initialize glade */	
+	glade_gnome_init ();
+
+	/* Display splashscreen */
 	splash = e_splash_new ();
 	gtk_widget_show (splash);
 	gtk_object_ref (GTK_OBJECT (splash));
 	while (gtk_events_pending ())
 		gtk_main_iteration ();
 
-	main_window = gide_window_new(splash);
+	/* Create main window */
+	main_window = gide_window_new (E_SPLASH (splash));
 	
 #if 0
 	/* FIXME: This is a good thing to be doing, but I don't want to
@@ -100,10 +112,8 @@
 	/* open the files */
 	startup_files = poptGetArgs(ctx);
 	nofargs = 0;
-	if (startup_files)
-	{
-		while (startup_files[nofargs])
-		{
+	if (startup_files) {
+		while (startup_files[nofargs]) {
 #if DOCNOTEBOOK
 			file_open_by_name( main_window,
 					   g_strdup(startup_files[nofargs]));
@@ -111,60 +121,25 @@
 #endif
 		}
 	}
-	poptFreeContext(ctx);
+	poptFreeContext (ctx);
 
-	if( nofargs == 0 )
-	{
+	if (nofargs == 0) {
 		/* no files given on the commandline, open files from last session */
-		open_history( HISTORY );
+		open_history (HISTORY);
 	}
 #endif
 
 	gtk_widget_unref (splash);
 	gtk_widget_destroy (splash);
 
-	/* GTK Main Loop */
-	gtk_main();
+	/* GTK main Loop */
+	gtk_main ();
 
 #if 0
 	/* Destroy the main_window */
-	gtk_object_destroy( GTK_OBJECT(main_window) );
+	gtk_object_destroy (GTK_OBJECT (main_window));
 #endif
-}
-
-static void
-arg_parse (int argc, char *argv [])
-{
-	CORBA_ORB         orb;
-
-	ctx = NULL;
-
-	gnomelib_register_popt_table (oaf_popt_options, _("Oaf options"));
-	gnome_init_with_popt_table(PACKAGE, VERSION,
-				   argc, argv, gide_popt_options,
-				   0, &ctx);
-	gnome_window_icon_set_default_from_file (GNOME_ICONDIR "/gide.png");
-
-	orb = oaf_init (argc, argv);
-
-	if (bonobo_init (orb, NULL, NULL) == FALSE)
-		g_error ("Failure starting up Bonobo");
-
-	bonobo_activate ();
-	
-}
-
-gint main (gint argc, gchar **argv)
-{
-	/* Internationalization */
-	bindtextdomain(PACKAGE, GNOMELOCALEDIR);
-	textdomain(PACKAGE);
-
-	arg_parse (argc, argv);
-	glade_gnome_init ();
-	
-	real_main(argc, argv);
 
-	/* allīs great, return EXIT_SUCCESS */
-	return( EXIT_SUCCESS );
+	/* Allīs great, return EXIT_SUCCESS */
+	return (EXIT_SUCCESS);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]