Patch to allow gnome_init to be called more than once



I'll commit this to stable tomorrow unless anyone objects. The
ChangeLog should explain all.

-- 
Maciej Stachowiak <mjs eazel com>
whacky-ass code cowboy[sic]
Technical Lead, Services Engineering
Eazel, Inc.


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-libs/ChangeLog,v
retrieving revision 1.463.4.43
diff -u -p -r1.463.4.43 ChangeLog
--- ChangeLog	2001/03/05 22:17:43	1.463.4.43
+++ ChangeLog	2001/03/21 07:01:34
@@ -1,3 +1,15 @@
+2001-03-20  Maciej Stachowiak  <mjs eazel com>
+
+	* libgnomeui/gnome-init.c: (gnome_add_gtk_arg_callback),
+	(gnome_init_cb), (gnome_init_with_popt_table), (gnome_init): Just
+	return silently if GNOME is already initialized, rather than
+	g_return_if_fail()ing. This is needed because there is no way to
+	even know if GNOME is already initialized, and there are times
+	when two pieces of code may both have valid reasons for wanting
+	GNOME initialized, for example if a GNOME app has embedded Python
+	and wants the embedded python scripts to be able to use the
+	Python/GNOME bindings.
+
 2001-03-05  Stanislav Brabec  <utx penguin cz>
 
 	* gnome-config.in: Added dependence on gdk_imlib to zvt, since
Index: libgnomeui/gnome-init.c
===================================================================
RCS file: /cvs/gnome/gnome-libs/libgnomeui/gnome-init.c,v
retrieving revision 1.100.4.8
diff -u -p -r1.100.4.8 gnome-init.c
--- libgnomeui/gnome-init.c	2001/02/13 21:10:04	1.100.4.8
+++ libgnomeui/gnome-init.c	2001/03/21 07:01:34
@@ -95,7 +95,7 @@ gnome_add_gtk_arg_callback(poptContext c
 	int final_argc;
 	char **final_argv;
 	
-	if(gnome_gtk_initialized) {
+	if (gnome_gtk_initialized) {
 		/*
 		 * gnome has already been initialized, so app might be making a
 		 * second pass over the args - just ignore
@@ -199,7 +199,7 @@ static void
 gnome_init_cb(poptContext ctx, enum poptCallbackReason reason,
 	      const struct poptOption *opt)
 {
-	if(gnome_initialized)
+	if (gnome_initialized)
 		return;
 	
 	switch(reason) {
@@ -437,7 +437,8 @@ gnome_init_with_popt_table(const char *a
 	__malloc_hook = my_malloc_hook;
 	__realloc_hook = my_realloc_hook;
 #endif
-	g_return_val_if_fail(gnome_initialized == FALSE, -1);
+	if (gnome_initialized)
+                return;
 	
 	gnomelib_init (app_id, app_version);
 	
@@ -485,7 +486,8 @@ gnome_init(const char *app_id,
 	   const char *app_version,
 	   int argc, char **argv)
 {
-  g_return_val_if_fail(gnome_initialized == FALSE, -1);
+  if (gnome_initialized)
+          return;
 
   gnome_init_with_popt_table(app_id, app_version,
 			     argc, argv, NULL, 0, NULL);







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