aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2011-11-17 22:55:48 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-11-17 22:55:48 +0800
commit900d019a0332b24d2bee7ea1407b149fca2c0598 (patch)
tree627edf5d63874be616d41c9a043571a80fc542f5 /e-util
parentcdb09641dc6be772931e5381cdf1e6a824a15684 (diff)
parentbadc11edcf5e73bc6148c7b5cdccee739eb9d7ae (diff)
downloadgsoc2013-evolution-900d019a0332b24d2bee7ea1407b149fca2c0598.tar.gz
gsoc2013-evolution-900d019a0332b24d2bee7ea1407b149fca2c0598.tar.zst
gsoc2013-evolution-900d019a0332b24d2bee7ea1407b149fca2c0598.zip
Merge branch 'master' into wip/gsettings
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-datetime-format.c22
-rw-r--r--e-util/e-datetime-format.h1
-rw-r--r--e-util/e-util.c74
-rw-r--r--e-util/e-util.h12
4 files changed, 24 insertions, 85 deletions
diff --git a/e-util/e-datetime-format.c b/e-util/e-datetime-format.c
index c21d025794..877b170218 100644
--- a/e-util/e-datetime-format.c
+++ b/e-util/e-datetime-format.c
@@ -662,3 +662,25 @@ e_datetime_format_format_tm (const gchar *component,
return res;
}
+
+gboolean
+e_datetime_format_includes_day_name (const gchar *component, const gchar *part, DTFormatKind kind)
+{
+ gchar *key;
+ const gchar *fmt;
+ gboolean res;
+
+ g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (*component != 0, FALSE);
+
+ key = gen_key (component, part, kind);
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ fmt = get_format_internal (key, kind);
+
+ res = fmt && (strstr (fmt, "%a") != NULL || strstr (fmt, "%A") != NULL);
+
+ g_free (key);
+
+ return res;
+}
diff --git a/e-util/e-datetime-format.h b/e-util/e-datetime-format.h
index 2c19c65133..28eed151b3 100644
--- a/e-util/e-datetime-format.h
+++ b/e-util/e-datetime-format.h
@@ -39,6 +39,7 @@ void e_datetime_format_add_setup_widget (GtkWidget *table, gint row, const gchar
gchar *e_datetime_format_format (const gchar *component, const gchar *part, DTFormatKind kind, time_t value);
gchar *e_datetime_format_format_tm (const gchar *component, const gchar *part, DTFormatKind kind, struct tm *tm_time);
+gboolean e_datetime_format_includes_day_name (const gchar *component, const gchar *part, DTFormatKind kind);
G_END_DECLS
diff --git a/e-util/e-util.c b/e-util/e-util.c
index cda17cbbc9..d41f43630e 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -1440,80 +1440,6 @@ e_binding_transform_string_to_color (GBinding *binding,
}
/**
- * e_binding_transform_enum_value_to_nick:
- * @binding: a #GBinding
- * @source_value: a #GValue whose type is derived from #G_TYPE_ENUM
- * @target_value: a #GValue of type #G_TYPE_STRING
- * @not_used: not used
- *
- * Transforms an enumeration value to its corresponding nickname.
- *
- * Returns: %TRUE if the enum value has a corresponding nickname
- **/
-gboolean
-e_binding_transform_enum_value_to_nick (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer not_used)
-{
- GEnumClass *enum_class;
- GEnumValue *enum_value;
- gint value;
- gboolean success = FALSE;
-
- g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
-
- enum_class = g_type_class_peek (G_VALUE_TYPE (source_value));
- g_return_val_if_fail (G_IS_ENUM_CLASS (enum_class), FALSE);
-
- value = g_value_get_enum (source_value);
- enum_value = g_enum_get_value (enum_class, value);
- if (enum_value != NULL) {
- g_value_set_string (target_value, enum_value->value_nick);
- success = TRUE;
- }
-
- return success;
-}
-
-/**
- * e_binding_transform_enum_nick_to_value:
- * @binding: a #GBinding
- * @source_value: a #GValue of type #G_TYPE_STRING
- * @target_value: a #GValue whose type is derived from #G_TYPE_ENUM
- * @not_used: not_used
- *
- * Transforms an enumeration nickname to its corresponding value.
- *
- * Returns: %TRUE if the enum nickname has a corresponding value
- **/
-gboolean
-e_binding_transform_enum_nick_to_value (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer not_used)
-{
- GEnumClass *enum_class;
- GEnumValue *enum_value;
- const gchar *string;
- gboolean success = FALSE;
-
- g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
-
- enum_class = g_type_class_peek (G_VALUE_TYPE (target_value));
- g_return_val_if_fail (G_IS_ENUM_CLASS (enum_class), FALSE);
-
- string = g_value_get_string (source_value);
- enum_value = g_enum_get_value_by_nick (enum_class, string);
- if (enum_value != NULL) {
- g_value_set_enum (target_value, enum_value->value);
- success = TRUE;
- }
-
- return success;
-}
-
-/**
* e_binding_transform_source_to_uid:
* @binding: a #GBinding
* @source_value: a #GValue of type #E_TYPE_SOURCE
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 1117781186..de2a817171 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -137,7 +137,7 @@ void e_util_set_source_combo_box_list
(GtkWidget *source_combo_box,
const gchar *source_gconf_path);
-/* Useful GBinding transformation functions */
+/* Useful GBinding transform functions */
gboolean e_binding_transform_color_to_string
(GBinding *binding,
const GValue *source_value,
@@ -148,16 +148,6 @@ gboolean e_binding_transform_string_to_color
const GValue *source_value,
GValue *target_value,
gpointer not_used);
-gboolean e_binding_transform_enum_value_to_nick
- (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer not_used);
-gboolean e_binding_transform_enum_nick_to_value
- (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer not_used);
gboolean e_binding_transform_source_to_uid
(GBinding *binding,
const GValue *source_value,