diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2005-01-03 13:43:31 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2005-01-03 13:43:31 (GMT) |
commit | f53f3523ebc7a082eb8a1c046cee836b67696912 (patch) | |
tree | 3f1de9127a28d9ae4ce2caa87d923add04e3a3e0 /shell | |
parent | b393a0f9386efcd5742d335be1ecc178caf00853 (diff) |
Initial support for document title. Not working yet.
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):
* backend/ev-document.h:
* pdf/xpdf/pdf-document.cc:
* ps/ps-document.c: (ps_document_set_property),
(ps_document_get_property), (ps_document_class_init),
(document_load):
* ps/ps-document.h:
* ps/ps.h:
* shell/ev-window.c: (update_window_title), (ev_window_open),
(ev_window_init):
Initial support for document title. Not working yet.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ev-window.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c index 19394f5..19c6734 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -249,6 +249,24 @@ mime_type_supported_by_gdk_pixbuf (const gchar *mime_type) return retval; } +static void +update_window_title (EvDocument *document, GParamSpec *pspec, EvWindow *ev_window) +{ + char *title = NULL; + + if (document) { + title = ev_document_get_title (document); + } + + if (title == NULL) { + title = g_strdup (_("Document Viewer")); + } + + gtk_window_set_title (GTK_WINDOW (ev_window), title); + + g_free (title); +} + void ev_window_open (EvWindow *ev_window, const char *uri) { @@ -279,6 +297,11 @@ 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 { @@ -1150,7 +1173,7 @@ ev_window_init (EvWindow *ev_window) ev_window->priv = EV_WINDOW_GET_PRIVATE (ev_window); - gtk_window_set_title (GTK_WINDOW (ev_window), _("Document Viewer")); + update_window_title (NULL, NULL, ev_window); ev_window->priv->main_box = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (ev_window), ev_window->priv->main_box); |