[Xfce4-commits] [xfce/libxfce4util] 01/02: Allow language-specific keys before language-neutral ones (Bug #13979)

noreply at xfce.org noreply at xfce.org
Sun Jun 10 19:06:04 CEST 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/libxfce4util.

commit ffc7a0a8bd63c154563f27c268183576e61c9d24
Author: Thomas Lange <thomas-lange2 at gmx.de>
Date:   Thu May 31 22:08:35 2018 +0200

    Allow language-specific keys before language-neutral ones (Bug #13979)
    
    The order of lines in a .desktop file should be irrelevant.
    The two examples below should give the same result.
    
    [Desktop Entry]
    Name[en]=Foo
    Name=Bar
    
    [Desktop Entry]
    Name=Bar
    Name[en]=Foo
    
    However all localized entries were ignored for example one.
    Fix this by using the approach mentioned in the comment:
    Set the language-neutral value to the first language-specific
    value and overwrite it later.
---
 libxfce4util/xfce-rc-simple.c | 25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/libxfce4util/xfce-rc-simple.c b/libxfce4util/xfce-rc-simple.c
index af98987..fbc4db3 100644
--- a/libxfce4util/xfce-rc-simple.c
+++ b/libxfce4util/xfce-rc-simple.c
@@ -184,28 +184,6 @@ simple_add_entry (XfceRcSimple *simple,
 
   if (G_UNLIKELY (entry == NULL))
     {
-      if (locale != NULL) {
-        /* this point is reached when there is a .desktop file that lists a language specific key for something that had no language-neutral key yet.
-           Example:
-             b.desktop
-
-             [Desktop Entry]
-             Version=1.0
-             Name=xyz
-             GenericName[de_AT]=Test
-
-           here GenericName[de_AT] will end up here.
-           The previous way with g_return_val_if_fail would call an assertion failure and terminate the _whole application_(!!).
-
-           Saner ways to react are either just ignoring GenericName[de_AT] altogether, or, alternatively, just set the normal GenericName
-           to Test too (i.e. imply GenericName=Test).
-
-           For now, we are just ignoring the line altogether. But we aren't assert-failing anymore and the apps dont crash anymore.
-           */
-        return NULL;
-      }
-      /* why you annoying macro, will you stop borking libxfceutil? thanks. DO NOT DO THAT: g_return_val_if_fail (locale == NULL, NULL); */
-
       entry         = g_slice_new (Entry);
       entry->key    = g_string_chunk_insert (simple->string_chunk, key);
       entry->value  = g_string_chunk_insert (simple->string_chunk, value);
@@ -225,7 +203,8 @@ simple_add_entry (XfceRcSimple *simple,
           simple->group->elast = entry;
         }
 
-      return entry;
+      if (locale == NULL)
+        return entry;
     }
 
   if (G_UNLIKELY (locale == NULL))

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


More information about the Xfce4-commits mailing list