diff options
author | Gene Z. Ragan <gzr@eazel.com> | 2000-11-15 21:36:42 +0000 |
---|---|---|
committer | Gene Ragan <gzr@src.gnome.org> | 2000-11-15 21:36:42 +0000 |
commit | 259c95fa589d3d267c0937afb55cb395979bacf9 (patch) | |
tree | 860b428bedd190a56692201cf9ab8eb4082e16d0 /libnautilus-extensions | |
parent | 3c7ded1f7a1de297c798dcfde88d523199b81218 (diff) | |
download | nautilus-259c95fa589d3d267c0937afb55cb395979bacf9.tar.gz |
Fixed bug 4717, Nautilus draw desktop icons overlapping.
2000-11-15 Gene Z. Ragan <gzr@eazel.com>
Fixed bug 4717, Nautilus draw desktop icons overlapping.
The problem was caused by the icon container responding to
an idle function that lays out icons that had been
newly added. This is a problem if the callback is called
form an idle after th eicon container has been created, but
before a size has been allocated. A nely intialized GtkWidget
has a default allocation of 0, 0, 1, 1 which is too small
for the layout algorithm to work properly. A flag was added
that is set to TRUE when the size_allocate function is called.
* src/nautilus-desktop-window.c: (nautilus_desktop_window_new):
Set has_been_allocated to FALSE initially.
* libnautilus-extensions/nautilus-icon-container.c:
(size_allocate), (nautilus_icon_container_initialize),
(nautilus_icon_container_add):
Checj status of has_been_allocated flag before adding
and laying out new icons.
* libnautilus-extensions/nautilus-icon-private.h:
Added has_been_allocated flag that is set to TRUE
when size_allocated is first called.
Work in progress on allowing desktop links to be renamed.
* src/file-manager/fm-desktop-icon-view.c:
(find_and_update_home_link):
Allow renaming of home links.
* src/file-manager/fm-icon-view.c:
(special_link_in_selection):
Removed home link from special link types.
* libnautilus-extensions/nautilus-file.c:
(nautilus_file_can_rename):
Allow renaming of home link types.
Diffstat (limited to 'libnautilus-extensions')
-rw-r--r-- | libnautilus-extensions/nautilus-file.c | 35 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-icon-container.c | 7 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-icon-private.h | 3 |
3 files changed, 42 insertions, 3 deletions
diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c index bc04d4117..ff6a12762 100644 --- a/libnautilus-extensions/nautilus-file.c +++ b/libnautilus-extensions/nautilus-file.c @@ -701,6 +701,10 @@ nautilus_file_can_rename (NautilusFile *file) { NautilusFile *parent; gboolean result; + const char *path; + char *text_uri, *unescaped_path; + GnomeVFSURI *uri; + gboolean can_rename_link; g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE); @@ -716,7 +720,36 @@ nautilus_file_can_rename (NautilusFile *file) /* Certain types of links can't be renamed */ if (nautilus_file_is_nautilus_link (file)) { - return FALSE; + text_uri = nautilus_file_get_uri (file); + uri = gnome_vfs_uri_new (text_uri); + path = gnome_vfs_uri_get_path (uri); + unescaped_path = gnome_vfs_unescape_string_for_display (path); + + switch (nautilus_link_local_get_link_type (unescaped_path)) { + case NAUTILUS_LINK_HOME: + can_rename_link = TRUE; + break; + + case NAUTILUS_LINK_TRASH: + case NAUTILUS_LINK_MOUNT: + can_rename_link = FALSE; + break; + + case NAUTILUS_LINK_GENERIC: + can_rename_link = FALSE; + break; + + default: + can_rename_link = FALSE; + break; + } + + g_free (text_uri); + gnome_vfs_uri_unref (uri); + + if (!can_rename_link) { + return FALSE; + } } /* User must have write permissions for the parent directory. */ diff --git a/libnautilus-extensions/nautilus-icon-container.c b/libnautilus-extensions/nautilus-icon-container.c index 0f00ea602..187b54427 100644 --- a/libnautilus-extensions/nautilus-icon-container.c +++ b/libnautilus-extensions/nautilus-icon-container.c @@ -2191,6 +2191,8 @@ static void size_allocate (GtkWidget *widget, GtkAllocation *allocation) { + NAUTILUS_ICON_CONTAINER (widget)->details->has_been_allocated = TRUE; + if (allocation->x != widget->allocation.x || allocation->width != widget->allocation.width || allocation->y != widget->allocation.y || @@ -3148,6 +3150,7 @@ nautilus_icon_container_initialize (NautilusIconContainer *container) container->details->rename_widget = NULL; container->details->original_text = NULL; container->details->type_select_state = NULL; + container->details->has_been_allocated = FALSE; } static gboolean @@ -3694,11 +3697,11 @@ nautilus_icon_container_add (NautilusIconContainer *container, details->new_icons = g_list_prepend (details->new_icons, icon); /* Run an idle function to add the icons. */ - if (container->details->idle_id == 0) { + if (container->details->idle_id == 0 && container->details->has_been_allocated) { container->details->idle_id = gtk_idle_add (finish_adding_new_icons_callback, container); } - + return TRUE; } diff --git a/libnautilus-extensions/nautilus-icon-private.h b/libnautilus-extensions/nautilus-icon-private.h index d763ddcc3..b3c1fd25d 100644 --- a/libnautilus-extensions/nautilus-icon-private.h +++ b/libnautilus-extensions/nautilus-icon-private.h @@ -198,6 +198,9 @@ struct NautilusIconContainerDetails { /* Layout mode */ NautilusIconLayoutMode layout_mode; + + /* Set to TRUE after first allocation has been done */ + gboolean has_been_allocated; /* Is the container fixed or resizable */ gboolean is_fixed_size; |