From ce80b45c492900e204b314c27000d8fd99687130 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Sun, 3 Apr 2005 00:01:48 +0000 Subject: [PATCH] Patch from Alberto Mesas to make F1 bring up Sat Apr 2 18:57:00 2005 Jonathan Blandford * shell/evwindow.c: Patch from Alberto Mesas to make F1 bring up non-existent help. * shell/eggfindbar.c: Patch from Christian Persch to sync to epiphany's find bar, #167477 * shell/ev-view.c (ev_view_jump): Patch from Emil Soleyman-Zomalan to add space-bar scrolling, * shell/ev-window.c (static GtkActionEntry entries): add default keybinding for Help (F1) Fixes #171068 * shell/ev-view.c (ev_view_show_cursor): Fix from Yuval Tanny changing EV_VIEW_CURSOR_LINK to EV_VIEW_CURSOR_NORMAL resolves bug 170110 --- ChangeLog | 19 +++++ shell/eggfindbar.c | 167 +++++++++++++++++++++++----------------- shell/eggfindbar.h | 9 ++- shell/ev-view.c | 146 +++++++++++++++++++++++++---------- shell/ev-window.c | 14 +++- thumbnailer/Makefile.am | 2 +- 6 files changed, 239 insertions(+), 118 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0227b57a..18787ee2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Sat Apr 2 18:57:00 2005 Jonathan Blandford + + * shell/evwindow.c: Patch from Alberto Mesas to + make F1 bring up non-existent help. + + * shell/eggfindbar.c: Patch from Christian Persch to sync to + epiphany's find bar, #167477 + + * shell/ev-view.c (ev_view_jump): Patch from Emil Soleyman-Zomalan + to add space-bar scrolling, + + * shell/ev-window.c (static GtkActionEntry entries): add default + keybinding for Help (F1) + Fixes #171068 + + * shell/ev-view.c (ev_view_show_cursor): Fix from Yuval Tanny + changing EV_VIEW_CURSOR_LINK to EV_VIEW_CURSOR_NORMAL resolves bug + 170110 + 2005-04-01 David Malcolm * Makefile.am: diff --git a/shell/eggfindbar.c b/shell/eggfindbar.c index c16e9b95..063a220b 100644 --- a/shell/eggfindbar.c +++ b/shell/eggfindbar.c @@ -32,18 +32,17 @@ Boston, MA 02111-1307, USA. #include -typedef struct _EggFindBarPrivate EggFindBarPrivate; struct _EggFindBarPrivate { gchar *search_string; GtkWidget *hbox; - GtkWidget *close_button; GtkWidget *find_entry; GtkWidget *next_button; GtkWidget *previous_button; GtkWidget *case_button; GtkWidget *status_separator; GtkWidget *status_label; + gulong set_focus_handler; guint case_sensitive : 1; }; @@ -70,6 +69,9 @@ static void egg_find_bar_size_request (GtkWidget *widget, GtkRequisition *requisition); static void egg_find_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static void egg_find_bar_show (GtkWidget *widget); +static void egg_find_bar_hide (GtkWidget *widget); +static void egg_find_bar_grab_focus (GtkWidget *widget); G_DEFINE_TYPE (EggFindBar, egg_find_bar, GTK_TYPE_BIN); @@ -90,6 +92,8 @@ egg_find_bar_class_init (EggFindBarClass *klass) GtkWidgetClass *widget_class; GtkBinClass *bin_class; GtkBindingSet *binding_set; + + egg_find_bar_parent_class = g_type_class_peek_parent (klass); object_class = (GObjectClass *)klass; widget_class = (GtkWidgetClass *)klass; @@ -102,12 +106,15 @@ egg_find_bar_class_init (EggFindBarClass *klass) widget_class->size_request = egg_find_bar_size_request; widget_class->size_allocate = egg_find_bar_size_allocate; + widget_class->show = egg_find_bar_show; + widget_class->hide = egg_find_bar_hide; + widget_class->grab_focus = egg_find_bar_grab_focus; find_bar_signals[NEXT] = g_signal_new ("next", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - 0, + G_STRUCT_OFFSET (EggFindBarClass, next), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -115,7 +122,7 @@ egg_find_bar_class_init (EggFindBarClass *klass) g_signal_new ("previous", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - 0, + G_STRUCT_OFFSET (EggFindBarClass, previous), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -123,7 +130,7 @@ egg_find_bar_class_init (EggFindBarClass *klass) g_signal_new ("close", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - 0, + G_STRUCT_OFFSET (EggFindBarClass, close), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -192,21 +199,6 @@ egg_find_bar_emit_previous (EggFindBar *find_bar) g_signal_emit (find_bar, find_bar_signals[PREVIOUS], 0); } -static void -egg_find_bar_emit_close (EggFindBar *find_bar) -{ - g_signal_emit (find_bar, find_bar_signals[CLOSE], 0); -} - -static void -close_clicked_callback (GtkButton *button, - void *data) -{ - EggFindBar *find_bar = EGG_FIND_BAR (data); - - egg_find_bar_emit_close (find_bar); -} - static void next_clicked_callback (GtkButton *button, void *data) @@ -240,7 +232,7 @@ entry_activate_callback (GtkEntry *entry, void *data) { EggFindBar *find_bar = EGG_FIND_BAR (data); - EggFindBarPrivate *priv = (EggFindBarPrivate *)find_bar->private_data; + EggFindBarPrivate *priv = (EggFindBarPrivate *)find_bar->priv; /* We activate the "next" button here so we'll get a nice animation */ @@ -264,19 +256,39 @@ entry_changed_callback (GtkEntry *entry, g_free (text); } +static void +set_focus_cb (GtkWidget *window, + GtkWidget *widget, + EggFindBar *bar) +{ + GtkWidget *wbar = GTK_WIDGET (bar); + + while (widget != NULL && widget != wbar) + { + widget = widget->parent; + } + + /* if widget == bar, the new focus widget is in the bar, so we + * don't deactivate. + */ + if (widget != wbar) + { + g_signal_emit (bar, find_bar_signals[CLOSE], 0); + } +} + static void egg_find_bar_init (EggFindBar *find_bar) { EggFindBarPrivate *priv; GtkWidget *label; GtkWidget *separator; - GtkWidget *image; GtkWidget *image_back; GtkWidget *image_forward; /* Data */ priv = EGG_FIND_BAR_GET_PRIVATE (find_bar); - find_bar->private_data = priv; + find_bar->priv = priv; priv->search_string = NULL; @@ -288,18 +300,13 @@ egg_find_bar_init (EggFindBar *find_bar) label = gtk_label_new_with_mnemonic (_("F_ind:")); separator = gtk_vseparator_new (); - priv->close_button = gtk_button_new (); - gtk_button_set_relief (GTK_BUTTON (priv->close_button), - GTK_RELIEF_NONE); - image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, - GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_container_add (GTK_CONTAINER (priv->close_button), image); - priv->find_entry = gtk_entry_new (); gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->find_entry); - + priv->previous_button = gtk_button_new_with_mnemonic (_("_Previous")); + gtk_button_set_focus_on_click (GTK_BUTTON (priv->previous_button), FALSE); priv->next_button = gtk_button_new_with_mnemonic (_("_Next")); + gtk_button_set_focus_on_click (GTK_BUTTON (priv->next_button), FALSE); image_back = gtk_image_new_from_stock (GTK_STOCK_GO_BACK, GTK_ICON_SIZE_BUTTON); @@ -314,7 +321,7 @@ egg_find_bar_init (EggFindBar *find_bar) priv->case_button = gtk_check_button_new_with_mnemonic (_("C_ase Sensitive")); priv->status_separator = gtk_vseparator_new (); - + priv->status_label = gtk_label_new (NULL); gtk_label_set_ellipsize (GTK_LABEL (priv->status_label), PANGO_ELLIPSIZE_END); @@ -333,9 +340,7 @@ egg_find_bar_init (EggFindBar *find_bar) PANGO_ELLIPSIZE_END); } #endif - - gtk_box_pack_start (GTK_BOX (priv->hbox), - priv->close_button, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (priv->hbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (priv->hbox), @@ -356,24 +361,17 @@ egg_find_bar_init (EggFindBar *find_bar) gtk_container_add (GTK_CONTAINER (find_bar), priv->hbox); gtk_widget_show (priv->hbox); - gtk_widget_show (priv->close_button); gtk_widget_show (priv->find_entry); gtk_widget_show (priv->previous_button); gtk_widget_show (priv->next_button); gtk_widget_show (separator); gtk_widget_show (label); - gtk_widget_show (image); gtk_widget_show (image_back); gtk_widget_show (image_forward); /* don't show status separator/label until they are set */ gtk_widget_pop_composite_child (); - gtk_widget_show_all (priv->hbox); - - g_signal_connect (priv->close_button, "clicked", - G_CALLBACK (close_clicked_callback), - find_bar); g_signal_connect (priv->find_entry, "changed", G_CALLBACK (entry_changed_callback), find_bar); @@ -395,7 +393,7 @@ static void egg_find_bar_finalize (GObject *object) { EggFindBar *find_bar = EGG_FIND_BAR (object); - EggFindBarPrivate *priv = (EggFindBarPrivate *)find_bar->private_data; + EggFindBarPrivate *priv = (EggFindBarPrivate *)find_bar->priv; g_free (priv->search_string); @@ -431,7 +429,7 @@ egg_find_bar_get_property (GObject *object, GParamSpec *pspec) { EggFindBar *find_bar = EGG_FIND_BAR (object); - EggFindBarPrivate *priv = (EggFindBarPrivate *)find_bar->private_data; + EggFindBarPrivate *priv = (EggFindBarPrivate *)find_bar->priv; switch (prop_id) { @@ -478,6 +476,55 @@ egg_find_bar_size_allocate (GtkWidget *widget, gtk_widget_size_allocate (bin->child, allocation); } +static void +egg_find_bar_show (GtkWidget *widget) +{ + EggFindBar *bar = EGG_FIND_BAR (widget); + EggFindBarPrivate *priv = bar->priv; + + GTK_WIDGET_CLASS (egg_find_bar_parent_class)->show (widget); + + if (priv->set_focus_handler == 0) + { + GtkWidget *toplevel; + + toplevel = gtk_widget_get_toplevel (widget); + + priv->set_focus_handler = + g_signal_connect (toplevel, "set-focus", + G_CALLBACK (set_focus_cb), bar); + } +} + +static void +egg_find_bar_hide (GtkWidget *widget) +{ + EggFindBar *bar = EGG_FIND_BAR (widget); + EggFindBarPrivate *priv = bar->priv; + + if (priv->set_focus_handler != 0) + { + GtkWidget *toplevel; + + toplevel = gtk_widget_get_toplevel (widget); + + g_signal_handlers_disconnect_by_func + (toplevel, (void (*)) G_CALLBACK (set_focus_cb), bar); + priv->set_focus_handler = 0; + } + + GTK_WIDGET_CLASS (egg_find_bar_parent_class)->hide (widget); +} + +static void +egg_find_bar_grab_focus (GtkWidget *widget) +{ + EggFindBar *find_bar = EGG_FIND_BAR (widget); + EggFindBarPrivate *priv = find_bar->priv; + + gtk_widget_grab_focus (priv->find_entry); +} + /** * egg_find_bar_new: * @@ -513,7 +560,7 @@ egg_find_bar_set_search_string (EggFindBar *find_bar, g_return_if_fail (EGG_IS_FIND_BAR (find_bar)); - priv = (EggFindBarPrivate *)find_bar->private_data; + priv = (EggFindBarPrivate *)find_bar->priv; g_object_freeze_notify (G_OBJECT (find_bar)); @@ -569,9 +616,9 @@ egg_find_bar_get_search_string (EggFindBar *find_bar) g_return_val_if_fail (EGG_IS_FIND_BAR (find_bar), NULL); - priv = (EggFindBarPrivate *)find_bar->private_data; + priv = find_bar->priv; - return priv->search_string; + return priv->search_string ? priv->search_string : ""; } /** @@ -589,7 +636,7 @@ egg_find_bar_set_case_sensitive (EggFindBar *find_bar, g_return_if_fail (EGG_IS_FIND_BAR (find_bar)); - priv = (EggFindBarPrivate *)find_bar->private_data; + priv = (EggFindBarPrivate *)find_bar->priv; g_object_freeze_notify (G_OBJECT (find_bar)); @@ -625,7 +672,7 @@ egg_find_bar_get_case_sensitive (EggFindBar *find_bar) g_return_val_if_fail (EGG_IS_FIND_BAR (find_bar), FALSE); - priv = (EggFindBarPrivate *)find_bar->private_data; + priv = (EggFindBarPrivate *)find_bar->priv; return priv->case_sensitive; } @@ -685,26 +732,6 @@ egg_find_bar_get_current_match_color (EggFindBar *find_bar, *color = found_color; } -/** - * egg_find_bar_grab_focus: - * - * Focuses the text entry in the find bar; currently GTK+ doesn't have - * a way to make this work on gtk_widget_grab_focus(find_bar). - * - * Since: 2.6 - */ -void -egg_find_bar_grab_focus (EggFindBar *find_bar) -{ - EggFindBarPrivate *priv; - - g_return_if_fail (EGG_IS_FIND_BAR (find_bar)); - - priv = (EggFindBarPrivate *)find_bar->private_data; - - gtk_widget_grab_focus (priv->find_entry); -} - /** * egg_find_bar_set_status_text: * @@ -723,7 +750,7 @@ egg_find_bar_set_status_text (EggFindBar *find_bar, g_return_if_fail (EGG_IS_FIND_BAR (find_bar)); - priv = (EggFindBarPrivate *)find_bar->private_data; + priv = (EggFindBarPrivate *)find_bar->priv; if (text == NULL || *text == '\0') { diff --git a/shell/eggfindbar.h b/shell/eggfindbar.h index 217a180f..49e2b9d3 100644 --- a/shell/eggfindbar.h +++ b/shell/eggfindbar.h @@ -32,19 +32,24 @@ G_BEGIN_DECLS typedef struct _EggFindBar EggFindBar; typedef struct _EggFindBarClass EggFindBarClass; +typedef struct _EggFindBarPrivate EggFindBarPrivate; struct _EggFindBar { GtkBin parent_instance; /*< private >*/ - gpointer private_data; + EggFindBarPrivate *priv; }; struct _EggFindBarClass { GtkBinClass parent_class; + void (* next) (EggFindBar *find_bar); + void (* previous) (EggFindBar *find_bar); + void (* close) (EggFindBar *find_bar); + /* Padding for future expansion */ void (*_gtk_reserved1) (void); void (*_gtk_reserved2) (void); @@ -65,8 +70,6 @@ void egg_find_bar_get_all_matches_color (EggFindBar *find_bar, GdkColor *color); void egg_find_bar_get_current_match_color (EggFindBar *find_bar, GdkColor *color); -void egg_find_bar_grab_focus (EggFindBar *find_bar); - void egg_find_bar_set_status_text (EggFindBar *find_bar, const char *text); diff --git a/shell/ev-view.c b/shell/ev-view.c index eaf88046..29c85f46 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -53,6 +53,11 @@ enum { TARGET_TEXT_BUFFER_CONTENTS }; +enum { + EV_SCROLL_PAGE_FORWARD, + EV_SCROLL_PAGE_BACKWARD +}; + static const GtkTargetEntry targets[] = { { "STRING", 0, TARGET_STRING }, { "TEXT", 0, TARGET_TEXT }, @@ -77,12 +82,12 @@ struct _EvView { GtkWidget parent_instance; EvDocument *document; - + GdkWindow *bin_window; char *status; char *find_status; - + int scroll_x; int scroll_y; @@ -119,24 +124,24 @@ struct _EvViewClass { void (*scroll_view) (EvView *view, GtkScrollType scroll, gboolean horizontal); - + }; static void ev_view_set_scroll_adjustments (EvView *view, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); - + G_DEFINE_TYPE (EvView, ev_view, GTK_TYPE_WIDGET) -/*** Helper functions ***/ - +/*** Helper functions ***/ + static void view_update_adjustments (EvView *view) { int old_x = view->scroll_x; int old_y = view->scroll_y; - + if (view->hadjustment) view->scroll_x = view->hadjustment->value; else @@ -146,7 +151,7 @@ view_update_adjustments (EvView *view) view->scroll_y = view->vadjustment->value; else view->scroll_y = 0; - + if (GTK_WIDGET_REALIZED (view) && (view->scroll_x != old_x || view->scroll_y != old_y)) { gdk_window_move (view->bin_window, - view->scroll_x, - view->scroll_y); @@ -176,7 +181,7 @@ view_set_adjustment_values (EvView *view, if (!adjustment) return; - + adjustment->page_size = allocation; adjustment->step_increment = allocation * 0.1; adjustment->page_increment = allocation * 0.9; @@ -193,8 +198,8 @@ view_set_adjustment_values (EvView *view, gtk_adjustment_value_changed (adjustment); } -/*** Virtual function implementations ***/ - +/*** Virtual function implementations ***/ + static void ev_view_finalize (GObject *object) { @@ -222,7 +227,7 @@ ev_view_destroy (GtkObject *object) view->pixbuf_cache = NULL; } ev_view_set_scroll_adjustments (view, NULL, NULL); - + GTK_OBJECT_CLASS (ev_view_parent_class)->destroy (object); } @@ -242,7 +247,7 @@ ev_view_get_offsets (EvView *view, int *x_offset, int *y_offset) &width, &height); ev_document_misc_get_page_border_size (width, height, &border); - + *x_offset = view->spacing; *y_offset = view->spacing; target_width = width + border.left + border.right + view->spacing * 2; @@ -256,7 +261,7 @@ view_rect_to_doc_rect (EvView *view, GdkRectangle *view_rect, GdkRectangle *doc_ { int x_offset, y_offset; - ev_view_get_offsets (view, &x_offset, &y_offset); + ev_view_get_offsets (view, &x_offset, &y_offset); doc_rect->x = (view_rect->x - x_offset) / view->scale; doc_rect->y = (view_rect->y - y_offset) / view->scale; doc_rect->width = view_rect->width / view->scale; @@ -268,7 +273,7 @@ doc_rect_to_view_rect (EvView *view, GdkRectangle *doc_rect, GdkRectangle *view_ { int x_offset, y_offset; - ev_view_get_offsets (view, &x_offset, &y_offset); + ev_view_get_offsets (view, &x_offset, &y_offset); view_rect->x = doc_rect->x * view->scale + x_offset; view_rect->y = doc_rect->y * view->scale + y_offset; view_rect->width = doc_rect->width * view->scale; @@ -312,7 +317,7 @@ ev_view_size_request (GtkWidget *widget, requisition->width = width + border.left + border.right + view->spacing * 2; } - + if (view->height >= 0) { requisition->height = 0; } else { @@ -346,19 +351,19 @@ ev_view_realize (GtkWidget *widget) GdkWindowAttr attributes; GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); - + attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); - + attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.event_mask = 0; - + widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, GDK_WA_X | GDK_WA_Y | @@ -367,7 +372,7 @@ ev_view_realize (GtkWidget *widget) gdk_window_set_user_data (widget->window, widget); widget->style = gtk_style_attach (widget->style, widget->window); gdk_window_set_background (widget->window, &widget->style->mid[widget->state]); - + attributes.x = 0; attributes.y = 0; attributes.width = MAX (widget->allocation.width, widget->requisition.width); @@ -379,7 +384,7 @@ ev_view_realize (GtkWidget *widget) GDK_KEY_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK; - + view->bin_window = gdk_window_new (widget->window, &attributes, GDK_WA_X | GDK_WA_Y | @@ -433,7 +438,7 @@ draw_rubberband (GtkWidget *widget, GdkWindow *window, guint fill_color; int x_offset, y_offset; - ev_view_get_offsets (EV_VIEW (widget), &x_offset, &y_offset); + ev_view_get_offsets (EV_VIEW (widget), &x_offset, &y_offset); fill_color_gdk = gdk_color_copy (>K_WIDGET (widget)->style->base[GTK_STATE_SELECTED]); fill_color = ev_gdk_color_to_rgb (fill_color_gdk) << 8 | alpha; @@ -475,7 +480,7 @@ highlight_find_results (EvView *view) g_mutex_lock (EV_DOC_MUTEX); results = ev_document_find_get_n_results (find); g_mutex_unlock (EV_DOC_MUTEX); - + for (i = 0; i < results; i++) { GdkRectangle rectangle; guchar alpha; @@ -505,14 +510,14 @@ expose_bin_window (GtkWidget *widget, if (view->document == NULL) return; - ev_view_get_offsets (view, &x_offset, &y_offset); + ev_view_get_offsets (view, &x_offset, &y_offset); ev_page_cache_get_size (view->page_cache, view->current_page, view->scale, &width, &height); ev_document_misc_get_page_border_size (width, height, &border); - + /* Paint the frame */ area.x = x_offset; area.y = y_offset; @@ -709,7 +714,7 @@ status_message_from_link (EvView *view, EvLink *link) char *page_label; type = ev_link_get_link_type (link); - + switch (type) { case EV_LINK_TYPE_TITLE: if (ev_link_get_title (link)) @@ -746,7 +751,7 @@ static void ev_view_set_find_status (EvView *view, const char *message) { g_return_if_fail (EV_IS_VIEW (view)); - + g_free (view->find_status); view->find_status = g_strdup (message); g_object_notify (G_OBJECT (view), "find-status"); @@ -931,7 +936,7 @@ set_scroll_adjustment (EvView *view, to_set = &view->hadjustment; else to_set = &view->vadjustment; - + if (*to_set != adjustment) { if (*to_set) { g_signal_handlers_disconnect_by_func (*to_set, @@ -969,7 +974,7 @@ add_scroll_binding (GtkBindingSet *binding_set, gboolean horizontal) { guint keypad_keyval = keyval - GDK_Left + GDK_KP_Left; - + gtk_binding_entry_add_signal (binding_set, keyval, 0, "scroll_view", 2, GTK_TYPE_SCROLL_TYPE, scroll, @@ -980,6 +985,60 @@ add_scroll_binding (GtkBindingSet *binding_set, G_TYPE_BOOLEAN, horizontal); } +static void +ev_view_jump (EvView *view, + GtkScrollType scroll) +{ + GtkAdjustment *adjustment; + double value, increment; + gboolean first_page = FALSE; + gboolean last_page = FALSE; + + /* Assign values for increment and vertical adjustment */ + adjustment = view->vadjustment; + increment = adjustment->page_size * 0.75; + value = adjustment->value; + + /* Assign boolean for first and last page */ + if (view->current_page == 0) + first_page = TRUE; + if (view->current_page == ev_page_cache_get_n_pages (view->page_cache) - 1) + last_page = TRUE; + + switch (scroll) { + case EV_SCROLL_PAGE_BACKWARD: + /* Do not jump backwards if at the first page */ + if (value == (adjustment->lower) && first_page) { + /* Do nothing */ + /* At the top of a page, assign the upper bound limit of previous page */ + } else if (value == (adjustment->lower)) { + value = adjustment->upper - adjustment->page_size; + ev_page_cache_set_current_page (view->page_cache, view->current_page - 1); + /* Jump to the top */ + } else { + value = MAX (value - increment, adjustment->lower); + } + break; + case EV_SCROLL_PAGE_FORWARD: + /* Do not jump forward if at the last page */ + if (value == (adjustment->upper - adjustment->page_size) && last_page) { + /* Do nothing */ + /* At the bottom of a page, assign the lower bound limit of next page */ + } else if (value == (adjustment->upper - adjustment->page_size)) { + value = 0; + ev_page_cache_set_current_page (view->page_cache, view->current_page + 1); + /* Jump to the bottom */ + } else { + value = MIN (value + increment, adjustment->upper - adjustment->page_size); + } + break; + default: + break; + } + + gtk_adjustment_set_value (adjustment, value); +} + static void ev_view_scroll_view (EvView *view, GtkScrollType scroll, @@ -989,12 +1048,14 @@ ev_view_scroll_view (EvView *view, ev_page_cache_prev_page (view->page_cache); } else if (scroll == GTK_SCROLL_PAGE_FORWARD) { ev_page_cache_next_page (view->page_cache); + } else if (scroll == EV_SCROLL_PAGE_BACKWARD || scroll == EV_SCROLL_PAGE_FORWARD) { + ev_view_jump (view, scroll); } else { GtkAdjustment *adjustment; double value; if (horizontal) { - adjustment = view->hadjustment; + adjustment = view->hadjustment; } else { adjustment = view->vadjustment; } @@ -1002,11 +1063,11 @@ ev_view_scroll_view (EvView *view, value = adjustment->value; switch (scroll) { - case GTK_SCROLL_STEP_BACKWARD: - value -= adjustment->step_increment; + case GTK_SCROLL_STEP_BACKWARD: + value -= adjustment->step_increment; break; case GTK_SCROLL_STEP_FORWARD: - value += adjustment->step_increment; + value += adjustment->step_increment; break; default: break; @@ -1123,6 +1184,9 @@ ev_view_class_init (EvViewClass *class) add_scroll_binding (binding_set, GDK_Page_Up, GTK_SCROLL_PAGE_BACKWARD, FALSE); add_scroll_binding (binding_set, GDK_Page_Down, GTK_SCROLL_PAGE_FORWARD, FALSE); + + add_scroll_binding (binding_set, GDK_space, EV_SCROLL_PAGE_FORWARD, FALSE); + add_scroll_binding (binding_set, GDK_BackSpace, EV_SCROLL_PAGE_BACKWARD, FALSE); } static void @@ -1170,7 +1234,7 @@ update_find_status_message (EvView *view) message = g_strdup_printf (_("%3d%% remaining to search"), (int) ((1.0 - percent) * 100)); } - + } // g_mutex_unlock (EV_DOC_MUTEX); @@ -1277,8 +1341,8 @@ find_changed_cb (EvDocument *document, int page, EvView *view) } #endif } -/*** Public API ***/ - +/*** Public API ***/ + GtkWidget* ev_view_new (void) { @@ -1330,7 +1394,7 @@ page_changed_cb (EvPageCache *page_cache, gtk_widget_queue_resize (GTK_WIDGET (view)); else gtk_widget_queue_draw (GTK_WIDGET (view)); - + gtk_adjustment_set_value (view->vadjustment, view->vadjustment->lower); @@ -1354,7 +1418,7 @@ ev_view_set_document (EvView *view, view); g_object_unref (view->document); view->page_cache = NULL; - + } view->document = document; @@ -1374,7 +1438,7 @@ ev_view_set_document (EvView *view, view->pixbuf_cache = ev_pixbuf_cache_new (view->document); g_signal_connect (view->pixbuf_cache, "job-finished", G_CALLBACK (job_finished_cb), view); } - + gtk_widget_queue_resize (GTK_WIDGET (view)); } } @@ -1387,7 +1451,7 @@ go_to_link (EvView *view, EvLink *link) int page; type = ev_link_get_link_type (link); - + switch (type) { case EV_LINK_TYPE_TITLE: break; @@ -1591,5 +1655,5 @@ ev_view_hide_cursor (EvView *view) void ev_view_show_cursor (EvView *view) { - ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK); + ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL); } diff --git a/shell/ev-window.c b/shell/ev-window.c index 9990f611..e606aedf 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -1051,7 +1051,7 @@ ev_window_cmd_edit_find (GtkAction *action, EvWindow *ev_window) } else { update_chrome_flag (ev_window, EV_CHROME_FINDBAR, NULL, TRUE); - egg_find_bar_grab_focus (EGG_FIND_BAR (ev_window->priv->find_bar)); + gtk_widget_grab_focus (ev_window->priv->find_bar); } } @@ -1874,7 +1874,7 @@ find_bar_search_changed_cb (EggFindBar *find_bar, if (ev_window->priv->document && EV_IS_DOCUMENT_FIND (ev_window->priv->document)) { - if (visible && search_string) { + if (visible && search_string && search_string[0]) { g_mutex_lock (EV_DOC_MUTEX); ev_document_find_begin (EV_DOCUMENT_FIND (ev_window->priv->document), search_string, case_sensitive); g_mutex_unlock (EV_DOC_MUTEX); @@ -1931,6 +1931,14 @@ ev_window_dispose (GObject *object) priv->password_uri = NULL; } + if (priv->find_bar) { + g_signal_handlers_disconnect_by_func + (window->priv->find_bar, + G_CALLBACK (find_bar_close_cb), + window); + priv->find_bar = NULL; + } + destroy_fullscreen_popup (window); G_OBJECT_CLASS (ev_window_parent_class)->dispose (object); @@ -2012,7 +2020,7 @@ static GtkActionEntry entries[] = { G_CALLBACK (ev_window_cmd_go_last_page) }, /* Help menu */ - { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), NULL, + { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", N_("Display help for the viewer application"), G_CALLBACK (ev_window_cmd_help_contents) }, diff --git a/thumbnailer/Makefile.am b/thumbnailer/Makefile.am index 50138678..c74910eb 100644 --- a/thumbnailer/Makefile.am +++ b/thumbnailer/Makefile.am @@ -36,7 +36,7 @@ install-data-local: if GCONF_SCHEMAS_INSTALL if test -z "$(DESTDIR)" ; then \ for p in $(schema_DATA) ; do \ - GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/thumbnailer/$$p >&1 > /dev/null; \ + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_srcdir)/thumbnailer/$$p >&1 > /dev/null; \ done \ fi endif -- 2.43.5