aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-15 23:28:31 -0500
committerTed Gould <ted@gould.cx>2010-07-15 23:28:31 -0500
commit189a8a9f03912c6a5da2fa040bca71115be925ee (patch)
tree4cee4cbc5fb0d545f9007d6fc50a583866a404e8 /src/indicator-datetime.c
parent56197266a0a3e82b91138988411d5280c96e4569 (diff)
downloadayatana-indicator-datetime-189a8a9f03912c6a5da2fa040bca71115be925ee.tar.gz
ayatana-indicator-datetime-189a8a9f03912c6a5da2fa040bca71115be925ee.tar.bz2
ayatana-indicator-datetime-189a8a9f03912c6a5da2fa040bca71115be925ee.zip
Fleshing out the set and get enum functions.
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index eb8394f..97d559c 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -316,18 +316,45 @@ indicator_datetime_finalize (GObject *object)
return;
}
+/* Turns the int value into a string GVariant */
static GVariant *
bind_enum_set (const GValue * value, const GVariantType * type, gpointer user_data)
{
-
- return NULL;
+ switch (g_value_get_int(value)) {
+ case SETTINGS_TIME_LOCALE:
+ return g_variant_new_string("locale-default");
+ case SETTINGS_TIME_12_HOUR:
+ return g_variant_new_string("12-hour");
+ case SETTINGS_TIME_24_HOUR:
+ return g_variant_new_string("24-hour");
+ case SETTINGS_TIME_CUSTOM:
+ return g_variant_new_string("custom");
+ default:
+ return NULL;
+ }
}
+/* Turns a string GVariant into an int value */
static gboolean
bind_enum_get (GValue * value, GVariant * variant, gpointer user_data)
{
+ const gchar * str = g_variant_get_string(variant, NULL);
+ gint output = 0;
+
+ if (g_strcmp0(str, "locale-default") == 0) {
+ output = SETTINGS_TIME_LOCALE;
+ } else if (g_strcmp0(str, "12-hour") == 0) {
+ output = SETTINGS_TIME_12_HOUR;
+ } else if (g_strcmp0(str, "24-hour") == 0) {
+ output = SETTINGS_TIME_24_HOUR;
+ } else if (g_strcmp0(str, "custom") == 0) {
+ output = SETTINGS_TIME_CUSTOM;
+ } else {
+ return FALSE;
+ }
- return FALSE;
+ g_value_set_int(value, output);
+ return TRUE;
}
static void