diff options
author | Tommi Komulainen <tko@litl.com> | 2009-08-25 10:23:36 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marcopg@litl.com> | 2010-07-27 22:04:22 (GMT) |
commit | 4665a2df604e22bdfe944ef0bd8104647fb81a66 (patch) | |
tree | ab4173ab43fc8bd9c3ee176a0f901849943afb9e | |
parent | e1b507d7c507458c54e1b11d8d070927bf13ca68 (diff) |
browser-plugin: extract pdf title to member variable for easier access
-rw-r--r-- | browser-plugin/plugin.cpp | 15 | ||||
-rw-r--r-- | browser-plugin/plugin.h | 3 |
2 files changed, 17 insertions, 1 deletions
diff --git a/browser-plugin/plugin.cpp b/browser-plugin/plugin.cpp index c8a7de7..db1f4f5 100644 --- a/browser-plugin/plugin.cpp +++ b/browser-plugin/plugin.cpp @@ -26,7 +26,8 @@ Plugin::Plugin (NPP instance) : mInstance (instance), mScriptableObject (0), mWindow (0), - mLoadJob (0) + mLoadJob (0), + mTitle (0) { mScrolledWindow = gtk_scrolled_window_new (NULL, NULL); @@ -56,6 +57,8 @@ Plugin::~Plugin () { ClearLoadJob (); + g_free (mTitle); + if (mScriptableObject) { NPN_ReleaseObject (mScriptableObject); mScriptableObject = 0; @@ -228,6 +231,16 @@ Plugin::LoadJobFinishedCallback (EvJob *job, gpointer data) if (!ev_job_is_failed (job)) { ev_view_set_document (EV_VIEW(plugin->mView), EV_JOB (job)->document); + + EvDocumentInfo *doc_info = ev_document_get_info (EV_JOB (job)->document); + if (doc_info) { + if (doc_info->fields_mask & EV_DOCUMENT_INFO_TITLE) { + + plugin->mTitle = g_strdup (doc_info->title); + } + + ev_document_info_free (doc_info); + } } else { plugin->ShowLoadingError (); } diff --git a/browser-plugin/plugin.h b/browser-plugin/plugin.h index 9c24630..58fbc96 100644 --- a/browser-plugin/plugin.h +++ b/browser-plugin/plugin.h @@ -59,6 +59,9 @@ class Plugin { GtkWidget *mScrolledWindow; GtkWidget *mView; EvJob *mLoadJob; + + public: + char *mTitle; }; void* NPN_MemDup (const void *aMem, uint32 aLen); |