From: Nickolay V. Shmyrev Date: Sun, 28 Jan 2007 22:04:14 +0000 (+0000) Subject: Correctly handle named destination links X-Git-Tag: EVINCE_0_7_2~52 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=b8f97c954e2e3c9b40f46dc55f3727cb7b35137c;p=evince.git Correctly handle named destination links 2007-01-29 Nickolay V. Shmyrev * shell/ev-view.c: (ev_view_page_label_from_dest), (tip_from_link): * shell/ev-view.h: * shell/ev-window.c: (ev_window_add_history): Correctly handle named destination links svn path=/trunk/; revision=2269 --- diff --git a/ChangeLog b/ChangeLog index bca1bace..20cbebe9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-01-29 Nickolay V. Shmyrev + + * shell/ev-view.c: (ev_view_page_label_from_dest), (tip_from_link): + * shell/ev-view.h: + * shell/ev-window.c: (ev_window_add_history): + + Correctly handle named destination links + 2007-01-28 Nickolay V. Shmyrev * NOTES: diff --git a/shell/ev-view.c b/shell/ev-view.c index a01a2171..072ca082 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -1370,8 +1370,8 @@ ev_view_handle_link (EvView *view, EvLink *link) } } -static gchar * -page_label_from_dest (EvView *view, EvLinkDest *dest) +gchar * +ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest) { EvLinkDestType type; gchar *msg = NULL; @@ -1394,6 +1394,10 @@ page_label_from_dest (EvView *view, EvLinkDest *dest) } break; + case EV_LINK_DEST_TYPE_PAGE_LABEL: { + msg = g_strdup (ev_link_dest_get_page_label (dest)); + } + break; default: msg = ev_page_cache_get_page_label (view->page_cache, ev_link_dest_get_page (dest)); @@ -1443,8 +1447,8 @@ tip_from_link (EvView *view, EvLink *link) switch (type) { case EV_LINK_ACTION_TYPE_GOTO_DEST: - page_label = page_label_from_dest (view, - ev_link_action_get_dest (action)); + page_label = ev_view_page_label_from_dest (view, + ev_link_action_get_dest (action)); msg = g_strdup_printf (_("Go to page %s"), page_label); g_free (page_label); break; diff --git a/shell/ev-view.h b/shell/ev-view.h index 77a4ba37..e9b8afa5 100644 --- a/shell/ev-view.h +++ b/shell/ev-view.h @@ -143,6 +143,7 @@ void ev_view_handle_link (EvView *view, EvLink *link); gboolean ev_view_next_page (EvView *view); gboolean ev_view_previous_page (EvView *view); +gchar* ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest); G_END_DECLS diff --git a/shell/ev-window.c b/shell/ev-window.c index af927dbc..dc034091 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -680,7 +680,7 @@ ev_window_find_chapter (GtkTreeModel *tree_model, static void ev_window_add_history (EvWindow *window, gint page, EvLink *link) { - const gchar *page_label; + const gchar *page_label = NULL; gchar *link_title; FindTask find_task; @@ -692,20 +692,16 @@ ev_window_add_history (EvWindow *window, gint page, EvLink *link) action = g_object_ref (ev_link_get_action (link)); dest = ev_link_action_get_dest (action); page = ev_link_dest_get_page (dest); + page_label = ev_view_page_label_from_dest (window->priv->view, dest); } else { dest = ev_link_dest_new_page (page); action = ev_link_action_new_dest (dest); + page_label = ev_page_cache_get_page_label (window->priv->page_cache, page); } - if (page < 0) + if (!page_label) return; - - if (ev_link_dest_get_page_label (dest)) - page_label = ev_link_dest_get_page_label (dest); - else - page_label = ev_page_cache_get_page_label (window->priv->page_cache, page); - find_task.page_label = page_label; find_task.chapter = NULL; @@ -735,6 +731,7 @@ ev_window_add_history (EvWindow *window, gint page, EvLink *link) ev_history_add_link (window->priv->history, real_link); g_free (link_title); + g_free (page_label); g_object_unref (real_link); }