diff options
-rw-r--r-- | data/eom-preferences-dialog.ui | 2 | ||||
-rw-r--r-- | src/eom-preferences-dialog.c | 30 |
2 files changed, 16 insertions, 16 deletions
diff --git a/data/eom-preferences-dialog.ui b/data/eom-preferences-dialog.ui index 0dc8945..5f3785e 100644 --- a/data/eom-preferences-dialog.ui +++ b/data/eom-preferences-dialog.ui @@ -304,7 +304,9 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_alpha">True</property> <property name="title" translatable="yes">Color for Transparent Areas</property> + <property name="rgba">rgb(0,0,0)</property> </object> <packing> <property name="position">1</property> diff --git a/src/eom-preferences-dialog.c b/src/eom-preferences-dialog.c index 24596d3..1c2eb5b 100644 --- a/src/eom-preferences-dialog.c +++ b/src/eom-preferences-dialog.c @@ -55,15 +55,15 @@ struct _EomPreferencesDialogPrivate { static GObject *instance = NULL; static gboolean -pd_string_to_color_mapping (GValue *value, +pd_string_to_rgba_mapping (GValue *value, GVariant *variant, gpointer user_data) { - GdkColor color; + GdkRGBA color; g_return_val_if_fail (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING), FALSE); - if (gdk_color_parse (g_variant_get_string (variant, NULL), &color)) { + if (gdk_rgba_parse (&color, g_variant_get_string (variant, NULL))) { g_value_set_boxed (value, &color); return TRUE; } @@ -72,23 +72,21 @@ pd_string_to_color_mapping (GValue *value, } static GVariant* -pd_color_to_string_mapping (const GValue *value, +pd_rgba_to_string_mapping (const GValue *value, const GVariantType *expected_type, gpointer user_data) { GVariant *variant = NULL; - GdkColor *color; + GdkRGBA *color; gchar *hex_val; - g_return_val_if_fail (G_VALUE_TYPE (value) == GDK_TYPE_COLOR, NULL); + g_return_val_if_fail (G_VALUE_TYPE (value) == GDK_TYPE_RGBA, NULL); g_return_val_if_fail (g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING), NULL); color = g_value_get_boxed (value); - hex_val = g_strdup_printf ("#%02X%02X%02X", - color->red / 256, - color->green / 256, - color->blue / 256); + hex_val = gdk_rgba_to_string(color); + variant = g_variant_new_string (hex_val); g_free (hex_val); @@ -211,10 +209,10 @@ eom_preferences_dialog_constructor (GType type, g_settings_bind_with_mapping (priv->view_settings, EOM_CONF_VIEW_BACKGROUND_COLOR, - bg_color_button, "color", + bg_color_button, "rgba", G_SETTINGS_BIND_DEFAULT, - pd_string_to_color_mapping, - pd_color_to_string_mapping, + pd_string_to_rgba_mapping, + pd_rgba_to_string_mapping, NULL, NULL); g_object_set_data (G_OBJECT (color_radio), @@ -263,10 +261,10 @@ eom_preferences_dialog_constructor (GType type, g_settings_bind_with_mapping (priv->view_settings, EOM_CONF_VIEW_TRANS_COLOR, - color_button, "color", + color_button, "rgba", G_SETTINGS_BIND_DEFAULT, - pd_string_to_color_mapping, - pd_color_to_string_mapping, + pd_string_to_rgba_mapping, + pd_rgba_to_string_mapping, NULL, NULL); g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_UPSCALE, |