[eog] Switch scrollwheel zoom setting with GSettings



commit 8c7cf9f8938673eda2843be650b558084b44303e
Author: Felix Riemann <friemann gnome org>
Date:   Sat Jun 26 17:59:17 2010 +0200

    Switch scrollwheel zoom setting with GSettings
    
    Drops another simple value-forwarding signal callback from EogWindow.

 src/eog-scroll-view.c |   19 +++++++++++++++++--
 src/eog-window.c      |   32 ++------------------------------
 2 files changed, 19 insertions(+), 32 deletions(-)
---
diff --git a/src/eog-scroll-view.c b/src/eog-scroll-view.c
index d351418..e13c539 100644
--- a/src/eog-scroll-view.c
+++ b/src/eog-scroll-view.c
@@ -75,8 +75,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
 };
 
@@ -2326,6 +2327,9 @@ eog_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;
@@ -2356,6 +2360,9 @@ eog_scroll_view_set_property (GObject *object, guint property_id,
 		eog_scroll_view_set_background_color (view, color);
 		break;
 	}
+	case PROP_SCROLLWHEEL_ZOOM:
+		eog_scroll_view_set_scroll_wheel_zoom (view, g_value_get_boolean (value));
+		break;
 	case PROP_ZOOM_MULTIPLIER:
 		eog_scroll_view_set_zoom_multiplier (view, g_value_get_double (value));
 		break;
@@ -2402,6 +2409,11 @@ eog_scroll_view_class_init (EogScrollViewClass *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",
 			      EOG_TYPE_SCROLL_VIEW,
@@ -2698,7 +2710,10 @@ eog_scroll_view_set_scroll_wheel_zoom (EogScrollView *view,
 {
 	g_return_if_fail (EOG_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/eog-window.c b/src/eog-window.c
index 22d5a95..0f317ac 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -264,28 +264,6 @@ eog_window_interp_out_type_changed_cb (GSettings *settings,
 }
 
 static void
-eog_window_scroll_wheel_zoom_changed_cb (GSettings *settings,
-				         gchar     *key,
-				         gpointer   user_data)
-{
-	EogWindowPrivate *priv;
-	gboolean scroll_wheel_zoom = FALSE;
-
-	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));
-
-	scroll_wheel_zoom = g_settings_get_boolean (settings, key);
-
-	eog_scroll_view_set_scroll_wheel_zoom (EOG_SCROLL_VIEW (priv->view),
-					       scroll_wheel_zoom);
-}
-
-static void
 eog_window_transparency_changed_cb (GSettings *settings,
 				    gchar     *key,
 				    gpointer   user_data)
@@ -4311,6 +4289,8 @@ eog_window_construct_ui (EogWindow *window)
 			  "zoom_changed",
 			  G_CALLBACK (view_zoom_changed_cb),
 			  window);
+	g_settings_bind (priv->view_settings, EOG_CONF_VIEW_SCROLL_WHEEL_ZOOM,
+			 priv->view, "scrollwheel-zoom", G_SETTINGS_BIND_GET);
 	g_settings_bind (priv->view_settings, EOG_CONF_VIEW_ZOOM_MULTIPLIER,
 			 priv->view, "zoom-multiplier", G_SETTINGS_BIND_GET);
 
@@ -4370,9 +4350,6 @@ eog_window_construct_ui (EogWindow *window)
 	eog_window_interp_out_type_changed_cb (priv->view_settings,
 					       EOG_CONF_VIEW_INTERPOLATE,
 					       window);
-	eog_window_scroll_wheel_zoom_changed_cb (priv->view_settings,
-						 EOG_CONF_VIEW_SCROLL_WHEEL_ZOOM
-						 , window);
 	eog_window_transparency_changed_cb (priv->view_settings,
 					    EOG_CONF_VIEW_TRANSPARENCY, window);
 	eog_window_trans_color_changed_cb (priv->view_settings,
@@ -4434,11 +4411,6 @@ eog_window_init (EogWindow *window)
 			  window);
 
 	g_signal_connect (priv->view_settings,
-			  "changed::" EOG_CONF_VIEW_SCROLL_WHEEL_ZOOM,
-			  (GCallback) eog_window_scroll_wheel_zoom_changed_cb,
-			   window);
-
-	g_signal_connect (priv->view_settings,
 			  "changed::" EOG_CONF_VIEW_TRANSPARENCY,
 			  (GCallback) eog_window_transparency_changed_cb,
 			  window);



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