summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-icon-container.c52
-rw-r--r--libcaja-private/caja-icon-dnd.c42
-rw-r--r--libcaja-private/caja-tree-view-drag-dest.c4
3 files changed, 59 insertions, 39 deletions
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 583b6c85..e88cac74 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -52,6 +52,12 @@
#include <stdio.h>
#include <string.h>
+#if !GTK_CHECK_VERSION(3, 0, 0)
+#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment
+#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment
+#define GTK_SCROLLABLE GTK_LAYOUT
+#endif
+
#define TAB_NAVIGATION_DISABLED
/* Interval for updating the rubberband selection, in milliseconds. */
@@ -591,8 +597,8 @@ caja_icon_container_scroll (CajaIconContainer *container,
GtkAdjustment *hadj, *vadj;
int old_h_value, old_v_value;
- hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
+ hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
+ vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
/* Store the old ajustment values so we can tell if we
* ended up actually scrolling. We may not have in a case
@@ -754,8 +760,8 @@ reveal_icon (CajaIconContainer *container,
details = container->details;
gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
- hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
+ hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
+ vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
if (caja_icon_container_is_auto_layout (container))
{
@@ -1087,8 +1093,8 @@ canvas_set_scroll_region_include_visible_area (EelCanvas *canvas,
width = (allocation.width) / canvas->pixels_per_unit;
height = (allocation.height) / canvas->pixels_per_unit;
- old_scroll_x = gtk_adjustment_get_value (GTK_ADJUSTMENT (gtk_layout_get_hadjustment (GTK_LAYOUT (canvas))));
- old_scroll_y = gtk_adjustment_get_value (GTK_ADJUSTMENT (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas))));
+ old_scroll_x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas)));
+ old_scroll_y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas)));
x1 = MIN (x1, old_x1 + old_scroll_x);
y1 = MIN (y1, old_y1 + old_scroll_y);
@@ -1212,8 +1218,8 @@ caja_icon_container_update_scroll_region (CajaIconContainer *container)
x1, y1, x2, y2);
}
- hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
+ hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
+ vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
/* Scroll by 1/4 icon each time you click. */
step_increment = caja_get_icon_size_for_zoom_level
@@ -2775,14 +2781,14 @@ rubberband_timeout_callback (gpointer data)
adj_changed = FALSE;
gtk_widget_get_allocation (widget, &allocation);
- adj_x = gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
+ adj_x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
if (adj_x != band_info->last_adj_x)
{
band_info->last_adj_x = adj_x;
adj_changed = TRUE;
}
- adj_y = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
+ adj_y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
if (adj_y != band_info->last_adj_y)
{
band_info->last_adj_y = adj_y;
@@ -2831,8 +2837,8 @@ rubberband_timeout_callback (gpointer data)
/* Remember to convert from widget to scrolled window coords */
eel_canvas_window_to_world (EEL_CANVAS (container),
- x + gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container))),
- y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))),
+ x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))),
+ y + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container))),
&world_x, &world_y);
if (world_x < band_info->start_x)
@@ -2953,8 +2959,8 @@ start_rubberbanding (CajaIconContainer *container,
atk_object_set_name (accessible, "selection");
atk_object_set_description (accessible, _("The selection rectangle"));
- band_info->prev_x = event->x - gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
- band_info->prev_y = event->y - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
+ band_info->prev_x = event->x - gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
+ band_info->prev_y = event->y - gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
band_info->active = TRUE;
@@ -4588,11 +4594,11 @@ realize (GtkWidget *widget)
setup_label_gcs (container);
- hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (widget));
+ hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget));
g_signal_connect (hadj, "value_changed",
G_CALLBACK (handle_hadjustment_changed), widget);
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (widget));
+ vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget));
g_signal_connect (vadj, "value_changed",
G_CALLBACK (handle_vadjustment_changed), widget);
@@ -7192,9 +7198,9 @@ caja_icon_container_get_first_visible_icon (CajaIconContainer *container)
gboolean better_icon;
gboolean compare_lt;
- hadj_v = gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
- vadj_v = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
- h_page_size = gtk_adjustment_get_page_size (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
+ hadj_v = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
+ vadj_v = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
+ h_page_size = gtk_adjustment_get_page_size (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
if (caja_icon_container_is_layout_rtl (container))
{
@@ -7283,8 +7289,8 @@ caja_icon_container_scroll_to_icon (CajaIconContainer *container,
EelIRect bounds;
GtkAllocation allocation;
- hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
+ hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
+ vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
/* We need to force a relayout now if there are updates queued
@@ -7616,8 +7622,8 @@ caja_icon_container_update_visible_icons (CajaIconContainer *container)
gboolean visible;
GtkAllocation allocation;
- hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
+ hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
+ vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
min_x = gtk_adjustment_get_value (hadj);
diff --git a/libcaja-private/caja-icon-dnd.c b/libcaja-private/caja-icon-dnd.c
index 5aa48669..cae6e4ee 100644
--- a/libcaja-private/caja-icon-dnd.c
+++ b/libcaja-private/caja-icon-dnd.c
@@ -60,6 +60,12 @@
#include <stdio.h>
#include <string.h>
+#if !GTK_CHECK_VERSION(3, 0, 0)
+#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment
+#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment
+#define GTK_SCROLLABLE GTK_LAYOUT
+#endif
+
static const GtkTargetEntry drag_types [] =
{
{ CAJA_ICON_DND_MATE_ICON_LIST_TYPE, 0, CAJA_ICON_DND_MATE_ICON_LIST },
@@ -197,6 +203,10 @@ canvas_rect_world_to_widget (EelCanvas *canvas,
EelIRect *widget_rect)
{
EelDRect window_rect;
+ GtkAdjustment *hadj, *vadj;
+
+ hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas));
+ vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas));
eel_canvas_world_to_window (canvas,
world_rect->x0, world_rect->y0,
@@ -204,10 +214,10 @@ canvas_rect_world_to_widget (EelCanvas *canvas,
eel_canvas_world_to_window (canvas,
world_rect->x1, world_rect->y1,
&window_rect.x1, &window_rect.y1);
- widget_rect->x0 = (int) window_rect.x0 - gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (canvas)));
- widget_rect->y0 = (int) window_rect.y0 - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas)));
- widget_rect->x1 = (int) window_rect.x1 - gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (canvas)));
- widget_rect->y1 = (int) window_rect.y1 - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas)));
+ widget_rect->x0 = (int) window_rect.x0 - gtk_adjustment_get_value (hadj);
+ widget_rect->y0 = (int) window_rect.y0 - gtk_adjustment_get_value (vadj);
+ widget_rect->x1 = (int) window_rect.x1 - gtk_adjustment_get_value (hadj);
+ widget_rect->y1 = (int) window_rect.y1 - gtk_adjustment_get_value (vadj);
}
static void
@@ -216,8 +226,8 @@ canvas_widget_to_world (EelCanvas *canvas,
double *world_x, double *world_y)
{
eel_canvas_window_to_world (canvas,
- widget_x + gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (canvas))),
- widget_y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas))),
+ widget_x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas))),
+ widget_y + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas))),
world_x, world_y);
}
@@ -1267,8 +1277,8 @@ caja_icon_container_receive_dropped_icons (CajaIconContainer *container,
if (real_action > 0)
{
eel_canvas_window_to_world (EEL_CANVAS (container),
- x + gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container))),
- y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))),
+ x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))),
+ y + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container))),
&world_x, &world_y);
drop_target = caja_icon_container_find_drop_target (container,
@@ -1531,8 +1541,10 @@ drag_begin_callback (GtkWidget *widget,
}
#endif
- start_x = container->details->dnd_info->drag_info.start_x + gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
- start_y = container->details->dnd_info->drag_info.start_y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
+ start_x = container->details->dnd_info->drag_info.start_x +
+ gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
+ start_y = container->details->dnd_info->drag_info.start_y +
+ gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
/* create a pixmap and mask to drag with */
#if GTK_CHECK_VERSION(3,0,0)
@@ -1593,8 +1605,10 @@ caja_icon_dnd_begin_drag (CajaIconContainer *container,
/* Notice that the event is in bin_window coordinates, because of
the way the canvas handles events.
*/
- dnd_info->drag_info.start_x = start_x - gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
- dnd_info->drag_info.start_y = start_y - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
+ dnd_info->drag_info.start_x = start_x -
+ gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
+ dnd_info->drag_info.start_y = start_y -
+ gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
/* start the drag */
context = gtk_drag_begin (GTK_WIDGET (container),
@@ -1618,8 +1632,8 @@ drag_highlight_expose (GtkWidget *widget,
gint x, y, width, height;
GdkWindow *window;
- x = gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (widget)));
- y = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (widget)));
+ x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget)));
+ y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget)));
window = gtk_widget_get_window (widget);
#if GTK_CHECK_VERSION(3, 0, 0)
diff --git a/libcaja-private/caja-tree-view-drag-dest.c b/libcaja-private/caja-tree-view-drag-dest.c
index d7a8d2b6..56e9a1cd 100644
--- a/libcaja-private/caja-tree-view-drag-dest.c
+++ b/libcaja-private/caja-tree-view-drag-dest.c
@@ -110,9 +110,9 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view)
window = gtk_tree_view_get_bin_window (tree_view);
#if GTK_CHECK_VERSION(3, 0, 0)
- vadjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(tree_view));
+ vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(tree_view));
#else
- vadjustment = gtk_tree_view_get_vadjustment(tree_view);
+ vadjustment = gtk_tree_view_get_vadjustment (tree_view);
#endif
gdk_window_get_pointer (window, NULL, &y, NULL);