]> www.fi.muni.cz Git - evince.git/commitdiff
Correctly handle named destination links
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>
Sun, 28 Jan 2007 22:04:14 +0000 (22:04 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sun, 28 Jan 2007 22:04:14 +0000 (22:04 +0000)
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

ChangeLog
shell/ev-view.c
shell/ev-view.h
shell/ev-window.c

index bca1bacec538c2248dc0cee6a9f2c414147c0f93..20cbebe9846555ce94c196964e6e57a67f0edf51 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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:
index a01a217125be401546f875f7ed0e96ef06f241ab..072ca0822336eb1439dbd257f5ea4c674bb6a244 100644 (file)
@@ -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;
index 77a4ba37ebdc32cf0733d235b66de7d128d2dc87..e9b8afa55a7416166860c02f39fe0dffd0da40a7 100644 (file)
@@ -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
 
index af927dbcd83d55c7bbaf7b1fe3e069fe5ddb67c0..dc0340917321270a38e7f15d8d784d6123f16566 100644 (file)
@@ -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);
 }