From: Kaj-Michael Lang Date: Thu, 10 Apr 2008 14:51:18 +0000 (+0300) Subject: Small cleanups and error checking for home dir X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc7d59ef90c7f730fbafc68feefa5545e1adfb27;p=mapper Small cleanups and error checking for home dir --- 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) {