summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2008-06-07 23:32:40 -0400
committerSøren Sandmann <sandmann@redhat.com>2008-06-07 23:32:40 -0400
commit039343b3d5d7fd05bfd0b1a530962ba546b1be37 (patch)
tree61746feb8ba52d44ed28e15b1234ba6460f9d0a0 /main.c
parent8b2329b89ad8730e2c5825523c1569958964d22b (diff)
TODO; scroll thumbnails:
Diffstat (limited to 'main.c')
-rw-r--r--main.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/main.c b/main.c
index 80aa2c4..0e93334 100644
--- a/main.c
+++ b/main.c
@@ -97,6 +97,27 @@ on_main_viewport_size_changed (FooScrollArea *scroll_area,
}
static void
+make_thumbnail_viewable (App *app)
+{
+ FooScrollArea *area = FOO_SCROLL_AREA (app->thumbnails);
+ GdkRectangle viewport;
+ int top, height;
+ const int margin = 10;
+
+ foo_scroll_area_get_viewport (area, &viewport);
+
+ top = deck_get_slide_location (app->deck, &viewport, app->nth_slide);
+ height = deck_get_slide_height (app->deck, &viewport);
+
+ if (top - margin < viewport.y)
+ viewport.y = top - margin;
+ else if (top + height + margin > viewport.y + viewport.height)
+ viewport.y = top + height - viewport.height - margin;
+
+ foo_scroll_area_set_viewport_pos (area, viewport.x, viewport.y);
+}
+
+static void
on_viewport_changed (FooScrollArea *scroll_area,
GdkRectangle *viewport,
GdkRectangle *old_viewport,
@@ -107,7 +128,8 @@ on_viewport_changed (FooScrollArea *scroll_area,
App *app = data;
app->nth_slide = deck_get_view_slide (app->deck, viewport);
- g_print ("nth: %d\n", app->nth_slide);
+
+ make_thumbnail_viewable (app);
}
}