summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-10-16 07:59:32 +0200
committerraveit65 <[email protected]>2016-10-17 06:15:04 +0200
commitfb4d4960d6e4efa3fd85751ae373abafa20967df (patch)
tree238cccf13387a1120588581140ebeba67ff83228
parenta7ef765a1c9f1d7796a4e168ae2398af2368d3ad (diff)
downloadcaja-fb4d4960d6e4efa3fd85751ae373abafa20967df.tar.bz2
caja-fb4d4960d6e4efa3fd85751ae373abafa20967df.tar.xz
GTK+2: use eel helper again to set adjustment values
This reverts https://github.com/mate-desktop/caja/commit/1f7ab5d for gtk2 Fixes https://github.com/mate-desktop/caja/issues/659
-rw-r--r--libcaja-private/caja-icon-container.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index af8de17e..21e8fc1b 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -623,8 +623,13 @@ caja_icon_container_scroll (CajaIconContainer *container,
old_h_value = gtk_adjustment_get_value (hadj);
old_v_value = gtk_adjustment_get_value (vadj);
+#if GTK_CHECK_VERSION (3, 0, 0)
gtk_adjustment_set_value (hadj, gtk_adjustment_get_value (hadj) + delta_x);
gtk_adjustment_set_value (vadj, gtk_adjustment_get_value (vadj) + delta_y);
+#else
+ eel_gtk_adjustment_set_value (hadj, gtk_adjustment_get_value (hadj) + delta_x);
+ eel_gtk_adjustment_set_value (vadj, gtk_adjustment_get_value (vadj) + delta_y);
+#endif
/* return TRUE if we did scroll */
return gtk_adjustment_get_value (hadj) != old_h_value || gtk_adjustment_get_value (vadj) != old_v_value;
@@ -778,6 +783,7 @@ reveal_icon (CajaIconContainer *container,
item_get_canvas_bounds (EEL_CANVAS_ITEM (icon->item), &bounds, TRUE);
}
if (bounds.y0 < gtk_adjustment_get_value (vadj)) {
+#if GTK_CHECK_VERSION (3, 0, 0)
gtk_adjustment_set_value (vadj, bounds.y0);
} else if (bounds.y1 > gtk_adjustment_get_value (vadj) + allocation.height) {
gtk_adjustment_set_value (vadj, bounds.y1 - allocation.height);
@@ -790,6 +796,20 @@ reveal_icon (CajaIconContainer *container,
gtk_adjustment_set_value (hadj, bounds.x0);
} else {
gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
+#else
+ eel_gtk_adjustment_set_value (vadj, bounds.y0);
+ } else if (bounds.y1 > gtk_adjustment_get_value (vadj) + allocation.height) {
+ eel_gtk_adjustment_set_value (vadj, bounds.y1 - allocation.height);
+ }
+
+ if (bounds.x0 < gtk_adjustment_get_value (hadj)) {
+ eel_gtk_adjustment_set_value (hadj, bounds.x0);
+ } else if (bounds.x1 > gtk_adjustment_get_value (hadj) + allocation.width) {
+ if (bounds.x1 - allocation.width > bounds.x0) {
+ eel_gtk_adjustment_set_value (hadj, bounds.x0);
+ } else {
+ eel_gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
+#endif
}
}
}
@@ -1230,6 +1250,13 @@ caja_icon_container_update_scroll_region (CajaIconContainer *container)
{
gtk_adjustment_set_step_increment (vadj, step_increment);
}
+#if !GTK_CHECK_VERSION (3, 0, 0)
+ /* Now that we have a new scroll region, clamp the
+ * adjustments so we are within the valid scroll area.
+ */
+ eel_gtk_adjustment_clamp_value (hadj);
+ eel_gtk_adjustment_clamp_value (vadj);
+#endif
}
static int
@@ -7475,12 +7502,21 @@ caja_icon_container_scroll_to_icon (CajaIconContainer *container,
if (caja_icon_container_is_layout_vertical (container)) {
if (caja_icon_container_is_layout_rtl (container)) {
+#if GTK_CHECK_VERSION (3, 0, 0)
gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
} else {
gtk_adjustment_set_value (hadj, bounds.x0);
}
} else {
gtk_adjustment_set_value (vadj, bounds.y0);
+#else
+ eel_gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
+ } else {
+ eel_gtk_adjustment_set_value (hadj, bounds.x0);
+ }
+ } else {
+ eel_gtk_adjustment_set_value (vadj, bounds.y0);
+#endif
}
}