Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-view.c
diff options
context:
space:
mode:
authorJohannes Buchner <buchner.johannes@gmx.at>2007-07-27 05:41:22 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2007-07-27 05:41:22 (GMT)
commit06e8fe2d26f02fd17a4dc19ea10d7ee00dc33243 (patch)
tree67f713b130459a3805e2535bfd3a761b501cad55 /shell/ev-view.c
parent0316bea7b62a35a692afad8cef9ecfb4a1d6a4f5 (diff)
Reorganizes utility functions.
2007-07-27 Johannes Buchner <buchner.johannes@gmx.at> * shell/ev-utils.c: (get_num_monitors), (get_screen_dpi): * shell/ev-utils.h: * shell/ev-view.c: (ev_view_set_zoom_for_size), (ev_view_update_view_size): * shell/ev-view.h: * shell/ev-window.c: (ev_window_update_actions), (setup_view_from_metadata), (ev_window_screen_changed), (ev_window_sizing_mode_changed_cb), (ev_window_zoom_changed_cb), (zoom_control_changed_cb): * shell/ev-window.h: Reorganizes utility functions. svn path=/trunk/; revision=2582
Diffstat (limited to 'shell/ev-view.c')
-rw-r--r--shell/ev-view.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 6a17aa8..6182fec 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -4685,13 +4685,14 @@ ev_view_zoom_for_size_single_page (EvView *view,
ev_view_set_zoom (view, scale, FALSE);
}
-void
+static void
ev_view_set_zoom_for_size (EvView *view,
int width,
int height,
int vsb_width,
int hsb_height)
{
+ g_return_if_fail (EV_IS_VIEW (view));
g_return_if_fail (view->sizing_mode == EV_SIZING_FIT_WIDTH ||
view->sizing_mode == EV_SIZING_BEST_FIT);
g_return_if_fail (width >= 0);
@@ -5564,3 +5565,37 @@ ev_scroll_type_get_type (void)
}
return etype;
}
+
+void
+ev_view_update_view_size (EvView *view, GtkScrolledWindow * scrolled_window)
+{
+ int width, height;
+ GtkRequisition vsb_requisition;
+ GtkRequisition hsb_requisition;
+ int scrollbar_spacing;
+
+ /* Calculate the width available for the content */
+ width = GTK_WIDGET (scrolled_window)->allocation.width;
+ height = GTK_WIDGET (scrolled_window)->allocation.height;
+
+ if (gtk_scrolled_window_get_shadow_type (scrolled_window) == GTK_SHADOW_IN
+ && view) {
+ width -= 2 * GTK_WIDGET(view)->style->xthickness;
+ height -= 2 * GTK_WIDGET(view)->style->ythickness;
+ }
+
+ gtk_widget_size_request (scrolled_window->vscrollbar, &vsb_requisition);
+ gtk_widget_size_request (scrolled_window->hscrollbar, &hsb_requisition);
+ gtk_widget_style_get (GTK_WIDGET (scrolled_window),
+ "scrollbar_spacing",
+ &scrollbar_spacing,
+ NULL);
+
+ if (EV_IS_VIEW(view)) {
+ ev_view_set_zoom_for_size (EV_VIEW (view),
+ MAX (1, width),
+ MAX (1, height),
+ vsb_requisition.width + scrollbar_spacing,
+ hsb_requisition.height + scrollbar_spacing);
+ }
+}