After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 304147 - gtksourceview does_obey XDG_DATA_DIRS
gtksourceview does_obey XDG_DATA_DIRS
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
1.2.x
Other All
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks: 523057
 
 
Reported: 2005-05-14 04:46 UTC by Ben Maurer
Modified: 2009-10-13 17:33 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
Proposed patch against CVS HEAD (v1) (2.42 KB, patch)
2005-06-21 18:20 UTC, Paolo Maggi
none Details | Review
patch (2.43 KB, patch)
2005-10-09 16:35 UTC, Paolo Borelli
none Details | Review
committed patch (2.68 KB, patch)
2005-11-14 16:48 UTC, Paolo Borelli
none Details | Review

Description Ben Maurer 2005-05-14 04:46:35 UTC
Please describe the problem:
gtksourceview should try to get .lang files from XDG_DATA_DIRS per the spec.
This allows people to make programs in prefixes work correctly

Steps to reproduce:
Configure an app that installs to a prefix and has a .lang file. Note it doesn't
work.

Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Paolo Maggi 2005-06-21 18:20:53 UTC
Created attachment 48119 [details] [review]
Proposed patch against CVS HEAD (v1)
Comment 2 Paolo Borelli 2005-06-21 18:37:09 UTC
looks mostly good, but I know little about XDG_DATA_DIRS.

Ben does the patch suits your needs?

The only doubt I have is if the orders in which we add the dirs matter: in that
case XDG_DATA_DIR should be prepended *after* DATADIR, so that we firts look in
~, then in XDG and finally fall back to /usr.

As a nitpick, it may also be worth do something like this:

#define LANGUAGE_DIR			"/gtksourceview-1.0/language-specs"
#define DEFAULT_LANGUAGE_DIR		DATADIR LANGUAGE_DIR
#define USER_LANGUAGE_DIR		LANGUAGE_DIR

and use LANGUAGE_DIR also for XDG instead of hardcoding
"/gtksourceview-1.0/language-specs"
Comment 3 Ben Maurer 2005-06-22 00:50:51 UTC
In terms of order, the user's home directory should come *before* the /usr one.
This allows them to override system preferences.

Also, what aobut XDG_DATA_HOME?

Other than that, I think I am happy.
Comment 4 Paolo Borelli 2005-06-22 06:26:24 UTC
> In terms of order, the user's home directory should come *before* the /usr one.

That's exactly what I meant: since we are *prepending* to the list,we should add
it last so that it is the first one checked :-)
Comment 5 Paolo Borelli 2005-06-23 19:44:44 UTC
Now that I think of it the patch is pretty much bogus: XDG_DATA_DIR should not
be obtained with g_getenv, since it may also be a list of dirs separated by ":".

Glib has an apposite function: g_get_user_data_dir ()
Comment 6 Paolo Borelli 2005-06-23 19:52:04 UTC
or maybe g_get_system_data_dirs ().

paolo: /me is confused so I'm not going to cook up a quick patch right now as I
said on irc
Comment 7 Jeroen Zwartepoorte 2005-08-05 11:37:59 UTC
g_get_user_data_dir () returns either XDG_DATA_HOME or ~/.local/share if it's
not set.

g_get_system_data_dirs () returns either XDG_DATA_DIRS or
"/usr/local/share/:/usr/share/" if not set.

So gtksourceview should use the latter one to look for .lang files.
Comment 8 Paolo Borelli 2005-10-09 16:35:04 UTC
Created attachment 53254 [details] [review]
patch

Here is the patch, works nicely for me and should make life easier for win32.
Comment 9 Paolo Borelli 2005-11-14 16:48:20 UTC
Created attachment 54741 [details] [review]
committed patch

fixed by committing this patch (which adds the directories specified in
XDG_DATA_DIRS in the right order)
Comment 10 Paolo Borelli 2005-11-15 23:46:45 UTC
The above patch contains a silly of by one error in the xdg directory lookup :(

I already committed the fix since it's obvious (drop the - 1 from the for loop).

Paolo do you want me to roll a 1.5.2 for this?