evince r3099 - in trunk: . shell
- From: carlosgc svn gnome org
- To: svn-commits-list gnome org
- Subject: evince r3099 - in trunk: . shell
- Date: Wed, 6 Aug 2008 17:35:23 +0000 (UTC)
Author: carlosgc
Date: Wed Aug 6 17:35:22 2008
New Revision: 3099
URL: http://svn.gnome.org/viewvc/evince?rev=3099&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/shell/ev-jobs.c
trunk/shell/ev-jobs.h
trunk/shell/ev-password.c
trunk/shell/ev-password.h
trunk/shell/ev-window.c
Modified: trunk/shell/ev-jobs.c
==============================================================================
--- trunk/shell/ev-jobs.c (original)
+++ trunk/shell/ev-jobs.c Wed Aug 6 17:35:22 2008
@@ -30,7 +30,7 @@
#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>
@@ -716,6 +716,11 @@
job->uri = NULL;
}
+ if (job->password) {
+ g_free (job->password);
+ job->password = NULL;
+ }
+
if (job->dest) {
g_object_unref (job->dest);
job->dest = NULL;
@@ -740,11 +745,19 @@
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);
@@ -805,6 +818,16 @@
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)
Modified: trunk/shell/ev-jobs.h
==============================================================================
--- trunk/shell/ev-jobs.h (original)
+++ trunk/shell/ev-jobs.h Wed Aug 6 17:35:22 2008
@@ -226,6 +226,7 @@
EvWindowRunMode mode;
gchar *search_string;
gchar *uri;
+ gchar *password;
};
struct _EvJobLoadClass
@@ -323,6 +324,8 @@
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;
Modified: trunk/shell/ev-password.c
==============================================================================
--- trunk/shell/ev-password.c (original)
+++ trunk/shell/ev-password.c Wed Aug 6 17:35:22 2008
@@ -334,10 +334,10 @@
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
Modified: trunk/shell/ev-password.h
==============================================================================
--- trunk/shell/ev-password.h (original)
+++ trunk/shell/ev-password.h Wed Aug 6 17:35:22 2008
@@ -47,11 +47,11 @@
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
Modified: trunk/shell/ev-window.c
==============================================================================
--- trunk/shell/ev-window.c (original)
+++ trunk/shell/ev-window.c Wed Aug 6 17:35:22 2008
@@ -55,7 +55,6 @@
#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"
@@ -1219,18 +1218,9 @@
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));
@@ -1351,8 +1341,8 @@
* 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;
@@ -1398,16 +1388,7 @@
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);
@@ -1458,7 +1439,7 @@
ev_window->priv->in_reload = FALSE;
return;
}
-
+
ev_window_set_document (ev_window, job->document);
/* Restart the search after reloading */
@@ -1467,7 +1448,7 @@
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;
}
@@ -4271,7 +4252,7 @@
ev_window_clear_local_uri (window);
priv->local_uri = NULL;
}
-
+
ev_window_close_dialogs (window);
ev_window_clear_print_job (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]