+2005-06-06 Marco Pesenti Gritti <mpg@redhat.com>
+
+ * backend/ev-page-cache.c: (_ev_page_cache_new):
+ * backend/ev-page-cache.h:
+
+ Use a const to return title so that we dont double
+ free it. Small cleanup and fix a leak.
+
+ * shell/ev-window.c: (update_window_title):
+
+ strdup value from get_title.
+
2005-06-06 Marco Pesenti Gritti <mpg@redhat.com>
* shell/ev-sidebar-links.c: (job_finished_callback),
EvPageCache *
_ev_page_cache_new (EvDocument *document)
{
- EvDocumentInfo *doc_info;
EvPageCache *page_cache;
EvPageCacheInfo *info;
gint i;
page_cache->page_labels = g_new0 (char *, page_cache->n_pages);
page_cache->max_width = 0;
page_cache->max_height = 0;
+ page_cache->page_info = ev_document_get_info (document);
- doc_info = ev_document_get_info (document);
- if (doc_info->fields_mask & EV_DOCUMENT_INFO_TITLE) {
- page_cache->title = g_strdup (doc_info->title);
+ if (page_cache->page_info->fields_mask & EV_DOCUMENT_INFO_TITLE) {
+ page_cache->title = g_strdup (page_cache->page_info->title);
} else {
page_cache->title = NULL;
}
- g_free (doc_info);
for (i = 0; i < page_cache->n_pages; i++) {
double page_width = 0;
}
}
- page_cache->page_info = ev_document_get_info (document);
-
/* make some sanity check assertions */
if (! page_cache->uniform)
g_assert (page_cache->size_cache != NULL);
ev_page_cache_set_current_page (page_cache, ev_link_get_page (link));
}
-char *
+const char *
ev_page_cache_get_title (EvPageCache *page_cache)
{
g_return_val_if_fail (EV_IS_PAGE_CACHE (page_cache), NULL);
/* Used by ev-document.c only */
EvPageCache *_ev_page_cache_new (EvDocument *document);
gint ev_page_cache_get_n_pages (EvPageCache *page_cache);
-char *ev_page_cache_get_title (EvPageCache *page_cache);
+const char *ev_page_cache_get_title (EvPageCache *page_cache);
void ev_page_cache_get_size (EvPageCache *page_cache,
gint page,
gfloat scale,
password_needed = (ev_window->priv->password_document != NULL);
if (document && ev_window->priv->page_cache) {
- doc_title = ev_page_cache_get_title (ev_window->priv->page_cache);
+ doc_title = g_strdup (ev_page_cache_get_title (ev_window->priv->page_cache));
/* Make sure we get a valid title back */
if (doc_title) {
if (doc_title[0] == '\000' ||
!g_utf8_validate (doc_title, -1, NULL)) {
- g_free (doc_title);
doc_title = NULL;
}
}