Fix "deleting" filename by adding another boolean parameter to

Wed Jan 16 20:28:38 2002  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkfilesel.c: Fix "deleting" filename by adding
	another boolean parameter to file_selection_populate() -
	whether to clear the entry. Also, never fill in the
	entry when the user clicks on something in the
	directory list. (#6791, Reported by Jos Dehaes and many,
	many, many others.)
This commit is contained in:
Owen Taylor 2002-01-17 01:37:06 +00:00 committed by Owen Taylor
parent fe622071f6
commit 9961ddc205
8 changed files with 85 additions and 35 deletions

View File

@ -1,3 +1,12 @@
Wed Jan 16 20:28:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Fix "deleting" filename by adding
another boolean parameter to file_selection_populate() -
whether to clear the entry. Also, never fill in the
entry when the user clicks on something in the
directory list. (#6791, Reported by Jos Dehaes and many,
many, many others.)
2002-01-16 Havoc Pennington <hp@redhat.com> 2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update * gtk/gtktextview.c (gtk_text_view_scroll_pages): update

View File

@ -1,3 +1,12 @@
Wed Jan 16 20:28:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Fix "deleting" filename by adding
another boolean parameter to file_selection_populate() -
whether to clear the entry. Also, never fill in the
entry when the user clicks on something in the
directory list. (#6791, Reported by Jos Dehaes and many,
many, many others.)
2002-01-16 Havoc Pennington <hp@redhat.com> 2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update * gtk/gtktextview.c (gtk_text_view_scroll_pages): update

View File

@ -1,3 +1,12 @@
Wed Jan 16 20:28:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Fix "deleting" filename by adding
another boolean parameter to file_selection_populate() -
whether to clear the entry. Also, never fill in the
entry when the user clicks on something in the
directory list. (#6791, Reported by Jos Dehaes and many,
many, many others.)
2002-01-16 Havoc Pennington <hp@redhat.com> 2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update * gtk/gtktextview.c (gtk_text_view_scroll_pages): update

View File

@ -1,3 +1,12 @@
Wed Jan 16 20:28:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Fix "deleting" filename by adding
another boolean parameter to file_selection_populate() -
whether to clear the entry. Also, never fill in the
entry when the user clicks on something in the
directory list. (#6791, Reported by Jos Dehaes and many,
many, many others.)
2002-01-16 Havoc Pennington <hp@redhat.com> 2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update * gtk/gtktextview.c (gtk_text_view_scroll_pages): update

View File

@ -1,3 +1,12 @@
Wed Jan 16 20:28:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Fix "deleting" filename by adding
another boolean parameter to file_selection_populate() -
whether to clear the entry. Also, never fill in the
entry when the user clicks on something in the
directory list. (#6791, Reported by Jos Dehaes and many,
many, many others.)
2002-01-16 Havoc Pennington <hp@redhat.com> 2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update * gtk/gtktextview.c (gtk_text_view_scroll_pages): update

View File

@ -1,3 +1,12 @@
Wed Jan 16 20:28:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Fix "deleting" filename by adding
another boolean parameter to file_selection_populate() -
whether to clear the entry. Also, never fill in the
entry when the user clicks on something in the
directory list. (#6791, Reported by Jos Dehaes and many,
many, many others.)
2002-01-16 Havoc Pennington <hp@redhat.com> 2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update * gtk/gtktextview.c (gtk_text_view_scroll_pages): update

View File

@ -1,3 +1,12 @@
Wed Jan 16 20:28:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Fix "deleting" filename by adding
another boolean parameter to file_selection_populate() -
whether to clear the entry. Also, never fill in the
entry when the user clicks on something in the
directory list. (#6791, Reported by Jos Dehaes and many,
many, many others.)
2002-01-16 Havoc Pennington <hp@redhat.com> 2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update * gtk/gtktextview.c (gtk_text_view_scroll_pages): update

View File

@ -381,7 +381,8 @@ static void gtk_file_selection_dir_button (GtkWidget *widget,
static void gtk_file_selection_populate (GtkFileSelection *fs, static void gtk_file_selection_populate (GtkFileSelection *fs,
gchar *rel_path, gchar *rel_path,
gint try_complete); gboolean try_complete,
gboolean reset_entry);
static void gtk_file_selection_abort (GtkFileSelection *fs); static void gtk_file_selection_abort (GtkFileSelection *fs);
static void gtk_file_selection_update_history_menu (GtkFileSelection *fs, static void gtk_file_selection_update_history_menu (GtkFileSelection *fs,
@ -733,7 +734,7 @@ gtk_file_selection_init (GtkFileSelection *filesel)
} }
else else
{ {
gtk_file_selection_populate (filesel, "", FALSE); gtk_file_selection_populate (filesel, "", FALSE, TRUE);
} }
gtk_widget_grab_focus (filesel->selection_entry); gtk_widget_grab_focus (filesel->selection_entry);
@ -1064,7 +1065,7 @@ gtk_file_selection_set_filename (GtkFileSelection *filesel,
name = last_slash + 1; name = last_slash + 1;
} }
gtk_file_selection_populate (filesel, buf, FALSE); gtk_file_selection_populate (filesel, buf, FALSE, TRUE);
if (filesel->selection_entry) if (filesel->selection_entry)
gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), name); gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), name);
@ -1120,7 +1121,7 @@ gtk_file_selection_complete (GtkFileSelection *filesel,
if (filesel->selection_entry) if (filesel->selection_entry)
gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), pattern); gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), pattern);
gtk_file_selection_populate (filesel, (gchar*) pattern, TRUE); gtk_file_selection_populate (filesel, (gchar*) pattern, TRUE, TRUE);
} }
static void static void
@ -1169,7 +1170,7 @@ gtk_file_selection_map (GtkWidget *widget)
GtkFileSelection *filesel = GTK_FILE_SELECTION (widget); GtkFileSelection *filesel = GTK_FILE_SELECTION (widget);
/* Refresh the contents */ /* Refresh the contents */
gtk_file_selection_populate (filesel, "", FALSE); gtk_file_selection_populate (filesel, "", FALSE, FALSE);
GTK_WIDGET_CLASS (parent_class)->map (widget); GTK_WIDGET_CLASS (parent_class)->map (widget);
} }
@ -1270,7 +1271,7 @@ gtk_file_selection_create_dir_confirmed (GtkWidget *widget,
g_free (sys_full_path); g_free (sys_full_path);
gtk_widget_destroy (fs->fileop_dialog); gtk_widget_destroy (fs->fileop_dialog);
gtk_file_selection_populate (fs, "", FALSE); gtk_file_selection_populate (fs, "", FALSE, FALSE);
} }
static void static void
@ -1392,7 +1393,7 @@ gtk_file_selection_delete_file_confirmed (GtkWidget *widget,
g_free (sys_full_path); g_free (sys_full_path);
gtk_widget_destroy (fs->fileop_dialog); gtk_widget_destroy (fs->fileop_dialog);
gtk_file_selection_populate (fs, "", FALSE); gtk_file_selection_populate (fs, "", FALSE, TRUE);
} }
static void static void
@ -1531,8 +1532,12 @@ gtk_file_selection_rename_file_confirmed (GtkWidget *widget,
sys_old_filename, sys_new_filename, sys_old_filename, sys_new_filename,
g_strerror (errno)); g_strerror (errno));
gtk_file_selection_fileop_error (fs, buf); gtk_file_selection_fileop_error (fs, buf);
goto out2;
} }
gtk_file_selection_populate (fs, "", FALSE, FALSE);
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), file);
out2: out2:
g_free (sys_old_filename); g_free (sys_old_filename);
@ -1542,7 +1547,6 @@ gtk_file_selection_rename_file_confirmed (GtkWidget *widget,
g_free (sys_new_filename); g_free (sys_new_filename);
gtk_widget_destroy (fs->fileop_dialog); gtk_widget_destroy (fs->fileop_dialog);
gtk_file_selection_populate (fs, "", FALSE);
} }
static void static void
@ -1672,7 +1676,7 @@ gtk_file_selection_key_press (GtkWidget *widget,
#endif #endif
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (fs->selection_entry))); text = g_strdup (gtk_entry_get_text (GTK_ENTRY (fs->selection_entry)));
gtk_file_selection_populate (fs, text, TRUE); gtk_file_selection_populate (fs, text, TRUE, TRUE);
g_free (text); g_free (text);
@ -1682,7 +1686,6 @@ gtk_file_selection_key_press (GtkWidget *widget,
return FALSE; return FALSE;
} }
static void static void
gtk_file_selection_history_callback (GtkWidget *widget, gtk_file_selection_history_callback (GtkWidget *widget,
gpointer data) gpointer data)
@ -1700,7 +1703,7 @@ gtk_file_selection_history_callback (GtkWidget *widget,
if (callback_arg->menu_item == widget) if (callback_arg->menu_item == widget)
{ {
gtk_file_selection_populate (fs, callback_arg->directory, FALSE); gtk_file_selection_populate (fs, callback_arg->directory, FALSE, FALSE);
break; break;
} }
@ -1846,34 +1849,17 @@ gtk_file_selection_dir_button (GtkWidget *widget,
gpointer user_data) gpointer user_data)
{ {
GtkFileSelection *fs = NULL; GtkFileSelection *fs = NULL;
gchar *filename, *temp = NULL; gchar *filename = NULL;
g_return_if_fail (GTK_IS_CLIST (widget)); g_return_if_fail (GTK_IS_CLIST (widget));
fs = GTK_FILE_SELECTION (user_data); fs = GTK_FILE_SELECTION (user_data);
g_return_if_fail (GTK_IS_FILE_SELECTION (fs)); g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
gtk_clist_get_text (GTK_CLIST (fs->dir_list), row, 0, &temp); gtk_clist_get_text (GTK_CLIST (fs->dir_list), row, 0, &filename);
filename = g_strdup (temp);
if (filename) if (filename && bevent && bevent->type == GDK_2BUTTON_PRESS)
{ gtk_file_selection_populate (fs, filename, FALSE, FALSE);
if (bevent)
switch (bevent->type)
{
case GDK_2BUTTON_PRESS:
gtk_file_selection_populate (fs, filename, FALSE);
break;
default:
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
break;
}
else
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
g_free (filename);
}
} }
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN) #if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
@ -1923,7 +1909,8 @@ win32_gtk_add_drives_to_dir_list (GtkWidget *the_dir_list)
static void static void
gtk_file_selection_populate (GtkFileSelection *fs, gtk_file_selection_populate (GtkFileSelection *fs,
gchar *rel_path, gchar *rel_path,
gint try_complete) gboolean try_complete,
gboolean reset_entry)
{ {
CompletionState *cmpl_state; CompletionState *cmpl_state;
PossibleCompletion* poss; PossibleCompletion* poss;
@ -2016,7 +2003,7 @@ gtk_file_selection_populate (GtkFileSelection *fs,
did_recurse = TRUE; did_recurse = TRUE;
gtk_file_selection_populate (fs, dir_name, TRUE); gtk_file_selection_populate (fs, dir_name, TRUE, TRUE);
g_free (dir_name); g_free (dir_name);
} }
@ -2035,7 +2022,7 @@ gtk_file_selection_populate (GtkFileSelection *fs,
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), rem_path); gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), rem_path);
} }
} }
else else if (reset_entry)
{ {
if (fs->selection_entry) if (fs->selection_entry)
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), ""); gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");