summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/eom-scroll-view.c47
-rw-r--r--src/eom-window.c39
2 files changed, 47 insertions, 39 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c
index 374dd8e..44886c6 100644
--- a/src/eom-scroll-view.c
+++ b/src/eom-scroll-view.c
@@ -11,6 +11,7 @@
#endif
#include "eom-config-keys.h"
+#include "eom-enum-types.h"
#include "eom-marshal.h"
#include "eom-scroll-view.h"
#include "eom-debug.h"
@@ -85,6 +86,7 @@ enum {
PROP_BACKGROUND_COLOR,
PROP_SCROLLWHEEL_ZOOM,
PROP_TRANSP_COLOR,
+ PROP_TRANSPARENCY_STYLE,
PROP_USE_BG_COLOR,
PROP_ZOOM_MULTIPLIER
};
@@ -2194,6 +2196,7 @@ eom_scroll_view_set_transparency (EomScrollView *view,
if (priv->transp_style != style) {
priv->transp_style = style;
_transp_background_changed (view);
+ g_object_notify (G_OBJECT (view), "transparency-style");
}
}
@@ -2450,6 +2453,32 @@ sv_color_to_string_mapping (const GValue *value,
return variant;
}
+static gboolean
+sv_string_to_transp_mapping (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ const gchar *str;
+
+ g_return_val_if_fail (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING), FALSE);
+
+ str = g_variant_get_string (variant, NULL);
+
+ if (!str)
+ return FALSE;
+
+ if (g_ascii_strcasecmp (str, "COLOR") == 0)
+ g_value_set_enum (value, EOM_TRANSP_COLOR);
+ else if (g_ascii_strcasecmp (str, "CHECK_PATTERN") == 0)
+ g_value_set_enum (value, EOM_TRANSP_CHECKED);
+ else if (g_ascii_strcasecmp (str, "NONE") == 0)
+ g_value_set_enum (value, EOM_TRANSP_BACKGROUND);
+ else
+ return FALSE;
+
+ return TRUE;
+}
+
static void
eom_scroll_view_init (EomScrollView *view)
{
@@ -2571,6 +2600,11 @@ eom_scroll_view_init (EomScrollView *view)
G_SETTINGS_BIND_GET,
sv_string_to_color_mapping,
sv_color_to_string_mapping, NULL, NULL);
+ g_settings_bind_with_mapping (settings, EOM_CONF_VIEW_TRANSPARENCY,
+ view, "transparency-style",
+ G_SETTINGS_BIND_GET,
+ sv_string_to_transp_mapping,
+ NULL, NULL, NULL);
g_object_unref (settings);
priv->override_bg_color = NULL;
@@ -2655,6 +2689,9 @@ eom_scroll_view_get_property (GObject *object, guint property_id,
case PROP_SCROLLWHEEL_ZOOM:
g_value_set_boolean (value, priv->scroll_wheel_zoom);
break;
+ case PROP_TRANSPARENCY_STYLE:
+ g_value_set_enum (value, priv->transp_style);
+ break;
case PROP_ZOOM_MULTIPLIER:
g_value_set_double (value, priv->zoom_multiplier);
break;
@@ -2697,6 +2734,9 @@ eom_scroll_view_set_property (GObject *object, guint property_id,
case PROP_TRANSP_COLOR:
eom_scroll_view_set_transparency_color (view, g_value_get_boxed (value));
break;
+ case PROP_TRANSPARENCY_STYLE:
+ eom_scroll_view_set_transparency (view, g_value_get_enum (value));
+ break;
case PROP_ZOOM_MULTIPLIER:
eom_scroll_view_set_zoom_multiplier (view, g_value_get_double (value));
break;
@@ -2764,6 +2804,13 @@ eom_scroll_view_class_init (EomScrollViewClass *klass)
GDK_TYPE_COLOR,
G_PARAM_WRITABLE | G_PARAM_STATIC_NAME));
+ g_object_class_install_property (
+ gobject_class, PROP_TRANSPARENCY_STYLE,
+ g_param_spec_enum ("transparency-style", NULL, NULL,
+ EOM_TYPE_TRANSPARENCY_STYLE,
+ EOM_TRANSP_CHECKED,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
+
view_signals [SIGNAL_ZOOM_CHANGED] =
g_signal_new ("zoom_changed",
EOM_TYPE_SCROLL_VIEW,
diff --git a/src/eom-window.c b/src/eom-window.c
index e00897b..7daa08f 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -226,37 +226,6 @@ eom_window_error_quark (void)
}
static void
-eom_window_transparency_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
-{
- EomWindowPrivate *priv;
- gchar *value = NULL;
-
- g_return_if_fail (EOM_IS_WINDOW (user_data));
-
- eom_debug (DEBUG_PREFERENCES);
-
- priv = EOM_WINDOW (user_data)->priv;
-
- g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view));
-
- value = g_settings_get_string (settings, key);
-
- if (value == NULL) {
- return;
- } else if (g_ascii_strcasecmp (value, "COLOR") == 0) {
- eom_scroll_view_set_transparency (EOM_SCROLL_VIEW (priv->view),
- EOM_TRANSP_COLOR);
- } else if (g_ascii_strcasecmp (value, "CHECK_PATTERN") == 0) {
- eom_scroll_view_set_transparency (EOM_SCROLL_VIEW (priv->view),
- EOM_TRANSP_CHECKED);
- } else {
- eom_scroll_view_set_transparency (EOM_SCROLL_VIEW (priv->view),
- EOM_TRANSP_BACKGROUND);
- }
- g_free (value);
-}
-
-static void
eom_window_collection_mode_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
{
EomWindowPrivate *priv;
@@ -4413,9 +4382,6 @@ eom_window_construct_ui (EomWindow *window)
gtk_box_pack_end (GTK_BOX (priv->cbox), priv->layout, TRUE, TRUE, 0);
- eom_window_transparency_changed_cb (priv->view_settings,
- EOM_CONF_VIEW_TRANSPARENCY,
- window);
eom_window_collection_mode_changed_cb (priv->ui_settings,
EOM_CONF_UI_IMAGE_COLLECTION_POSITION,
window);
@@ -4455,11 +4421,6 @@ eom_window_init (EomWindow *window)
priv->fullscreen_settings = g_settings_new (EOM_CONF_FULLSCREEN);
priv->lockdown_settings = g_settings_new (EOM_CONF_LOCKDOWN_SCHEMA);
- g_signal_connect (priv->view_settings,
- "changed::" EOM_CONF_VIEW_TRANSPARENCY,
- G_CALLBACK (eom_window_transparency_changed_cb),
- window);
-
g_signal_connect (priv->ui_settings,
"changed::" EOM_CONF_UI_IMAGE_COLLECTION_POSITION,
G_CALLBACK (eom_window_collection_mode_changed_cb),