Merged from gtk-2-6:

2005-01-24  Federico Mena Quintero  <federico@ximian.com>

	Merged from gtk-2-6:

	Fix #147785 and clean up the loading code:

	* gtk/gtkfilechooserdefault.c (LoadState): Make the set of states
	be EMPTY, PRELOAD, LOADING, FINISHED.
	(gtk_file_chooser_default_init): Start in the LOAD_EMPTY state.
	(struct _GtkFileChooserDefault): Added a pending_select_paths
	field.
	(load_remove_timer): Add the new states.
	(load_setup_timer): Likewise.
	(load_timeout_cb): Likewise.  Switch to the LOAD_LOADING state.
	(browse_files_model_finished_loading_cb): Switch to the
	LOAD_FINISHED state.
	(enum PendingOp): Removed.
	(struct _GtkFileChooserDefault): Removed the pending_op and
	pending_select_path fields.
	(pending_select_paths_free): New utility function.
	(pending_select_paths_add): New utility function.
	(gtk_file_chooser_default_finalize): Call
	pending_select_paths_free().
	(pending_op_queue): Removed.
	(pending_op_process): Removed.
	(pending_select_paths_process): New function.
	(browse_files_model_finished_loading_cb): Call
	pending_select_paths_process().
	(center_selected_row_foreach_cb): Handle multiple selection by
	only centering the first row.
	(get_is_file_filtered): Constify.
	(gtk_file_chooser_default_select_path): Queue into a list of paths
	to select if we are not finished loading.
	(show_and_select_paths): New utility function.
	(up_folder_handler): Use pending_select_paths_add().
	(gtk_file_chooser_default_should_respond): Do not call
	pending_op_queue(); free the pending_selected_paths instead.
	(gtk_file_chooser_default_initial_focus): Don't queue a pending
	operation, and don't select the first row unconditionally --- this
	will happen when the folder is done loading.
	(shortcuts_row_activated_cb): Free the pending_select_paths.
	(pending_select_paths_store_selection): New utility function.
	(gtk_file_chooser_default_map): Call
	pending_select_paths_store_selection() to save the selection
	before reloading the folder.
	(select_func): Umm?  Call gtk_tree_selection_select_iter().  Don't
	move the cursor here; it will be done when processing the pending paths.

	* tests/testfilechooser.c (main): Add a button to the command
	window to unmap and remap the file chooser.
This commit is contained in:
Federico Mena Quintero
2005-01-25 01:35:09 +00:00
committed by Federico Mena Quintero
parent a57035d9d1
commit ed30bc0c76
5 changed files with 415 additions and 139 deletions

View File

@ -375,6 +375,14 @@ set_filename_existing_nonexistent_cb (GtkButton *button,
set_filename (chooser, "/usr/nonexistent");
}
static void
unmap_and_remap_cb (GtkButton *button,
GtkFileChooser *chooser)
{
gtk_widget_hide (GTK_WIDGET (chooser));
gtk_widget_show (GTK_WIDGET (chooser));
}
static void
kill_dependent (GtkWindow *win, GtkObject *dep)
{
@ -569,6 +577,11 @@ main (int argc, char **argv)
g_signal_connect (button, "clicked",
G_CALLBACK (set_filename_existing_nonexistent_cb), dialog);
button = gtk_button_new_with_label ("Unmap and remap");
gtk_container_add (GTK_CONTAINER (vbbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (unmap_and_remap_cb), dialog);
gtk_widget_show_all (control_window);
g_object_ref (control_window);