Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2005-01-03 18:18:57 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-01-03 18:18:57 (GMT)
commit81ab197b294eaaba8b6b99bf2c259c5adb1e2251 (patch)
treea46eb3b64bd16e26c890e8990cb3fe9c1d18b0f2
parentf53f3523ebc7a082eb8a1c046cee836b67696912 (diff)
Fix document title bugs and fallback to filename when not available.
2005-01-03 Marco Pesenti Gritti <marco@gnome.org> * backend/ev-document.c: (ev_document_class_init): * pdf/xpdf/pdf-document.cc: * shell/ev-window.c: (ev_window_open): Fix document title bugs and fallback to filename when not available.
-rw-r--r--ChangeLog9
-rw-r--r--backend/ev-document.c3
-rw-r--r--pdf/xpdf/pdf-document.cc4
-rw-r--r--shell/ev-window.c24
4 files changed, 29 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 1ce27d4..cb92d36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2005-01-03 Marco Pesenti Gritti <marco@gnome.org>
+ * backend/ev-document.c: (ev_document_class_init):
+ * pdf/xpdf/pdf-document.cc:
+ * shell/ev-window.c: (ev_window_open):
+
+ Fix document title bugs and fallback to
+ filename when not available.
+
+2005-01-03 Marco Pesenti Gritti <marco@gnome.org>
+
* backend/ev-document.c: (ev_document_get_type),
(ev_document_class_init), (ev_document_load),
(ev_document_get_title):
diff --git a/backend/ev-document.c b/backend/ev-document.c
index a76a555..e80f95f 100644
--- a/backend/ev-document.c
+++ b/backend/ev-document.c
@@ -73,7 +73,8 @@ ev_document_class_init (gpointer g_class)
g_param_spec_string ("title",
"Document Title",
"The title of the document",
- NULL, 0));
+ NULL,
+ G_PARAM_READABLE));
}
gboolean
diff --git a/pdf/xpdf/pdf-document.cc b/pdf/xpdf/pdf-document.cc
index ede8f77..284b371 100644
--- a/pdf/xpdf/pdf-document.cc
+++ b/pdf/xpdf/pdf-document.cc
@@ -928,6 +928,8 @@ pdf_document_get_title (PdfDocument *pdf_document)
if (info.isDict ()) {
title = pdf_info_dict_get_string (info.getDict(), "Title");
}
+
+ return title;
}
static void
@@ -942,7 +944,7 @@ pdf_document_get_property (GObject *object,
switch (prop_id)
{
case PROP_TITLE:
- title = pdf_document_get_title (pdf_document);
+ title = pdf_document_get_title (pdf_document);
g_value_set_string (value, title);
g_free (title);
break;
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 19c6734..a1e8654 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -72,6 +72,7 @@ struct _EvWindowPrivate {
GtkWidget *statusbar;
guint help_message_cid;
GtkWidget *exit_fullscreen_popup;
+ char *uri;
EvDocument *document;
@@ -254,12 +255,14 @@ update_window_title (EvDocument *document, GParamSpec *pspec, EvWindow *ev_windo
{
char *title = NULL;
- if (document) {
+ if (document == NULL) {
+ title = g_strdup (_("Document Viewer"));
+ } else {
title = ev_document_get_title (document);
- }
- if (title == NULL) {
- title = g_strdup (_("Document Viewer"));
+ if (title == NULL) {
+ title = g_path_get_basename (ev_window->priv->uri);
+ }
}
gtk_window_set_title (GTK_WINDOW (ev_window), title);
@@ -272,6 +275,9 @@ ev_window_open (EvWindow *ev_window, const char *uri)
{
EvDocument *document = NULL;
char *mime_type;
+
+ g_free (ev_window->priv->uri);
+ ev_window->priv->uri = g_strdup (uri);
mime_type = gnome_vfs_get_mime_type (uri);
@@ -287,6 +293,11 @@ ev_window_open (EvWindow *ev_window, const char *uri)
if (document) {
GError *error = NULL;
+ g_signal_connect_object (G_OBJECT (document),
+ "notify::title",
+ G_CALLBACK (update_window_title),
+ ev_window, 0);
+
if (ev_document_load (document, uri, &error)) {
if (ev_window->priv->document)
g_object_unref (ev_window->priv->document);
@@ -297,11 +308,6 @@ ev_window_open (EvWindow *ev_window, const char *uri)
ev_sidebar_set_document (EV_SIDEBAR (ev_window->priv->sidebar),
document);
- g_signal_connect_object (G_OBJECT (document),
- "notify::title",
- G_CALLBACK (update_window_title),
- ev_window, 0);
-
update_action_sensitivity (ev_window);
} else {