]> err.no Git - mapper/commitdiff
Small cleanups and error checking for home dir
authorKaj-Michael Lang <milang@tal.org>
Thu, 10 Apr 2008 14:51:18 +0000 (17:51 +0300)
committerKaj-Michael Lang <milang@tal.org>
Thu, 10 Apr 2008 14:51:18 +0000 (17:51 +0300)
src/file.c

index 68bf5b8f9c747501d7c48a208ca9ac37aee57e33..3b436cabd63c436f0c1437b0ec583a6c7e7b953c 100644 (file)
@@ -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) {