Commit 7379412e authored by Pavel Cisler's avatar Pavel Cisler Committed by Pavel Cisler

reviewed by: Michael Engber <engber@eazel.com>

2001-01-25  Pavel Cisler  <pavel@eazel.com>

	reviewed by: Michael Engber  <engber@eazel.com>

	Fix 5879 (Close copy source & destination windows -> crash at
		  end of copy operation).

	* libnautilus-extensions/nautilus-directory-metafile.c:
	(nautilus_directory_remove_file_metadata):
	Merge a fix from PR3 branch.

	* libnautilus-extensions/nautilus-gtk-extensions.c:
	(null_the_reference), (nautilus_gtk_null_reference_if_destroyed),
	(nautilus_gtk_stop_null_reference_if_destroyed):
	* libnautilus-extensions/nautilus-gtk-extensions.h:
	Add new magic calls that set up a reference to get nulled out
	when the object it points to is destroyed.

	* libnautilus-extensions/nautilus-file-operations.c:
	(transfer_info_new), (transfer_info_destroy),
	(handle_transfer_ok), (nautilus_file_operations_copy_move),
	(nautilus_file_operations_move_to_trash),
	(nautilus_file_operations_delete), (do_empty_trash):
	Null out a saved reference to the parent window so
	that we don't try to use it after the window gets closed.
	Clean up creation and destruction of TransferInfo.

	* libnautilus-extensions/nautilus-file-operations.c:
	(handle_transfer_ok):
	Fix a case where TransferInfo could get leaked.

	* libnautilus-extensions/nautilus-file-operations.c:
	(new_folder_transfer_callback),
	(nautilus_file_operations_new_folder):
	Rework to make deleting of NewFolderTransferState cleaner.
	Set up parent_view to get nulled out when the view gets closed.

	* libnautilus-extensions/nautilus-preferences-dialog.c:
	(dialog_clicked), (dialog_show), (dialog_destroy),
	Tweaks. Get rid of unneeded casts.

	* src/nautilus-property-browser.c: (add_new_pattern),
	(show_color_selection_window), (add_new_color), (add_new_emblem):
	* src/nautilus-theme-selector.c: (add_new_theme_button_callback):
	* src/nautilus-view-frame-corba.c:
	(impl_Nautilus_ViewFrame__destroy),
	(impl_Nautilus_ViewFrame__create):
	Use new magic calls to null out references.

	* src/nautilus-property-browser.c:
	(nautilus_property_browser_destroy):
	Disconnect from the destroy-watching signal.

	* libnautilus-extensions/nautilus-icon-container.c:
	(set_pending_icon_to_reveal):
	(nautilus_preferences_dialog_construct):
	* src/file-manager/fm-directory-view.c: (copy_move_done_data_free),
	(pre_copy_move), (copy_move_done_partition_func),
	(copy_move_done_callback):
	Use new magic calls to null out references.
	Fix a memory trasher where CopyMoveDoneData was being destroyed too
	early.
parent f7f1d37a
2001-01-25 Pavel Cisler <pavel@eazel.com>
reviewed by: Michael Engber <engber@eazel.com>
Fix 5879 (Close copy source & destination windows -> crash at
end of copy operation).
* libnautilus-extensions/nautilus-directory-metafile.c:
(nautilus_directory_remove_file_metadata):
Merge a fix from PR3 branch.
* libnautilus-extensions/nautilus-gtk-extensions.c:
(null_the_reference), (nautilus_gtk_null_reference_if_destroyed),
(nautilus_gtk_stop_null_reference_if_destroyed):
* libnautilus-extensions/nautilus-gtk-extensions.h:
Add new magic calls that set up a reference to get nulled out
when the object it points to is destroyed.
* libnautilus-extensions/nautilus-file-operations.c:
(transfer_info_new), (transfer_info_destroy),
(handle_transfer_ok), (nautilus_file_operations_copy_move),
(nautilus_file_operations_move_to_trash),
(nautilus_file_operations_delete), (do_empty_trash):
Null out a saved reference to the parent window so
that we don't try to use it after the window gets closed.
Clean up creation and destruction of TransferInfo.
* libnautilus-extensions/nautilus-file-operations.c:
(handle_transfer_ok):
Fix a case where TransferInfo could get leaked.
* libnautilus-extensions/nautilus-file-operations.c:
(new_folder_transfer_callback),
(nautilus_file_operations_new_folder):
Rework to make deleting of NewFolderTransferState cleaner.
Set up parent_view to get nulled out when the view gets closed.
* libnautilus-extensions/nautilus-preferences-dialog.c:
(dialog_clicked), (dialog_show), (dialog_destroy),
Tweaks. Get rid of unneeded casts.
* src/nautilus-property-browser.c: (add_new_pattern),
(show_color_selection_window), (add_new_color), (add_new_emblem):
* src/nautilus-theme-selector.c: (add_new_theme_button_callback):
* src/nautilus-view-frame-corba.c:
(impl_Nautilus_ViewFrame__destroy),
(impl_Nautilus_ViewFrame__create):
Use new magic calls to null out references.
* src/nautilus-property-browser.c:
(nautilus_property_browser_destroy):
Disconnect from the destroy-watching signal.
* libnautilus-extensions/nautilus-icon-container.c:
(set_pending_icon_to_reveal):
(nautilus_preferences_dialog_construct):
* src/file-manager/fm-directory-view.c: (copy_move_done_data_free),
(pre_copy_move), (copy_move_done_partition_func),
(copy_move_done_callback):
Use new magic calls to null out references.
Fix a memory trasher where CopyMoveDoneData was being destroyed too
early.
2001-01-25 Gene Z. Ragan <gzr@eazel.com>
Fixed bug 5981, Desktop Eazel-Services link won't work without
......
......@@ -934,12 +934,14 @@ nautilus_directory_remove_file_metadata (NautilusDirectory *directory,
* be removed when the metafile is later read.
*/
hash = directory->details->metadata_changes;
found = g_hash_table_lookup_extended
(hash, file_name, &key, &value);
if (found) {
g_hash_table_remove (hash, file_name);
g_free (key);
metadata_value_destroy (value);
if (hash != NULL) {
found = g_hash_table_lookup_extended
(hash, file_name, &key, &value);
if (found) {
g_hash_table_remove (hash, file_name);
g_free (key);
metadata_value_destroy (value);
}
}
}
......
......@@ -41,6 +41,7 @@
#include <libnautilus-extensions/nautilus-file-changes-queue.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-gdk-font-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-link.h>
......@@ -77,6 +78,35 @@ typedef struct {
gboolean cancelled;
} TransferInfo;
static TransferInfo *
transfer_info_new (GtkWidget *parent_view)
{
TransferInfo *result;
result = g_new0 (TransferInfo, 1);
result->parent_view = parent_view;
nautilus_nullify_when_destroyed (&result->parent_view);
return result;
}
static void
transfer_info_destroy (TransferInfo *transfer_info)
{
nautilus_nullify_cancel (&transfer_info->parent_view);
if (transfer_info->progress_dialog != NULL) {
gtk_widget_destroy (transfer_info->progress_dialog);
}
if (transfer_info->debuting_uris != NULL) {
nautilus_g_hash_table_destroy_deep (transfer_info->debuting_uris);
}
g_free (transfer_info);
}
/* Struct used to control applying icon positions to
* top level items during a copy, drag, new folder creation and
* link creation
......@@ -473,17 +503,14 @@ handle_transfer_ok (const GnomeVFSXferProgressInfo *progress_info,
case GNOME_VFS_XFER_PHASE_COMPLETED:
nautilus_file_changes_consume_changes (TRUE);
if (transfer_info->progress_dialog != NULL) {
gtk_widget_destroy (transfer_info->progress_dialog);
}
if (transfer_info->done_callback != NULL) {
transfer_info->done_callback (transfer_info->debuting_uris, transfer_info->done_callback_data);
/* done_callback now owns (will free) debuting_uris
*/
} else if (transfer_info->debuting_uris != NULL) {
nautilus_g_hash_table_destroy_deep (transfer_info->debuting_uris);
transfer_info->done_callback (transfer_info->debuting_uris,
transfer_info->done_callback_data);
/* done_callback now owns (will free) debuting_uris */
transfer_info->debuting_uris = NULL;
}
g_free (transfer_info);
transfer_info_destroy (transfer_info);
return 1;
default:
......@@ -1618,7 +1645,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
GArray *relative_item_points,
const char *target_dir,
int copy_action,
GtkWidget *view,
GtkWidget *parent_view,
void (*done_callback) (GHashTable *debuting_uris, gpointer data),
gpointer done_callback_data)
{
......@@ -1737,10 +1764,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
}
/* set up the copy/move parameters */
transfer_info = g_new0 (TransferInfo, 1);
transfer_info->parent_view = view;
transfer_info->progress_dialog = NULL;
transfer_info = transfer_info_new (parent_view);
if (relative_item_points != NULL && relative_item_points->len > 0) {
/* FIXME: we probably don't need an icon_position_iterator
* here at all.
......@@ -1800,7 +1824,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
/* don't allow copying into Trash */
if (check_target_directory_is_or_in_trash (trash_dir_uri, target_dir_uri)) {
nautilus_simple_dialog
(view,
(parent_view,
FALSE,
_("You cannot copy items into the Trash."),
_("Can't Copy to Trash"),
......@@ -1822,7 +1846,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
*/
is_desktop_trash_link = vfs_uri_is_special_link (uri);
nautilus_simple_dialog
(view,
(parent_view,
FALSE,
((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0)
? (is_desktop_trash_link
......@@ -1848,7 +1872,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
&& (gnome_vfs_uri_equal (uri, target_dir_uri)
|| gnome_vfs_uri_is_parent (uri, target_dir_uri, TRUE))) {
nautilus_simple_dialog
(view,
(parent_view,
FALSE,
((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0)
? _("You cannot move a folder into itself.")
......@@ -1924,69 +1948,79 @@ handle_new_folder_vfs_error (const GnomeVFSXferProgressInfo *progress_info, NewF
static int
new_folder_transfer_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSXferProgressInfo *progress_info,
gpointer data)
GnomeVFSXferProgressInfo *progress_info,
gpointer data)
{
NewFolderTransferState *state;
char *temp_string;
state = (NewFolderTransferState *) data;
switch (progress_info->status) {
case GNOME_VFS_XFER_PROGRESS_STATUS_OK:
nautilus_file_changes_consume_changes (TRUE);
(* state->done_callback) (progress_info->target_name, state->data);
switch (progress_info->phase) {
case GNOME_VFS_XFER_PHASE_COMPLETED:
nautilus_nullify_cancel (&state->parent_view);
g_free (state);
return 0;
case GNOME_VFS_XFER_PROGRESS_STATUS_DUPLICATE:
temp_string = progress_info->duplicate_name;
if (progress_info->vfs_status == GNOME_VFS_ERROR_NAME_TOO_LONG) {
/* special case an 8.3 file system */
progress_info->duplicate_name = g_strndup (temp_string, 8);
progress_info->duplicate_name[8] = '\0';
g_free (temp_string);
default:
switch (progress_info->status) {
case GNOME_VFS_XFER_PROGRESS_STATUS_OK:
nautilus_file_changes_consume_changes (TRUE);
(* state->done_callback) (progress_info->target_name, state->data);
return 0;
case GNOME_VFS_XFER_PROGRESS_STATUS_DUPLICATE:
temp_string = progress_info->duplicate_name;
progress_info->duplicate_name = g_strdup_printf
("%s.%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
} else {
progress_info->duplicate_name = g_strdup_printf
("%s%%20%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
}
g_free (temp_string);
return GNOME_VFS_XFER_ERROR_ACTION_SKIP;
case GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR:
return handle_new_folder_vfs_error (progress_info, state);
if (progress_info->vfs_status == GNOME_VFS_ERROR_NAME_TOO_LONG) {
/* special case an 8.3 file system */
progress_info->duplicate_name = g_strndup (temp_string, 8);
progress_info->duplicate_name[8] = '\0';
g_free (temp_string);
temp_string = progress_info->duplicate_name;
progress_info->duplicate_name = g_strdup_printf
("%s.%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
} else {
progress_info->duplicate_name = g_strdup_printf
("%s%%20%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
}
g_free (temp_string);
return GNOME_VFS_XFER_ERROR_ACTION_SKIP;
case GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR:
return handle_new_folder_vfs_error (progress_info, state);
default:
g_warning (_("Unknown GnomeVFSXferProgressStatus %d"),
progress_info->status);
return 0;
default:
g_warning (_("Unknown GnomeVFSXferProgressStatus %d"),
progress_info->status);
return 0;
}
}
}
void
nautilus_file_operations_new_folder (GtkWidget *parent_view,
const char *parent_dir,
void (*done_callback) (const char *, gpointer),
gpointer data)
{
NewFolderTransferState *state;
GList *target_uri_list;
GnomeVFSURI *uri, *parent_uri;
NewFolderTransferState *state;
state = g_new (NewFolderTransferState, 1);
state->done_callback = done_callback;
state->data = data;
state->parent_view = parent_view;
nautilus_nullify_when_destroyed (&state->parent_view);
/* pass in the target directory and the new folder name as a destination URI */
parent_uri = gnome_vfs_uri_new (parent_dir);
......@@ -2086,9 +2120,7 @@ nautilus_file_operations_move_to_trash (const GList *item_uris,
g_assert (trash_dir_uri != NULL);
/* set up the move parameters */
transfer_info = g_new0 (TransferInfo, 1);
transfer_info->parent_view = parent_view;
transfer_info->progress_dialog = NULL;
transfer_info = transfer_info_new (parent_view);
/* Do an arbitrary guess that an operation will take very little
* time and the progress shouldn't be shown.
......@@ -2137,9 +2169,7 @@ nautilus_file_operations_delete (const GList *item_uris,
}
uri_list = g_list_reverse (uri_list);
transfer_info = g_new0 (TransferInfo, 1);
transfer_info->parent_view = parent_view;
transfer_info->progress_dialog = NULL;
transfer_info = transfer_info_new (parent_view);
transfer_info->show_progress_dialog = TRUE;
/* localizers: progress dialog title */
......@@ -2174,9 +2204,7 @@ do_empty_trash (GtkWidget *parent_view)
trash_dir_list = nautilus_trash_monitor_get_trash_directories ();
if (trash_dir_list != NULL) {
/* set up the move parameters */
transfer_info = g_new0 (TransferInfo, 1);
transfer_info->parent_view = parent_view;
transfer_info->progress_dialog = NULL;
transfer_info = transfer_info_new (parent_view);
transfer_info->show_progress_dialog = TRUE;
/* localizers: progress dialog title */
......
......@@ -1269,6 +1269,69 @@ nautilus_gtk_signal_connect_full_while_alive (GtkObject *object,
info);
}
static void
null_the_reference (GtkObject *object, gpointer callback_data)
{
g_assert (* (GtkObject **) callback_data == object);
* (gpointer *) callback_data = NULL;
}
/**
* nautilus_nullify_when_destroyed.
*
* Nulls out a saved reference to an object when the object gets destroyed.
* @data: Address of the saved reference.
**/
void
nautilus_nullify_when_destroyed (gpointer data)
{
GtkObject **object_reference;
object_reference = (GtkObject **)data;
if (*object_reference == NULL) {
/* the reference is NULL, nothing to do. */
return;
}
g_assert (GTK_IS_OBJECT (*object_reference));
gtk_signal_connect (*object_reference, "destroy",
null_the_reference, object_reference);
}
/**
* nautilus_nullify_cancel.
*
* Disconnects the signal used to make nautilus_nullify_when_destroyed.
* Used when the saved reference is no longer needed, the structure it is in is
* being destroyed, etc. Nulls out the refernce when done.
* @data: Address of the saved reference.
**/
void
nautilus_nullify_cancel (gpointer data)
{
GtkObject **object_reference;
object_reference = (GtkObject **)data;
if (*object_reference == NULL) {
/* the object was already destroyed and the reference nulled out,
* nothing to do.
*/
return;
}
g_assert (GTK_IS_OBJECT (*object_reference));
gtk_signal_disconnect_by_func (*object_reference,
null_the_reference, object_reference);
*object_reference = NULL;
}
/**
* nautilus_gtk_container_get_first_child.
*
......
......@@ -71,6 +71,9 @@ void nautilus_gtk_signal_connect_full_while_alive (GtkObjec
gboolean after,
GtkObject *alive_object);
void nautilus_nullify_when_destroyed (gpointer object_pointer_address);
void nautilus_nullify_cancel (gpointer object_pointer_address);
/* list of GtkObject */
GList * nautilus_gtk_object_list_ref (GList *list);
void nautilus_gtk_object_list_unref (GList *list);
......
......@@ -434,7 +434,7 @@ set_pending_icon_to_reveal (NautilusIconContainer *container, NautilusIcon *icon
if (cur_pending != NULL) {
gtk_signal_disconnect_by_func (GTK_OBJECT (cur_pending->item),
&pending_icon_to_reveal_destroy_callback,
pending_icon_to_reveal_destroy_callback,
container);
}
......
......@@ -120,25 +120,25 @@ nautilus_preferences_dialog_initialize (NautilusPreferencesDialog * prefs_dialog
}
static void
dialog_clicked(GtkWidget * widget, gint n, gpointer data)
dialog_clicked (GtkWidget * widget, gint n, gpointer data)
{
NautilusPreferencesDialog * prefs_dialog = (NautilusPreferencesDialog *) data;
g_assert(prefs_dialog);
gtk_widget_hide(GTK_WIDGET(prefs_dialog));
gtk_widget_hide (GTK_WIDGET(prefs_dialog));
}
static void
dialog_show(GtkWidget * widget, gpointer data)
dialog_show (GtkWidget * widget, gpointer data)
{
NautilusPreferencesDialog * prefs_dialog = (NautilusPreferencesDialog *) data;
g_assert(prefs_dialog);
g_assert (prefs_dialog);
}
static void
dialog_destroy(GtkWidget * widget, gpointer data)
dialog_destroy (GtkWidget * widget, gpointer data)
{
NautilusPreferencesDialog * prefs_dialog = (NautilusPreferencesDialog *) data;
......@@ -185,17 +185,17 @@ nautilus_preferences_dialog_construct (NautilusPreferencesDialog *prefs_dialog,
gtk_signal_connect (GTK_OBJECT (prefs_dialog),
"clicked",
GTK_SIGNAL_FUNC (dialog_clicked),
(gpointer) prefs_dialog);
prefs_dialog);
gtk_signal_connect (GTK_OBJECT (prefs_dialog),
"show",
GTK_SIGNAL_FUNC(dialog_show),
(gpointer) prefs_dialog);
prefs_dialog);
gtk_signal_connect (GTK_OBJECT (prefs_dialog),
"destroy",
GTK_SIGNAL_FUNC (dialog_destroy),
(gpointer) prefs_dialog);
prefs_dialog);
/* Configure the GNOME_DIALOG's vbox */
g_assert (gnome_dialog->vbox);
......
......@@ -934,12 +934,14 @@ nautilus_directory_remove_file_metadata (NautilusDirectory *directory,
* be removed when the metafile is later read.
*/
hash = directory->details->metadata_changes;
found = g_hash_table_lookup_extended
(hash, file_name, &key, &value);
if (found) {
g_hash_table_remove (hash, file_name);
g_free (key);
metadata_value_destroy (value);
if (hash != NULL) {
found = g_hash_table_lookup_extended
(hash, file_name, &key, &value);
if (found) {
g_hash_table_remove (hash, file_name);
g_free (key);
metadata_value_destroy (value);
}
}
}
......
......@@ -41,6 +41,7 @@
#include <libnautilus-extensions/nautilus-file-changes-queue.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-gdk-font-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-link.h>
......@@ -77,6 +78,35 @@ typedef struct {
gboolean cancelled;
} TransferInfo;
static TransferInfo *
transfer_info_new (GtkWidget *parent_view)
{
TransferInfo *result;
result = g_new0 (TransferInfo, 1);
result->parent_view = parent_view;
nautilus_nullify_when_destroyed (&result->parent_view);
return result;
}
static void
transfer_info_destroy (TransferInfo *transfer_info)
{
nautilus_nullify_cancel (&transfer_info->parent_view);
if (transfer_info->progress_dialog != NULL) {
gtk_widget_destroy (transfer_info->progress_dialog);
}
if (transfer_info->debuting_uris != NULL) {
nautilus_g_hash_table_destroy_deep (transfer_info->debuting_uris);
}
g_free (transfer_info);
}
/* Struct used to control applying icon positions to
* top level items during a copy, drag, new folder creation and
* link creation
......@@ -473,17 +503,14 @@ handle_transfer_ok (const GnomeVFSXferProgressInfo *progress_info,
case GNOME_VFS_XFER_PHASE_COMPLETED:
nautilus_file_changes_consume_changes (TRUE);
if (transfer_info->progress_dialog != NULL) {
gtk_widget_destroy (transfer_info->progress_dialog);
}
if (transfer_info->done_callback != NULL) {
transfer_info->done_callback (transfer_info->debuting_uris, transfer_info->done_callback_data);
/* done_callback now owns (will free) debuting_uris
*/
} else if (transfer_info->debuting_uris != NULL) {
nautilus_g_hash_table_destroy_deep (transfer_info->debuting_uris);
transfer_info->done_callback (transfer_info->debuting_uris,
transfer_info->done_callback_data);
/* done_callback now owns (will free) debuting_uris */
transfer_info->debuting_uris = NULL;
}
g_free (transfer_info);
transfer_info_destroy (transfer_info);
return 1;
default:
......@@ -1618,7 +1645,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
GArray *relative_item_points,
const char *target_dir,
int copy_action,
GtkWidget *view,
GtkWidget *parent_view,
void (*done_callback) (GHashTable *debuting_uris, gpointer data),
gpointer done_callback_data)
{
......@@ -1737,10 +1764,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
}
/* set up the copy/move parameters */
transfer_info = g_new0 (TransferInfo, 1);
transfer_info->parent_view = view;
transfer_info->progress_dialog = NULL;
transfer_info = transfer_info_new (parent_view);
if (relative_item_points != NULL && relative_item_points->len > 0) {
/* FIXME: we probably don't need an icon_position_iterator
* here at all.
......@@ -1800,7 +1824,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
/* don't allow copying into Trash */
if (check_target_directory_is_or_in_trash (trash_dir_uri, target_dir_uri)) {
nautilus_simple_dialog
(view,
(parent_view,
FALSE,
_("You cannot copy items into the Trash."),
_("Can't Copy to Trash"),
......@@ -1822,7 +1846,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
*/
is_desktop_trash_link = vfs_uri_is_special_link (uri);
nautilus_simple_dialog
(view,
(parent_view,
FALSE,
((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0)
? (is_desktop_trash_link
......@@ -1848,7 +1872,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
&& (gnome_vfs_uri_equal (uri, target_dir_uri)
|| gnome_vfs_uri_is_parent (uri, target_dir_uri, TRUE))) {
nautilus_simple_dialog
(view,
(parent_view,
FALSE,
((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0)
? _("You cannot move a folder into itself.")
......@@ -1924,69 +1948,79 @@ handle_new_folder_vfs_error (const GnomeVFSXferProgressInfo *progress_info, NewF
static int
new_folder_transfer_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSXferProgressInfo *progress_info,
gpointer data)
GnomeVFSXferProgressInfo *progress_info,
gpointer data)
{
NewFolderTransferState *state;
char *temp_string;
state = (NewFolderTransferState *) data;
switch (progress_info->status) {
case GNOME_VFS_XFER_PROGRESS_STATUS_OK:
nautilus_file_changes_consume_changes (TRUE);
(* state->done_callback) (progress_info->target_name, state->data);
switch (progress_info->phase) {
case GNOME_VFS_XFER_PHASE_COMPLETED:
nautilus_nullify_cancel (&state->parent_view);
g_free (state);
return 0;
case GNOME_VFS_XFER_PROGRESS_STATUS_DUPLICATE:
temp_string = progress_info->duplicate_name;
if (progress_info->vfs_status == GNOME_VFS_ERROR_NAME_TOO_LONG) {
/* special case an 8.3 file system */
progress_info->duplicate_name = g_strndup (temp_string, 8);
progress_info->duplicate_name[8] = '\0';
g_free (temp_string);
default:
switch (progress_info->status) {
case GNOME_VFS_XFER_PROGRESS_STATUS_OK:
nautilus_file_changes_consume_changes (TRUE);
(* state->done_callback) (progress_info->target_name, state->data);
return 0;
case GNOME_VFS_XFER_PROGRESS_STATUS_DUPLICATE:
temp_string = progress_info->duplicate_name;
progress_info->duplicate_name = g_strdup_printf
("%s.%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
} else {
progress_info->duplicate_name = g_strdup_printf
("%s%%20%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
}
g_free (temp_string);
return GNOME_VFS_XFER_ERROR_ACTION_SKIP;
case GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR:
return handle_new_folder_vfs_error (progress_info, state);
if (progress_info->vfs_status == GNOME_VFS_ERROR_NAME_TOO_LONG) {
/* special case an 8.3 file system */
progress_info->duplicate_name = g_strndup (temp_string, 8);
progress_info->duplicate_name[8] = '\0';
g_free (temp_string);
temp_string = progress_info->duplicate_name;
progress_info->duplicate_name = g_strdup_printf
("%s.%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
} else {
progress_info->duplicate_name = g_strdup_printf
("%s%%20%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
}
g_free (temp_string);
return GNOME_VFS_XFER_ERROR_ACTION_SKIP;
case GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR:
return handle_new_folder_vfs_error (progress_info, state);
default: