[nautilus/gnome-3-0] icon-view: Only resort during relayout if necessary
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-0] icon-view: Only resort during relayout if necessary
- Date: Mon, 23 May 2011 21:07:02 +0000 (UTC)
commit c5ba911c93ed6bf10076ed2085122fa20983fb07
Author: Alexander Larsson <alexl redhat com>
Date: Tue May 3 16:54:40 2011 +0200
icon-view: Only resort during relayout if necessary
We don't need to resort unless e.g. a file changed or was added.
Additionally, for weird reason this makes the keyboard focus handling
work when deleting a file (file after deleted gets focus). This was
broken due to a relayout happening due to a size_allocate due to
a style set due to a focus change when going to/from the "are you sure"
dialog.
libnautilus-private/nautilus-icon-container.c | 12 +++++++++++-
libnautilus-private/nautilus-icon-private.h | 1 +
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 743720b..01f13e0 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -2147,7 +2147,10 @@ redo_layout_internal (NautilusIconContainer *container)
*/
if (container->details->auto_layout
&& container->details->drag_state != DRAG_STATE_STRETCH) {
- resort (container);
+ if (container->details->needs_resort) {
+ resort (container);
+ container->details->needs_resort = FALSE;
+ }
lay_down_icons (container, container->details->icons, 0);
}
@@ -7188,6 +7191,8 @@ nautilus_icon_container_add (NautilusIconContainer *container,
g_hash_table_insert (details->icon_set, data, icon);
+ details->needs_resort = TRUE;
+
/* Run an idle function to add the icons. */
schedule_redo_layout (container);
@@ -7260,6 +7265,7 @@ nautilus_icon_container_request_update (NautilusIconContainer *container,
if (icon != NULL) {
nautilus_icon_container_update_icon (container, icon);
+ container->details->needs_resort = TRUE;
schedule_redo_layout (container);
}
}
@@ -7324,6 +7330,7 @@ nautilus_icon_container_request_update_all (NautilusIconContainer *container)
nautilus_icon_container_update_icon (container, icon);
}
+ container->details->needs_resort = TRUE;
redo_layout (container);
}
@@ -7891,6 +7898,7 @@ nautilus_icon_container_set_auto_layout (NautilusIconContainer *container,
nautilus_icon_container_freeze_icon_positions (container);
}
+ container->details->needs_resort = TRUE;
redo_layout (container);
g_signal_emit (container, signals[LAYOUT_CHANGED], 0);
@@ -7957,6 +7965,7 @@ nautilus_icon_container_set_layout_mode (NautilusIconContainer *container,
container->details->layout_mode = mode;
invalidate_labels (container);
+ container->details->needs_resort = TRUE;
redo_layout (container);
g_signal_emit (container, signals[LAYOUT_CHANGED], 0);
@@ -8018,6 +8027,7 @@ nautilus_icon_container_sort (NautilusIconContainer *container)
container->details->auto_layout = TRUE;
reset_scroll_region_if_not_empty (container);
+ container->details->needs_resort = TRUE;
redo_layout (container);
if (changed) {
diff --git a/libnautilus-private/nautilus-icon-private.h b/libnautilus-private/nautilus-icon-private.h
index 8f94d6c..9b0a3d7 100644
--- a/libnautilus-private/nautilus-icon-private.h
+++ b/libnautilus-private/nautilus-icon-private.h
@@ -274,6 +274,7 @@ struct NautilusIconContainerDetails {
GQueue* a11y_item_action_queue;
eel_boolean_bit is_loading : 1;
+ eel_boolean_bit needs_resort : 1;
eel_boolean_bit store_layout_timestamps : 1;
eel_boolean_bit store_layout_timestamps_when_finishing_new_icons : 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]