Fix #131418.
2004-01-19 Federico Mena Quintero <federico@ximian.com> Fix #131418. * gtk/gtkfilechooserdefault.c (set_select_multiple): New helper function. (gtk_file_chooser_default_set_property): Use set_select_multiple(). Also, re-set this mode to single if the file chooser is set to Save mode. (entry_activate): Handle the case where the entry is completely empty *and* its current folder does exist. Also, there is need to test for select_multiple here now that we ensure that it won't happen during Save mode.
This commit is contained in:
		
				
					committed by
					
						
						Federico Mena Quintero
					
				
			
			
				
	
			
			
			
						parent
						
							3799ae9520
						
					
				
				
					commit
					45e6ab2d84
				
			
							
								
								
									
										14
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								ChangeLog
									
									
									
									
									
								
							@ -1,3 +1,17 @@
 | 
				
			|||||||
 | 
					2004-01-19  Federico Mena Quintero  <federico@ximian.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Fix #131418.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gtk/gtkfilechooserdefault.c (set_select_multiple): New helper
 | 
				
			||||||
 | 
						function.
 | 
				
			||||||
 | 
						(gtk_file_chooser_default_set_property): Use
 | 
				
			||||||
 | 
						set_select_multiple().  Also, re-set this mode to single if the
 | 
				
			||||||
 | 
						file chooser is set to Save mode.
 | 
				
			||||||
 | 
						(entry_activate): Handle the case where the entry is completely
 | 
				
			||||||
 | 
						empty *and* its current folder does exist.  Also, there is need to
 | 
				
			||||||
 | 
						test for select_multiple here now that we ensure that it won't
 | 
				
			||||||
 | 
						happen during Save mode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
					Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
						* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,17 @@
 | 
				
			|||||||
 | 
					2004-01-19  Federico Mena Quintero  <federico@ximian.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Fix #131418.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gtk/gtkfilechooserdefault.c (set_select_multiple): New helper
 | 
				
			||||||
 | 
						function.
 | 
				
			||||||
 | 
						(gtk_file_chooser_default_set_property): Use
 | 
				
			||||||
 | 
						set_select_multiple().  Also, re-set this mode to single if the
 | 
				
			||||||
 | 
						file chooser is set to Save mode.
 | 
				
			||||||
 | 
						(entry_activate): Handle the case where the entry is completely
 | 
				
			||||||
 | 
						empty *and* its current folder does exist.  Also, there is need to
 | 
				
			||||||
 | 
						test for select_multiple here now that we ensure that it won't
 | 
				
			||||||
 | 
						happen during Save mode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
					Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
						* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,17 @@
 | 
				
			|||||||
 | 
					2004-01-19  Federico Mena Quintero  <federico@ximian.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Fix #131418.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gtk/gtkfilechooserdefault.c (set_select_multiple): New helper
 | 
				
			||||||
 | 
						function.
 | 
				
			||||||
 | 
						(gtk_file_chooser_default_set_property): Use
 | 
				
			||||||
 | 
						set_select_multiple().  Also, re-set this mode to single if the
 | 
				
			||||||
 | 
						file chooser is set to Save mode.
 | 
				
			||||||
 | 
						(entry_activate): Handle the case where the entry is completely
 | 
				
			||||||
 | 
						empty *and* its current folder does exist.  Also, there is need to
 | 
				
			||||||
 | 
						test for select_multiple here now that we ensure that it won't
 | 
				
			||||||
 | 
						happen during Save mode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
					Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
						* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,17 @@
 | 
				
			|||||||
 | 
					2004-01-19  Federico Mena Quintero  <federico@ximian.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Fix #131418.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gtk/gtkfilechooserdefault.c (set_select_multiple): New helper
 | 
				
			||||||
 | 
						function.
 | 
				
			||||||
 | 
						(gtk_file_chooser_default_set_property): Use
 | 
				
			||||||
 | 
						set_select_multiple().  Also, re-set this mode to single if the
 | 
				
			||||||
 | 
						file chooser is set to Save mode.
 | 
				
			||||||
 | 
						(entry_activate): Handle the case where the entry is completely
 | 
				
			||||||
 | 
						empty *and* its current folder does exist.  Also, there is need to
 | 
				
			||||||
 | 
						test for select_multiple here now that we ensure that it won't
 | 
				
			||||||
 | 
						happen during Save mode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
					Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
						* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,17 @@
 | 
				
			|||||||
 | 
					2004-01-19  Federico Mena Quintero  <federico@ximian.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Fix #131418.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gtk/gtkfilechooserdefault.c (set_select_multiple): New helper
 | 
				
			||||||
 | 
						function.
 | 
				
			||||||
 | 
						(gtk_file_chooser_default_set_property): Use
 | 
				
			||||||
 | 
						set_select_multiple().  Also, re-set this mode to single if the
 | 
				
			||||||
 | 
						file chooser is set to Save mode.
 | 
				
			||||||
 | 
						(entry_activate): Handle the case where the entry is completely
 | 
				
			||||||
 | 
						empty *and* its current folder does exist.  Also, there is need to
 | 
				
			||||||
 | 
						test for select_multiple here now that we ensure that it won't
 | 
				
			||||||
 | 
						happen during Save mode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
					Sun Jan 18 15:25:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
						* gtk/gtktoolbar.[ch]: Add _gtk_toolbar_paint_space_line(),
 | 
				
			||||||
 | 
				
			|||||||
@ -1642,6 +1642,21 @@ bookmarks_changed_cb (GtkFileSystem         *file_system,
 | 
				
			|||||||
  bookmarks_check_remove_sensitivity (impl);
 | 
					  bookmarks_check_remove_sensitivity (impl);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Sets the file chooser to multiple selection mode */
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					set_select_multiple (GtkFileChooserDefault *impl, gboolean select_multiple)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  /* FIXME: this does not work for folder mode */
 | 
				
			||||||
 | 
					  GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->list));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  impl->select_multiple = select_multiple;
 | 
				
			||||||
 | 
					  gtk_tree_selection_set_mode (selection,
 | 
				
			||||||
 | 
								       (select_multiple ?
 | 
				
			||||||
 | 
									GTK_SELECTION_MULTIPLE : GTK_SELECTION_BROWSE));
 | 
				
			||||||
 | 
					  /* FIXME: See note in check_preview_change() */
 | 
				
			||||||
 | 
					  check_preview_change (impl);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
gtk_file_chooser_default_set_property (GObject      *object,
 | 
					gtk_file_chooser_default_set_property (GObject      *object,
 | 
				
			||||||
				       guint         prop_id,
 | 
									       guint         prop_id,
 | 
				
			||||||
@ -1656,7 +1671,16 @@ gtk_file_chooser_default_set_property (GObject      *object,
 | 
				
			|||||||
    case GTK_FILE_CHOOSER_PROP_ACTION:
 | 
					    case GTK_FILE_CHOOSER_PROP_ACTION:
 | 
				
			||||||
      impl->action = g_value_get_enum (value);
 | 
					      impl->action = g_value_get_enum (value);
 | 
				
			||||||
      if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
 | 
					      if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
 | 
				
			||||||
	gtk_widget_show (impl->new_folder_button);
 | 
						{
 | 
				
			||||||
 | 
						  gtk_widget_show (impl->new_folder_button);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						  if (impl->select_multiple)
 | 
				
			||||||
 | 
						    {
 | 
				
			||||||
 | 
						      g_warning ("Save mode cannot be set in conjunction with multiple selection mode.  "
 | 
				
			||||||
 | 
								 "Re-setting to single selection mode.");
 | 
				
			||||||
 | 
						      set_select_multiple (impl, FALSE);
 | 
				
			||||||
 | 
						    }
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
	gtk_widget_hide (impl->new_folder_button);
 | 
						gtk_widget_hide (impl->new_folder_button);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1733,16 +1757,7 @@ gtk_file_chooser_default_set_property (GObject      *object,
 | 
				
			|||||||
	  }
 | 
						  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (select_multiple != impl->select_multiple)
 | 
						if (select_multiple != impl->select_multiple)
 | 
				
			||||||
	  {
 | 
						  set_select_multiple (impl, select_multiple);
 | 
				
			||||||
	    GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->list));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	    impl->select_multiple = select_multiple;
 | 
					 | 
				
			||||||
	    gtk_tree_selection_set_mode (selection,
 | 
					 | 
				
			||||||
					 (select_multiple ?
 | 
					 | 
				
			||||||
					  GTK_SELECTION_MULTIPLE : GTK_SELECTION_BROWSE));
 | 
					 | 
				
			||||||
	    /* FIXME: See note in check_preview_change() */
 | 
					 | 
				
			||||||
	    check_preview_change (impl);
 | 
					 | 
				
			||||||
	  }
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
 | 
					    case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
 | 
				
			||||||
@ -2850,12 +2865,16 @@ entry_activate (GtkEntry              *entry,
 | 
				
			|||||||
  const gchar *file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry);
 | 
					  const gchar *file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry);
 | 
				
			||||||
  GtkFilePath *new_folder = NULL;
 | 
					  GtkFilePath *new_folder = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* If the file part is non-empty, we need to figure out if it
 | 
					  if (!folder_path)
 | 
				
			||||||
   * refers to a folder within folder. We could optimize the case
 | 
					    return; /* The entry got a nonexistent path */
 | 
				
			||||||
   * here where the folder is already loaded for one of our tree models.
 | 
					
 | 
				
			||||||
   */
 | 
					  if (file_part[0] == '\0')
 | 
				
			||||||
  if (file_part[0] == '\0' && gtk_file_path_compare (impl->current_folder, folder_path) != 0)
 | 
					    {
 | 
				
			||||||
    new_folder = gtk_file_path_copy (folder_path);
 | 
					      if (gtk_file_path_compare (impl->current_folder, folder_path) != 0)
 | 
				
			||||||
 | 
						new_folder = gtk_file_path_copy (folder_path);
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      GtkFileFolder *folder = NULL;
 | 
					      GtkFileFolder *folder = NULL;
 | 
				
			||||||
@ -2863,6 +2882,11 @@ entry_activate (GtkEntry              *entry,
 | 
				
			|||||||
      GtkFileInfo *info = NULL;
 | 
					      GtkFileInfo *info = NULL;
 | 
				
			||||||
      GError *error;
 | 
					      GError *error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      /* If the file part is non-empty, we need to figure out if it
 | 
				
			||||||
 | 
					       * refers to a folder within folder. We could optimize the case
 | 
				
			||||||
 | 
					       * here where the folder is already loaded for one of our tree models.
 | 
				
			||||||
 | 
					       */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      error = NULL;
 | 
					      error = NULL;
 | 
				
			||||||
      folder = gtk_file_system_get_folder (impl->file_system, folder_path, GTK_FILE_INFO_IS_FOLDER, &error);
 | 
					      folder = gtk_file_system_get_folder (impl->file_system, folder_path, GTK_FILE_INFO_IS_FOLDER, &error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2894,8 +2918,7 @@ entry_activate (GtkEntry              *entry,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      if (!info)
 | 
					      if (!info)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	  if ((gtk_file_chooser_get_action (GTK_FILE_CHOOSER (impl)) == GTK_FILE_CHOOSER_ACTION_SAVE &&
 | 
						  if (gtk_file_chooser_get_action (GTK_FILE_CHOOSER (impl)) == GTK_FILE_CHOOSER_ACTION_SAVE)
 | 
				
			||||||
	      !gtk_file_chooser_get_select_multiple (GTK_FILE_CHOOSER (impl))))
 | 
					 | 
				
			||||||
	    {
 | 
						    {
 | 
				
			||||||
	      g_object_unref (folder);
 | 
						      g_object_unref (folder);
 | 
				
			||||||
	      gtk_file_path_free (subfolder_path);
 | 
						      gtk_file_path_free (subfolder_path);
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user