aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-07-31 01:24:40 +0800
committerChristian Persch <chpe@src.gnome.org>2005-07-31 01:24:40 +0800
commitb8d8036da7543c57c03d0baf218691c74419ec0a (patch)
tree871c106484722babc82066e59140e5a19599ebb9 /embed
parentc5b7639e5ed72d29b9dea3779c4091c14d08d52b (diff)
downloadgsoc2013-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')
-rwxr-xr-xembed/print-dialog.c24
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);