summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-03-30 02:21:26 +0000
committerDarin Adler <darin@src.gnome.org>2001-03-30 02:21:26 +0000
commit31128bf3bc63dac98da65f76cb7867342bdde00a (patch)
treee681981e54c6f4d67a5024b099585be153d13454
parentd9dd7957100aa79bbf0e125f7b736113fc8ab079 (diff)
downloadnautilus-31128bf3bc63dac98da65f76cb7867342bdde00a.tar.gz
reviewed by: Pavel Cisler <pavel@eazel.com>
* libnautilus-extensions/nautilus-file-operations.c: (sync_transfer_callback): Don't send out notifications in the case where we did a no-op move on top of self. (nautilus_file_operations_copy_move): Get rid of code that complains about move on top of self, since that's no longer considered an error. * configure.in: We require the new gnome-vfs now because we need the code that handles move to self better.
-rw-r--r--ChangeLog14
-rw-r--r--configure.in2
-rw-r--r--libnautilus-extensions/nautilus-file-operations.c54
-rw-r--r--libnautilus-private/nautilus-file-operations.c54
4 files changed, 81 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 599189cd8..bf43f2d23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2001-03-29 Darin Adler <darin@eazel.com>
+
+ reviewed by: Pavel Cisler <pavel@eazel.com>
+
+ * libnautilus-extensions/nautilus-file-operations.c:
+ (sync_transfer_callback): Don't send out notifications in the case
+ where we did a no-op move on top of self.
+ (nautilus_file_operations_copy_move): Get rid of code that
+ complains about move on top of self, since that's no longer
+ considered an error.
+
+ * configure.in: We require the new gnome-vfs now because we need
+ the code that handles move to self better.
+
2001-03-29 Pavel Cisler <pavel@eazel.com>
reviewed by: Darin Adler <darin@eazel.com>
diff --git a/configure.in b/configure.in
index a05af3c59..3e2d0eb0d 100644
--- a/configure.in
+++ b/configure.in
@@ -19,7 +19,7 @@ CONTROL_CENTER_REQUIRED=1.2.3
IMLIB_REQUIRED=1.9.8
LIBXML_REQUIRED=1.8.10
ORBIT_REQUIRED=0.5.6
-GNOME_VFS_REQUIRED=1.0
+GNOME_VFS_REQUIRED=1.1
POPT_REQUIRED=1.5
FREETYPE_REQUIRED=2.0.1
FREETYPE_LIBRARY_REQUIRED=6.1.0
diff --git a/libnautilus-extensions/nautilus-file-operations.c b/libnautilus-extensions/nautilus-file-operations.c
index 70c50f6fb..3d8398e0b 100644
--- a/libnautilus-extensions/nautilus-file-operations.c
+++ b/libnautilus-extensions/nautilus-file-operations.c
@@ -1083,10 +1083,10 @@ is_special_link (const char *uri)
static int
handle_transfer_overwrite (const GnomeVFSXferProgressInfo *progress_info,
TransferInfo *transfer_info)
-{
+{
int result;
char *text, *formatted_name;
-
+
/* Handle special case files such as Trash, mount links and home directory */
if (is_special_link (progress_info->target_name)) {
formatted_name = extract_and_ellipsize_file_name_for_dialog
@@ -1556,6 +1556,7 @@ sync_transfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
{
GHashTable *debuting_uris;
IconPositionIterator *position_iterator;
+ gboolean really_moved;
if (data != NULL) {
debuting_uris = ((SyncTransferInfo *) data)->debuting_uris;
@@ -1592,27 +1593,42 @@ sync_transfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
break;
case GNOME_VFS_XFER_PHASE_MOVING:
- if (progress_info->top_level_item) {
- g_assert (progress_info->source_name != NULL);
+ g_assert (progress_info->source_name != NULL);
+
+ /* If the source and target are the same, that
+ * means we "moved" something in place. No
+ * actual change happened, so we really don't
+ * want to send out any change notification,
+ * but we do want to select the files as
+ * "newly moved here" so we put them into the
+ * debuting_uris set.
+ */
+ really_moved = strcmp (progress_info->source_name,
+ progress_info->target_name) != 0;
- nautilus_file_changes_queue_schedule_metadata_move
- (progress_info->source_name, progress_info->target_name);
-
- apply_one_position (position_iterator,
- progress_info->source_name,
- progress_info->target_name);
+ if (progress_info->top_level_item) {
+ if (really_moved) {
+ nautilus_file_changes_queue_schedule_metadata_move
+ (progress_info->source_name, progress_info->target_name);
+
+ apply_one_position (position_iterator,
+ progress_info->source_name,
+ progress_info->target_name);
+ }
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
}
}
- nautilus_file_changes_queue_file_moved (progress_info->source_name,
- progress_info->target_name);
+ if (really_moved) {
+ nautilus_file_changes_queue_file_moved (progress_info->source_name,
+ progress_info->target_name);
+ }
break;
case GNOME_VFS_XFER_PHASE_DELETESOURCE:
+ g_assert (progress_info->source_name != NULL);
if (progress_info->top_level_item) {
- g_assert (progress_info->source_name != NULL);
nautilus_file_changes_queue_schedule_metadata_remove
(progress_info->source_name);
}
@@ -1948,18 +1964,14 @@ nautilus_file_operations_copy_move (const GList *item_uris,
result = GNOME_VFS_ERROR_NOT_PERMITTED;
break;
}
- if (((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0
- || (move_options & GNOME_VFS_XFER_USE_UNIQUE_NAMES) == 0)
+ if ((move_options & GNOME_VFS_XFER_REMOVESOURCE) == 0
+ && (move_options & GNOME_VFS_XFER_USE_UNIQUE_NAMES) == 0
&& gnome_vfs_uri_is_parent (target_dir_uri, uri, FALSE)) {
nautilus_run_simple_dialog
(parent_view,
FALSE,
- ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0)
- ? _("You cannot move a file onto itself.")
- : _("You cannot copy a file over itself."),
- ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0)
- ? _("Can't Move Onto Self")
- : _("Can't Copy Over Self"),
+ _("You cannot copy a file over itself."),
+ _("Can't Copy Over Self"),
GNOME_STOCK_BUTTON_OK, NULL, NULL);
result = GNOME_VFS_ERROR_NOT_PERMITTED;
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 70c50f6fb..3d8398e0b 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -1083,10 +1083,10 @@ is_special_link (const char *uri)
static int
handle_transfer_overwrite (const GnomeVFSXferProgressInfo *progress_info,
TransferInfo *transfer_info)
-{
+{
int result;
char *text, *formatted_name;
-
+
/* Handle special case files such as Trash, mount links and home directory */
if (is_special_link (progress_info->target_name)) {
formatted_name = extract_and_ellipsize_file_name_for_dialog
@@ -1556,6 +1556,7 @@ sync_transfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
{
GHashTable *debuting_uris;
IconPositionIterator *position_iterator;
+ gboolean really_moved;
if (data != NULL) {
debuting_uris = ((SyncTransferInfo *) data)->debuting_uris;
@@ -1592,27 +1593,42 @@ sync_transfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
break;
case GNOME_VFS_XFER_PHASE_MOVING:
- if (progress_info->top_level_item) {
- g_assert (progress_info->source_name != NULL);
+ g_assert (progress_info->source_name != NULL);
+
+ /* If the source and target are the same, that
+ * means we "moved" something in place. No
+ * actual change happened, so we really don't
+ * want to send out any change notification,
+ * but we do want to select the files as
+ * "newly moved here" so we put them into the
+ * debuting_uris set.
+ */
+ really_moved = strcmp (progress_info->source_name,
+ progress_info->target_name) != 0;
- nautilus_file_changes_queue_schedule_metadata_move
- (progress_info->source_name, progress_info->target_name);
-
- apply_one_position (position_iterator,
- progress_info->source_name,
- progress_info->target_name);
+ if (progress_info->top_level_item) {
+ if (really_moved) {
+ nautilus_file_changes_queue_schedule_metadata_move
+ (progress_info->source_name, progress_info->target_name);
+
+ apply_one_position (position_iterator,
+ progress_info->source_name,
+ progress_info->target_name);
+ }
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
}
}
- nautilus_file_changes_queue_file_moved (progress_info->source_name,
- progress_info->target_name);
+ if (really_moved) {
+ nautilus_file_changes_queue_file_moved (progress_info->source_name,
+ progress_info->target_name);
+ }
break;
case GNOME_VFS_XFER_PHASE_DELETESOURCE:
+ g_assert (progress_info->source_name != NULL);
if (progress_info->top_level_item) {
- g_assert (progress_info->source_name != NULL);
nautilus_file_changes_queue_schedule_metadata_remove
(progress_info->source_name);
}
@@ -1948,18 +1964,14 @@ nautilus_file_operations_copy_move (const GList *item_uris,
result = GNOME_VFS_ERROR_NOT_PERMITTED;
break;
}
- if (((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0
- || (move_options & GNOME_VFS_XFER_USE_UNIQUE_NAMES) == 0)
+ if ((move_options & GNOME_VFS_XFER_REMOVESOURCE) == 0
+ && (move_options & GNOME_VFS_XFER_USE_UNIQUE_NAMES) == 0
&& gnome_vfs_uri_is_parent (target_dir_uri, uri, FALSE)) {
nautilus_run_simple_dialog
(parent_view,
FALSE,
- ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0)
- ? _("You cannot move a file onto itself.")
- : _("You cannot copy a file over itself."),
- ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0)
- ? _("Can't Move Onto Self")
- : _("Can't Copy Over Self"),
+ _("You cannot copy a file over itself."),
+ _("Can't Copy Over Self"),
GNOME_STOCK_BUTTON_OK, NULL, NULL);
result = GNOME_VFS_ERROR_NOT_PERMITTED;