diff options
author | infirit <[email protected]> | 2014-07-27 21:47:26 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-07-27 21:47:26 +0200 |
commit | 4072dcf8e4eb9895a6abed3a62a27da208e0af40 (patch) | |
tree | 65c6302d12ca6958b982d04e7da22f01af93029c | |
parent | 845be7089dfde1cb1168e19b01e9fdbb9852cf1e (diff) | |
download | eom-4072dcf8e4eb9895a6abed3a62a27da208e0af40.tar.bz2 eom-4072dcf8e4eb9895a6abed3a62a27da208e0af40.tar.xz |
Set zoomed in antialiasing using a GSettings binding
Based on eog commit 15917972d9a60fc185b1cc9a7b4e304952c49d2d
From Felix Riemann <[email protected]>
-rw-r--r-- | src/eom-scroll-view.c | 19 | ||||
-rw-r--r-- | src/eom-window.c | 28 |
2 files changed, 19 insertions, 28 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c index 01f22af..45618b1 100644 --- a/src/eom-scroll-view.c +++ b/src/eom-scroll-view.c @@ -80,6 +80,7 @@ static GtkTargetEntry target_table[] = { enum { PROP_0, + PROP_ANTIALIAS_IN, PROP_BACKGROUND_COLOR, PROP_SCROLLWHEEL_ZOOM, PROP_USE_BG_COLOR, @@ -2111,6 +2112,7 @@ eom_scroll_view_set_antialiasing_in (EomScrollView *view, gboolean state) if (priv->interp_type_in != new_interp_type) { priv->interp_type_in = new_interp_type; gtk_widget_queue_draw (GTK_WIDGET (priv->display)); + g_object_notify (G_OBJECT (view), "antialiasing-in"); } } @@ -2536,6 +2538,9 @@ eom_scroll_view_init (EomScrollView *view) G_SETTINGS_BIND_DEFAULT, sv_string_to_color_mapping, sv_color_to_string_mapping, NULL, NULL); + g_settings_bind (settings, EOM_CONF_VIEW_EXTRAPOLATE, view, + "antialiasing-in", G_SETTINGS_BIND_GET); + g_object_unref (settings); priv->override_bg_color = NULL; @@ -2598,6 +2603,12 @@ eom_scroll_view_get_property (GObject *object, guint property_id, priv = view->priv; switch (property_id) { + case PROP_ANTIALIAS_IN: + { + gboolean filter = (priv->interp_type_in != GDK_INTERP_NEAREST); + g_value_set_boolean (value, filter); + break; + } case PROP_USE_BG_COLOR: g_value_set_boolean (value, priv->use_bg_color); break; @@ -2629,6 +2640,9 @@ eom_scroll_view_set_property (GObject *object, guint property_id, priv = view->priv; switch (property_id) { + case PROP_ANTIALIAS_IN: + eom_scroll_view_set_antialiasing_in (view, g_value_get_boolean (value)); + break; case PROP_USE_BG_COLOR: eom_scroll_view_set_use_bg_color (view, g_value_get_boolean (value)); break; @@ -2663,6 +2677,11 @@ eom_scroll_view_class_init (EomScrollViewClass *klass) gobject_class->set_property = eom_scroll_view_set_property; gobject_class->get_property = eom_scroll_view_get_property; + g_object_class_install_property ( + gobject_class, PROP_ANTIALIAS_IN, + g_param_spec_boolean ("antialiasing-in", NULL, NULL, TRUE, + G_PARAM_READWRITE | G_PARAM_STATIC_NAME)); + /** * EomScrollView:background-color: * diff --git a/src/eom-window.c b/src/eom-window.c index db585f9..ee15a4f 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -226,26 +226,6 @@ eom_window_error_quark (void) } static void -eom_window_interp_in_type_changed_cb (GSettings *settings, gchar *key, gpointer user_data) -{ - EomWindowPrivate *priv; - gboolean interpolate_in = TRUE; - - 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)); - - interpolate_in = g_settings_get_boolean (settings, key); - - eom_scroll_view_set_antialiasing_in (EOM_SCROLL_VIEW (priv->view), - interpolate_in); -} - -static void eom_window_interp_out_type_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; @@ -4493,9 +4473,6 @@ eom_window_construct_ui (EomWindow *window) gtk_box_pack_end (GTK_BOX (priv->cbox), priv->layout, TRUE, TRUE, 0); - eom_window_interp_in_type_changed_cb (priv->view_settings, - EOM_CONF_VIEW_EXTRAPOLATE, - window); eom_window_interp_out_type_changed_cb (priv->view_settings, EOM_CONF_VIEW_INTERPOLATE, window); @@ -4545,11 +4522,6 @@ eom_window_init (EomWindow *window) priv->lockdown_settings = g_settings_new (EOM_CONF_LOCKDOWN_SCHEMA); g_signal_connect (priv->view_settings, - "changed::" EOM_CONF_VIEW_EXTRAPOLATE, - G_CALLBACK (eom_window_interp_in_type_changed_cb), - window); - - g_signal_connect (priv->view_settings, "changed::" EOM_CONF_VIEW_INTERPOLATE, G_CALLBACK (eom_window_interp_out_type_changed_cb), window); |