From 79cb06835073622ffeaa082eac48b70c8d1ee7a7 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Fri, 9 Jun 2006 05:24:35 +0000 Subject: [PATCH] Fixes bug #344160: if the xfer job doesn't complete because a password is * shell/ev-jobs.c: (ev_job_xfer_run): * shell/ev-window.c: (password_dialog_response), (ev_window_popup_password_dialog), (ev_window_xfer_job_cb), (ev_window_dispose): Fixes bug #344160: if the xfer job doesn't complete because a password is required, reload the existing instance instead of creating a new one. --- ChangeLog | 10 ++++++++++ shell/ev-jobs.c | 11 +++++++++++ shell/ev-window.c | 20 +++----------------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae272967..927bd0fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-06-09 Pat Rondon + + * shell/ev-jobs.c: (ev_job_xfer_run): + * shell/ev-window.c: (password_dialog_response), + (ev_window_popup_password_dialog), (ev_window_xfer_job_cb), + (ev_window_dispose): + Fixes bug #344160: if the xfer job doesn't complete + because a password is required, reload the existing + instance instead of creating a new one. + 2006-06-01 Nickolay V. Shmyrev <> * shell/main.c: (main): Call gdk_threads_init. Thus diff --git a/shell/ev-jobs.c b/shell/ev-jobs.c index e9f29eb6..c88c0119 100644 --- a/shell/ev-jobs.c +++ b/shell/ev-jobs.c @@ -434,6 +434,17 @@ ev_job_xfer_run (EvJobXfer *job) g_error_free (job->error); job->error = NULL; } + + /* This job may already have a document even if the job didn't complete + because, e.g., a password is required - if so, just reload rather than + creating a new instance */ + if (EV_JOB (job)->document) { + ev_document_load (EV_JOB (job)->document, + job->local_uri ? job->local_uri : job->uri, + &job->error); + EV_JOB (job)->finished = TRUE; + return; + } source_uri = gnome_vfs_uri_new (job->uri); if (!gnome_vfs_uri_is_local (source_uri) && !job->local_uri) { diff --git a/shell/ev-window.c b/shell/ev-window.c index e4b0ca0c..b285ca0c 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -145,7 +145,7 @@ struct _EvWindowPrivate { EvLinkDest *dest; EvDocument *document; - EvDocument *password_document; + EvPageCache *page_cache; EvWindowPageMode page_mode; EvWindowTitle *title; @@ -803,7 +803,7 @@ password_dialog_response (GtkWidget *password_dialog, password = ev_password_dialog_get_password (EV_PASSWORD_DIALOG (password_dialog)); if (password) { ev_document_doc_mutex_lock (); - ev_document_security_set_password (EV_DOCUMENT_SECURITY (ev_window->priv->password_document), + ev_document_security_set_password (EV_DOCUMENT_SECURITY (ev_window->priv->xfer_job->document), password); ev_document_doc_mutex_unlock (); } @@ -811,9 +811,6 @@ password_dialog_response (GtkWidget *password_dialog, ev_password_dialog_save_password (EV_PASSWORD_DIALOG (password_dialog)); - g_object_unref (ev_window->priv->password_document); - ev_window->priv->password_document = NULL; - ev_window_title_set_type (ev_window->priv->title, EV_WINDOW_TITLE_DOCUMENT); ev_job_queue_add_job (ev_window->priv->xfer_job, EV_JOB_PRIORITY_HIGH); @@ -833,7 +830,7 @@ password_dialog_response (GtkWidget *password_dialog, static void ev_window_popup_password_dialog (EvWindow *ev_window) { - g_assert (ev_window->priv->password_document); + g_assert (ev_window->priv->xfer_job); gtk_widget_set_sensitive (ev_window->priv->password_view, FALSE); @@ -906,11 +903,6 @@ ev_window_xfer_job_cb (EvJobXfer *job, ev_view_set_loading (EV_VIEW (ev_window->priv->view), FALSE); - if (ev_window->priv->password_document) { - g_object_unref (ev_window->priv->password_document); - ev_window->priv->password_document = NULL; - } - /* Success! */ if (job->error == NULL) { @@ -946,7 +938,6 @@ ev_window_xfer_job_cb (EvJobXfer *job, ev_window->priv->uri = g_strdup (job->uri); setup_view_from_metadata (ev_window); - ev_window->priv->password_document = g_object_ref (document); file_name = gnome_vfs_format_uri_for_display (job->uri); base_name = g_path_get_basename (file_name); @@ -2724,11 +2715,6 @@ ev_window_dispose (GObject *object) if (priv->local_uri) { ev_window_clear_local_uri (window); } - - if (priv->password_document) { - g_object_unref (priv->password_document); - priv->password_document = NULL; - } ev_window_close_dialogs (window); -- 2.43.5