+2004-02-09 Federico Mena Quintero <federico@ximian.com>
+
+ Fix #132256.
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_get_paths): Read the contents of the
+ filename entry in both OPEN and SAVE mode. In multiple-selection
+ mode, add this to the selection from the file/folder list.
+ (struct get_paths_closure): Add a path_from_entry field.
+ (get_paths_foreach): Only add the iterated path if it is not the
+ same as the path from the entry.
+
2004-02-09 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): If
+2004-02-09 Federico Mena Quintero <federico@ximian.com>
+
+ Fix #132256.
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_get_paths): Read the contents of the
+ filename entry in both OPEN and SAVE mode. In multiple-selection
+ mode, add this to the selection from the file/folder list.
+ (struct get_paths_closure): Add a path_from_entry field.
+ (get_paths_foreach): Only add the iterated path if it is not the
+ same as the path from the entry.
+
2004-02-09 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): If
+2004-02-09 Federico Mena Quintero <federico@ximian.com>
+
+ Fix #132256.
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_get_paths): Read the contents of the
+ filename entry in both OPEN and SAVE mode. In multiple-selection
+ mode, add this to the selection from the file/folder list.
+ (struct get_paths_closure): Add a path_from_entry field.
+ (get_paths_foreach): Only add the iterated path if it is not the
+ same as the path from the entry.
+
2004-02-09 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): If
+2004-02-09 Federico Mena Quintero <federico@ximian.com>
+
+ Fix #132256.
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_get_paths): Read the contents of the
+ filename entry in both OPEN and SAVE mode. In multiple-selection
+ mode, add this to the selection from the file/folder list.
+ (struct get_paths_closure): Add a path_from_entry field.
+ (get_paths_foreach): Only add the iterated path if it is not the
+ same as the path from the entry.
+
2004-02-09 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): If
+2004-02-09 Federico Mena Quintero <federico@ximian.com>
+
+ Fix #132256.
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_get_paths): Read the contents of the
+ filename entry in both OPEN and SAVE mode. In multiple-selection
+ mode, add this to the selection from the file/folder list.
+ (struct get_paths_closure): Add a path_from_entry field.
+ (get_paths_foreach): Only add the iterated path if it is not the
+ same as the path from the entry.
+
2004-02-09 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): If
}
struct get_paths_closure {
- GSList *result;
GtkFileChooserDefault *impl;
+ GSList *result;
+ GtkFilePath *path_from_entry;
};
static void
}
file_path = _gtk_file_system_model_get_path (fs_model, &sel_iter);
- info->result = g_slist_prepend (info->result, gtk_file_path_copy (file_path));
+
+ if (!info->path_from_entry
+ || gtk_file_path_compare (info->path_from_entry, file_path) != 0)
+ info->result = g_slist_prepend (info->result, gtk_file_path_copy (file_path));
}
static GSList *
gtk_file_chooser_default_get_paths (GtkFileChooser *chooser)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- GtkTreeSelection *selection;
+ GtkFileChooserEntry *chooser_entry;
+ const GtkFilePath *folder_path;
+ const gchar *file_part;
struct get_paths_closure info;
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
- {
- GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->entry);
- const GtkFilePath *folder_path = _gtk_file_chooser_entry_get_current_folder (chooser_entry);
- const gchar *file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry);
+ info.impl = impl;
+ info.result = NULL;
+ info.path_from_entry = NULL;
- if (file_part != NULL && file_part[0] != '\0')
- {
- GtkFilePath *selected;
- GError *error = NULL;
+ chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->entry);
+ folder_path = _gtk_file_chooser_entry_get_current_folder (chooser_entry);
+ file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry);
- selected = gtk_file_system_make_path (impl->file_system, folder_path, file_part, &error);
+ if (file_part != NULL && file_part[0] != '\0')
+ {
+ GtkFilePath *selected;
+ GError *error = NULL;
- if (!selected)
- {
- error_building_filename_dialog (impl, folder_path, file_part, error);
- return NULL;
- }
+ selected = gtk_file_system_make_path (impl->file_system, folder_path, file_part, &error);
- return g_slist_append (NULL, selected);
+ if (!selected)
+ {
+ error_building_filename_dialog (impl, folder_path, file_part, error);
+ return NULL;
}
+
+ info.path_from_entry = selected;
}
- if (impl->folder_mode)
+ if (!info.path_from_entry || impl->select_multiple)
{
- if (!impl->tree_model)
- return NULL;
+ GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->tree));
- }
- else
- {
- if (!impl->sort_model)
- return NULL;
+ selection = NULL;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->list));
+ if (impl->folder_mode)
+ {
+ if (impl->tree_model)
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->tree));
+ }
+ else
+ {
+ if (impl->sort_model)
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->list));
+ }
+
+ if (selection)
+ gtk_tree_selection_selected_foreach (selection, get_paths_foreach, &info);
}
- info.result = NULL;
- info.impl = impl;
+ if (info.path_from_entry)
+ info.result = g_slist_prepend (info.result, info.path_from_entry);
- gtk_tree_selection_selected_foreach (selection, get_paths_foreach, &info);
return g_slist_reverse (info.result);
}