evince r3573 - in trunk: . libview shell
- From: carlosgc svn gnome org
- To: svn-commits-list gnome org
- Subject: evince r3573 - in trunk: . libview shell
- Date: Mon, 6 Apr 2009 17:05:52 +0000 (UTC)
Author: carlosgc
Date: Mon Apr 6 17:05:52 2009
New Revision: 3573
URL: http://svn.gnome.org/viewvc/evince?rev=3573&view=rev
Log:
2009-04-06 Carlos Garcia Campos <carlosgc gnome org>
* libview/ev-view.[ch]: (ev_view_set_zoom),
(ev_view_update_view_size):
* shell/ev-window.c: (ev_window_set_view_size),
(ev_window_sizing_mode_changed_cb), (ev_window_init):
Move ev_view_update_view_size() from libview to ev-window again
and make sure the view is not redrawn when calling
ev_view_set_zoom more than once with the same zoom scale.
Modified:
trunk/ChangeLog
trunk/libview/ev-view.c
trunk/libview/ev-view.h
trunk/shell/ev-window.c
Modified: trunk/libview/ev-view.c
==============================================================================
--- trunk/libview/ev-view.c (original)
+++ trunk/libview/ev-view.c Mon Apr 6 17:05:52 2009
@@ -2218,9 +2218,7 @@
if (view->sizing_mode == EV_SIZING_FIT_WIDTH ||
view->sizing_mode == EV_SIZING_BEST_FIT) {
-
g_signal_emit (view, signals[SIGNAL_ZOOM_INVALID], 0);
-
ev_view_size_request (widget, &widget->requisition);
}
@@ -4441,6 +4439,9 @@
view->sizing_mode == EV_SIZING_FREE ? view->min_scale : 0,
view->max_scale);
+ if (scale == view->scale)
+ return;
+
if (ABS (view->scale - scale) < EPSILON)
return;
@@ -5834,38 +5835,3 @@
}
}
-/*** Enum description for usage in signal ***/
-
-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);
- }
-}
Modified: trunk/libview/ev-view.h
==============================================================================
--- trunk/libview/ev-view.h (original)
+++ trunk/libview/ev-view.h Mon Apr 6 17:05:52 2009
@@ -133,9 +133,6 @@
gboolean ev_view_previous_page (EvView *view);
gchar* ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest);
-void ev_view_update_view_size (EvView *view,
- GtkScrolledWindow *scrolled_window);
-
void ev_view_autoscroll_start (EvView *view);
void ev_view_autoscroll_stop (EvView *view);
Modified: trunk/shell/ev-window.c
==============================================================================
--- trunk/shell/ev-window.c (original)
+++ trunk/shell/ev-window.c Mon Apr 6 17:05:52 2009
@@ -4120,51 +4120,59 @@
enum_value->value_nick);
}
+static void
+ev_window_set_view_size (EvWindow *window)
+{
+ gint width, height;
+ GtkRequisition vsb_requisition;
+ GtkRequisition hsb_requisition;
+ gint scrollbar_spacing;
+ GtkWidget *scrolled_window = window->priv->scrolled_window;
+
+ if (!window->priv->view)
+ return;
+
+ /* Calculate the width available for the content */
+ width = scrolled_window->allocation.width;
+ height = scrolled_window->allocation.height;
+
+ if (gtk_scrolled_window_get_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window)) == GTK_SHADOW_IN) {
+ width -= 2 * window->priv->view->style->xthickness;
+ height -= 2 * window->priv->view->style->ythickness;
+ }
+
+ gtk_widget_size_request (GTK_SCROLLED_WINDOW (scrolled_window)->vscrollbar,
+ &vsb_requisition);
+ gtk_widget_size_request (GTK_SCROLLED_WINDOW (scrolled_window)->hscrollbar,
+ &hsb_requisition);
+ gtk_widget_style_get (scrolled_window,
+ "scrollbar_spacing",
+ &scrollbar_spacing,
+ NULL);
+
+ ev_view_set_zoom_for_size (EV_VIEW (window->priv->view),
+ MAX (1, width),
+ MAX (1, height),
+ vsb_requisition.width + scrollbar_spacing,
+ hsb_requisition.height + scrollbar_spacing);
+}
+
static void
ev_window_sizing_mode_changed_cb (EvView *view, GParamSpec *pspec,
EvWindow *ev_window)
{
- GtkWidget *scrolled_window;
EvSizingMode sizing_mode;
g_object_get (ev_window->priv->view,
"sizing-mode", &sizing_mode,
NULL);
- scrolled_window = ev_window->priv->scrolled_window;
-
- g_signal_handlers_disconnect_by_func (ev_window->priv->view, ev_view_update_view_size, scrolled_window);
-
- if (sizing_mode != EV_SIZING_FREE)
- ev_view_update_view_size (EV_VIEW (ev_window->priv->view),
- GTK_SCROLLED_WINDOW (scrolled_window));
-
- switch (sizing_mode) {
- case EV_SIZING_BEST_FIT:
- g_object_set (G_OBJECT (scrolled_window),
- "hscrollbar-policy", GTK_POLICY_NEVER,
- "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
- NULL);
- g_signal_connect (ev_window->priv->view, "zoom_invalid",
- G_CALLBACK (ev_view_update_view_size),
- scrolled_window);
- break;
- case EV_SIZING_FIT_WIDTH:
- g_object_set (G_OBJECT (scrolled_window),
- "hscrollbar-policy", GTK_POLICY_NEVER,
- "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
- NULL);
- g_signal_connect (ev_window->priv->view, "zoom_invalid",
- G_CALLBACK (ev_view_update_view_size),
- scrolled_window);
- break;
- case EV_SIZING_FREE:
- g_object_set (G_OBJECT (scrolled_window),
- "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
- "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
- NULL);
- break;
- }
+ g_object_set (ev_window->priv->scrolled_window,
+ "hscrollbar-policy",
+ sizing_mode == EV_SIZING_FREE ?
+ GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER,
+ "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
+ NULL);
update_sizing_buttons (ev_window);
save_sizing_mode (ev_window);
@@ -4727,7 +4735,7 @@
} else {
mode = EV_SIZING_FREE;
}
-
+
ev_view_set_sizing_mode (EV_VIEW (ev_window->priv->view), mode);
if (mode == EV_SIZING_FREE) {
@@ -6178,7 +6186,9 @@
g_signal_connect_object (ev_window->priv->view, "handle-link",
G_CALLBACK (view_handle_link_cb),
ev_window, 0);
-
+ g_signal_connect_swapped (ev_window->priv->view, "zoom_invalid",
+ G_CALLBACK (ev_window_set_view_size),
+ ev_window);
g_signal_connect_object (ev_window->priv->view,
"popup",
G_CALLBACK (view_menu_popup_cb),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]