+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
+
2007-01-28 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* NOTES:
}
}
-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;
}
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));
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;
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
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;
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;
ev_history_add_link (window->priv->history, real_link);
g_free (link_title);
+ g_free (page_label);
g_object_unref (real_link);
}