Skip to content

Commit

Permalink
Merge pull request #54 from monich/double
Browse files Browse the repository at this point in the history
Accept floating point values from dconf
  • Loading branch information
monich committed Aug 25, 2014
2 parents cf2acb4 + b9718b5 commit 13ef593
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mms-settings-dconf/src/mms_settings_dconf.c
Expand Up @@ -104,12 +104,20 @@ mms_settings_dconf_get_uint32(
} else if (klass == G_VARIANT_CLASS_UINT64) {
guint64 u64 = g_variant_get_uint64(variant);
if (u64 <= UINT_MAX) {
*value = (guint32)u64;
*value = (unsigned int)u64;
return TRUE;
}
} else if (klass == G_VARIANT_CLASS_DOUBLE) {
gdouble d = g_variant_get_double(variant);
if (d >= 0.0 && d <= (double)UINT_MAX) {
*value = (unsigned int)d;
return TRUE;
}
} else {
MMS_ERR("Unexpected variant type \'%c\'", (char)klass);
return FALSE;
}
MMS_ERR("Unable to convert variant type \'%c\'", (char)klass);
}
return FALSE;
}
Expand Down

0 comments on commit 13ef593

Please sign in to comment.