nautilus/nautilus-330298-297983-fix-overlapping-desktop-icons.diff

87 lines
3.6 KiB
Diff

2007-08-10 Federico Mena Quintero <federico@novell.com>
Fix http://bugzilla.gnome.org/show_bug.cgi?id=330298 once again
(desktop icons overlap when placing a volume icon, and in various
other situations):
* libnautilus-private/nautilus-icon-container.c (icon_set_position):
Clear icon->has_lazy_position, since the icon will be
well-positioned once this function exits.
(finish_adding_new_icons): Don't clear icon->has_lazy_position
here, since it is now done in icon_set_position(). Emit the
"icon-position-changed" signal so that the upstream code will save
the final position for icons which were semi-positioned.
(finish_adding_new_icons): Remember the original
icon->has_lazy_position before calling assign_icon_position();
later, if the icon was to be lazily positioned, add it to the
semi_position_icons list. Previously we were ignoring
semi-positioned icons when populating the placement grid; that's
why overlaps would happen.
* src/file-manager/fm-icon-view.c (file_has_lazy_position): Also
use lazy positioning for drives, not just volumes.
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index dbf1da5..7a17479 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -298,6 +298,8 @@ icon_set_position (NautilusIcon *icon,
int x1, y1, x2, y2;
int container_x, container_y, container_width, container_height;
+ icon->has_lazy_position = FALSE;
+
if (icon->x == x && icon->y == y) {
return;
}
@@ -5859,9 +5861,13 @@ finish_adding_new_icons (NautilusIconContainer *container)
new_icons = g_list_reverse (new_icons);
no_position_icons = semi_position_icons = NULL;
for (p = new_icons; p != NULL; p = p->next) {
+ gboolean had_lazy_position;
+
icon = p->data;
+ had_lazy_position = icon->has_lazy_position;
+
if (assign_icon_position (container, icon)) {
- if (!container->details->auto_layout && icon->has_lazy_position) {
+ if (!container->details->auto_layout && had_lazy_position) {
semi_position_icons = g_list_prepend (semi_position_icons, icon);
}
} else {
@@ -5894,6 +5900,7 @@ finish_adding_new_icons (NautilusIconContainer *container)
for (p = semi_position_icons; p != NULL; p = p->next) {
NautilusIcon *icon;
int x, y;
+ NautilusIconPosition position;
icon = p->data;
x = icon->x;
@@ -5906,9 +5913,10 @@ finish_adding_new_icons (NautilusIconContainer *container)
placement_grid_mark_icon (grid, icon);
- /* ensure that next time we run this code, the formerly semi-positioned
- * icons are treated as being positioned. */
- icon->has_lazy_position = FALSE;
+ position.x = icon->x;
+ position.y = icon->y;
+ g_signal_emit (container, signals[ICON_POSITION_CHANGED], 0,
+ icon->data, &position);
}
placement_grid_free (grid);
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 864382e..efff989 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -538,7 +538,7 @@ file_has_lazy_position (FMDirectoryView *view,
* icon we don't overlap that one. We don't do this in general though,
* as it can cause icons moving around.
*/
- lazy_position = nautilus_file_has_volume (file);
+ lazy_position = nautilus_file_has_volume (file) || nautilus_file_has_drive (file);
if (lazy_position && fm_directory_view_get_loading (view)) {
/* if volumes are loaded during directory load, don't mark them
* as lazy. This is wrong for files that were mounted during user