2004-08-06  Federico Mena Quintero  <federico@ximian.com>

	Fix #144232:

	* gtk/gtkfilechooserdefault.c (save_widgets_create): Use a
	GtkFileChooserEntry for the file name, rather than a GtkEntry.
	(update_chooser_entry): Set the contents of the file chooser entry
	rather than the plain entry's.
	(gtk_file_chooser_default_set_current_folder): Set the new folder
	on the save entry.
	(gtk_file_chooser_default_set_current_name): Set the name on the
	file chooser entry.
	(check_save_entry): Use the file chooser entry rather than the
	plain entry.

	* gtk/gtkfilechooserentry.c
	(_gtk_file_chooser_entry_set_base_folder): Call
	gtk_file_chooser_entry_changed() so that we recompute the current
	folder based on the new base folder.
This commit is contained in:
Federico Mena Quintero 2004-08-06 19:25:25 +00:00 committed by Federico Mena Quintero
parent 7405177690
commit bbd78cd9a0
6 changed files with 102 additions and 9 deletions

View File

@ -1,3 +1,23 @@
2004-08-06 Federico Mena Quintero <federico@ximian.com>
Fix #144232:
* gtk/gtkfilechooserdefault.c (save_widgets_create): Use a
GtkFileChooserEntry for the file name, rather than a GtkEntry.
(update_chooser_entry): Set the contents of the file chooser entry
rather than the plain entry's.
(gtk_file_chooser_default_set_current_folder): Set the new folder
on the save entry.
(gtk_file_chooser_default_set_current_name): Set the name on the
file chooser entry.
(check_save_entry): Use the file chooser entry rather than the
plain entry.
* gtk/gtkfilechooserentry.c
(_gtk_file_chooser_entry_set_base_folder): Call
gtk_file_chooser_entry_changed() so that we recompute the current
folder based on the new base folder.
2004-08-06 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkwindow-win32.c : make it compile and more

View File

@ -1,3 +1,23 @@
2004-08-06 Federico Mena Quintero <federico@ximian.com>
Fix #144232:
* gtk/gtkfilechooserdefault.c (save_widgets_create): Use a
GtkFileChooserEntry for the file name, rather than a GtkEntry.
(update_chooser_entry): Set the contents of the file chooser entry
rather than the plain entry's.
(gtk_file_chooser_default_set_current_folder): Set the new folder
on the save entry.
(gtk_file_chooser_default_set_current_name): Set the name on the
file chooser entry.
(check_save_entry): Use the file chooser entry rather than the
plain entry.
* gtk/gtkfilechooserentry.c
(_gtk_file_chooser_entry_set_base_folder): Call
gtk_file_chooser_entry_changed() so that we recompute the current
folder based on the new base folder.
2004-08-06 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkwindow-win32.c : make it compile and more

View File

@ -1,3 +1,23 @@
2004-08-06 Federico Mena Quintero <federico@ximian.com>
Fix #144232:
* gtk/gtkfilechooserdefault.c (save_widgets_create): Use a
GtkFileChooserEntry for the file name, rather than a GtkEntry.
(update_chooser_entry): Set the contents of the file chooser entry
rather than the plain entry's.
(gtk_file_chooser_default_set_current_folder): Set the new folder
on the save entry.
(gtk_file_chooser_default_set_current_name): Set the name on the
file chooser entry.
(check_save_entry): Use the file chooser entry rather than the
plain entry.
* gtk/gtkfilechooserentry.c
(_gtk_file_chooser_entry_set_base_folder): Call
gtk_file_chooser_entry_changed() so that we recompute the current
folder based on the new base folder.
2004-08-06 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkwindow-win32.c : make it compile and more

View File

@ -1,3 +1,23 @@
2004-08-06 Federico Mena Quintero <federico@ximian.com>
Fix #144232:
* gtk/gtkfilechooserdefault.c (save_widgets_create): Use a
GtkFileChooserEntry for the file name, rather than a GtkEntry.
(update_chooser_entry): Set the contents of the file chooser entry
rather than the plain entry's.
(gtk_file_chooser_default_set_current_folder): Set the new folder
on the save entry.
(gtk_file_chooser_default_set_current_name): Set the name on the
file chooser entry.
(check_save_entry): Use the file chooser entry rather than the
plain entry.
* gtk/gtkfilechooserentry.c
(_gtk_file_chooser_entry_set_base_folder): Call
gtk_file_chooser_entry_changed() so that we recompute the current
folder based on the new base folder.
2004-08-06 Hans Breuer <hans@breuer.org>
* gdk/win32/gdkwindow-win32.c : make it compile and more

View File

@ -3134,7 +3134,9 @@ save_widgets_create (GtkFileChooserDefault *impl)
0, 0);
gtk_widget_show (widget);
impl->save_file_name_entry = gtk_entry_new ();
impl->save_file_name_entry = _gtk_file_chooser_entry_new ();
_gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
impl->file_system);
gtk_entry_set_width_chars (GTK_ENTRY (impl->save_file_name_entry), 45);
gtk_entry_set_activates_default (GTK_ENTRY (impl->save_file_name_entry), TRUE);
gtk_table_attach (GTK_TABLE (table), impl->save_file_name_entry,
@ -4075,8 +4077,8 @@ update_chooser_entry (GtkFileChooserDefault *impl)
info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
if (!gtk_file_info_get_is_folder (info))
gtk_entry_set_text (GTK_ENTRY (impl->save_file_name_entry),
gtk_file_info_get_display_name (info));
_gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
gtk_file_info_get_display_name (info));
}
static gboolean
@ -4124,6 +4126,11 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
impl->changing_folder = FALSE;
}
/* Set the folder on the save entry */
_gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
impl->current_folder);
/* Create a new list model. This is slightly evil; we store the result value
* but perform more actions rather than returning immediately even if it
* generates an error.
@ -4161,7 +4168,7 @@ gtk_file_chooser_default_set_current_name (GtkFileChooser *chooser,
g_return_if_fail (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
|| impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
gtk_entry_set_text (GTK_ENTRY (impl->save_file_name_entry), name);
_gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), name);
}
static void
@ -4295,16 +4302,21 @@ check_save_entry (GtkFileChooserDefault *impl,
gboolean *is_valid,
gboolean *is_empty)
{
const char *filename;
GtkFileChooserEntry *chooser_entry;
const GtkFilePath *current_folder;
const char *file_part;
GtkFilePath *path;
GError *error;
g_assert (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
|| impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
filename = gtk_entry_get_text (GTK_ENTRY (impl->save_file_name_entry));
chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry);
if (!filename || filename[0] == '\0')
current_folder = _gtk_file_chooser_entry_get_current_folder (chooser_entry);
file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry);
if (!file_part || file_part[0] == '\0')
{
*is_valid = FALSE;
*is_empty = TRUE;
@ -4314,11 +4326,11 @@ check_save_entry (GtkFileChooserDefault *impl,
*is_empty = FALSE;
error = NULL;
path = gtk_file_system_make_path (impl->file_system, impl->current_folder, filename, &error);
path = gtk_file_system_make_path (impl->file_system, current_folder, file_part, &error);
if (!path)
{
error_building_filename_dialog (impl, impl->current_folder, filename, error);
error_building_filename_dialog (impl, current_folder, file_part, error);
*is_valid = FALSE;
return NULL;
}

View File

@ -841,6 +841,7 @@ _gtk_file_chooser_entry_set_base_folder (GtkFileChooserEntry *chooser_entry,
chooser_entry->base_folder = gtk_file_path_copy (path);
gtk_file_chooser_entry_changed (GTK_EDITABLE (chooser_entry));
gtk_editable_select_region (GTK_EDITABLE (chooser_entry), 0, -1);
}