Commit c6a934be authored by Pavel Cisler's avatar Pavel Cisler Committed by Pavel Cisler

src/file-manager/fm-directory-view.c Added "Move to Trash" and "Empty

2000-04-26  Pavel Cisler  <pavel@eazel.com>

	* src/file-manager/fm-directory-view.c
	* src/file-manager/fm-directory-view.h:
	(bonobo_menu_open_in_new_window_cb), (bonobo_menu_delete_cb),
	(bonobo_menu_duplicate_cb), (fm_directory_view_get_model),
	(fm_directory_view_delete_with_confirm), (append_uri_one),
	(fm_directory_duplicate_selection), (compute_menu_item_info),
	(fm_directory_view_real_append_selection_),
	(fm_directory_view_real_merge_menus),
	(fm_directory_view_real_update_menus), (free_file_by_uri_map),
	(fm_directory_view_get_context_menu_index):
	Added "Move to Trash" and "Empty Trash" menu items.
	Disabled the existing Delete code (I'll scavenge it later to implement
	Delete as a fallback.)

	* src/file-manager/dfos-xfer.h:
	* src/file-manager/dfos-xfer.c (file_operation_alert), (fs_xfer),
	(get_parent_make_name_list), (fs_move_to_trash):
	Add move to trash and empty trash calls.


	* libnautilus-extensions/nautilus-file-changes-queue.c
	(nautilus_file_changes_queue_get_change),
	(nautilus_file_changes_consume_changes):
	Fix a problem with nautilus_file_changes_consume_changes getting called
	when there is no change allocated yet.

	* libnautilus-extensions/nautilus-directory.c
	(nautilus_directory_notify_files_added),
	(nautilus_directory_notify_files_removed),
	(nautilus_directory_notify_files_moved):
	Got rid of old debugging code.
parent d402738c
2000-04-26 Pavel Cisler <pavel@eazel.com>
* src/file-manager/fm-directory-view.c
* src/file-manager/fm-directory-view.h:
(bonobo_menu_open_in_new_window_cb), (bonobo_menu_delete_cb),
(bonobo_menu_duplicate_cb), (fm_directory_view_get_model),
(fm_directory_view_delete_with_confirm), (append_uri_one),
(fm_directory_duplicate_selection), (compute_menu_item_info),
(fm_directory_view_real_append_selection_),
(fm_directory_view_real_merge_menus),
(fm_directory_view_real_update_menus), (free_file_by_uri_map),
(fm_directory_view_get_context_menu_index):
Added "Move to Trash" and "Empty Trash" menu items.
Disabled the existing Delete code (I'll scavenge it later to implement
Delete as a fallback.)
* src/file-manager/dfos-xfer.h:
* src/file-manager/dfos-xfer.c (file_operation_alert), (fs_xfer),
(get_parent_make_name_list), (fs_move_to_trash):
Add move to trash and empty trash calls.
* libnautilus-extensions/nautilus-file-changes-queue.c
(nautilus_file_changes_queue_get_change),
(nautilus_file_changes_consume_changes):
Fix a problem with nautilus_file_changes_consume_changes getting called
when there is no change allocated yet.
* libnautilus-extensions/nautilus-directory.c
(nautilus_directory_notify_files_added),
(nautilus_directory_notify_files_removed),
(nautilus_directory_notify_files_moved):
Got rid of old debugging code.
2000-04-26 Ramiro Estrugo <ramiro@eazel.com>
* nautilus-clean.sh: Give this thing a -q flag to quiet down noise.
......@@ -650,8 +684,6 @@
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_notify_files_moved):
a b c d e f a b c d e f a b c d e f a b c d e f a b c d e f a b cd
d d e f a b c d e f a b c d e f
Darin helped me finish implementing the missing parts of the call,
including updating the reference to the new directory object,
updating the file info structure to match the file's new location.
......
......@@ -867,10 +867,6 @@ nautilus_directory_notify_files_added (GList *uris)
for (p = uris; p != NULL; p = p->next) {
uri = (const char *) p->data;
#ifdef COPY_NOTIFY_TESTING
g_message ("added %s", uri);
#endif
/* See if the directory is already known. */
directory = get_parent_directory_if_exists (uri);
if (directory == NULL) {
......@@ -943,10 +939,6 @@ nautilus_directory_notify_files_removed (GList *uris)
for (p = uris; p != NULL; p = p->next) {
uri = (const char *) p->data;
#ifdef COPY_NOTIFY_TESTING
g_message ("removed %s", p->data);
#endif
/* Find the file. */
file = get_file_if_exists (uri);
if (file == NULL) {
......@@ -987,10 +979,6 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
for (p = uri_pairs; p != NULL; p = p->next) {
pair = p->data;
#ifdef COPY_NOTIFY_TESTING
g_message ("moved %s to %s", pair->from_uri, pair->to_uri);
#endif
/* Move an existing file. */
file = get_file_if_exists (pair->from_uri);
if (file == NULL) {
......
......@@ -156,6 +156,8 @@ nautilus_file_changes_queue_get_change (NautilusFileChangesQueue *queue)
{
GList *new_tail;
NautilusFileChange *result;
g_assert(queue);
/* dequeue the tail item while locking down the list */
MUTEX_LOCK (queue->details->mutex);
......@@ -211,12 +213,17 @@ nautilus_file_changes_consume_changes (gboolean consume_all)
URIPair *pair;
int kind;
int chunk_count;
NautilusFileChangesQueue *queue;
additions = NULL;
deletions = NULL;
moves = NULL;
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.
* This is to ensure that the changes get sent off in the same order that they
......
......@@ -26,8 +26,11 @@
#include <config.h>
#include <gnome.h>
#include <libgnomevfs/gnome-vfs-find-directory.h>
#include "dfos-xfer.h"
#include "libnautilus-extensions/nautilus-file-changes-queue.h"
#include "libnautilus-extensions/nautilus-glib-extensions.h"
#include "fm-directory-view.h"
......@@ -413,6 +416,26 @@ file_operation_alert (GtkWidget *parent_view, const char *text,
return gnome_dialog_run (GNOME_DIALOG (dialog));
}
static void
get_parent_make_name_list (const GList *item_uris, GnomeVFSURI **source_dir_uri,
GList **item_names)
{
const GList *p;
/* 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)
*source_dir_uri = gnome_vfs_uri_get_parent (item_uri);
gnome_vfs_uri_unref (item_uri);
}
}
void
fs_xfer (const GList *item_uris,
const GdkPoint *relative_item_points,
......@@ -420,10 +443,9 @@ fs_xfer (const GList *item_uris,
int copy_action,
GtkWidget *view)
{
const GList *p;
GList *item_names;
GnomeVFSXferOptions move_options;
gchar *source_dir;
char *source_dir;
GnomeVFSURI *source_dir_uri;
GnomeVFSURI *target_dir_uri;
XferInfo *xfer_info;
......@@ -434,20 +456,7 @@ fs_xfer (const GList *item_uris,
item_names = NULL;
source_dir_uri = NULL;
/* 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_append (item_names, g_strdup (item_name));
if (source_dir_uri == NULL)
source_dir_uri = gnome_vfs_uri_get_parent (item_uri);
gnome_vfs_uri_unref (item_uri);
}
get_parent_make_name_list (item_uris, &source_dir_uri, &item_names);
source_dir = gnome_vfs_uri_to_string (source_dir_uri, GNOME_VFS_URI_HIDE_NONE);
if (target_dir != NULL) {
......@@ -492,10 +501,117 @@ fs_xfer (const GList *item_uris,
&update_xfer_callback, xfer_info,
&sync_xfer_callback, xfer_info);
if (!target_dir)
if (target_dir != NULL)
g_free ((char *)target_dir_uri_text);
gnome_vfs_uri_unref (target_dir_uri);
gnome_vfs_uri_unref (source_dir_uri);
g_free (source_dir);
}
void
fs_move_to_trash (const GList *item_uris, GtkWidget *parent_view)
{
GList *item_names;
GnomeVFSURI *source_dir_uri;
GnomeVFSURI *trash_dir_uri;
char *source_dir;
char *trash_dir_uri_text;
GnomeVFSResult result;
XferInfo *xfer_info;
g_assert (item_uris != NULL);
item_names = NULL;
source_dir_uri = NULL;
trash_dir_uri = NULL;
/* FIXME:
* Separate items that can be moved to trash and ones that can't.
* For the ones that cannot, ask the user if they want to delete the files
* on the spot.
*/
get_parent_make_name_list (item_uris, &source_dir_uri, &item_names);
source_dir = gnome_vfs_uri_to_string (source_dir_uri, GNOME_VFS_URI_HIDE_NONE);
result = gnome_vfs_find_directory (source_dir_uri, GNOME_VFS_DIRECTORY_KIND_TRASH,
&trash_dir_uri, TRUE, 0777);
if (result == GNOME_VFS_OK) {
g_assert (trash_dir_uri != NULL);
trash_dir_uri_text = gnome_vfs_uri_to_string (trash_dir_uri,
GNOME_VFS_URI_HIDE_NONE);
/* set up the move parameters */
xfer_info = g_new (XferInfo, 1);
xfer_info->parent_view = parent_view;
xfer_info->progress_dialog = NULL;
xfer_info->operation_name = _("Moving to Trash");
xfer_info->preparation_name =_("Preparing to Move to Trash...");
xfer_info->error_mode = GNOME_VFS_XFER_ERROR_MODE_QUERY;
xfer_info->overwrite_mode = GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE;
gnome_vfs_async_xfer (&xfer_info->handle, source_dir, item_names,
trash_dir_uri_text, NULL,
GNOME_VFS_XFER_REMOVESOURCE | GNOME_VFS_XFER_USE_UNIQUE_NAMES,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
&update_xfer_callback, xfer_info,
&sync_xfer_callback, xfer_info);
g_free (trash_dir_uri_text);
}
gnome_vfs_uri_unref (trash_dir_uri);
gnome_vfs_uri_unref (source_dir_uri);
g_free (source_dir);
}
void
fs_empty_trash (GtkWidget *parent_view)
{
GnomeVFSURI *trash_dir_uri;
GnomeVFSResult result;
XferInfo *xfer_info;
/* FIXME:
* add the different trash directories from the different volumes
*/
result = gnome_vfs_find_directory (NULL, GNOME_VFS_DIRECTORY_KIND_TRASH,
&trash_dir_uri, TRUE, 0777);
if (result == GNOME_VFS_OK) {
GList *trash_dir_list;
char *trash_dir_name;
trash_dir_list = NULL;
g_assert (trash_dir_uri != NULL);
/* set up the move parameters */
xfer_info = g_new (XferInfo, 1);
xfer_info->parent_view = parent_view;
xfer_info->progress_dialog = NULL;
xfer_info->operation_name = _("Emptying the Trash");
xfer_info->preparation_name =_("Preparing to Empty to Trash...");
xfer_info->error_mode = GNOME_VFS_XFER_ERROR_MODE_QUERY;
xfer_info->overwrite_mode = GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE;
trash_dir_name = gnome_vfs_uri_to_string (trash_dir_uri,
GNOME_VFS_URI_HIDE_NONE);
trash_dir_list = g_list_append (trash_dir_list, trash_dir_name);
gnome_vfs_async_xfer (&xfer_info->handle, NULL, trash_dir_list,
NULL, NULL,
GNOME_VFS_XFER_REMOVESOURCE,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
&update_xfer_callback, xfer_info,
&sync_xfer_callback, xfer_info);
nautilus_g_list_free_deep (trash_dir_list);
}
gnome_vfs_uri_unref (trash_dir_uri);
}
......@@ -42,6 +42,11 @@ void fs_xfer (const GList *item_uris,
int copy_action,
GtkWidget *parent_view);
void fs_move_to_trash (const GList *item_uris,
GtkWidget *parent_view);
void fs_empty_trash (GtkWidget *parent_view);
int file_operation_alert (GtkWidget *parent_view,
const char *text,
const char *title,
......
......@@ -867,10 +867,6 @@ nautilus_directory_notify_files_added (GList *uris)
for (p = uris; p != NULL; p = p->next) {
uri = (const char *) p->data;
#ifdef COPY_NOTIFY_TESTING
g_message ("added %s", uri);
#endif
/* See if the directory is already known. */
directory = get_parent_directory_if_exists (uri);
if (directory == NULL) {
......@@ -943,10 +939,6 @@ nautilus_directory_notify_files_removed (GList *uris)
for (p = uris; p != NULL; p = p->next) {
uri = (const char *) p->data;
#ifdef COPY_NOTIFY_TESTING
g_message ("removed %s", p->data);
#endif
/* Find the file. */
file = get_file_if_exists (uri);
if (file == NULL) {
......@@ -987,10 +979,6 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
for (p = uri_pairs; p != NULL; p = p->next) {
pair = p->data;
#ifdef COPY_NOTIFY_TESTING
g_message ("moved %s to %s", pair->from_uri, pair->to_uri);
#endif
/* Move an existing file. */
file = get_file_if_exists (pair->from_uri);
if (file == NULL) {
......
......@@ -156,6 +156,8 @@ nautilus_file_changes_queue_get_change (NautilusFileChangesQueue *queue)
{
GList *new_tail;
NautilusFileChange *result;
g_assert(queue);
/* dequeue the tail item while locking down the list */
MUTEX_LOCK (queue->details->mutex);
......@@ -211,12 +213,17 @@ nautilus_file_changes_consume_changes (gboolean consume_all)
URIPair *pair;
int kind;
int chunk_count;
NautilusFileChangesQueue *queue;
additions = NULL;
deletions = NULL;
moves = NULL;
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.
* This is to ensure that the changes get sent off in the same order that they
......
......@@ -26,8 +26,11 @@
#include <config.h>
#include <gnome.h>
#include <libgnomevfs/gnome-vfs-find-directory.h>
#include "dfos-xfer.h"
#include "libnautilus-extensions/nautilus-file-changes-queue.h"
#include "libnautilus-extensions/nautilus-glib-extensions.h"
#include "fm-directory-view.h"
......@@ -413,6 +416,26 @@ file_operation_alert (GtkWidget *parent_view, const char *text,
return gnome_dialog_run (GNOME_DIALOG (dialog));
}
static void
get_parent_make_name_list (const GList *item_uris, GnomeVFSURI **source_dir_uri,
GList **item_names)
{
const GList *p;
/* 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)
*source_dir_uri = gnome_vfs_uri_get_parent (item_uri);
gnome_vfs_uri_unref (item_uri);
}
}
void
fs_xfer (const GList *item_uris,
const GdkPoint *relative_item_points,
......@@ -420,10 +443,9 @@ fs_xfer (const GList *item_uris,
int copy_action,
GtkWidget *view)
{
const GList *p;
GList *item_names;
GnomeVFSXferOptions move_options;
gchar *source_dir;
char *source_dir;
GnomeVFSURI *source_dir_uri;
GnomeVFSURI *target_dir_uri;
XferInfo *xfer_info;
......@@ -434,20 +456,7 @@ fs_xfer (const GList *item_uris,
item_names = NULL;
source_dir_uri = NULL;
/* 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_append (item_names, g_strdup (item_name));
if (source_dir_uri == NULL)
source_dir_uri = gnome_vfs_uri_get_parent (item_uri);
gnome_vfs_uri_unref (item_uri);
}
get_parent_make_name_list (item_uris, &source_dir_uri, &item_names);
source_dir = gnome_vfs_uri_to_string (source_dir_uri, GNOME_VFS_URI_HIDE_NONE);
if (target_dir != NULL) {
......@@ -492,10 +501,117 @@ fs_xfer (const GList *item_uris,
&update_xfer_callback, xfer_info,
&sync_xfer_callback, xfer_info);
if (!target_dir)
if (target_dir != NULL)
g_free ((char *)target_dir_uri_text);
gnome_vfs_uri_unref (target_dir_uri);
gnome_vfs_uri_unref (source_dir_uri);
g_free (source_dir);
}
void
fs_move_to_trash (const GList *item_uris, GtkWidget *parent_view)
{
GList *item_names;
GnomeVFSURI *source_dir_uri;
GnomeVFSURI *trash_dir_uri;
char *source_dir;
char *trash_dir_uri_text;
GnomeVFSResult result;
XferInfo *xfer_info;
g_assert (item_uris != NULL);
item_names = NULL;
source_dir_uri = NULL;
trash_dir_uri = NULL;
/* FIXME:
* Separate items that can be moved to trash and ones that can't.
* For the ones that cannot, ask the user if they want to delete the files
* on the spot.
*/
get_parent_make_name_list (item_uris, &source_dir_uri, &item_names);
source_dir = gnome_vfs_uri_to_string (source_dir_uri, GNOME_VFS_URI_HIDE_NONE);
result = gnome_vfs_find_directory (source_dir_uri, GNOME_VFS_DIRECTORY_KIND_TRASH,
&trash_dir_uri, TRUE, 0777);
if (result == GNOME_VFS_OK) {
g_assert (trash_dir_uri != NULL);
trash_dir_uri_text = gnome_vfs_uri_to_string (trash_dir_uri,
GNOME_VFS_URI_HIDE_NONE);
/* set up the move parameters */
xfer_info = g_new (XferInfo, 1);
xfer_info->parent_view = parent_view;
xfer_info->progress_dialog = NULL;
xfer_info->operation_name = _("Moving to Trash");
xfer_info->preparation_name =_("Preparing to Move to Trash...");
xfer_info->error_mode = GNOME_VFS_XFER_ERROR_MODE_QUERY;
xfer_info->overwrite_mode = GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE;
gnome_vfs_async_xfer (&xfer_info->handle, source_dir, item_names,
trash_dir_uri_text, NULL,
GNOME_VFS_XFER_REMOVESOURCE | GNOME_VFS_XFER_USE_UNIQUE_NAMES,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
&update_xfer_callback, xfer_info,
&sync_xfer_callback, xfer_info);
g_free (trash_dir_uri_text);
}
gnome_vfs_uri_unref (trash_dir_uri);
gnome_vfs_uri_unref (source_dir_uri);
g_free (source_dir);
}
void
fs_empty_trash (GtkWidget *parent_view)
{
GnomeVFSURI *trash_dir_uri;
GnomeVFSResult result;
XferInfo *xfer_info;
/* FIXME:
* add the different trash directories from the different volumes
*/
result = gnome_vfs_find_directory (NULL, GNOME_VFS_DIRECTORY_KIND_TRASH,
&trash_dir_uri, TRUE, 0777);
if (result == GNOME_VFS_OK) {
GList *trash_dir_list;
char *trash_dir_name;
trash_dir_list = NULL;
g_assert (trash_dir_uri != NULL);
/* set up the move parameters */
xfer_info = g_new (XferInfo, 1);
xfer_info->parent_view = parent_view;
xfer_info->progress_dialog = NULL;
xfer_info->operation_name = _("Emptying the Trash");
xfer_info->preparation_name =_("Preparing to Empty to Trash...");
xfer_info->error_mode = GNOME_VFS_XFER_ERROR_MODE_QUERY;
xfer_info->overwrite_mode = GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE;
trash_dir_name = gnome_vfs_uri_to_string (trash_dir_uri,
GNOME_VFS_URI_HIDE_NONE);
trash_dir_list = g_list_append (trash_dir_list, trash_dir_name);
gnome_vfs_async_xfer (&xfer_info->handle, NULL, trash_dir_list,
NULL, NULL,
GNOME_VFS_XFER_REMOVESOURCE,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
&update_xfer_callback, xfer_info,
&sync_xfer_callback, xfer_info);
nautilus_g_list_free_deep (trash_dir_list);
}
gnome_vfs_uri_unref (trash_dir_uri);
}
......@@ -42,6 +42,11 @@ void fs_xfer (const GList *item_uris,
int copy_action,
GtkWidget *parent_view);
void fs_move_to_trash (const GList *item_uris,
GtkWidget *parent_view);
void fs_empty_trash (GtkWidget *parent_view);
int file_operation_alert (GtkWidget *parent_view,
const char *text,
const char *title,
......
......@@ -26,8 +26,11 @@
#include <config.h>
#include <gnome.h>
#include <libgnomevfs/gnome-vfs-find-directory.h>
#include "dfos-xfer.h"
#include "libnautilus-extensions/nautilus-file-changes-queue.h"
#include "libnautilus-extensions/nautilus-glib-extensions.h"
#include "fm-directory-view.h"
......@@ -413,6 +416,26 @@ file_operation_alert (GtkWidget *parent_view, const char *text,
return gnome_dialog_run (GNOME_DIALOG (dialog));
}
static void
get_parent_make_name_list (const GList *item_uris, GnomeVFSURI **source_dir_uri,
GList **item_names)
{
const GList *p;
/* 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)
*source_dir_uri = gnome_vfs_uri_get_parent (item_uri);
gnome_vfs_uri_unref (item_uri);
}
}
void
fs_xfer (const GList *item_uris,
const GdkPoint *relative_item_points,
......@@ -420,10 +443,9 @@ fs_xfer (const GList *item_uris,
int copy_action,
GtkWidget *view)
{
const GList *p;
GList *item_names;
GnomeVFSXferOptions move_options;
gchar *source_dir;
char *source_dir;
GnomeVFSURI *source_dir_uri;
GnomeVFSURI *target_dir_uri;
XferInfo *xfer_info;
......@@ -434,20 +456,7 @@ fs_xfer (const GList *item_uris,
item_names = NULL;
source_dir_uri = NULL;
/* 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_append (item_names, g_strdup (item_name));
if (source_dir_uri == NULL)
source_dir_uri = gnome_vfs_uri_get_parent (item_uri);
gnome_vfs_uri_unref (item_uri);
}
get_parent_make_name_list (item_uris, &source_dir_uri, &item_names);
source_dir = gnome_vfs_uri_to_string (source_dir_uri, GNOME_VFS_URI_HIDE_NONE);
if (target_dir != NULL) {
......@@ -492,10 +501,117 @@ fs_xfer (const GList *item_uris,
&update_xfer_callback, xfer_info,
&sync_xfer_callback, xfer_info);
if (!target_dir)
if (target_dir != NULL)
g_free ((char *)target_dir_uri_text);
gnome_vfs_uri_unref (target_dir_uri);
gnome_vfs_uri_unref (source_dir_uri);
g_free (source_dir);
}
void
fs_move_to_trash (const GList *item_uris, GtkWidget *parent_view)
{
GList *item_names;
GnomeVFSURI *source_dir_uri;
GnomeVFSURI *trash_dir_uri;
char *source_dir;
char *trash_dir_uri_text;
GnomeVFSResult result;
XferInfo *xfer_info;
g_assert (item_uris != NULL);
item_names = NULL;
source_dir_uri = NULL;
trash_dir_uri = NULL;
/* FIXME:
* Separate items that can be moved to trash and ones that can't.
* For the ones that cannot, ask the user if they want to delete the files
* on the spot.
*/