aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-util.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-14 11:40:16 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-14 19:12:52 +0800
commit1e663aa13266cad55e5019c03e768a38955166eb (patch)
tree6d7a3e20d3a24f004d0db4ab1c06d8a768b2f112 /e-util/e-util.c
parent3f58ba3d833953c29bb6aa5e1834e2f367f15202 (diff)
downloadgsoc2013-evolution-1e663aa13266cad55e5019c03e768a38955166eb.tar
gsoc2013-evolution-1e663aa13266cad55e5019c03e768a38955166eb.tar.gz
gsoc2013-evolution-1e663aa13266cad55e5019c03e768a38955166eb.tar.bz2
gsoc2013-evolution-1e663aa13266cad55e5019c03e768a38955166eb.tar.lz
gsoc2013-evolution-1e663aa13266cad55e5019c03e768a38955166eb.tar.xz
gsoc2013-evolution-1e663aa13266cad55e5019c03e768a38955166eb.tar.zst
gsoc2013-evolution-1e663aa13266cad55e5019c03e768a38955166eb.zip
Replace EBinding with GBinding.
GObject now does property bindings itself. Requires GLib >= 2.26.
Diffstat (limited to 'e-util/e-util.c')
-rw-r--r--e-util/e-util.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 68662bd3d4..22f792c3a7 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -1494,3 +1494,64 @@ e_util_set_source_combo_box_list (GtkWidget *source_combo_box,
g_object_unref (gconf_client);
}
+/**
+ * e_binding_transform_color_to_string:
+ * @binding: a #GBinding
+ * @source_value: a #GValue of type #GDK_TYPE_COLOR
+ * @target_value: a #GValue of type #G_TYPE_STRING
+ * @user_data: not used
+ *
+ * Transforms a #GdkColor value to a color string specification.
+ *
+ * Returns: %TRUE always
+ **/
+gboolean
+e_binding_transform_color_to_string (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer user_data)
+{
+ const GdkColor *color;
+ gchar *string;
+
+ g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
+
+ color = g_value_get_boxed (source_value);
+ string = gdk_color_to_string (color);
+ g_value_set_string (target_value, string);
+ g_free (string);
+
+ return TRUE;
+}
+
+/**
+ * e_binding_transform_string_to_color:
+ * @binding: a #GBinding
+ * @source_value: a #GValue of type #G_TYPE_STRING
+ * @target_value: a #GValue of type #GDK_TYPE_COLOR
+ * @user_data: not used
+ *
+ * Transforms a color string specification to a #GdkColor.
+ *
+ * Returns: %TRUE if color string specification was valid
+ **/
+gboolean
+e_binding_transform_string_to_color (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer user_data)
+{
+ GdkColor color;
+ const gchar *string;
+ gboolean success = FALSE;
+
+ g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
+
+ string = g_value_get_string (source_value);
+ if (gdk_color_parse (string, &color)) {
+ g_value_set_boxed (target_value, &color);
+ success = TRUE;
+ }
+
+ return success;
+}