summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Riemann <[email protected]>2017-04-22 11:17:50 +0200
committerraveit65 <[email protected]>2017-04-23 12:02:57 +0200
commitf6783576e848cb09b8a251a1df235ec9f08d07ae (patch)
tree99072cad6b3cf42b30c99fa71e8a4806bc1a011a /src
parent8d7af89c01357a7a676ff9eb845120c586b246c6 (diff)
downloadeom-f6783576e848cb09b8a251a1df235ec9f08d07ae.tar.bz2
eom-f6783576e848cb09b8a251a1df235ec9f08d07ae.tar.xz
EomPropertiesDialog: Allow RGBA for transparent background color
Now that it is supported in EomScrollView there's no reason not to allow setting an alpha value for the color. taken from: https://git.gnome.org/browse/eog/commit/?id=7d2cf4d
Diffstat (limited to 'src')
-rw-r--r--src/eom-preferences-dialog.c30
1 files changed, 14 insertions, 16 deletions
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,