summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-27 15:45:43 +0200
committerinfirit <[email protected]>2014-07-27 21:16:30 +0200
commitf9308d5f86250219e6bf35208e517780d2de2772 (patch)
treeb821c0ec823f8e6e936e554805be7b99c5152e4f
parent77f6ed0e2a178b9934baee8b846cdd1cc88b2eab (diff)
downloadeom-f9308d5f86250219e6bf35208e517780d2de2772.tar.bz2
eom-f9308d5f86250219e6bf35208e517780d2de2772.tar.xz
Bind zoom multiplier to GSettings instead of setting it by hand
Based on eog commit 0cadaebd5c7561991eceaf3ed9af32f50e63b1e9 From Felix Riemann <[email protected]>
-rw-r--r--src/eom-scroll-view.c17
-rw-r--r--src/eom-window.c33
2 files changed, 20 insertions, 30 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c
index a7db63f..664d819 100644
--- a/src/eom-scroll-view.c
+++ b/src/eom-scroll-view.c
@@ -80,7 +80,8 @@ static GtkTargetEntry target_table[] = {
enum {
PROP_0,
PROP_USE_BG_COLOR,
- PROP_BACKGROUND_COLOR
+ PROP_BACKGROUND_COLOR,
+ PROP_ZOOM_MULTIPLIER
};
/* Private part of the EomScrollView structure */
@@ -2551,6 +2552,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_ZOOM_MULTIPLIER:
+ g_value_set_double (value, priv->zoom_multiplier);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -2578,6 +2582,9 @@ eom_scroll_view_set_property (GObject *object, guint property_id,
eom_scroll_view_set_background_color (view, color);
break;
}
+ case PROP_ZOOM_MULTIPLIER:
+ eom_scroll_view_set_zoom_multiplier (view, g_value_get_double (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -2615,6 +2622,12 @@ eom_scroll_view_class_init (EomScrollViewClass *klass)
g_param_spec_boolean ("use-background-color", NULL, NULL, FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
+ g_object_class_install_property (
+ gobject_class, PROP_ZOOM_MULTIPLIER,
+ g_param_spec_double ("zoom-multiplier", NULL, NULL,
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0.05,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
+
view_signals [SIGNAL_ZOOM_CHANGED] =
g_signal_new ("zoom_changed",
EOM_TYPE_SCROLL_VIEW,
@@ -2854,4 +2867,6 @@ eom_scroll_view_set_zoom_multiplier (EomScrollView *view,
g_return_if_fail (EOM_IS_SCROLL_VIEW (view));
view->priv->zoom_multiplier = 1.0 + zoom_multiplier;
+
+ g_object_notify (G_OBJECT (view), "zoom-multiplier");
}
diff --git a/src/eom-window.c b/src/eom-window.c
index 7e8008f..287a037 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -286,26 +286,6 @@ eom_window_scroll_wheel_zoom_changed_cb (GSettings *settings, gchar *key, gpoint
}
static void
-eom_window_zoom_multiplier_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
-{
- EomWindowPrivate *priv;
- gdouble multiplier = 0.05;
-
- 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));
-
- multiplier = g_settings_get_double (settings, key);
-
- eom_scroll_view_set_zoom_multiplier (EOM_SCROLL_VIEW (priv->view),
- multiplier);
-}
-
-static void
eom_window_transparency_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
{
EomWindowPrivate *priv;
@@ -4244,7 +4224,7 @@ eom_window_drag_data_received (GtkWidget *widget,
/* if the request is from another process this will return NULL */
src = gtk_drag_get_source_widget (context);
- /* if the drag request originates from the current eog instance, ignore
+ /* if the drag request originates from the current eom instance, ignore
the request if the source window is the same as the dest window */
if (src &&
gtk_widget_get_toplevel (src) == gtk_widget_get_toplevel (widget))
@@ -4548,6 +4528,9 @@ eom_window_construct_ui (EomWindow *window)
G_CALLBACK (view_zoom_changed_cb),
window);
+ g_settings_bind (priv->view_settings, EOM_CONF_VIEW_ZOOM_MULTIPLIER,
+ priv->view, "zoom-multiplier", G_SETTINGS_BIND_GET);
+
view_popup = gtk_ui_manager_get_widget (priv->ui_mgr, "/ViewPopup");
eom_scroll_view_set_popup (EOM_SCROLL_VIEW (priv->view),
GTK_MENU (view_popup));
@@ -4597,9 +4580,6 @@ eom_window_construct_ui (EomWindow *window)
eom_window_scroll_wheel_zoom_changed_cb (priv->view_settings,
EOM_CONF_VIEW_SCROLL_WHEEL_ZOOM,
window);
- eom_window_zoom_multiplier_changed_cb (priv->view_settings,
- EOM_CONF_VIEW_ZOOM_MULTIPLIER,
- window);
eom_window_bg_color_changed_cb (priv->view_settings,
EOM_CONF_VIEW_BACKGROUND_COLOR,
window);
@@ -4667,11 +4647,6 @@ eom_window_init (EomWindow *window)
window);
g_signal_connect (priv->view_settings,
- "changed::" EOM_CONF_VIEW_ZOOM_MULTIPLIER,
- G_CALLBACK (eom_window_zoom_multiplier_changed_cb),
- window);
-
- g_signal_connect (priv->view_settings,
"changed::" EOM_CONF_VIEW_BACKGROUND_COLOR,
G_CALLBACK (eom_window_bg_color_changed_cb),
window);