diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-02-19 09:36:04 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-02-19 09:36:04 +0800 |
commit | fd564be3203400024147469faaa7de0884861566 (patch) | |
tree | 80e69ff89307a7393193520e0f2fe51cdc21540e /e-util/e-binding.c | |
parent | 7ed5f59771262651ee8b0d29a123e43a6ac0b6c6 (diff) | |
download | gsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.tar.gz gsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.tar.zst gsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.zip |
Clean up the EMFormat stack. Add some GObject properties to bind to.
Add some handy color conversion functions to e-util.
svn path=/branches/kill-bonobo/; revision=37290
Diffstat (limited to 'e-util/e-binding.c')
-rw-r--r-- | e-util/e-binding.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/e-util/e-binding.c b/e-util/e-binding.c index 26e62c6a23..26e23ee792 100644 --- a/e-util/e-binding.c +++ b/e-util/e-binding.c @@ -480,3 +480,55 @@ e_mutual_binding_unbind (EMutualBinding *binding) g_signal_handler_disconnect ( binding->reverse.dst_object, binding->direct.handler); } + +/** + * e_binding_transform_color_to_string: + * @src_value: a #GValue of type #GDK_TYPE_COLOR + * @dst_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 (const GValue *src_value, + GValue *dst_value, + gpointer user_data) +{ + const GdkColor *color; + gchar *string; + + color = g_value_get_boxed (src_value); + string = gdk_color_to_string (color); + g_value_set_string (dst_value, string); + g_free (string); + + return TRUE; +} + +/** + * e_binding_transform_string_to_color: + * @src_value: a #GValue of type #G_TYPE_STRING + * @dst_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 (const GValue *src_value, + GValue *dst_value, + gpointer user_data) +{ + GdkColor color; + const gchar *string; + gboolean success; + + string = g_value_get_string (src_value); + if (gdk_color_parse (string, &color)) + g_value_set_boxed (dst_value, &color); + + return success; +} |