summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-27 15:57:15 +0200
committerinfirit <[email protected]>2014-07-27 21:16:30 +0200
commit7a1720ee8a365ae6418de438d4c42068bf9a97d5 (patch)
tree3bb15008cb9c6e3774734738225f4ddaf63de8e2
parentf9308d5f86250219e6bf35208e517780d2de2772 (diff)
downloadeom-7a1720ee8a365ae6418de438d4c42068bf9a97d5.tar.bz2
eom-7a1720ee8a365ae6418de438d4c42068bf9a97d5.tar.xz
Switch scrollwheel zoom setting with GSettings
Based on eog commit 8c7cf9f8938673eda2843be650b558084b44303e From Felix Riemann <[email protected]>
-rw-r--r--src/eom-scroll-view.c19
-rw-r--r--src/eom-window.c30
2 files changed, 19 insertions, 30 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c
index 664d819..52bce7e 100644
--- a/src/eom-scroll-view.c
+++ b/src/eom-scroll-view.c
@@ -79,8 +79,9 @@ static GtkTargetEntry target_table[] = {
enum {
PROP_0,
- PROP_USE_BG_COLOR,
PROP_BACKGROUND_COLOR,
+ PROP_SCROLLWHEEL_ZOOM,
+ PROP_USE_BG_COLOR,
PROP_ZOOM_MULTIPLIER
};
@@ -2552,6 +2553,9 @@ eom_scroll_view_get_property (GObject *object, guint property_id,
//FIXME: This doesn't really handle the NULL color.
g_value_set_boxed (value, priv->background_color);
break;
+ case PROP_SCROLLWHEEL_ZOOM:
+ g_value_set_boolean (value, priv->scroll_wheel_zoom);
+ break;
case PROP_ZOOM_MULTIPLIER:
g_value_set_double (value, priv->zoom_multiplier);
break;
@@ -2582,6 +2586,9 @@ eom_scroll_view_set_property (GObject *object, guint property_id,
eom_scroll_view_set_background_color (view, color);
break;
}
+ case PROP_SCROLLWHEEL_ZOOM:
+ eom_scroll_view_set_scroll_wheel_zoom (view, g_value_get_boolean (value));
+ break;
case PROP_ZOOM_MULTIPLIER:
eom_scroll_view_set_zoom_multiplier (view, g_value_get_double (value));
break;
@@ -2628,6 +2635,11 @@ eom_scroll_view_class_init (EomScrollViewClass *klass)
-G_MAXDOUBLE, G_MAXDOUBLE, 0.05,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
+ g_object_class_install_property (
+ gobject_class, PROP_SCROLLWHEEL_ZOOM,
+ g_param_spec_boolean ("scrollwheel-zoom", NULL, NULL, TRUE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
+
view_signals [SIGNAL_ZOOM_CHANGED] =
g_signal_new ("zoom_changed",
EOM_TYPE_SCROLL_VIEW,
@@ -2857,7 +2869,10 @@ eom_scroll_view_set_scroll_wheel_zoom (EomScrollView *view,
{
g_return_if_fail (EOM_IS_SCROLL_VIEW (view));
- view->priv->scroll_wheel_zoom = scroll_wheel_zoom;
+ if (view->priv->scroll_wheel_zoom != scroll_wheel_zoom) {
+ view->priv->scroll_wheel_zoom = scroll_wheel_zoom;
+ g_object_notify (G_OBJECT (view), "scrollwheel-zoom");
+ }
}
void
diff --git a/src/eom-window.c b/src/eom-window.c
index 287a037..6fc4eb6 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -266,26 +266,6 @@ eom_window_interp_out_type_changed_cb (GSettings *settings, gchar *key, gpointer
}
static void
-eom_window_scroll_wheel_zoom_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
-{
- EomWindowPrivate *priv;
- gboolean scroll_wheel_zoom = FALSE;
-
- eom_debug (DEBUG_PREFERENCES);
-
- g_return_if_fail (EOM_IS_WINDOW (user_data));
-
- priv = EOM_WINDOW (user_data)->priv;
-
- g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view));
-
- scroll_wheel_zoom = g_settings_get_boolean (settings, key);
-
- eom_scroll_view_set_scroll_wheel_zoom (EOM_SCROLL_VIEW (priv->view),
- scroll_wheel_zoom);
-}
-
-static void
eom_window_transparency_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
{
EomWindowPrivate *priv;
@@ -4528,6 +4508,8 @@ eom_window_construct_ui (EomWindow *window)
G_CALLBACK (view_zoom_changed_cb),
window);
+ g_settings_bind (priv->view_settings, EOM_CONF_VIEW_SCROLL_WHEEL_ZOOM,
+ priv->view, "scrollwheel-zoom", G_SETTINGS_BIND_GET);
g_settings_bind (priv->view_settings, EOM_CONF_VIEW_ZOOM_MULTIPLIER,
priv->view, "zoom-multiplier", G_SETTINGS_BIND_GET);
@@ -4577,9 +4559,6 @@ eom_window_construct_ui (EomWindow *window)
eom_window_interp_out_type_changed_cb (priv->view_settings,
EOM_CONF_VIEW_INTERPOLATE,
window);
- eom_window_scroll_wheel_zoom_changed_cb (priv->view_settings,
- EOM_CONF_VIEW_SCROLL_WHEEL_ZOOM,
- window);
eom_window_bg_color_changed_cb (priv->view_settings,
EOM_CONF_VIEW_BACKGROUND_COLOR,
window);
@@ -4642,11 +4621,6 @@ eom_window_init (EomWindow *window)
window);
g_signal_connect (priv->view_settings,
- "changed::" EOM_CONF_VIEW_SCROLL_WHEEL_ZOOM,
- G_CALLBACK (eom_window_scroll_wheel_zoom_changed_cb),
- window);
-
- g_signal_connect (priv->view_settings,
"changed::" EOM_CONF_VIEW_BACKGROUND_COLOR,
G_CALLBACK (eom_window_bg_color_changed_cb),
window);