From 70076454c6b03a5c1ae4b60bd5fdc26496f3762c Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 6 Aug 2004 19:59:36 +0000 Subject: [PATCH] Merged from HEAD: 2004-08-06 Federico Mena Quintero Merged from HEAD: 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. --- ChangeLog | 22 ++++++++++++++++++++++ ChangeLog.pre-2-10 | 22 ++++++++++++++++++++++ ChangeLog.pre-2-6 | 22 ++++++++++++++++++++++ ChangeLog.pre-2-8 | 22 ++++++++++++++++++++++ gtk/gtkfilechooserdefault.c | 30 +++++++++++++++++++++--------- gtk/gtkfilechooserentry.c | 1 + 6 files changed, 110 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d5e94a6c4..ab28545b22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2004-08-06 Federico Mena Quintero + + Merged from HEAD: + + 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 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_move_cursor_page_up_down): Fix diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4d5e94a6c4..ab28545b22 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,25 @@ +2004-08-06 Federico Mena Quintero + + Merged from HEAD: + + 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 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_move_cursor_page_up_down): Fix diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4d5e94a6c4..ab28545b22 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,25 @@ +2004-08-06 Federico Mena Quintero + + Merged from HEAD: + + 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 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_move_cursor_page_up_down): Fix diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4d5e94a6c4..ab28545b22 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,25 @@ +2004-08-06 Federico Mena Quintero + + Merged from HEAD: + + 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 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_move_cursor_page_up_down): Fix diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 4e2466871c..63ec06797c 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -3057,7 +3057,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, @@ -3998,8 +4000,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 @@ -4047,6 +4049,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. @@ -4084,7 +4091,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 @@ -4218,16 +4225,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; @@ -4237,11 +4249,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; } diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 6bc9d8a9a3..90671792bf 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -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); }