mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-27 03:19:18 +00:00
Handle nautilus_desktop_icon_file_get_link() returning NULL. Likely fixes
2005-02-22 Alexander Larsson <alexl@redhat.com> * libnautilus-private/nautilus-desktop-icon-file.c: * libnautilus-private/nautilus-file-operations.c: (nautilus_file_operations_delete): * libnautilus-private/nautilus-file.c: (nautilus_file_can_rename), (rename_guts), (nautilus_file_get_drop_target_uri): * src/file-manager/fm-desktop-icon-view.c: (trash_link_is_selection): * src/file-manager/fm-icon-container.c: (get_sort_category): * src/file-manager/fm-properties-window.c: (get_target_file_for_original_file): Handle nautilus_desktop_icon_file_get_link() returning NULL. Likely fixes bug #145971
This commit is contained in:
parent
198c89c0fb
commit
80d81ac551
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2005-02-22 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* libnautilus-private/nautilus-desktop-icon-file.c:
|
||||
* libnautilus-private/nautilus-file-operations.c:
|
||||
(nautilus_file_operations_delete):
|
||||
* libnautilus-private/nautilus-file.c: (nautilus_file_can_rename),
|
||||
(rename_guts), (nautilus_file_get_drop_target_uri):
|
||||
* src/file-manager/fm-desktop-icon-view.c:
|
||||
(trash_link_is_selection):
|
||||
* src/file-manager/fm-icon-container.c: (get_sort_category):
|
||||
* src/file-manager/fm-properties-window.c:
|
||||
(get_target_file_for_original_file):
|
||||
Handle nautilus_desktop_icon_file_get_link() returning NULL.
|
||||
Likely fixes bug #145971
|
||||
|
||||
2005-02-22 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* src/file-manager/fm-properties-window.c: (should_show_mime_type):
|
||||
|
|
|
@ -313,6 +313,8 @@ nautilus_desktop_icon_file_new (NautilusDesktopLink *link)
|
|||
return icon_file;
|
||||
}
|
||||
|
||||
|
||||
/* Note: This can return NULL if the link was recently removed (i.e. unmounted) */
|
||||
NautilusDesktopLink *
|
||||
nautilus_desktop_icon_file_get_link (NautilusDesktopIconFile *icon_file)
|
||||
{
|
||||
|
|
|
@ -2461,11 +2461,12 @@ nautilus_file_operations_delete (const GList *item_uris,
|
|||
|
||||
link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
|
||||
|
||||
nautilus_desktop_link_monitor_delete_link (nautilus_desktop_link_monitor_get (),
|
||||
link,
|
||||
parent_view);
|
||||
|
||||
g_object_unref (link);
|
||||
if (link != NULL) {
|
||||
nautilus_desktop_link_monitor_delete_link (nautilus_desktop_link_monitor_get (),
|
||||
link,
|
||||
parent_view);
|
||||
g_object_unref (link);
|
||||
}
|
||||
}
|
||||
nautilus_file_unref (file);
|
||||
}
|
||||
|
|
|
@ -872,8 +872,10 @@ nautilus_file_can_rename (NautilusFile *file)
|
|||
|
||||
link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
|
||||
|
||||
can_rename = nautilus_desktop_link_can_rename (link);
|
||||
g_object_unref (link);
|
||||
if (link != NULL) {
|
||||
can_rename = nautilus_desktop_link_can_rename (link);
|
||||
g_object_unref (link);
|
||||
}
|
||||
}
|
||||
|
||||
/* Nautilus trash directories cannot be renamed */
|
||||
|
@ -1202,7 +1204,8 @@ rename_guts (NautilusFile *file,
|
|||
|
||||
link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
|
||||
|
||||
if (nautilus_desktop_link_rename (link, new_name)) {
|
||||
if (link != NULL &&
|
||||
nautilus_desktop_link_rename (link, new_name)) {
|
||||
(* callback) (file, GNOME_VFS_OK, callback_data);
|
||||
} else {
|
||||
(* callback) (file, GNOME_VFS_ERROR_GENERIC, callback_data);
|
||||
|
@ -2823,11 +2826,13 @@ nautilus_file_get_drop_target_uri (NautilusFile *file)
|
|||
|
||||
if (NAUTILUS_IS_DESKTOP_ICON_FILE (file)) {
|
||||
link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
|
||||
|
||||
uri = nautilus_desktop_link_get_activation_uri (link);
|
||||
g_object_unref (link);
|
||||
if (uri != NULL) {
|
||||
return uri;
|
||||
|
||||
if (link != NULL) {
|
||||
uri = nautilus_desktop_link_get_activation_uri (link);
|
||||
g_object_unref (link);
|
||||
if (uri != NULL) {
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -651,7 +651,9 @@ trash_link_is_selection (FMDirectoryView *view)
|
|||
if (eel_g_list_exactly_one_item (selection) &&
|
||||
NAUTILUS_IS_DESKTOP_ICON_FILE (selection->data)) {
|
||||
link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (selection->data));
|
||||
if (nautilus_desktop_link_get_link_type (link) == NAUTILUS_DESKTOP_LINK_TRASH) {
|
||||
/* link may be NULL if the link was recently removed (unmounted) */
|
||||
if (link != NULL &&
|
||||
nautilus_desktop_link_get_link_type (link) == NAUTILUS_DESKTOP_LINK_TRASH) {
|
||||
result = TRUE;
|
||||
}
|
||||
g_object_unref (link);
|
||||
|
|
|
@ -356,29 +356,30 @@ get_sort_category (NautilusFile *file)
|
|||
NautilusDesktopLink *link;
|
||||
SortCategory category;
|
||||
|
||||
category = SORT_OTHER;
|
||||
|
||||
if (NAUTILUS_IS_DESKTOP_ICON_FILE (file)) {
|
||||
link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
|
||||
|
||||
switch (nautilus_desktop_link_get_link_type (link)) {
|
||||
case NAUTILUS_DESKTOP_LINK_COMPUTER:
|
||||
category = SORT_COMPUTER_LINK;
|
||||
break;
|
||||
case NAUTILUS_DESKTOP_LINK_HOME:
|
||||
category = SORT_HOME_LINK;
|
||||
break;
|
||||
case NAUTILUS_DESKTOP_LINK_VOLUME:
|
||||
category = SORT_MOUNT_LINK;
|
||||
break;
|
||||
case NAUTILUS_DESKTOP_LINK_TRASH:
|
||||
category = SORT_TRASH_LINK;
|
||||
break;
|
||||
default:
|
||||
category = SORT_OTHER;
|
||||
break;
|
||||
if (link != NULL) {
|
||||
switch (nautilus_desktop_link_get_link_type (link)) {
|
||||
case NAUTILUS_DESKTOP_LINK_COMPUTER:
|
||||
category = SORT_COMPUTER_LINK;
|
||||
break;
|
||||
case NAUTILUS_DESKTOP_LINK_HOME:
|
||||
category = SORT_HOME_LINK;
|
||||
break;
|
||||
case NAUTILUS_DESKTOP_LINK_VOLUME:
|
||||
category = SORT_MOUNT_LINK;
|
||||
break;
|
||||
case NAUTILUS_DESKTOP_LINK_TRASH:
|
||||
category = SORT_TRASH_LINK;
|
||||
break;
|
||||
default:
|
||||
category = SORT_OTHER;
|
||||
break;
|
||||
}
|
||||
g_object_unref (link);
|
||||
}
|
||||
g_object_unref (link);
|
||||
} else {
|
||||
category = SORT_OTHER;
|
||||
}
|
||||
|
||||
return category;
|
||||
|
|
|
@ -293,15 +293,17 @@ get_target_file_for_original_file (NautilusFile *file)
|
|||
}
|
||||
} else if (NAUTILUS_IS_DESKTOP_ICON_FILE (file)) {
|
||||
link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
|
||||
|
||||
/* map to linked URI for these types of links */
|
||||
uri_to_display = nautilus_desktop_link_get_activation_uri (link);
|
||||
if (uri_to_display) {
|
||||
target_file = nautilus_file_get (uri_to_display);
|
||||
g_free (uri_to_display);
|
||||
}
|
||||
|
||||
g_object_unref (link);
|
||||
|
||||
if (link != NULL) {
|
||||
/* map to linked URI for these types of links */
|
||||
uri_to_display = nautilus_desktop_link_get_activation_uri (link);
|
||||
if (uri_to_display) {
|
||||
target_file = nautilus_file_get (uri_to_display);
|
||||
g_free (uri_to_display);
|
||||
}
|
||||
|
||||
g_object_unref (link);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue