AppInfo: use XDG_CURRENT_DESKTOP for OnlyShowIn
authorRyan Lortie <desrt@desrt.ca>
Thu, 8 May 2014 12:57:50 +0000 (08:57 -0400)
committerRyan Lortie <desrt@desrt.ca>
Thu, 8 May 2014 20:19:56 +0000 (16:19 -0400)
commit5a5e16e93c4f11e635918ecdb41681f63fd05a39
tree96b7117e5928a69ab4ea10c7089e504ae8e72ccc
parent880e8e8cb254e8c0c8a4bb62ebb606404818b52b
AppInfo: use XDG_CURRENT_DESKTOP for OnlyShowIn

Expand the functionality of g_desktop_app_info_set_desktop_env() to
include the possibility of passing strings containing ':' characters (as
some apps, such as gnome-session, are directly passing the value of
XDG_CURRENT_DESKTOP).  At the same time, deprecate it, since now we get
the list from the environment variable for ourselves.

Modify the checks in g_desktop_app_info_get_show_in() to deal with
multiple items listed in XDG_CURRENT_DESKTOP.  For example, if we find
that we have

  XDG_CURRENT_DESKTOP=GNOME-Classic:GNOME

and a desktop file contains:

  OnlyShowIn=GNOME

then we will show this file because of the fallback to GNOME.  If the
file _also_ contains the line:

  NotShowIn=GNOME-Classic

Then we will not show it, because GNOME-Classic comes before GNOME in
XDG_CURRENT_DESKTOP.

https://bugzilla.gnome.org/show_bug.cgi?id=729813
gio/gdesktopappinfo.c
gio/gdesktopappinfo.h