]> Pileus Git - ~andy/gtk/commitdiff
Fix #132256.
authorFederico Mena Quintero <federico@ximian.com>
Mon, 9 Feb 2004 20:31:38 +0000 (20:31 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Mon, 9 Feb 2004 20:31:38 +0000 (20:31 +0000)
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.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c

index a0133ef50df86653aba84846855dc3628726b030..9af02934372ac85c1e928d12f226b307748a0b35 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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
index a0133ef50df86653aba84846855dc3628726b030..9af02934372ac85c1e928d12f226b307748a0b35 100644 (file)
@@ -1,3 +1,15 @@
+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
index a0133ef50df86653aba84846855dc3628726b030..9af02934372ac85c1e928d12f226b307748a0b35 100644 (file)
@@ -1,3 +1,15 @@
+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
index a0133ef50df86653aba84846855dc3628726b030..9af02934372ac85c1e928d12f226b307748a0b35 100644 (file)
@@ -1,3 +1,15 @@
+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
index a0133ef50df86653aba84846855dc3628726b030..9af02934372ac85c1e928d12f226b307748a0b35 100644 (file)
@@ -1,3 +1,15 @@
+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
index c6b1b565c45707c0f7b9e8e27f02f2f3d3e90263..487e15b35b62d82645de273e30a37d8255141433 100644 (file)
@@ -2275,8 +2275,9 @@ gtk_file_chooser_default_unselect_all (GtkFileChooser *chooser)
 }
 
 struct get_paths_closure {
-  GSList *result;
   GtkFileChooserDefault *impl;
+  GSList *result;
+  GtkFilePath *path_from_entry;
 };
 
 static void
@@ -2304,58 +2305,69 @@ get_paths_foreach (GtkTreeModel *model,
     }
 
   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);
 }