From dc7d59ef90c7f730fbafc68feefa5545e1adfb27 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Thu, 10 Apr 2008 17:51:18 +0300 Subject: [PATCH] Small cleanups and error checking for home dir --- src/file.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/file.c b/src/file.c index 68bf5b8..3b436ca 100644 --- a/src/file.c +++ b/src/file.c @@ -65,7 +65,11 @@ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); if (dir && *dir) { gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), *dir); } else { - gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), g_get_home_dir()); + const gchar *home; + + home=g_get_home_dir(); + if (home) + gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), home); } *new_file=NULL; @@ -73,7 +77,6 @@ if (dir && *dir) { if (gtk_dialog_run(GTK_DIALOG(dialog))==GTK_RESPONSE_OK) { /* Get the selected filename. */ *new_file = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); - g_printf("file: %s\n", *new_file); success=TRUE; } @@ -104,7 +107,11 @@ gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); if (dir && *dir) { gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), *dir); } else { - gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), g_get_home_dir()); + const gchar *home; + + home=g_get_home_dir(); + if (home) + gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), home); } if (file && *file) { -- 2.39.5