Re: Two newbie questions

Carlos Franke <[email protected]> Thu, 16 May 2013 11:10:26 +0200
Newsgroups gmane.comp.gnome.glade.user
Message-ID <1368695430.2947.0@Brett>
Sorry for bringing this month-old thread up again. I just did not get  
to it earlier. Anyway, here are my two cents.

Ma Xiaojun wrote:
> 1. Where is the correct location to install .glade/.ui files with
> regard to FHS or some freedesktop.org standards?

and:
> On Sun, Apr 7, 2013 at 7:23 PM, Tristan Van Berkom
> <[email protected]> wrote:
> > Rather, I would encourage you to use GResources to bind
> > the XML into your app or library and use  
> gtk_builder_add_from_resource().
> > (note that GResources allows for a compression option too).
> 
> This is available since GTK+ 3.4, I'm on GTK+ 2.24 though.

First, I am very grateful for the hint to GResources. I wonder if  
embedding the glade files in the binaries would somehow allow for an  
easier way of UI localisation (i. e. translation of strings). On the  
first glance it appears that one would still have to maintain separate  
glade files for every supported language, just that they wouldn't all  
have to be installed in the file sytem, but in the executables (which  
might not be a good thing, as the executables would grow bigger with  
every supported translation). I may be missing something.	

Second, for installation in the file system, the right place for glade  
files is probably the one specified in the $XDG_DATA_DIRS environment  
variable*, usually /usr/share. There is a Glib utility function to get  
the right directories, so they do not need to be hard-coded. In gtkmm,  
it is called Glib::get_system_data_dirs(), don't know about GTK+.
* http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

There is also this four year old video explaining a way to embed glade  
files in executables:
http://www.youtube.com/watch?v=5-8h6eOwKwA
I don't know if this way is any good. On 2 Aug 2011 the above quoted  
Tristan Van Berkom had this to say about it:
“Sure you can do that, unfortunately it means any graphic files in the  
Glade file need to be specified by full path, because GtkBuilder  
currently only uses the file load location to resolve relative paths  
for loaded resources (something that could/should be easily fixed in  
GtkBuilder).”
(http://lists.ximian.com/pipermail/glade-users/2011-August/005355.html)

Carlos

_______________________________________________
Glade-users maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/glade-users
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iEYEABECAAYFAlGUooYACgkQ4K8q+2fhBpernACeJF1FudesCKFzFfBMkDjc9f0D
HE8An1uW17Mckr998ojDqXFCNP0q5fUH
=i4/q
-----END PGP SIGNATURE-----