[Xfce4-commits] [xfce/garcon] 02/04: Support composite XDG_CURRENT_DESKTOP

noreply at xfce.org noreply at xfce.org
Sun Nov 18 20:29:13 CET 2018


This is an automated email from the git hooks/post-receive script.

s   k   u   n   n   y   k       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/garcon.

commit 2bee8d9bc3c0fe20937e01b85d332719c18c14d8
Author: Romain Bouvier <skunnyk at alteroot.org>
Date:   Sun Nov 18 19:33:20 2018 +0100

    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
---
 garcon/garcon-menu-item.c | 38 ++++++++++++++++++++++++++------------
 1 file 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;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list