* Open a file for reading.
*/
gboolean
-file_open(gchar *dir, gchar *file, gchar *new_file)
+file_open(gchar **dir, gchar **file, gchar *new_file)
{
GtkWidget *dialog;
gint r;
GTK_RESPONSE_ACCEPT, NULL);
#endif
-if (dir)
- gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), dir);
+if (dir && *dir)
+ gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), *dir);
-if (file)
- gtk_file_chooser_set_uri(GTK_FILE_CHOOSER(dialog), file);
+if (file && *file)
+ gtk_file_chooser_set_uri(GTK_FILE_CHOOSER(dialog), *file);
new_file=NULL;
* Open a file for writing. Return a GnomeVFSHandle to the file for writing.
*/
gboolean
-file_save(gchar *dir, gchar *file, GnomeVFSHandle **vfs_handle)
+file_save(gchar **dir, gchar **file, GnomeVFSHandle **vfs_handle)
{
GtkWidget *dialog;
gint r;
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
#endif
-if (dir)
- gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), dir);
+if (dir && *dir)
+ gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), *dir);
-if (file)
- gtk_file_chooser_set_uri(GTK_FILE_CHOOSER(dialog), file);
+if (file && *file)
+ gtk_file_chooser_set_uri(GTK_FILE_CHOOSER(dialog), *file);
r=gtk_dialog_run(GTK_DIALOG(dialog));
if (r==GTK_RESPONSE_ACCEPT || r==GTK_RESPONSE_OK) {
success=FALSE;
} else {
if (dir) {
- g_free(dir);
- dir = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER(dialog));
+ g_free(*dir);
+ *dir = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER(dialog));
}
if (file) {
- g_free(file);
- file = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
+ g_free(*file);
+ *file = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
}
success=TRUE;
}
gchar *file_uri_str;
GnomeVFSResult vfs_result;
-if (!file_open(file,dir, file_uri_str)) {
+if (!file_open(&file,&dir,file_uri_str)) {
buffer=NULL;
return TRUE;
}