From 132815e5f921e9b54d3e56d17fdf48fbe1732c06 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Mon, 8 Aug 2011 19:27:09 +0300 Subject: gsettings-data-convert: Attempt conversion to unsigned int When we find an integer in GConf, and the gsettings key has unsigned int type, try to do the right thing. --- gsettings/gsettings-data-convert.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gsettings/gsettings-data-convert.c b/gsettings/gsettings-data-convert.c index 3c52bc20..0d3c8c27 100644 --- a/gsettings/gsettings-data-convert.c +++ b/gsettings/gsettings-data-convert.c @@ -36,6 +36,20 @@ static gboolean dry_run = FALSE; extern const gchar *gconf_value_type_to_string (int type); +static gboolean +type_uint32 (GSettings *settings, + const gchar *key) +{ + const GVariantType *type; + GVariant *value; + + value = g_settings_get_value (settings, key); + type = g_variant_get_type (value); + g_variant_unref (value); + + return g_variant_type_equal (type, G_VARIANT_TYPE_UINT32); +} + static gboolean handle_file (const gchar *filename) { @@ -166,6 +180,9 @@ handle_file (const gchar *filename) g_settings_set_enum (settings, keys[j], gconf_value_get_int (value)); else if (strcmp (type, "flags") == 0) g_settings_set_flags (settings, keys[j], gconf_value_get_int (value)); + else if (type_uint32 (settings, keys[j])) + g_settings_set (settings, keys[j], "u", + gconf_value_get_int (value)); else g_settings_set (settings, keys[j], "i", gconf_value_get_int (value)); -- cgit v1.2.1