Gnome relocation issue

There was already a debate on gnome-devel-list about Gnome relocation
issue (between MDI and the Anjuta guy) but no solutions were provided at
that time.
To recall those that miss it, the problem comes from the fact that some
entry point in the Gnome API for managing sounds, images and help files
makes it impossible to put those files in a location different than
where Gnome has been installed.
If for image and sounds, the user can bypass the Gnome API facility and
locate its file on its own, it is more complex for the help since the
GNOMEUI_HELP macros does much more than just locating a file.

This breaks a rule in Gnu where most possible is done to permit a
software package to be installed anywhere.

To solve thet, I propose to fix that by adding an entry in the
gnome-libs to pass it the user package --prefix value. 
This way, each gnome package can be made relocatable by just by adding
one line of code.
I made the test of adding an entry point in gnome-libs that I called
void gnome_myprefix(chr * dir)
When given the user's prefix, any subsequent call to the gnome_xxx_file
and gnome_unconditional_xxx_file group will use the user prefix instead
of  the GNOME's one.
Thus, it solves the relocation issue with the help and it is backward
On the bad side, to use it, the user will have to bring the --prefix to
be visible in his c files through the and
(while this also could be made easier by enhancing the gnome .m4 code to
ease that task.)

Here is the proposed patch tested here on gnome-libs-1.2.13:

---cut here
diff -ru gnome-libs-1.2.13/libgnome/gnome-util.c
--- gnome-libs-1.2.13/libgnome/gnome-util.c	Tue Dec 26 19:15:45 2000
+++ gnome-libs-1.2.13.myprefix/libgnome/gnome-util.c	Wed May  2 12:19:35
@@ -25,10 +25,17 @@
 #include "gnome-defs.h"
 #include "gnome-util.h"
+static char *gnomedir = NULL;
+gnome_myprefix (const char *dir)
+  gnomedir=dir;
 static char *
 gnome_dirrelative_file (const char *base, const char *sub, const char
*filename, int unconditional)
-        static char *gnomedir = NULL;
 	char *dir = NULL, *fil = NULL, *odir = NULL, *ofil = NULL;
 	char *retval = NULL;
diff -ru gnome-libs-1.2.13/libgnome/gnome-util.h
--- gnome-libs-1.2.13/libgnome/gnome-util.h	Mon Jan 25 21:47:28 1999
+++ gnome-libs-1.2.13.myprefix/libgnome/gnome-util.h	Wed May  2 12:19:55
@@ -9,6 +9,16 @@
 #define PATH_SEP '/'
 #define PATH_SEP_STR "/"
+/* Set the given dir as your application base directory.
+   This is the same as using the env variable GNOMEDIR.
+   This dir is used by the gnome_xxx_file and 
+   gnome_unconditional_xxx_file group to return a directory file 
+   relative to the installation of your application. 
+   Usually, you must call it at the start of your program and 
+   give it the prefix that comes for the configure process.
+   */
+void gnome_myprefix (const char *dir);
 /* Prepend the correct prefix to a filename you expect to find in the
    GNOME libdir, datadir, or pixmap directory. Return NULL if the file
    does not exist. "unconditional" versions always return a full path,

----cut here

Bruno Coudoin
ANFORA - BP 306- Bât ACTYS- 31313 LABEGE Cedex
Tel: (33)5 61 00 34 67 Fax: (33)5 61 00 34 61

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