From 51e1ae36121928f84940b8e8dcb317f87157933b Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sun, 18 Jan 2009 10:28:37 +0000 Subject: [PATCH] Remove dest, mode and search_string from EvJobLoad since they are not 2009-01-18 Carlos Garcia Campos * shell/ev-jobs.[ch]: (ev_job_load_dispose), (ev_job_load_new): * shell/ev-window.c: (ev_window_load_job_cb), (ev_window_load_job_cb), (ev_window_open_uri), (ev_window_reload_local), (ev_window_dispose): Remove dest, mode and search_string from EvJobLoad since they are not really needed by the job, but for the window. svn path=/trunk/; revision=3347 --- ChangeLog | 10 ++++++++++ shell/ev-jobs.c | 19 +------------------ shell/ev-jobs.h | 11 ++--------- shell/ev-window.c | 46 +++++++++++++++++++++++++++++++++++++--------- 4 files changed, 50 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 319aefa3..ae7ec15d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-01-18 Carlos Garcia Campos + + * shell/ev-jobs.[ch]: (ev_job_load_dispose), (ev_job_load_new): + * shell/ev-window.c: (ev_window_load_job_cb), + (ev_window_load_job_cb), (ev_window_open_uri), + (ev_window_reload_local), (ev_window_dispose): + + Remove dest, mode and search_string from EvJobLoad since they are + not really needed by the job, but for the window. + 2009-01-17 Carlos Garcia Campos * shell/ev-view.c: (ev_view_drag_data_received), diff --git a/shell/ev-jobs.c b/shell/ev-jobs.c index a952243e..102cd908 100644 --- a/shell/ev-jobs.c +++ b/shell/ev-jobs.c @@ -803,16 +803,6 @@ ev_job_load_dispose (GObject *object) job->password = NULL; } - if (job->dest) { - g_object_unref (job->dest); - job->dest = NULL; - } - - if (job->search_string) { - g_free (job->search_string); - job->search_string = NULL; - } - (* G_OBJECT_CLASS (ev_job_load_parent_class)->dispose) (object); } @@ -871,21 +861,14 @@ ev_job_load_class_init (EvJobLoadClass *class) } EvJob * -ev_job_load_new (const gchar *uri, - EvLinkDest *dest, - EvWindowRunMode mode, - const gchar *search_string) +ev_job_load_new (const gchar *uri) { EvJobLoad *job; ev_debug_message (DEBUG_JOBS, "%s", uri); job = g_object_new (EV_TYPE_JOB_LOAD, NULL); - job->uri = g_strdup (uri); - job->dest = dest ? g_object_ref (dest) : NULL; - job->mode = mode; - job->search_string = search_string ? g_strdup (search_string) : NULL; return EV_JOB (job); } diff --git a/shell/ev-jobs.h b/shell/ev-jobs.h index 27b40a1c..5915a28a 100644 --- a/shell/ev-jobs.h +++ b/shell/ev-jobs.h @@ -27,7 +27,6 @@ #include "ev-document.h" #include "ev-selection.h" #include "ev-render-context.h" -#include "ev-window.h" G_BEGIN_DECLS @@ -259,10 +258,7 @@ struct _EvJobFontsClass struct _EvJobLoad { EvJob parent; - - EvLinkDest *dest; - EvWindowRunMode mode; - gchar *search_string; + gchar *uri; gchar *password; }; @@ -385,10 +381,7 @@ EvJob *ev_job_fonts_new (EvDocument *document); /* EvJobLoad */ GType ev_job_load_get_type (void) G_GNUC_CONST; -EvJob *ev_job_load_new (const gchar *uri, - EvLinkDest *dest, - EvWindowRunMode mode, - const gchar *search_string); +EvJob *ev_job_load_new (const gchar *uri); void ev_job_load_set_uri (EvJobLoad *load, const gchar *uri); void ev_job_load_set_password (EvJobLoad *job, diff --git a/shell/ev-window.c b/shell/ev-window.c index eb606ef9..abfcae25 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -181,7 +181,6 @@ struct _EvWindowPrivate { char *uri; glong uri_mtime; char *local_uri; - EvLinkDest *dest; gboolean unlink_temp_file; gboolean in_reload; EvFileMonitor *monitor; @@ -193,6 +192,11 @@ struct _EvWindowPrivate { EvWindowPageMode page_mode; EvWindowTitle *title; + /* Load params */ + EvLinkDest *dest; + gchar *search_string; + EvWindowRunMode window_mode; + EvJob *load_job; EvJob *reload_job; EvJob *thumbnail_job; @@ -1372,7 +1376,7 @@ ev_window_load_job_cb (EvJob *job, if (!ev_job_is_failed (job)) { ev_window_set_document (ev_window, document); - if (job_load->mode != EV_WINDOW_MODE_PREVIEW) { + if (ev_window->priv->window_mode != EV_WINDOW_MODE_PREVIEW) { setup_view_from_metadata (ev_window); } @@ -1392,17 +1396,23 @@ ev_window_load_job_cb (EvJob *job, flags); } - if (job_load->dest) { + if (ev_window->priv->dest) { EvLink *link; EvLinkAction *link_action; - link_action = ev_link_action_new_dest (g_object_ref (job_load->dest)); + link_action = ev_link_action_new_dest (ev_window->priv->dest); link = ev_link_new (NULL, link_action); ev_view_handle_link (EV_VIEW (ev_window->priv->view), link); g_object_unref (link); + + /* Already unrefed by ev_link_action + * FIXME: link action should inc dest ref counting + * or not unref it at all + */ + ev_window->priv->dest = NULL; } - switch (job_load->mode) { + switch (ev_window->priv->window_mode) { case EV_WINDOW_MODE_FULLSCREEN: ev_window_run_fullscreen (ev_window); break; @@ -1416,12 +1426,15 @@ ev_window_load_job_cb (EvJob *job, break; } - if (job_load->search_string && EV_IS_DOCUMENT_FIND (document)) { + if (ev_window->priv->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->search_string); } + g_free (ev_window->priv->search_string); + ev_window->priv->search_string = NULL; + /* Create a monitor for the document */ ev_window->priv->monitor = ev_file_monitor_new (ev_window->priv->uri); g_signal_connect_swapped (G_OBJECT (ev_window->priv->monitor), "changed", @@ -1807,6 +1820,7 @@ ev_window_open_uri (EvWindow *ev_window, ev_view_set_loading (EV_VIEW (ev_window->priv->view), TRUE); ev_window->priv->unlink_temp_file = unlink_temp_file; + ev_window->priv->window_mode = mode; if (mode == EV_WINDOW_MODE_PREVIEW) { ev_window->priv->print_settings_file = print_settings ? @@ -1817,9 +1831,18 @@ ev_window_open_uri (EvWindow *ev_window, g_free (ev_window->priv->uri); ev_window->priv->uri = g_strdup (uri); + if (ev_window->priv->search_string) + g_free (ev_window->priv->search_string); + ev_window->priv->search_string = search_string ? + g_strdup (search_string) : NULL; + + if (ev_window->priv->dest) + g_object_unref (ev_window->priv->dest); + ev_window->priv->dest = dest ? g_object_ref (dest) : NULL; + setup_size_from_metadata (ev_window); - ev_window->priv->load_job = ev_job_load_new (uri, dest, mode, search_string); + ev_window->priv->load_job = ev_job_load_new (uri); g_signal_connect (ev_window->priv->load_job, "finished", G_CALLBACK (ev_window_load_job_cb), @@ -1840,7 +1863,7 @@ ev_window_reload_local (EvWindow *ev_window) const gchar *uri; uri = ev_window->priv->local_uri ? ev_window->priv->local_uri : ev_window->priv->uri; - ev_window->priv->reload_job = ev_job_load_new (uri, NULL, 0, NULL); + ev_window->priv->reload_job = ev_job_load_new (uri); g_signal_connect (ev_window->priv->reload_job, "finished", G_CALLBACK (ev_window_reload_job_cb), ev_window); @@ -4898,6 +4921,11 @@ ev_window_dispose (GObject *object) priv->uri = NULL; } + if (priv->search_string) { + g_free (priv->search_string); + priv->search_string = NULL; + } + if (priv->dest) { g_object_unref (priv->dest); priv->dest = NULL; -- 2.43.5