Commit fb0ea9c6 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero
Browse files

http://bugzilla.gnome.org/show_bug.cgi?id=330298

2006-11-06  Federico Mena Quintero  <federico@novell.com>

	http://bugzilla.gnome.org/show_bug.cgi?id=330298

	Fix the use of lazy positioning, and the saving of metadata for
	lazily-positioned icons.  Fixes
	https://bugzilla.novell.com/show_bug.cgi?id=155337 and
	https://bugzilla.novell.com/show_bug.cgi?id=174766.

	* src/file-manager/fm-icon-view.c (file_has_lazy_position): Only
	desktop icon files (not "real" files) have lazy positions.  Don't
	consider whether the directory is loading; this is not the right
	place to check that.
	(fm_icon_view_begin_loading): Tell the icon container that we
	just started reloading.
	(fm_icon_view_end_loading): Tell the icon container that we
	finished loading.

	* libnautilus-private/nautilus-icon-private.h
	(NautilusIconContainerDetails): New flag "is_reloading".

	* libnautilus-private/nautilus-icon-container.h: New prototype for
	nautilus_icon_container_set_is_reloading().

	* libnautilus-private/nautilus-icon-container.c
	(nautilus_icon_container_set_is_reloading): New function; sets an
	is_reloading flag in the icon container.
	(icon_set_position): Clear icon->has_lazy_position, since the icon
	will be well-positioned once this function exits.
	(finish_adding_new_icons): Do not ignore already-placed lazy
	position icons when filling the placement grid!  Save the value of
	icon->has_lazy_position before calling assign_icon_position().
	Since that function may call icon_set_position() (which will clear
	the flag), we need to keep the original value of the flag.
	(finish_adding_new_icons): Don't clear icon->has_lazy_position
	here; let icon_set_position() do it.
	(finish_adding_new_icons): Emit the icon_position_changed signal
	so that the parent knows that we moved an icon under it.  This has
	the effect of updating/preserving the position metadata for
	has_lazy_position icons.
parent 6508bd71
2006-11-06 Federico Mena Quintero <federico@novell.com>
http://bugzilla.gnome.org/show_bug.cgi?id=330298
Fix the use of lazy positioning, and the saving of metadata for
lazily-positioned icons. Fixes
https://bugzilla.novell.com/show_bug.cgi?id=155337 and
https://bugzilla.novell.com/show_bug.cgi?id=174766.
* src/file-manager/fm-icon-view.c (file_has_lazy_position): Only
desktop icon files (not "real" files) have lazy positions. Don't
consider whether the directory is loading; this is not the right
place to check that.
(fm_icon_view_begin_loading): Tell the icon container that we
just started reloading.
(fm_icon_view_end_loading): Tell the icon container that we
finished loading.
* libnautilus-private/nautilus-icon-private.h
(NautilusIconContainerDetails): New flag "is_reloading".
* libnautilus-private/nautilus-icon-container.h: New prototype for
nautilus_icon_container_set_is_reloading().
* libnautilus-private/nautilus-icon-container.c
(nautilus_icon_container_set_is_reloading): New function; sets an
is_reloading flag in the icon container.
(icon_set_position): Clear icon->has_lazy_position, since the icon
will be well-positioned once this function exits.
(finish_adding_new_icons): Do not ignore already-placed lazy
position icons when filling the placement grid! Save the value of
icon->has_lazy_position before calling assign_icon_position().
Since that function may call icon_set_position() (which will clear
the flag), we need to keep the original value of the flag.
(finish_adding_new_icons): Don't clear icon->has_lazy_position
here; let icon_set_position() do it.
(finish_adding_new_icons): Emit the icon_position_changed signal
so that the parent knows that we moved an icon under it. This has
the effect of updating/preserving the position metadata for
has_lazy_position icons.
2006-11-06 Alexander Larsson <alexl@redhat.com>
* configure.in:
......
......@@ -287,6 +287,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;
}
......@@ -347,7 +349,7 @@ icon_set_position (NautilusIcon *icon,
if (icon->y == ICON_UNPOSITIONED_VALUE) {
icon->y = 0;
}
eel_canvas_item_move (EEL_CANVAS_ITEM (icon->item),
x - icon->x,
y - icon->y);
......@@ -5733,9 +5735,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 has_lazy_position;
icon = p->data;
has_lazy_position = icon->has_lazy_position;
if (assign_icon_position (container, icon)) {
if (!container->details->auto_layout && icon->has_lazy_position) {
if (!container->details->is_reloading && !container->details->auto_layout && has_lazy_position) {
semi_position_icons = g_list_prepend (semi_position_icons, icon);
}
} else {
......@@ -5768,6 +5774,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;
......@@ -5780,9 +5787,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);
......@@ -6682,6 +6690,15 @@ nautilus_icon_container_sort (NautilusIconContainer *container)
}
}
void
nautilus_icon_container_set_is_reloading (NautilusIconContainer *container,
gboolean is_reloading)
{
g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
container->details->is_reloading = is_reloading;
}
gboolean
nautilus_icon_container_is_auto_layout (NautilusIconContainer *container)
{
......
......@@ -228,6 +228,8 @@ void nautilus_icon_container_scroll_to_icon (Nautilu
NautilusIconData *data);
/* control the layout */
void nautilus_icon_container_set_is_reloading (NautilusIconContainer *container,
gboolean is_reloading);
gboolean nautilus_icon_container_is_auto_layout (NautilusIconContainer *container);
void nautilus_icon_container_set_auto_layout (NautilusIconContainer *container,
gboolean auto_layout);
......
......@@ -253,6 +253,8 @@ struct NautilusIconContainerDetails {
guint a11y_item_action_idle_handler;
GQueue* a11y_item_action_queue;
eel_boolean_bit is_reloading : 1;
/* interactive search */
gboolean disable_popdown;
gboolean imcontext_changed;
......
......@@ -531,22 +531,12 @@ static gboolean
file_has_lazy_position (FMDirectoryView *view,
NautilusFile *file)
{
gboolean lazy_position;
/* For volumes (i.e. cdrom icon) we use lazy positioning so that when
* an old cdrom gets re-mounted in a place that now has another
* icon we don't overlap that one. We don't do this in general though,
* as it can cause icons moving around.
* icon we don't overlap that one.
*/
lazy_position = nautilus_file_has_volume (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
* log-off, but it is right for files that were mounted during login. */
lazy_position = FALSE;
}
return lazy_position;
return NAUTILUS_IS_DESKTOP_ICON_FILE (file);
}
static void
......@@ -1092,6 +1082,8 @@ fm_icon_view_begin_loading (FMDirectoryView *view)
file = fm_directory_view_get_directory_as_file (view);
icon_container = GTK_WIDGET (get_icon_container (icon_view));
nautilus_icon_container_set_is_reloading (NAUTILUS_ICON_CONTAINER (icon_container), TRUE);
nautilus_icon_container_set_allow_moves (NAUTILUS_ICON_CONTAINER (icon_container),
fm_directory_view_get_allow_moves (view));
......@@ -1166,6 +1158,7 @@ fm_icon_view_end_loading (FMDirectoryView *view)
FMIconView *icon_view;
icon_view = FM_ICON_VIEW (view);
nautilus_icon_container_set_is_reloading (get_icon_container (icon_view), FALSE);
}
static NautilusZoomLevel
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment