diff options
author | Marco 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) |
commit | 81ab197b294eaaba8b6b99bf2c259c5adb1e2251 (patch) | |
tree | a46eb3b64bd16e26c890e8990cb3fe9c1d18b0f2 /shell/ev-window.c | |
parent | f53f3523ebc7a082eb8a1c046cee836b67696912 (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.
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r-- | shell/ev-window.c | 24 |
1 files changed, 15 insertions, 9 deletions
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 { |