Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@src.gnome.org>2005-03-31 18:43:05 (GMT)
committer Jonathan Blandford <jrb@src.gnome.org>2005-03-31 18:43:05 (GMT)
commit03ad9a29cbe1a89dfc5e8b94a74f6f86c4cba076 (patch)
tree9a2b40848e7f657691fd682673d71189301b676e /shell
parente8096c18ba580156072e8c84103bee6f6d3f0bfc (diff)
Cr 31 13:27:50 2005 Jonathan Blandford <jrb@redhat.com>
Cr 31 13:27:50 2005 Jonathan Blandford <jrb@redhat.com> * backend/ev-document.c: (ev_document_get_page_label): * backend/ev-document.h: * backend/ev-page-cache.c: (_ev_page_cache_new), (ev_page_cache_get_page_label): * backend/ev-page-cache.h: * pdf/ev-poppler.cc: * shell/ev-sidebar-links.c: (ev_sidebar_links_construct), (links_page_num_func): * shell/ev-sidebar-thumbnails.c: (ev_sidebar_thumbnails_set_document): * shell/ev-view.c: (status_message_from_link), (ev_view_motion_notify_event): * shell/ev-window.c: (document_supports_sidebar): Add in page label support. It's not perfect yet, but it's the first 'feature' in a while. Also, fix a bogus comment noticed by crispin. VS: Modified Files:
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-sidebar-links.c19
-rw-r--r--shell/ev-sidebar-thumbnails.c13
-rw-r--r--shell/ev-view.c11
-rw-r--r--shell/ev-window.c1
4 files changed, 27 insertions, 17 deletions
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index 03ea9e9..a278034 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -51,7 +51,7 @@ static void links_page_num_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
- gpointer data);
+ EvSidebarLinks *sidebar_links);
static void update_page_callback (EvPageCache *page_cache,
gint current_page,
EvSidebarLinks *sidebar_links);
@@ -189,7 +189,7 @@ ev_sidebar_links_construct (EvSidebarLinks *ev_sidebar_links)
gtk_tree_view_column_pack_end (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE);
gtk_tree_view_column_set_cell_data_func (GTK_TREE_VIEW_COLUMN (column), renderer,
(GtkTreeCellDataFunc) links_page_num_func,
- NULL, NULL);
+ ev_sidebar_links, NULL);
}
@@ -207,7 +207,7 @@ links_page_num_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
- gpointer data)
+ EvSidebarLinks *sidebar_links)
{
EvLink *link;
@@ -217,12 +217,19 @@ links_page_num_func (GtkTreeViewColumn *tree_column,
if (link != NULL &&
ev_link_get_link_type (link) == EV_LINK_TYPE_PAGE) {
- gchar *markup = g_strdup_printf ("<i>%d</i>", ev_link_get_page (link));
+ gchar *page_label;
+ gchar *page_string;
+
+ page_label = ev_page_cache_get_page_label (sidebar_links->priv->page_cache, ev_link_get_page (link));
+ page_string = g_markup_printf_escaped ("<i>%s</i>", page_label);
+
g_object_set (cell,
- "markup", markup,
+ "markup", page_string,
"visible", TRUE,
NULL);
- g_free (markup);
+
+ g_free (page_label);
+ g_free (page_string);
} else {
g_object_set (cell,
"visible", FALSE,
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index 7bbaa09..b439e4b 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -222,7 +222,6 @@ ev_sidebar_thumbnails_set_document (EvSidebarThumbnails *sidebar_thumbnails,
GdkPixbuf *loading_icon;
gint i, n_pages;
GtkTreeIter iter;
- gchar *page;
gint width = THUMBNAIL_WIDTH;
gint height = THUMBNAIL_WIDTH;
EvPageCache *page_cache;
@@ -249,18 +248,22 @@ ev_sidebar_thumbnails_set_document (EvSidebarThumbnails *sidebar_thumbnails,
gtk_list_store_clear (priv->list_store);
for (i = 0; i < n_pages; i++) {
EvJob *job;
+ gchar *page_label;
+ gchar *page_string;
- /* FIXME: Bah. This is still -1 for some reason. Need to track it down.. */
job = ev_job_thumbnail_new (priv->document, i, THUMBNAIL_WIDTH);
- page = g_strdup_printf ("<i>%d</i>", i + 1); /* FIXME: replace with string. */
+ page_label = ev_page_cache_get_page_label (page_cache, i);
+ page_string = g_markup_printf_escaped ("<i>%s</i>", page_label);
+
gtk_list_store_append (priv->list_store, &iter);
gtk_list_store_set (priv->list_store, &iter,
- COLUMN_PAGE_STRING, page,
+ COLUMN_PAGE_STRING, page_string,
COLUMN_PIXBUF, loading_icon,
COLUMN_THUMBNAIL_SET, FALSE,
COLUMN_JOB, job,
-1);
- g_free (page);
+ g_free (page_label);
+ g_free (page_string);
ev_job_queue_add_job (job, EV_JOB_PRIORITY_LOW);
g_object_set_data_full (G_OBJECT (job), "tree_iter",
gtk_tree_iter_copy (&iter),
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 97e0c54..d1bce99 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -701,11 +701,11 @@ ev_view_button_press_event (GtkWidget *widget,
}
static char *
-status_message_from_link (EvLink *link)
+status_message_from_link (EvView *view, EvLink *link)
{
EvLinkType type;
char *msg = NULL;
- int page;
+ char *page_label;
type = ev_link_get_link_type (link);
@@ -715,8 +715,9 @@ status_message_from_link (EvLink *link)
msg = g_strdup (ev_link_get_title (link));
break;
case EV_LINK_TYPE_PAGE:
- page = ev_link_get_page (link);
- msg = g_strdup_printf (_("Go to page %d"), page);
+ page_label = ev_page_cache_get_page_label (view->page_cache, ev_link_get_page (link));
+ msg = g_strdup_printf (_("Go to page %s"), page_label);
+ g_free (page_label);
break;
case EV_LINK_TYPE_EXTERNAL_URI:
msg = g_strdup (ev_link_get_uri (link));
@@ -874,7 +875,7 @@ ev_view_motion_notify_event (GtkWidget *widget,
if (link) {
char *msg;
- msg = status_message_from_link (link);
+ msg = status_message_from_link (view, link);
ev_view_set_status (view, msg);
ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK);
g_free (msg);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 8b3044f..9607405 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -495,7 +495,6 @@ update_total_pages (EvWindow *ev_window)
static gboolean
document_supports_sidebar (EvDocument *document)
{
- /* FIXME: Remove the (TRUE ||) after links are fixed in poppler-glib */
return (EV_IS_DOCUMENT_THUMBNAILS (document) && (EV_IS_DOCUMENT_LINKS (document)));
}