diff options
author | infirit <[email protected]> | 2014-07-25 23:44:09 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-07-25 23:44:09 +0200 |
commit | a6cf3eab819fe90142bfeb719d794f7c6db89feb (patch) | |
tree | f8cc00cd02c76dfb5915192f711341df3b1811f1 /src/eom-window.c | |
parent | 13f1c75845c8a55a95d2c5426dbf343e3828bc78 (diff) | |
download | eom-a6cf3eab819fe90142bfeb719d794f7c6db89feb.tar.bz2 eom-a6cf3eab819fe90142bfeb719d794f7c6db89feb.tar.xz |
Use default page settings when opening print dialog the first time
Use the default page setup the first time after application start.
Then re-use the last used page setup for rest of the time.
Eog bug http://bugzilla.gnome.org/show_bug.cgi?id=549039
Based on eog commit 796aae00058655d6f9e796f36fd7420991c657a7
From Marek Kašík <[email protected]>
Diffstat (limited to 'src/eom-window.c')
-rw-r--r-- | src/eom-window.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/eom-window.c b/src/eom-window.c index cb15773..43c1312 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -181,6 +181,8 @@ struct _EomWindowPrivate { gboolean save_disabled; gboolean needs_reload_confirmation; + GtkPageSetup *page_setup; + #ifdef HAVE_LCMS cmsHPROFILE *display_profile; #endif @@ -2379,11 +2381,15 @@ eom_window_print (EomWindow *window) eom_debug (DEBUG_PRINTING); print_settings = eom_print_get_print_settings (); - page_setup = eom_print_get_page_setup (); /* Make sure the window stays valid while printing */ g_object_ref (window); + if (window->priv->page_setup !=NULL) + page_setup = g_object_ref (window->priv->page_setup); + else + page_setup = NULL; + print = eom_print_operation_new (window->priv->image, print_settings, page_setup); @@ -2404,11 +2410,16 @@ eom_window_print (EomWindow *window) gtk_widget_show (dialog); g_error_free (error); } else if (res == GTK_PRINT_OPERATION_RESULT_APPLY) { + GtkPageSetup *new_page_setup; eom_print_set_print_settings (gtk_print_operation_get_print_settings (print)); - eom_print_set_page_setup (gtk_print_operation_get_default_page_setup (print)); + new_page_setup = gtk_print_operation_get_default_page_setup (print); + if (window->priv->page_setup != NULL) + g_object_unref (window->priv->page_setup); + window->priv->page_setup = g_object_ref (new_page_setup); } - g_object_unref (page_setup); + if (page_setup != NULL) + g_object_unref (page_setup); g_object_unref (print_settings); g_object_unref (window); } @@ -4710,6 +4721,8 @@ eom_window_init (EomWindow *window) window->priv->collection_resizable = FALSE; window->priv->save_disabled = FALSE; + + window->priv->page_setup = NULL; } static void @@ -4726,6 +4739,11 @@ eom_window_dispose (GObject *object) window = EOM_WINDOW (object); priv = window->priv; + if (priv->page_setup != NULL) { + g_object_unref (priv->page_setup); + priv->page_setup = NULL; + } + eom_plugin_engine_garbage_collect (); if (priv->store != NULL) { |