Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>2007-01-28 22:04:14 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2007-01-28 22:04:14 (GMT)
commitb8f97c954e2e3c9b40f46dc55f3727cb7b35137c (patch)
tree120915c452b1d58cb50dbbc28503665c6b69a72c /shell
parent8c53a52d2cf88d095bccbff7ea927100e082c537 (diff)
Correctly handle named destination links
2007-01-29 Nickolay V. Shmyrev <nshmyrev@yandex.ru> * 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
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-view.c12
-rw-r--r--shell/ev-view.h1
-rw-r--r--shell/ev-window.c13
3 files changed, 14 insertions, 12 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c
index a01a217..072ca08 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 77a4ba3..e9b8afa 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 af927db..dc03409 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);
}