Re: gnome-program.h: defining variables in headers



On 6 Dec 2001, Havoc Pennington wrote:

> gtk_init() is also going to g_set_prgname(), but yeah libgnome
> should probably do so as well for non-GUI apps.

So here's the patchlet. OK to check in?

-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
X Window System: Complex Nonsolutions to Simple Nonproblems
Index: libgnome/ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/ChangeLog,v
retrieving revision 1.377
diff -u -u -r1.377 ChangeLog
--- libgnome/ChangeLog	2001/12/03 11:29:38	1.377
+++ libgnome/ChangeLog	2001/12/07 13:17:29
@@ -1,3 +1,9 @@
+2001-12-07  ERDI Gergo  <cactus cactus rulez org>
+
+	* gnome-program.h: Removed buggy buggy BUGGY
+	program_invocation_name public variable. If you've used it in your
+	code, use g_get_prgname from Glib instead.
+
 2001-12-03  Malcolm Tredinnick <malcolm commsecure com au>
 	* gnome-init.[ch], gnome-util.h, parse-path.cP: replace
 	  references to .gnome and .gnome_private with GNOME_DOT_GNOME
Index: libgnome/gnome-init.c
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/gnome-init.c,v
retrieving revision 1.98
diff -u -u -r1.98 gnome-init.c
--- libgnome/gnome-init.c	2001/12/03 11:29:38	1.98
+++ libgnome/gnome-init.c	2001/12/07 13:17:31
@@ -63,7 +63,7 @@
 	int dumb_argc = 1;
 	char *dumb_argv[] = {NULL};
 
-	dumb_argv[0] = program_invocation_name;
+	dumb_argv[0] = g_get_prgname ();
 
 	bonobo_init (&dumb_argc, dumb_argv);
 }
@@ -127,7 +127,7 @@
 		int dumb_argc = 1;
 		char *dumb_argv[] = {NULL};
 
-		dumb_argv[0] = program_invocation_name;
+		dumb_argv[0] = g_get_prgname ();
 		(void) bonobo_activation_orb_init (&dumb_argc, dumb_argv);
 		
 		bonobo_activation_postinit (program, mod_info);
Index: libgnome/gnome-program.c
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/gnome-program.c,v
retrieving revision 1.47
diff -u -u -r1.47 gnome-program.c
--- libgnome/gnome-program.c	2001/12/05 15:56:50	1.47
+++ libgnome/gnome-program.c	2001/12/07 13:17:33
@@ -1240,12 +1240,9 @@
     if (program->_priv->state != APP_CREATE_DONE)
 	return NULL;
 
-    /* On non-glibc systems, this is not set up for us.  */
-    if (!program_invocation_name) {
-	program_invocation_name = g_strdup (argv[0]);
-	program_invocation_short_name = g_path_get_basename (program_invocation_name);
-    }
-
+    /* Store invocation name */
+    g_set_prgname (argv[0]);
+    
     /* 0. Misc setup */
     if (program->_priv->app_id)
 	g_free (program->_priv->app_id);
Index: libgnome/gnome-program.h
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/gnome-program.h,v
retrieving revision 1.24
diff -u -u -r1.24 gnome-program.h
--- libgnome/gnome-program.h	2001/12/03 11:01:28	1.24
+++ libgnome/gnome-program.h	2001/12/07 13:17:33
@@ -266,15 +266,8 @@
 		     int argc, char **argv,
 		     const char *first_property_name, va_list args);
 
-
-/* Some systems, like Red Hat 4.0, define these but don't declare
-   them.  Hopefully it is safe to always declare them here.  */
-#ifndef program_invocation_short_name
-char *program_invocation_short_name;
-#endif
-#ifndef program_invocation_name
-char *program_invocation_name;
-#endif
+const gchar * gnome_program_get_invocation_name       () G_GNUC_CONST;
+const gchar * gnome_program_get_short_invocation_name () G_GNUC_CONST;
 
 G_END_DECLS


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