Package: gconf2
Version: 2.28.1-6
Tags: patch

Hi,

Attached patch adds support for lists of integers to
update-gconf-defaults. It does so by assuming that any list of numbers
should be treated as integers and not as strings.

The patch applies to the version in squeeze and by the look of
update-gconf-defaults in sid, it should also apply as-is to the latest
version.

Cheers,
-- 
Raphael Geissert - Debian Developer
www.debian.org - get.debian.net
--- unpacked/usr/bin/update-gconf-defaults	2010-10-07 12:04:41.000000000 +0200
+++ /usr/bin/update-gconf-defaults	2016-07-26 10:29:39.964296703 +0200
@@ -9,6 +9,8 @@
 import os,tempfile,shutil,sys
 from optparse import OptionParser
 
+import re
+
 parser = OptionParser()
 parser.add_option("--source", dest="source_dir", default="/usr/share/gconf/defaults",
                   help="directory where to find the defaults", metavar="DIR")
@@ -64,13 +66,27 @@
 def string_entry(value):
   return '  <string>' + htmlescape(value) + '</string>\n'
 
+def int_list_entry(value):
+  ret = '  <list type="int">\n'
+  for v in value[1:-1].split(','):
+    ret += '    <value><int>' + v + '</int></value>\n'
+  ret += '  </list>\n'
+  return ret
+
 def list_entry(value):
+  if is_int_list(value):
+    return int_list_entry(value)
   ret = '  <list type="string">\n'
   for v in value[1:-1].split(','):
     ret += '    <value><string>' + htmlescape(v) + '</string></value>\n'
   ret += '  </list>\n'
   return ret
 
+def is_int_list(value):
+  if re.search('^\[(?:\d+,?)+\]$', value) == None:
+    return False
+  else:
+    return True
 
 def listcmp(a,b):
   """Number of starting similar elements in a and b"""

Reply via email to