Update for release 2.23.6.
+2008-08-06 Carlos Garcia Campos <carlosgc@gnome.org>
+
+ * shell/ev-jobs.[ch]: (ev_job_load_dispose), (ev_job_load_run),
+ (ev_job_load_set_password):
+ * shell/ev-password.[ch]: (ev_password_dialog_get_password):
+ * shell/ev-window.c: (password_dialog_response),
+ (ev_window_load_job_cb):
+
+ Fix loading encrypted documents since I broke it with the jobs
+ rework.
+
2008-08-05 Carlos Garcia Campos <carlosgc@gnome.org>
* NEWS:
#include "ev-document-misc.h"
#include "ev-file-helpers.h"
#include "ev-document-fonts.h"
-#include "ev-async-renderer.h"
+#include "ev-document-security.h"
#include "ev-debug.h"
#include <errno.h>
job->uri = NULL;
}
+ if (job->password) {
+ g_free (job->password);
+ job->password = NULL;
+ }
+
if (job->dest) {
g_object_unref (job->dest);
job->dest = NULL;
ev_document_fc_mutex_lock ();
- /* TODO: reuse the job!!! */
/* 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 (job->document) {
+ if (job_load->password) {
+ ev_document_security_set_password (EV_DOCUMENT_SECURITY (job->document),
+ job_load->password);
+ }
+
+ job->failed = FALSE;
+ job->finished = FALSE;
+ g_clear_error (&job->error);
+
ev_document_load (job->document,
job_load->uri,
&error);
job->uri = g_strdup (uri);
}
+void
+ev_job_load_set_password (EvJobLoad *job, const gchar *password)
+{
+ ev_debug_message (DEBUG_JOBS, NULL);
+
+ if (job->password)
+ g_free (job->password);
+ job->password = password ? g_strdup (password) : NULL;
+}
+
/* EvJobSave */
static void
ev_job_save_init (EvJobSave *job)
EvWindowRunMode mode;
gchar *search_string;
gchar *uri;
+ gchar *password;
};
struct _EvJobLoadClass
const gchar *search_string);
void ev_job_load_set_uri (EvJobLoad *load,
const gchar *uri);
+void ev_job_load_set_password (EvJobLoad *job,
+ const gchar *password);
/* EvJobSave */
GType ev_job_save_get_type (void) G_GNUC_CONST;
return;
}
-char *
+const char *
ev_password_dialog_get_password (EvPasswordDialog *dialog)
{
- return g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->priv->entry)));
+ return gtk_entry_get_text (GTK_ENTRY (dialog->priv->entry));
}
void
GtkDialogClass parent_class;
};
-GType ev_password_dialog_get_type (void) G_GNUC_CONST;
+GType ev_password_dialog_get_type (void) G_GNUC_CONST;
-char *ev_password_dialog_get_password (EvPasswordDialog *dialog);
-void ev_password_dialog_set_bad_pass (EvPasswordDialog *dialog);
-void ev_password_dialog_save_password (EvPasswordDialog *dialog);
+const char *ev_password_dialog_get_password (EvPasswordDialog *dialog);
+void ev_password_dialog_set_bad_pass (EvPasswordDialog *dialog);
+void ev_password_dialog_save_password (EvPasswordDialog *dialog);
G_END_DECLS
#include "ev-document-fonts.h"
#include "ev-document-images.h"
#include "ev-document-links.h"
-#include "ev-document-security.h"
#include "ev-document-thumbnails.h"
#include "ev-file-exporter.h"
#include "ev-file-helpers.h"
gint response_id,
EvWindow *ev_window)
{
- char *password;
-
if (response_id == GTK_RESPONSE_OK) {
-
- 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->load_job->document),
- password);
- ev_document_doc_mutex_unlock ();
- }
- g_free (password);
+ ev_job_load_set_password (EV_JOB_LOAD (ev_window->priv->load_job),
+ ev_password_dialog_get_password (EV_PASSWORD_DIALOG (password_dialog)));
ev_password_dialog_save_password (EV_PASSWORD_DIALOG (password_dialog));
* function should _not_ necessarily expect those to exist after being
* called. */
static void
-ev_window_load_job_cb (EvJob *job,
- gpointer data)
+ev_window_load_job_cb (EvJob *job,
+ gpointer data)
{
EvWindow *ev_window = EV_WINDOW (data);
EvDocument *document = EV_JOB (job)->document;
break;
}
- /* Restart the search after reloading */
- if (ev_window->priv->in_reload) {
- GtkWidget *widget;
-
- widget = gtk_window_get_focus (GTK_WINDOW (ev_window));
- if (widget && gtk_widget_get_ancestor (widget, EGG_TYPE_FIND_BAR)) {
- find_bar_search_changed_cb (EGG_FIND_BAR (ev_window->priv->find_bar),
- NULL, ev_window);
- }
- } else if (job_load->search_string && EV_IS_DOCUMENT_FIND (document)) {
+ if (job_load->search_string && EV_IS_DOCUMENT_FIND (document)) {
ev_window_cmd_edit_find (NULL, ev_window);
egg_find_bar_set_search_string (EGG_FIND_BAR (ev_window->priv->find_bar),
job_load->search_string);
ev_window->priv->in_reload = FALSE;
return;
}
-
+
ev_window_set_document (ev_window, job->document);
/* Restart the search after reloading */
find_bar_search_changed_cb (EGG_FIND_BAR (ev_window->priv->find_bar),
NULL, ev_window);
}
-
+
ev_window_clear_reload_job (ev_window);
ev_window->priv->in_reload = FALSE;
}
ev_window_clear_local_uri (window);
priv->local_uri = NULL;
}
-
+
ev_window_close_dialogs (window);
ev_window_clear_print_job (window);