Merged from gtk-2-4:

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

	Merged from gtk-2-4:

	* gtk/gtkfilechooserdefault.c (pending_op_process): Center the
	selected row so that it's easily visible.
This commit is contained in:
Federico Mena Quintero 2004-12-09 02:12:47 +00:00 committed by Federico Mena Quintero
parent 057ab5a4df
commit 787ee3e77d
5 changed files with 54 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2004-12-08 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-4:
* gtk/gtkfilechooserdefault.c (pending_op_process): Center the
selected row so that it's easily visible.
2004-12-08 Matthias Clasen <mclasen@redhat.com>
Fix #111031, reported by Padraig O'Briain:

View File

@ -1,3 +1,10 @@
2004-12-08 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-4:
* gtk/gtkfilechooserdefault.c (pending_op_process): Center the
selected row so that it's easily visible.
2004-12-08 Matthias Clasen <mclasen@redhat.com>
Fix #111031, reported by Padraig O'Briain:

View File

@ -1,3 +1,10 @@
2004-12-08 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-4:
* gtk/gtkfilechooserdefault.c (pending_op_process): Center the
selected row so that it's easily visible.
2004-12-08 Matthias Clasen <mclasen@redhat.com>
Fix #111031, reported by Padraig O'Briain:

View File

@ -1,3 +1,10 @@
2004-12-08 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-4:
* gtk/gtkfilechooserdefault.c (pending_op_process): Center the
selected row so that it's easily visible.
2004-12-08 Matthias Clasen <mclasen@redhat.com>
Fix #111031, reported by Padraig O'Briain:

View File

@ -4265,6 +4265,31 @@ browse_files_select_first_row (GtkFileChooserDefault *impl)
gtk_tree_path_free (path);
}
/* Callback used from gtk_tree_selection_selected_foreach(); centers the
* selected row in the tree view.
*/
static void
center_selected_row_foreach_cb (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
{
GtkFileChooserDefault *impl;
impl = GTK_FILE_CHOOSER_DEFAULT (data);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (impl->browse_files_tree_view), path, NULL, TRUE, 0.5, 0.0);
}
/* Centers the selected row in the tree view */
static void
browse_files_center_selected_row (GtkFileChooserDefault *impl)
{
GtkTreeSelection *selection;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, center_selected_row_foreach_cb, impl);
}
/* Processes the pending operation when a folder is finished loading */
static void
pending_op_process (GtkFileChooserDefault *impl)
@ -4281,6 +4306,7 @@ pending_op_process (GtkFileChooserDefault *impl)
gtk_file_path_free (impl->pending_select_path);
impl->pending_select_path = NULL;
impl->pending_op = PENDING_OP_NONE;
browse_files_center_selected_row (impl);
break;
case PENDING_OP_SELECT_FIRST: