Don't select the first row if the folder is empty. Patch by Olle

* gtk/gtkfilechooserdefault.c (browse_files_select_first_row): Don't
        select the first row if the folder is empty.
        Patch by Olle Bergkvist.


svn path=/trunk/; revision=20751
This commit is contained in:
Matthias Clasen 2008-07-03 22:40:33 +00:00
parent 688cc55cdd
commit 2f1ef69fb7
2 changed files with 16 additions and 1 deletions

View File

@ -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 <mclasen@redhat.com>
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 <mclasen@redhat.com>
Bug 540915 GtkBuilder sets properties in reverse order

View File

@ -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);
}