diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-07-31 01:24:40 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-07-31 01:24:40 +0800 |
commit | b8d8036da7543c57c03d0baf218691c74419ec0a (patch) | |
tree | 871c106484722babc82066e59140e5a19599ebb9 /embed/print-dialog.c | |
parent | c5b7639e5ed72d29b9dea3779c4091c14d08d52b (diff) | |
download | gsoc2013-epiphany-b8d8036da7543c57c03d0baf218691c74419ec0a.tar gsoc2013-epiphany-b8d8036da7543c57c03d0baf218691c74419ec0a.tar.gz gsoc2013-epiphany-b8d8036da7543c57c03d0baf218691c74419ec0a.tar.bz2 gsoc2013-epiphany-b8d8036da7543c57c03d0baf218691c74419ec0a.tar.lz gsoc2013-epiphany-b8d8036da7543c57c03d0baf218691c74419ec0a.tar.xz gsoc2013-epiphany-b8d8036da7543c57c03d0baf218691c74419ec0a.tar.zst gsoc2013-epiphany-b8d8036da7543c57c03d0baf218691c74419ec0a.zip |
Make those more robust.
2005-07-30 Christian Persch <chpe@cvs.gnome.org>
* embed/print-dialog.c: (ephy_print_load_config_from_file),
(ephy_print_save_config_to_file):
Make those more robust.
Diffstat (limited to 'embed/print-dialog.c')
-rwxr-xr-x | embed/print-dialog.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/embed/print-dialog.c b/embed/print-dialog.c index fbb66d733..69140ca8d 100755 --- a/embed/print-dialog.c +++ b/embed/print-dialog.c @@ -111,24 +111,25 @@ ephy_print_info_free (EmbedPrintInfo *info) static GnomePrintConfig * ephy_print_load_config_from_file (void) { - gchar *file_name; - gboolean res; - gchar *contents; - GnomePrintConfig *ephy_print_config; + GnomePrintConfig *ephy_print_config = NULL; + char *file_name, *contents = NULL; - file_name = g_build_filename (ephy_dot_dir (), PRINT_CONFIG_FILENAME, + file_name = g_build_filename (ephy_dot_dir (), + PRINT_CONFIG_FILENAME, NULL); - res = g_file_get_contents (file_name, &contents, NULL, NULL); - g_free (file_name); - - if (res) + if (g_file_get_contents (file_name, &contents, NULL, NULL)) { ephy_print_config = gnome_print_config_from_string (contents, 0); g_free (contents); } - else + + if (ephy_print_config == NULL) + { ephy_print_config = gnome_print_config_default (); + } + + g_free (file_name); return ephy_print_config; } @@ -136,8 +137,7 @@ ephy_print_load_config_from_file (void) static void ephy_print_save_config_to_file (GnomePrintConfig *config) { - gchar *file_name; - gchar *str; + char *file_name, *str; g_return_if_fail (config != NULL); |