diff options
author | Matthias Clasen <mclasen@redhat.com> | 2007-04-29 06:23:58 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2007-04-29 06:23:58 +0000 |
commit | 3c5bd522b36383afa704d39bf12963683a4663ea (patch) | |
tree | 0c3222b44bb43e6224c94e932620f740d990de85 /tests/print-editor.c | |
parent | ea3667c49ca6ee6c692bc6fbf00d8769c80deca3 (diff) | |
download | gdk-pixbuf-3c5bd522b36383afa704d39bf12963683a4663ea.tar.gz |
Add a new error code
2007-04-29 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintoperation.h: Add a new error code
* gtk/gtk.symbols:
* gtk/gtkpagesetup.[hc]:
* gtk/gtkpapersize.[hc]:
* gtk/gtkprintsettings.[hc]: Add functions to serialize
and deserialize page setups and print settings to files
and key files. (#344515, Christian Persch)
* gtk/gtkpagesetupunixdialog.c: Adapt to the new functions.
* tests/print-editor.c: Use the new functions to persist
page setup and print settings.
svn path=/trunk/; revision=17697
Diffstat (limited to 'tests/print-editor.c')
-rw-r--r-- | tests/print-editor.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/tests/print-editor.c b/tests/print-editor.c index 237c34a45..3999acf06 100644 --- a/tests/print-editor.c +++ b/tests/print-editor.c @@ -372,9 +372,6 @@ do_page_setup (GtkAction *action) { GtkPageSetup *new_page_setup; - if (settings == NULL) - settings = gtk_print_settings_new (); - new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window), page_setup, settings); @@ -830,9 +827,14 @@ create_window (void) GtkWidget *sw; GtkActionGroup *actions; GError *error; + GtkWindowGroup *group; main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + group = gtk_window_group_new (); + gtk_window_group_add_window (group, GTK_WINDOW (main_window)); + g_object_unref (group); + gtk_window_set_default_size (GTK_WINDOW (main_window), 400, 600); @@ -929,14 +931,42 @@ create_window (void) int main (int argc, char **argv) { + GError *error = NULL; + g_set_application_name ("Print editor"); gtk_init (&argc, &argv); + settings = gtk_print_settings_new_from_file ("print-settings.ini", &error); + if (error) { + g_print ("Failed to load print settings: %s\n", error->message); + g_clear_error (&error); + + settings = gtk_print_settings_new (); + } + g_assert (settings != NULL); + + page_setup = gtk_page_setup_new_from_file ("page-setup.ini", &error); + if (error) { + g_print ("Failed to load page setup: %s\n", error->message); + g_clear_error (&error); + } + create_window (); if (argc == 2) load_file (argv[1]); gtk_main (); + + if (!gtk_print_settings_to_file (settings, "print-settings.ini", &error)) { + g_print ("Failed to save print settings: %s\n", error->message); + g_clear_error (&error); + } + if (page_setup && + !gtk_page_setup_to_file (page_setup, "page-setup.ini", &error)) { + g_print ("Failed to save page setup: %s\n", error->message); + g_clear_error (&error); + } + return 0; } |