diff --git a/ChangeLog b/ChangeLog index 997a173a4..2b9cb3695 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,14 @@ * gdk/win32/gdkinput-win32.c: Fetch the device and cursor names in Unicode, and convert to UTF-8 for the GdkDevice's name field. +2008-07-03 Matthias Clasen + + Bug 538863 – Fixes assertion on entering empty folder + + * gtk/gtkfilechooserdefault.c (browse_files_select_first_row): Don't + select the first row if the folder is empty. + Patch by Olle Bergkvist. + 2008-07-03 Matthias Clasen Bug 540915 – GtkBuilder sets properties in reverse order diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index ce575eae6..458bdee71 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -6285,12 +6285,19 @@ static void browse_files_select_first_row (GtkFileChooserDefault *impl) { GtkTreePath *path; + GtkTreeIter dummy_iter; + GtkTreeModel *tree_model; if (!impl->sort_model) return; path = gtk_tree_path_new_from_indices (0, -1); - gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), path, NULL, FALSE); + tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)); + + /* If the list is empty, do nothing. */ + if (gtk_tree_model_get_iter (tree_model, &dummy_iter, path)) + gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), path, NULL, FALSE); + gtk_tree_path_free (path); }