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
This commit is contained in:
Ryan Lortie
2014-05-08 08:57:50 -04:00
parent 880e8e8cb2
commit 5a5e16e93c
2 changed files with 50 additions and 51 deletions

View File

@@ -71,7 +71,7 @@ GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_
GLIB_AVAILABLE_IN_ALL
gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_42
void g_desktop_app_info_set_desktop_env (const char *desktop_env);
GLIB_AVAILABLE_IN_2_36