[eog] Use default page settings when opening print dialog the first time
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Use default page settings when opening print dialog the first time
- Date: Sat, 18 Dec 2010 14:22:36 +0000 (UTC)
commit 796aae00058655d6f9e796f36fd7420991c657a7
Author: Marek KaÅ¡Ãk <mkasik redhat com>
Date: Sat Dec 18 15:19:14 2010 +0100
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.
Fixes bug 549039.
src/eog-window.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index befe84e..1eb9e3c 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -178,6 +178,8 @@ struct _EogWindowPrivate {
gboolean save_disabled;
gboolean needs_reload_confirmation;
+ GtkPageSetup *page_setup;
+
#ifdef HAVE_LCMS
cmsHPROFILE *display_profile;
#endif
@@ -2167,11 +2169,15 @@ eog_window_print (EogWindow *window)
eog_debug (DEBUG_PRINTING);
print_settings = eog_print_get_print_settings ();
- page_setup = eog_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 = eog_print_operation_new (window->priv->image,
print_settings,
page_setup);
@@ -2200,11 +2206,16 @@ eog_window_print (EogWindow *window)
gtk_widget_show (dialog);
g_error_free (error);
} else if (res == GTK_PRINT_OPERATION_RESULT_APPLY) {
+ GtkPageSetup *new_page_setup;
eog_print_set_print_settings (gtk_print_operation_get_print_settings (print));
- eog_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);
}
@@ -4506,6 +4517,8 @@ eog_window_init (EogWindow *window)
window->priv->gallery_resizable = FALSE;
window->priv->save_disabled = FALSE;
+
+ window->priv->page_setup = NULL;
}
static void
@@ -4628,6 +4641,11 @@ eog_window_dispose (GObject *object)
priv->last_save_as_folder = NULL;
}
+ if (priv->page_setup != NULL) {
+ g_object_unref (priv->page_setup);
+ priv->page_setup = NULL;
+ }
+
eog_plugin_engine_garbage_collect ();
G_OBJECT_CLASS (eog_window_parent_class)->dispose (object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]