Only send selection_changed once when removing lots of files.

2009-01-13  Alexander Larsson  <alexl@redhat.com>

        * libnautilus-private/nautilus-icon-container.c:
        * libnautilus-private/nautilus-icon-private.h:
	Only send selection_changed once when removing lots of files.



svn path=/trunk/; revision=14845
This commit is contained in:
Alexander Larsson 2009-01-13 09:32:50 +00:00 committed by Alexander Larsson
parent afadb31464
commit 4def951e1a
3 changed files with 29 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2009-01-13 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-container.c:
* libnautilus-private/nautilus-icon-private.h:
Only send selection_changed once when removing lots of files.
2009-01-13 Alexander Larsson <alexl@redhat.com>
* src/nautilus-window-slot.c (nautilus_window_slot_update_icon):

View file

@ -3983,6 +3983,10 @@ destroy (GtkObject *object)
container->details->align_idle_id = 0;
}
if (container->details->selection_changed_id != 0) {
g_source_remove (container->details->selection_changed_id);
container->details->selection_changed_id = 0;
}
/* destroy interactive search dialog */
if (container->details->search_window) {
@ -6591,6 +6595,20 @@ nautilus_icon_container_for_each (NautilusIconContainer *container,
call_icon_callback, &callback_and_data);
}
static int
selection_changed_at_idle_callback (gpointer data)
{
NautilusIconContainer *container;
container = NAUTILUS_ICON_CONTAINER (data);
g_signal_emit (container,
signals[SELECTION_CHANGED], 0);
container->details->selection_changed_id = 0;
return FALSE;
}
/* utility routine to remove a single icon from the container */
static void
@ -6654,8 +6672,8 @@ icon_destroy (NautilusIconContainer *container,
icon_free (icon);
if (was_selected) {
g_signal_emit (container,
signals[SELECTION_CHANGED], 0);
/* Coalesce multiple removals causing multiple selection_changed events */
details->selection_changed_id = g_idle_add (selection_changed_at_idle_callback, container);
}
}

View file

@ -146,6 +146,9 @@ struct NautilusIconContainerDetails {
guint keyboard_icon_reveal_timer_id;
NautilusIcon *keyboard_icon_to_reveal;
/* Used to coalesce selection changed signals in some cases */
guint selection_changed_id;
/* If a request is made to reveal an unpositioned icon we remember
* it and reveal it once it gets positioned (in relayout).
*/