diff options
author | Romain Bouvier <skunnyk@alteroot.org> | 2018-11-18 19:33:20 +0100 |
---|---|---|
committer | Romain Bouvier <skunnyk@alteroot.org> | 2018-11-18 19:33:20 +0100 |
commit | 2bee8d9bc3c0fe20937e01b85d332719c18c14d8 (patch) | |
tree | 0507d5b87442f5c0a4c9c3113598887ae7c859b1 | |
parent | 5df804aedbb44c42d050e3865f1af9eac77b89a2 (diff) | |
download | garcon-2bee8d9bc3c0fe20937e01b85d332719c18c14d8.tar.gz |
Support composite XDG_CURRENT_DESKTOP
- Per the Freedesktop specification, XDG_CURRENT_DESKTOP can now
be set with a colon-separated list of strings.
This allow the user to force multiple desktops, for example
XDG_CURRENT_DESKTOP=XFCE:KDE, to display icons from theses 2 desktops.
- This fix bug #14137
-rw-r--r-- | garcon/garcon-menu-item.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/garcon/garcon-menu-item.c b/garcon/garcon-menu-item.c index 04ff2a0..4382e9b 100644 --- a/garcon/garcon-menu-item.c +++ b/garcon/garcon-menu-item.c @@ -1825,8 +1825,9 @@ gboolean garcon_menu_item_get_show_in_environment (GarconMenuItem *item) { const gchar *env; - guint i; + guint i, j; gboolean show = TRUE; + gchar** path = NULL; g_return_val_if_fail (GARCON_IS_MENU_ITEM (item), FALSE); @@ -1838,20 +1839,29 @@ garcon_menu_item_get_show_in_environment (GarconMenuItem *item) if (G_UNLIKELY (env == NULL)) return TRUE; - /* According to the spec there is either a OnlyShowIn or a NotShowIn list */ + /* According to the spec there is either a OnlyShowIn or a NotShowIn list + * The environment can be multiple Desktop Names separated by a colons */ if (G_UNLIKELY (item->priv->only_show_in != NULL)) { /* Check if your environemnt is in OnlyShowIn list */ - for (i = 0, show = FALSE; !show && item->priv->only_show_in[i] != NULL; i++) - if (g_strcmp0 (item->priv->only_show_in[i], env) == 0) - show = TRUE; + show = FALSE; + path = g_strsplit(env, ":", 0); + for (j = 0; path[j] != NULL; j++) + for (i = 0; !show && item->priv->only_show_in[i] != NULL; i++) + if (g_strcmp0 (item->priv->only_show_in[i], path[j]) == 0) + show = TRUE; + g_strfreev(path); } else if (G_UNLIKELY (item->priv->not_show_in != NULL)) { /* Check if your environemnt is in NotShowIn list */ - for (i = 0, show = TRUE; show && item->priv->not_show_in[i] != NULL; i++) - if (g_strcmp0 (item->priv->not_show_in[i], env) == 0) - show = FALSE; + show = TRUE; + path = g_strsplit(env, ":", 0); + for (j = 0; path[j] != NULL; j++) + for (i = 0; show && item->priv->not_show_in[i] != NULL; i++) + if (g_strcmp0 (item->priv->not_show_in[i], path[j]) == 0) + show = FALSE; + g_strfreev(path); } return show; @@ -1863,8 +1873,9 @@ gboolean garcon_menu_item_only_show_in_environment (GarconMenuItem *item) { const gchar *env; - guint i; + guint i, j; gboolean show = FALSE; + gchar** path = NULL; g_return_val_if_fail (GARCON_IS_MENU_ITEM (item), FALSE); @@ -1879,9 +1890,12 @@ garcon_menu_item_only_show_in_environment (GarconMenuItem *item) if (G_UNLIKELY (item->priv->only_show_in != NULL)) { /* Check if your environemnt is in OnlyShowIn list */ - for (i = 0, show = FALSE; !show && item->priv->only_show_in[i] != NULL; i++) - if (g_strcmp0 (item->priv->only_show_in[i], env) == 0) - show = TRUE; + show = FALSE; + path = g_strsplit(env, ":", 0); + for (j= 0; path[j] != NULL; j++) + for (i = 0; !show && item->priv->only_show_in[i] != NULL; i++) + if (g_strcmp0 (item->priv->only_show_in[i], path[j]) == 0) + show = TRUE; } return show; |