[eog] Set zoomed in antialiasing using a GSettings binding



commit 15917972d9a60fc185b1cc9a7b4e304952c49d2d
Author: Felix Riemann <friemann gnome org>
Date:   Mon Jul 19 21:32:04 2010 +0200

    Set zoomed in antialiasing using a GSettings binding
    
    Again less work for EogWindow.

 src/eog-scroll-view.c |   18 ++++++++++++++++++
 src/eog-window.c      |   29 -----------------------------
 2 files changed, 18 insertions(+), 29 deletions(-)
---
diff --git a/src/eog-scroll-view.c b/src/eog-scroll-view.c
index 2012e65..228bce9 100644
--- a/src/eog-scroll-view.c
+++ b/src/eog-scroll-view.c
@@ -76,6 +76,7 @@ static GtkTargetEntry target_table[] = {
 
 enum {
 	PROP_0,
+	PROP_ANTIALIAS_IN,
 	PROP_BACKGROUND_COLOR,
 	PROP_SCROLLWHEEL_ZOOM,
 	PROP_TRANSP_COLOR,
@@ -1921,6 +1922,7 @@ eog_scroll_view_set_antialiasing_in (EogScrollView *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");
 	}
 }
 
@@ -2402,6 +2404,8 @@ eog_scroll_view_init (EogScrollView *view)
 				      G_SETTINGS_BIND_GET,
 				      sv_string_to_transp_mapping,
 				      NULL, NULL, NULL);
+	g_settings_bind (settings, EOG_CONF_VIEW_EXTRAPOLATE, view,
+			 "antialiasing-in", G_SETTINGS_BIND_GET);
 
 	g_object_unref (settings);
 }
@@ -2460,6 +2464,12 @@ eog_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;
@@ -2494,6 +2504,9 @@ eog_scroll_view_set_property (GObject *object, guint property_id,
 	priv = view->priv;
 
 	switch (property_id) {
+	case PROP_ANTIALIAS_IN:
+		eog_scroll_view_set_antialiasing_in (view, g_value_get_boolean (value));
+		break;
 	case PROP_USE_BG_COLOR:
 		eog_scroll_view_set_use_bg_color (view, g_value_get_boolean (value));
 		break;
@@ -2534,6 +2547,11 @@ eog_scroll_view_class_init (EogScrollViewClass *klass)
         gobject_class->set_property = eog_scroll_view_set_property;
         gobject_class->get_property = eog_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));
+
 	/**
 	 * EogScrollView:background-color:
 	 *
diff --git a/src/eog-window.c b/src/eog-window.c
index 68dfedb..255417a 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -226,27 +226,6 @@ eog_window_error_quark (void)
 }
 
 static void
-eog_window_interp_in_type_changed_cb (GSettings *settings,
-				      gchar     *key,
-				      gpointer   user_data)
-{
-	EogWindowPrivate *priv;
-	gboolean interpolate_in = TRUE;
-
-	eog_debug (DEBUG_PREFERENCES);
-
-	g_return_if_fail (EOG_IS_WINDOW (user_data));
-
-	priv = EOG_WINDOW (user_data)->priv;
-
-	g_return_if_fail (EOG_IS_SCROLL_VIEW (priv->view));
-
-	interpolate_in = g_settings_get_boolean (settings, key);
-	eog_scroll_view_set_antialiasing_in (EOG_SCROLL_VIEW (priv->view),
-					  interpolate_in);
-}
-
-static void
 eog_window_interp_out_type_changed_cb (GSettings *settings,
 				       gchar     *key,
 				       gpointer   user_data)
@@ -4277,9 +4256,6 @@ eog_window_construct_ui (EogWindow *window)
 
 	gtk_box_pack_end (GTK_BOX (priv->cbox), priv->layout, TRUE, TRUE, 0);
 
-	eog_window_interp_in_type_changed_cb (priv->view_settings,
-					      EOG_CONF_VIEW_EXTRAPOLATE,
-					      window);
 	eog_window_interp_out_type_changed_cb (priv->view_settings,
 					       EOG_CONF_VIEW_INTERPOLATE,
 					       window);
@@ -4332,11 +4308,6 @@ eog_window_init (EogWindow *window)
 	priv->client = gconf_client_get_default ();
 
 	g_signal_connect (priv->view_settings,
-			  "changed::" EOG_CONF_VIEW_EXTRAPOLATE,
-			  (GCallback) eog_window_interp_in_type_changed_cb,
-			  window);
-
-	g_signal_connect (priv->view_settings,
 			  "changed::" EOG_CONF_VIEW_INTERPOLATE,
 			  (GCallback) eog_window_interp_out_type_changed_cb,
 			  window);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]