diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-07-06 22:19:16 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-07-06 22:19:16 +0800 |
commit | 4e4d7e38f19498e1840f22e3aa42335ccea5ec45 (patch) | |
tree | 23f545e45f27c594a81bb108a388d99d13026333 /e-util | |
parent | 8ee43fc1fb4c9f792116c5502da61cd00d112610 (diff) | |
download | gsoc2013-evolution-4e4d7e38f19498e1840f22e3aa42335ccea5ec45.tar gsoc2013-evolution-4e4d7e38f19498e1840f22e3aa42335ccea5ec45.tar.gz gsoc2013-evolution-4e4d7e38f19498e1840f22e3aa42335ccea5ec45.tar.bz2 gsoc2013-evolution-4e4d7e38f19498e1840f22e3aa42335ccea5ec45.tar.lz gsoc2013-evolution-4e4d7e38f19498e1840f22e3aa42335ccea5ec45.tar.xz gsoc2013-evolution-4e4d7e38f19498e1840f22e3aa42335ccea5ec45.tar.zst gsoc2013-evolution-4e4d7e38f19498e1840f22e3aa42335ccea5ec45.zip |
** Fixes bug #446894
2007-07-06 Matthew Barnes <mbarnes@redhat.com>
** Fixes bug #446894
* ui/evolution.xml:
Add a filepagesetup command, and a corresponding menu item within
the print place holder. net result is to add a "file -> page setup"
menu item to all components, just above the print menu items.
* shell/e-shell-window-commands.c (command_page_setup):
Callback for new FilePageSetup verb.
* mail/em-format-html-print.c:
Use new gtk_html_print_operation_run() function in GtkHTML.
* e-util/e-print.c (load_page_setup):
Extract GtkPageSetup properties from a GtkPrintSettings object.
* e-util/e-print.c (save_page_setup):
Merge GtkPageSetup properties into a GtkPrintSettings object.
* e-util/e-print.[ch] (e_print_run_page_setup_dialog):
New function runs a preconfigured Page Setup dialog and saves
the configuration to GConf (/apps/evolution/shell/printing).
svn path=/trunk/; revision=33762
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/ChangeLog | 14 | ||||
-rw-r--r-- | e-util/e-print.c | 56 | ||||
-rw-r--r-- | e-util/e-print.h | 1 |
3 files changed, 65 insertions, 6 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index c12d6c07e5..96bcbc6320 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,17 @@ +2007-07-06 Matthew Barnes <mbarnes@redhat.com> + + ** Fixes part of bug #446894 + + * e-print.c (load_page_setup): + Extract GtkPageSetup properties from a GtkPrintSettings object. + + * e-print.c (save_page_setup): + Merge GtkPageSetup properties into a GtkPrintSettings object. + + * e-print.[ch] (e_print_run_page_setup_dialog): + New function runs a preconfigured Page Setup dialog and saves + the configuration to GConf (/apps/evolution/shell/printing). + 2007-06-18 Srinivasa Ragavan <sragavan@novell.com> ** Fix for bug #448223 from Gilles Dartiguelongue diff --git a/e-util/e-print.c b/e-util/e-print.c index 0a3cf7ee43..f5fe1804fb 100644 --- a/e-util/e-print.c +++ b/e-util/e-print.c @@ -43,7 +43,7 @@ unpack_settings (gchar *item, GtkPrintSettings *settings) gchar *cp, *key, *value; cp = strchr (item, '='); if (cp == NULL) - return; + return; *cp ++ = '\0'; key = g_strstrip (item); value = g_strstrip (cp); @@ -78,15 +78,12 @@ load_settings (void) } static void -save_settings (GtkPrintOperation *operation) +save_settings (GtkPrintSettings *settings) { - GtkPrintSettings *settings; GConfClient *client; GSList *list = NULL; GError *error = NULL; - settings = gtk_print_operation_get_print_settings (operation); - client = gconf_client_get_default (); gtk_print_settings_foreach ( @@ -103,6 +100,30 @@ save_settings (GtkPrintOperation *operation) g_object_unref (client); } +static GtkPageSetup * +load_page_setup (GtkPrintSettings *settings) +{ + GtkPageSetup *page_setup; + GtkPaperSize *paper_size; + + page_setup = gtk_page_setup_new (); + gtk_page_setup_set_orientation ( + page_setup, gtk_print_settings_get_orientation (settings)); + paper_size = gtk_print_settings_get_paper_size (settings); + if (paper_size != NULL) + gtk_page_setup_set_paper_size_and_default_margins ( + page_setup, paper_size); +} + +static void +save_page_setup (GtkPrintSettings *settings, GtkPageSetup *page_setup) +{ + gtk_print_settings_set_orientation ( + settings, gtk_page_setup_get_orientation (page_setup)); + gtk_print_settings_set_paper_size ( + settings, gtk_page_setup_get_paper_size (page_setup)); +} + static void handle_error (GtkPrintOperation *operation) { @@ -139,8 +160,12 @@ handle_error (GtkPrintOperation *operation) static void print_done_cb (GtkPrintOperation *operation, GtkPrintOperationResult result) { + GtkPrintSettings *settings; + + settings = gtk_print_operation_get_print_settings (operation); + if (result == GTK_PRINT_OPERATION_RESULT_APPLY) - save_settings (operation); + save_settings (settings); if (result == GTK_PRINT_OPERATION_RESULT_ERROR) handle_error (operation); } @@ -161,3 +186,22 @@ e_print_operation_new (void) return operation; } + +void +e_print_run_page_setup_dialog (GtkWindow *parent) +{ + GtkPageSetup *new_page_setup; + GtkPageSetup *old_page_setup; + GtkPrintSettings *settings; + + settings = load_settings (); + old_page_setup = load_page_setup (settings); + new_page_setup = gtk_print_run_page_setup_dialog ( + parent, old_page_setup, settings); + save_page_setup (settings, new_page_setup); + save_settings (settings); + + g_object_unref (new_page_setup); + g_object_unref (old_page_setup); + g_object_unref (settings); +} diff --git a/e-util/e-print.h b/e-util/e-print.h index 8044506c0c..a8c4f7862f 100644 --- a/e-util/e-print.h +++ b/e-util/e-print.h @@ -27,6 +27,7 @@ G_BEGIN_DECLS GtkPrintOperation * e_print_operation_new (void); +void e_print_run_page_setup_dialog (GtkWindow *parent); G_END_DECLS |