summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-06-02 23:33:02 +0000
committerDarin Adler <darin@src.gnome.org>2000-06-02 23:33:02 +0000
commit58b235f00658dbe892b001e0c14b8af1596d966e (patch)
tree6b0d2e1656c6076dafcb1635fda103a0d3ef3405
parentc846f9825892eb126ee85c3cd97137f2d3067d54 (diff)
downloadnautilus-58b235f00658dbe892b001e0c14b8af1596d966e.tar.gz
Need to unencode the name here because it's used to compare with file
* libnautilus-extensions/nautilus-directory.c: (uri_get_basename): Need to unencode the name here because it's used to compare with file names that come from get_file_info. * src/file-manager/dfos-xfer.c: (get_parent_make_name_list): Unescape the result of get_basename to convert it to a plain old file name, since that's why gnome_vfs_xfer wants in its file name lists (for now, see bug 1107). * libnautilus-extensions/Makefile.am: * libnautilus-extensions/nautilus-file-changes-queue-private.h: Removed the private header since it's so private it can be in the .c file :-) * libnautilus-extensions/nautilus-file-changes-queue.h: * libnautilus-extensions/nautilus-file-changes-queue.c: (nautilus_file_changes_queue_new), (nautilus_file_changes_queue_get), (nautilus_file_change_free), (nautilus_file_changes_queue_free), (nautilus_file_changes_queue_add_common), (nautilus_file_changes_queue_get_change): A little simplification and reformatting. Got rid of the details indirection since the entire data structure is private.
-rw-r--r--ChangeLog27
-rw-r--r--libnautilus-extensions/Makefile.am1
-rw-r--r--libnautilus-extensions/nautilus-directory.c6
-rw-r--r--libnautilus-extensions/nautilus-file-changes-queue-private.h48
-rw-r--r--libnautilus-extensions/nautilus-file-changes-queue.c93
-rw-r--r--libnautilus-extensions/nautilus-file-changes-queue.h21
-rw-r--r--libnautilus-extensions/nautilus-file-operations.c18
-rw-r--r--libnautilus-private/Makefile.am1
-rw-r--r--libnautilus-private/nautilus-directory.c6
-rw-r--r--libnautilus-private/nautilus-file-changes-queue-private.h48
-rw-r--r--libnautilus-private/nautilus-file-changes-queue.c93
-rw-r--r--libnautilus-private/nautilus-file-changes-queue.h21
-rw-r--r--libnautilus-private/nautilus-file-operations.c18
-rw-r--r--src/file-manager/dfos-xfer.c18
14 files changed, 204 insertions, 215 deletions
diff --git a/ChangeLog b/ChangeLog
index afd3dfa1d..0a785e8b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2000-06-02 Darin Adler <darin@eazel.com>
+
+ * libnautilus-extensions/nautilus-directory.c: (uri_get_basename):
+ Need to unencode the name here because it's used to compare with
+ file names that come from get_file_info.
+
+ * src/file-manager/dfos-xfer.c: (get_parent_make_name_list):
+ Unescape the result of get_basename to convert it to a plain old
+ file name, since that's why gnome_vfs_xfer wants in its file name
+ lists (for now, see bug 1107).
+
+ * libnautilus-extensions/Makefile.am:
+ * libnautilus-extensions/nautilus-file-changes-queue-private.h:
+ Removed the private header since it's so private it can be in the
+ .c file :-)
+
+ * libnautilus-extensions/nautilus-file-changes-queue.h:
+ * libnautilus-extensions/nautilus-file-changes-queue.c:
+ (nautilus_file_changes_queue_new),
+ (nautilus_file_changes_queue_get), (nautilus_file_change_free),
+ (nautilus_file_changes_queue_free),
+ (nautilus_file_changes_queue_add_common),
+ (nautilus_file_changes_queue_get_change):
+ A little simplification and reformatting. Got rid of the details
+ indirection since the entire data structure is private.
+
2000-06-02 John Sullivan <sullivan@eazel.com>
* libnautilus-extensions/nautilus-mime-actions.h,
@@ -29,6 +55,7 @@
* libnautilus-extensions/nautilus-icon-container.c (realize):
Reduce flicker by setting the back pixmap to NULL on realize.
+
2000-06-02 John Sullivan <sullivan@eazel.com>
Finished task 968 (Add one-time viewer choice to "View as"
diff --git a/libnautilus-extensions/Makefile.am b/libnautilus-extensions/Makefile.am
index fee044a0f..4d83dc7f7 100644
--- a/libnautilus-extensions/Makefile.am
+++ b/libnautilus-extensions/Makefile.am
@@ -75,7 +75,6 @@ libnautilus_extensionsinclude_HEADERS= \
$(NULL)
libnautilus_extensions_la_SOURCES = \
- nautilus-file-changes-queue-private.h \
nautilus-icon-private.h \
nautilus-file-private.h \
nautilus-directory-private.h \
diff --git a/libnautilus-extensions/nautilus-directory.c b/libnautilus-extensions/nautilus-directory.c
index fa00d7e31..1eaa23b05 100644
--- a/libnautilus-extensions/nautilus-directory.c
+++ b/libnautilus-extensions/nautilus-directory.c
@@ -507,7 +507,7 @@ static char *
uri_get_basename (const char *uri)
{
GnomeVFSURI *vfs_uri;
- char *name;
+ char *escaped_name, *name;
/* Make VFS version of URI. */
vfs_uri = gnome_vfs_uri_new (uri);
@@ -516,8 +516,10 @@ uri_get_basename (const char *uri)
}
/* Extract name part. */
- name = gnome_vfs_uri_extract_short_name (vfs_uri);
+ escaped_name = gnome_vfs_uri_extract_short_path_name (vfs_uri);
gnome_vfs_uri_unref (vfs_uri);
+ name = gnome_vfs_unescape_string (escaped_name, NULL);
+ g_free (escaped_name);
return name;
}
diff --git a/libnautilus-extensions/nautilus-file-changes-queue-private.h b/libnautilus-extensions/nautilus-file-changes-queue-private.h
deleted file mode 100644
index c57094c90..000000000
--- a/libnautilus-extensions/nautilus-file-changes-queue-private.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-directory.h: Nautilus directory model.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
-
-#include <glib.h>
-#include "nautilus-file-changes-queue.h"
-
-typedef struct NautilusFileChange NautilusFileChange;
-
-enum {
- CHANGE_FILE_INITIAL,
- CHANGE_FILE_ADDED,
- CHANGE_FILE_REMOVED,
- CHANGE_FILE_MOVED
-};
-
-struct NautilusFileChange {
- int kind;
- char *from_uri;
- char *to_uri;
-};
-
-struct NautilusFileChangesQueueDetails {
- GList *head;
- GList *tail;
-#ifdef G_THREADS_ENABLED
- GMutex *mutex;
-#endif
-};
diff --git a/libnautilus-extensions/nautilus-file-changes-queue.c b/libnautilus-extensions/nautilus-file-changes-queue.c
index 39bfc4b2d..37bcd97d2 100644
--- a/libnautilus-extensions/nautilus-file-changes-queue.c
+++ b/libnautilus-extensions/nautilus-file-changes-queue.c
@@ -22,7 +22,7 @@
*/
#include <config.h>
-#include "nautilus-file-changes-queue-private.h"
+#include "nautilus-file-changes-queue.h"
#include "nautilus-glib-extensions.h"
#include "nautilus-directory-private.h"
@@ -35,21 +35,36 @@
#define MUTEX_UNLOCK(a)
#endif
-static void
-nautilus_file_change_free (NautilusFileChange *change)
-{
- g_free (change->from_uri);
- g_free (change->to_uri);
-}
+typedef enum {
+ CHANGE_FILE_INITIAL,
+ CHANGE_FILE_ADDED,
+ CHANGE_FILE_REMOVED,
+ CHANGE_FILE_MOVED
+} NautilusFileChangeKind;
+
+typedef struct {
+ NautilusFileChangeKind kind;
+ char *from_uri;
+ char *to_uri;
+} NautilusFileChange;
+
+typedef struct {
+ GList *head;
+ GList *tail;
+#ifdef G_THREADS_ENABLED
+ GMutex *mutex;
+#endif
+} NautilusFileChangesQueue;
static NautilusFileChangesQueue *
nautilus_file_changes_queue_new (void)
{
- NautilusFileChangesQueue *result = g_new (NautilusFileChangesQueue, 1);
- result->details = g_new0 (NautilusFileChangesQueueDetails, 1);
+ NautilusFileChangesQueue *result;
+
+ result = g_new0 (NautilusFileChangesQueue, 1);
#ifdef G_THREADS_ENABLED
- result->details->mutex = g_mutex_new ();
+ result->mutex = g_mutex_new ();
#endif
return result;
}
@@ -59,12 +74,23 @@ nautilus_file_changes_queue_get (void)
{
static NautilusFileChangesQueue *file_changes_queue;
- if (file_changes_queue == NULL)
- file_changes_queue = nautilus_file_changes_queue_new();
+ if (file_changes_queue == NULL) {
+ file_changes_queue = nautilus_file_changes_queue_new ();
+ }
return file_changes_queue;
}
+#if 0 /* no public free call yet */
+
+static void
+nautilus_file_change_free (NautilusFileChange *change)
+{
+ g_free (change->from_uri);
+ g_free (change->to_uri);
+}
+
+
void
nautilus_file_changes_queue_free (NautilusFileChangesQueue *queue)
{
@@ -79,30 +105,31 @@ nautilus_file_changes_queue_free (NautilusFileChangesQueue *queue)
*/
#endif
- for (p = queue->details->head; p != NULL; p = p->next) {
+ for (p = queue->head; p != NULL; p = p->next) {
nautilus_file_change_free (p->data);
}
- g_list_free (queue->details->head);
+ g_list_free (queue->head);
#ifdef G_THREADS_ENABLED
- g_mutex_free (queue->details->mutex);
+ g_mutex_free (queue->mutex);
#endif
- g_free (queue->details);
g_free (queue);
}
+#endif /* no public free call yet */
+
static void
nautilus_file_changes_queue_add_common (NautilusFileChangesQueue *queue,
NautilusFileChange *new_item)
{
/* enqueue the new queue item while locking down the list */
- MUTEX_LOCK (queue->details->mutex);
+ MUTEX_LOCK (queue->mutex);
- queue->details->head = g_list_prepend (queue->details->head, new_item);
- if (queue->details->tail == NULL)
- queue->details->tail = queue->details->head;
+ queue->head = g_list_prepend (queue->head, new_item);
+ if (queue->tail == NULL)
+ queue->tail = queue->head;
- MUTEX_UNLOCK (queue->details->mutex);
+ MUTEX_UNLOCK (queue->mutex);
}
void
@@ -112,7 +139,6 @@ nautilus_file_changes_queue_file_added (const char *uri)
NautilusFileChangesQueue *queue;
queue = nautilus_file_changes_queue_get();
- g_assert (queue);
new_item = g_new0 (NautilusFileChange, 1);
new_item->kind = CHANGE_FILE_ADDED;
@@ -127,7 +153,6 @@ nautilus_file_changes_queue_file_removed (const char *uri)
NautilusFileChangesQueue *queue;
queue = nautilus_file_changes_queue_get();
- g_assert (queue);
new_item = g_new0 (NautilusFileChange, 1);
new_item->kind = CHANGE_FILE_REMOVED;
@@ -141,8 +166,7 @@ nautilus_file_changes_queue_file_moved (const char *from, const char *to)
NautilusFileChange *new_item;
NautilusFileChangesQueue *queue;
- queue = nautilus_file_changes_queue_get();
- g_assert (queue);
+ queue = nautilus_file_changes_queue_get ();
new_item = g_new (NautilusFileChange, 1);
new_item->kind = CHANGE_FILE_MOVED;
@@ -157,22 +181,22 @@ nautilus_file_changes_queue_get_change (NautilusFileChangesQueue *queue)
GList *new_tail;
NautilusFileChange *result;
- g_assert(queue);
+ g_assert (queue != NULL);
/* dequeue the tail item while locking down the list */
- MUTEX_LOCK (queue->details->mutex);
+ MUTEX_LOCK (queue->mutex);
- if (queue->details->tail == NULL) {
+ if (queue->tail == NULL) {
result = NULL;
} else {
- new_tail = queue->details->tail->prev;
- result = queue->details->tail->data;
- queue->details->head = g_list_remove_link (queue->details->head,
- queue->details->tail);
- queue->details->tail = new_tail;
+ new_tail = queue->tail->prev;
+ result = queue->tail->data;
+ queue->head = g_list_remove_link (queue->head,
+ queue->tail);
+ queue->tail = new_tail;
}
- MUTEX_UNLOCK (queue->details->mutex);
+ MUTEX_UNLOCK (queue->mutex);
return result;
}
@@ -222,7 +246,6 @@ nautilus_file_changes_consume_changes (gboolean consume_all)
kind = CHANGE_FILE_INITIAL;
queue = nautilus_file_changes_queue_get();
- g_assert (queue);
/* Consume changes from the queue, stuffing them into one of three lists,
* keep doing it while the changes are of the same kind, then send them off.
diff --git a/libnautilus-extensions/nautilus-file-changes-queue.h b/libnautilus-extensions/nautilus-file-changes-queue.h
index 3cedb1c09..084dac0e6 100644
--- a/libnautilus-extensions/nautilus-file-changes-queue.h
+++ b/libnautilus-extensions/nautilus-file-changes-queue.h
@@ -24,20 +24,13 @@
#ifndef NAUTILUS_FILE_CHANGES_QUEUE_H
#define NAUTILUS_FILE_CHANGES_QUEUE_H
-typedef struct NautilusFileChangesQueue NautilusFileChangesQueue;
-typedef struct NautilusFileChangesQueueDetails NautilusFileChangesQueueDetails;
+#include <glib.h>
-void nautilus_file_changes_queue_free (NautilusFileChangesQueue *queue);
+void nautilus_file_changes_queue_file_added (const char *uri);
+void nautilus_file_changes_queue_file_removed (const char *uri);
+void nautilus_file_changes_queue_file_moved (const char *from_uri,
+ const char *to_uri);
-void nautilus_file_changes_queue_file_added (const char *uri);
-void nautilus_file_changes_queue_file_removed (const char *uri);
-void nautilus_file_changes_queue_file_moved (const char *from_uri,
- const char *to_uri);
+void nautilus_file_changes_consume_changes (gboolean consume_all);
-void nautilus_file_changes_consume_changes (gboolean consume_all);
-
-struct NautilusFileChangesQueue {
- NautilusFileChangesQueueDetails *details;
-};
-
-#endif
+#endif /* NAUTILUS_FILE_CHANGES_QUEUE_H */
diff --git a/libnautilus-extensions/nautilus-file-operations.c b/libnautilus-extensions/nautilus-file-operations.c
index 58a029400..e0fb057ec 100644
--- a/libnautilus-extensions/nautilus-file-operations.c
+++ b/libnautilus-extensions/nautilus-file-operations.c
@@ -411,16 +411,24 @@ get_parent_make_name_list (const GList *item_uris, GnomeVFSURI **source_dir_uri,
GList **item_names)
{
const GList *p;
+ GnomeVFSURI *item_uri;
+ const gchar *item_name;
+ char *unescaped_item_name;
+
/* convert URI list to a source parent URI and a list of names */
for (p = item_uris; p != NULL; p = p->next) {
- GnomeVFSURI *item_uri;
- const gchar *item_name;
-
item_uri = gnome_vfs_uri_new (p->data);
item_name = gnome_vfs_uri_get_basename (item_uri);
- *item_names = g_list_prepend (*item_names, g_strdup (item_name));
- if (*source_dir_uri == NULL)
+ unescaped_item_name = gnome_vfs_unescape_string (item_name, NULL);
+ /* FIXME bugzilla.eazel.com 1107: If a file had %00 in
+ * its name, then this assert would fail. Also, people
+ * could pass us bad URIs and it would fail.
+ */
+ g_assert (unescaped_item_name != NULL);
+ *item_names = g_list_prepend (*item_names, unescaped_item_name);
+ if (*source_dir_uri == NULL) {
*source_dir_uri = gnome_vfs_uri_get_parent (item_uri);
+ }
gnome_vfs_uri_unref (item_uri);
}
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am
index fee044a0f..4d83dc7f7 100644
--- a/libnautilus-private/Makefile.am
+++ b/libnautilus-private/Makefile.am
@@ -75,7 +75,6 @@ libnautilus_extensionsinclude_HEADERS= \
$(NULL)
libnautilus_extensions_la_SOURCES = \
- nautilus-file-changes-queue-private.h \
nautilus-icon-private.h \
nautilus-file-private.h \
nautilus-directory-private.h \
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index fa00d7e31..1eaa23b05 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -507,7 +507,7 @@ static char *
uri_get_basename (const char *uri)
{
GnomeVFSURI *vfs_uri;
- char *name;
+ char *escaped_name, *name;
/* Make VFS version of URI. */
vfs_uri = gnome_vfs_uri_new (uri);
@@ -516,8 +516,10 @@ uri_get_basename (const char *uri)
}
/* Extract name part. */
- name = gnome_vfs_uri_extract_short_name (vfs_uri);
+ escaped_name = gnome_vfs_uri_extract_short_path_name (vfs_uri);
gnome_vfs_uri_unref (vfs_uri);
+ name = gnome_vfs_unescape_string (escaped_name, NULL);
+ g_free (escaped_name);
return name;
}
diff --git a/libnautilus-private/nautilus-file-changes-queue-private.h b/libnautilus-private/nautilus-file-changes-queue-private.h
deleted file mode 100644
index c57094c90..000000000
--- a/libnautilus-private/nautilus-file-changes-queue-private.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-directory.h: Nautilus directory model.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
-
-#include <glib.h>
-#include "nautilus-file-changes-queue.h"
-
-typedef struct NautilusFileChange NautilusFileChange;
-
-enum {
- CHANGE_FILE_INITIAL,
- CHANGE_FILE_ADDED,
- CHANGE_FILE_REMOVED,
- CHANGE_FILE_MOVED
-};
-
-struct NautilusFileChange {
- int kind;
- char *from_uri;
- char *to_uri;
-};
-
-struct NautilusFileChangesQueueDetails {
- GList *head;
- GList *tail;
-#ifdef G_THREADS_ENABLED
- GMutex *mutex;
-#endif
-};
diff --git a/libnautilus-private/nautilus-file-changes-queue.c b/libnautilus-private/nautilus-file-changes-queue.c
index 39bfc4b2d..37bcd97d2 100644
--- a/libnautilus-private/nautilus-file-changes-queue.c
+++ b/libnautilus-private/nautilus-file-changes-queue.c
@@ -22,7 +22,7 @@
*/
#include <config.h>
-#include "nautilus-file-changes-queue-private.h"
+#include "nautilus-file-changes-queue.h"
#include "nautilus-glib-extensions.h"
#include "nautilus-directory-private.h"
@@ -35,21 +35,36 @@
#define MUTEX_UNLOCK(a)
#endif
-static void
-nautilus_file_change_free (NautilusFileChange *change)
-{
- g_free (change->from_uri);
- g_free (change->to_uri);
-}
+typedef enum {
+ CHANGE_FILE_INITIAL,
+ CHANGE_FILE_ADDED,
+ CHANGE_FILE_REMOVED,
+ CHANGE_FILE_MOVED
+} NautilusFileChangeKind;
+
+typedef struct {
+ NautilusFileChangeKind kind;
+ char *from_uri;
+ char *to_uri;
+} NautilusFileChange;
+
+typedef struct {
+ GList *head;
+ GList *tail;
+#ifdef G_THREADS_ENABLED
+ GMutex *mutex;
+#endif
+} NautilusFileChangesQueue;
static NautilusFileChangesQueue *
nautilus_file_changes_queue_new (void)
{
- NautilusFileChangesQueue *result = g_new (NautilusFileChangesQueue, 1);
- result->details = g_new0 (NautilusFileChangesQueueDetails, 1);
+ NautilusFileChangesQueue *result;
+
+ result = g_new0 (NautilusFileChangesQueue, 1);
#ifdef G_THREADS_ENABLED
- result->details->mutex = g_mutex_new ();
+ result->mutex = g_mutex_new ();
#endif
return result;
}
@@ -59,12 +74,23 @@ nautilus_file_changes_queue_get (void)
{
static NautilusFileChangesQueue *file_changes_queue;
- if (file_changes_queue == NULL)
- file_changes_queue = nautilus_file_changes_queue_new();
+ if (file_changes_queue == NULL) {
+ file_changes_queue = nautilus_file_changes_queue_new ();
+ }
return file_changes_queue;
}
+#if 0 /* no public free call yet */
+
+static void
+nautilus_file_change_free (NautilusFileChange *change)
+{
+ g_free (change->from_uri);
+ g_free (change->to_uri);
+}
+
+
void
nautilus_file_changes_queue_free (NautilusFileChangesQueue *queue)
{
@@ -79,30 +105,31 @@ nautilus_file_changes_queue_free (NautilusFileChangesQueue *queue)
*/
#endif
- for (p = queue->details->head; p != NULL; p = p->next) {
+ for (p = queue->head; p != NULL; p = p->next) {
nautilus_file_change_free (p->data);
}
- g_list_free (queue->details->head);
+ g_list_free (queue->head);
#ifdef G_THREADS_ENABLED
- g_mutex_free (queue->details->mutex);
+ g_mutex_free (queue->mutex);
#endif
- g_free (queue->details);
g_free (queue);
}
+#endif /* no public free call yet */
+
static void
nautilus_file_changes_queue_add_common (NautilusFileChangesQueue *queue,
NautilusFileChange *new_item)
{
/* enqueue the new queue item while locking down the list */
- MUTEX_LOCK (queue->details->mutex);
+ MUTEX_LOCK (queue->mutex);
- queue->details->head = g_list_prepend (queue->details->head, new_item);
- if (queue->details->tail == NULL)
- queue->details->tail = queue->details->head;
+ queue->head = g_list_prepend (queue->head, new_item);
+ if (queue->tail == NULL)
+ queue->tail = queue->head;
- MUTEX_UNLOCK (queue->details->mutex);
+ MUTEX_UNLOCK (queue->mutex);
}
void
@@ -112,7 +139,6 @@ nautilus_file_changes_queue_file_added (const char *uri)
NautilusFileChangesQueue *queue;
queue = nautilus_file_changes_queue_get();
- g_assert (queue);
new_item = g_new0 (NautilusFileChange, 1);
new_item->kind = CHANGE_FILE_ADDED;
@@ -127,7 +153,6 @@ nautilus_file_changes_queue_file_removed (const char *uri)
NautilusFileChangesQueue *queue;
queue = nautilus_file_changes_queue_get();
- g_assert (queue);
new_item = g_new0 (NautilusFileChange, 1);
new_item->kind = CHANGE_FILE_REMOVED;
@@ -141,8 +166,7 @@ nautilus_file_changes_queue_file_moved (const char *from, const char *to)
NautilusFileChange *new_item;
NautilusFileChangesQueue *queue;
- queue = nautilus_file_changes_queue_get();
- g_assert (queue);
+ queue = nautilus_file_changes_queue_get ();
new_item = g_new (NautilusFileChange, 1);
new_item->kind = CHANGE_FILE_MOVED;
@@ -157,22 +181,22 @@ nautilus_file_changes_queue_get_change (NautilusFileChangesQueue *queue)
GList *new_tail;
NautilusFileChange *result;
- g_assert(queue);
+ g_assert (queue != NULL);
/* dequeue the tail item while locking down the list */
- MUTEX_LOCK (queue->details->mutex);
+ MUTEX_LOCK (queue->mutex);
- if (queue->details->tail == NULL) {
+ if (queue->tail == NULL) {
result = NULL;
} else {
- new_tail = queue->details->tail->prev;
- result = queue->details->tail->data;
- queue->details->head = g_list_remove_link (queue->details->head,
- queue->details->tail);
- queue->details->tail = new_tail;
+ new_tail = queue->tail->prev;
+ result = queue->tail->data;
+ queue->head = g_list_remove_link (queue->head,
+ queue->tail);
+ queue->tail = new_tail;
}
- MUTEX_UNLOCK (queue->details->mutex);
+ MUTEX_UNLOCK (queue->mutex);
return result;
}
@@ -222,7 +246,6 @@ nautilus_file_changes_consume_changes (gboolean consume_all)
kind = CHANGE_FILE_INITIAL;
queue = nautilus_file_changes_queue_get();
- g_assert (queue);
/* Consume changes from the queue, stuffing them into one of three lists,
* keep doing it while the changes are of the same kind, then send them off.
diff --git a/libnautilus-private/nautilus-file-changes-queue.h b/libnautilus-private/nautilus-file-changes-queue.h
index 3cedb1c09..084dac0e6 100644
--- a/libnautilus-private/nautilus-file-changes-queue.h
+++ b/libnautilus-private/nautilus-file-changes-queue.h
@@ -24,20 +24,13 @@
#ifndef NAUTILUS_FILE_CHANGES_QUEUE_H
#define NAUTILUS_FILE_CHANGES_QUEUE_H
-typedef struct NautilusFileChangesQueue NautilusFileChangesQueue;
-typedef struct NautilusFileChangesQueueDetails NautilusFileChangesQueueDetails;
+#include <glib.h>
-void nautilus_file_changes_queue_free (NautilusFileChangesQueue *queue);
+void nautilus_file_changes_queue_file_added (const char *uri);
+void nautilus_file_changes_queue_file_removed (const char *uri);
+void nautilus_file_changes_queue_file_moved (const char *from_uri,
+ const char *to_uri);
-void nautilus_file_changes_queue_file_added (const char *uri);
-void nautilus_file_changes_queue_file_removed (const char *uri);
-void nautilus_file_changes_queue_file_moved (const char *from_uri,
- const char *to_uri);
+void nautilus_file_changes_consume_changes (gboolean consume_all);
-void nautilus_file_changes_consume_changes (gboolean consume_all);
-
-struct NautilusFileChangesQueue {
- NautilusFileChangesQueueDetails *details;
-};
-
-#endif
+#endif /* NAUTILUS_FILE_CHANGES_QUEUE_H */
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 58a029400..e0fb057ec 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -411,16 +411,24 @@ get_parent_make_name_list (const GList *item_uris, GnomeVFSURI **source_dir_uri,
GList **item_names)
{
const GList *p;
+ GnomeVFSURI *item_uri;
+ const gchar *item_name;
+ char *unescaped_item_name;
+
/* convert URI list to a source parent URI and a list of names */
for (p = item_uris; p != NULL; p = p->next) {
- GnomeVFSURI *item_uri;
- const gchar *item_name;
-
item_uri = gnome_vfs_uri_new (p->data);
item_name = gnome_vfs_uri_get_basename (item_uri);
- *item_names = g_list_prepend (*item_names, g_strdup (item_name));
- if (*source_dir_uri == NULL)
+ unescaped_item_name = gnome_vfs_unescape_string (item_name, NULL);
+ /* FIXME bugzilla.eazel.com 1107: If a file had %00 in
+ * its name, then this assert would fail. Also, people
+ * could pass us bad URIs and it would fail.
+ */
+ g_assert (unescaped_item_name != NULL);
+ *item_names = g_list_prepend (*item_names, unescaped_item_name);
+ if (*source_dir_uri == NULL) {
*source_dir_uri = gnome_vfs_uri_get_parent (item_uri);
+ }
gnome_vfs_uri_unref (item_uri);
}
diff --git a/src/file-manager/dfos-xfer.c b/src/file-manager/dfos-xfer.c
index 58a029400..e0fb057ec 100644
--- a/src/file-manager/dfos-xfer.c
+++ b/src/file-manager/dfos-xfer.c
@@ -411,16 +411,24 @@ get_parent_make_name_list (const GList *item_uris, GnomeVFSURI **source_dir_uri,
GList **item_names)
{
const GList *p;
+ GnomeVFSURI *item_uri;
+ const gchar *item_name;
+ char *unescaped_item_name;
+
/* convert URI list to a source parent URI and a list of names */
for (p = item_uris; p != NULL; p = p->next) {
- GnomeVFSURI *item_uri;
- const gchar *item_name;
-
item_uri = gnome_vfs_uri_new (p->data);
item_name = gnome_vfs_uri_get_basename (item_uri);
- *item_names = g_list_prepend (*item_names, g_strdup (item_name));
- if (*source_dir_uri == NULL)
+ unescaped_item_name = gnome_vfs_unescape_string (item_name, NULL);
+ /* FIXME bugzilla.eazel.com 1107: If a file had %00 in
+ * its name, then this assert would fail. Also, people
+ * could pass us bad URIs and it would fail.
+ */
+ g_assert (unescaped_item_name != NULL);
+ *item_names = g_list_prepend (*item_names, unescaped_item_name);
+ if (*source_dir_uri == NULL) {
*source_dir_uri = gnome_vfs_uri_get_parent (item_uri);
+ }
gnome_vfs_uri_unref (item_uri);
}