Commit 5cea1c86 authored by Marc-Antoine Perennou's avatar Marc-Antoine Perennou
parent 210a9796
......@@ -2614,8 +2614,12 @@ g_settings_get_boolean
g_settings_set_boolean
g_settings_get_int
g_settings_set_int
g_settings_get_int64
g_settings_set_int64
g_settings_get_uint
g_settings_set_uint
g_settings_get_uint64
g_settings_set_uint64
g_settings_get_double
g_settings_set_double
g_settings_get_string
......
......@@ -1873,6 +1873,62 @@ g_settings_set_int (GSettings *settings,
return g_settings_set_value (settings, key, g_variant_new_int32 (value));
}
/**
* g_settings_get_int64:
* @settings: a #GSettings object
* @key: the key to get the value for
*
* Gets the value that is stored at @key in @settings.
*
* A convenience variant of g_settings_get() for 64-bit integers.
*
* It is a programmer error to give a @key that isn't specified as
* having a int64 type in the schema for @settings.
*
* Returns: a 64-bit integer
*
* Since: 2.50
*/
gint64
g_settings_get_int64 (GSettings *settings,
const gchar *key)
{
GVariant *value;
gint64 result;
value = g_settings_get_value (settings, key);
result = g_variant_get_int64 (value);
g_variant_unref (value);
return result;
}
/**
* g_settings_set_int64:
* @settings: a #GSettings object
* @key: the name of the key to set
* @value: the value to set it to
*
* Sets @key in @settings to @value.
*
* A convenience variant of g_settings_set() for 64-bit integers.
*
* It is a programmer error to give a @key that isn't specified as
* having a int64 type in the schema for @settings.
*
* Returns: %TRUE if setting the key succeeded,
* %FALSE if the key was not writable
*
* Since: 2.50
*/
gboolean
g_settings_set_int64 (GSettings *settings,
const gchar *key,
gint64 value)
{
return g_settings_set_value (settings, key, g_variant_new_int64 (value));
}
/**
* g_settings_get_uint:
* @settings: a #GSettings object
......@@ -1931,6 +1987,64 @@ g_settings_set_uint (GSettings *settings,
return g_settings_set_value (settings, key, g_variant_new_uint32 (value));
}
/**
* g_settings_get_uint64:
* @settings: a #GSettings object
* @key: the key to get the value for
*
* Gets the value that is stored at @key in @settings.
*
* A convenience variant of g_settings_get() for 64-bit unsigned
* integers.
*
* It is a programmer error to give a @key that isn't specified as
* having a uint64 type in the schema for @settings.
*
* Returns: a 64-bit unsigned integer
*
* Since: 2.50
*/
guint64
g_settings_get_uint64 (GSettings *settings,
const gchar *key)
{
GVariant *value;
guint64 result;
value = g_settings_get_value (settings, key);
result = g_variant_get_uint64 (value);
g_variant_unref (value);
return result;
}
/**
* g_settings_set_uint64:
* @settings: a #GSettings object
* @key: the name of the key to set
* @value: the value to set it to
*
* Sets @key in @settings to @value.
*
* A convenience variant of g_settings_set() for 64-bit unsigned
* integers.
*
* It is a programmer error to give a @key that isn't specified as
* having a uint64 type in the schema for @settings.
*
* Returns: %TRUE if setting the key succeeded,
* %FALSE if the key was not writable
*
* Since: 2.50
*/
gboolean
g_settings_set_uint64 (GSettings *settings,
const gchar *key,
guint64 value)
{
return g_settings_set_value (settings, key, g_variant_new_uint64 (value));
}
/**
* g_settings_get_double:
* @settings: a #GSettings object
......
......@@ -138,6 +138,13 @@ GLIB_AVAILABLE_IN_ALL
gboolean g_settings_set_int (GSettings *settings,
const gchar *key,
gint value);
GLIB_AVAILABLE_IN_2_50
gint64 g_settings_get_int64 (GSettings *settings,
const gchar *key);
GLIB_AVAILABLE_IN_2_50
gboolean g_settings_set_int64 (GSettings *settings,
const gchar *key,
gint64 value);
GLIB_AVAILABLE_IN_2_32
guint g_settings_get_uint (GSettings *settings,
const gchar *key);
......@@ -145,6 +152,13 @@ GLIB_AVAILABLE_IN_2_32
gboolean g_settings_set_uint (GSettings *settings,
const gchar *key,
guint value);
GLIB_AVAILABLE_IN_2_50
guint64 g_settings_get_uint64 (GSettings *settings,
const gchar *key);
GLIB_AVAILABLE_IN_2_50
gboolean g_settings_set_uint64 (GSettings *settings,
const gchar *key,
guint64 value);
GLIB_AVAILABLE_IN_ALL
gchar * g_settings_get_string (GSettings *settings,
const gchar *key);
......
......@@ -1180,6 +1180,16 @@ test_simple_binding (void)
g_object_get (obj, "uint", &u, NULL);
g_assert_cmpuint (u, ==, 54321);
g_settings_bind (settings, "uint64", obj, "uint64", G_SETTINGS_BIND_DEFAULT);
g_object_set (obj, "uint64", 12345, NULL);
g_assert_cmpuint (g_settings_get_uint64 (settings, "uint64"), ==, 12345);
g_settings_set_uint64 (settings, "uint64", 54321);
u = 1111;
g_object_get (obj, "uint64", &u, NULL);
g_assert_cmpuint (u, ==, 54321);
g_settings_bind (settings, "int64", obj, "int64", G_SETTINGS_BIND_DEFAULT);
g_object_set (obj, "int64", (gint64) G_MAXINT64, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment