<chapter id="GuideFaq">
<title>Frequently Asked Questions</title>
<para />
+ <section id="TrashFailed">
+ <title>Move to Trash failed</title>
+ <para />
+ <section id="HowdoIfixtrashproblem">
+ <title>How do I fix move to trash failed?</title>
+ <para>It appears that some distributions will only trash files that are in the same filesytem as where the Trash bin is located.</para>
+ <para>
+ The location of the Trash bin for some systems is
+ <code>$HOME/.local/share/Trash</code>
+ .
+ </para>
+ <para>
+ If you attempt to trash a file not in this filesystem, an attempt is made to find directory
+ <code><top of filesystem>/.Trash-<uid></code>
+ where
+ <code><uid></code>
+ is your user id (in a terminal type
+ <code>id</code>
+ to display it). If this directory does not exist, then the action will fail.
+ </para>
+ <para>You may create this directory and set write access to it as follows:</para>
+ <para />
+ <para>
+ <code>cd</code>
+ to the directory where the file to be deleted is
+ <para />
+ <code>df --human-readable .</code>
+ (Note the dot!) The "Mounted on" column shows the top of the filesystem.
+ <para />
+ <code>cd <the top of the filesystem shown above></code>
+ <para />
+ <code>sudo mkdir .Trash-<uid></code>
+ <para />
+ <code>sudo chown <your user name> .Trash-<uid></code>
+ <para />
+ <code>sudo chmod u+rwx .Trash-<uid></code>
+ </para>
+ </section>
+ </section>
<section id="Imageviewing">
<title>Image viewing</title>
<para />
#include "main.h"
#include "trash.h"
#include "utilops.h"
+#include "window.h"
#include "editors.h"
#include "filedata.h"
return dest;
}
+static void move_to_trash_failed_cb(GenericDialog *UNUSED(gd), gpointer UNUSED(data))
+{
+ help_window_show("TrashFailed.html");
+}
+
gboolean file_util_safe_unlink(const gchar *path)
{
static GenericDialog *gd = NULL;
gchar *result = NULL;
gboolean success = TRUE;
+ gchar *message;
if (!isfile(path)) return FALSE;
}
else
{
- GFile *tmp = g_file_new_for_path (path);
- g_file_trash(tmp, FALSE, NULL);
- g_object_unref(tmp);
- }
+ GFile *tmp = g_file_new_for_path(path);
+ GError *error = NULL;
+
+ if (!g_file_trash(tmp, FALSE, &error) )
+ {
+ message = g_strconcat("See the Help file for a possible workaround.\n\n", error->message, NULL);
+ gd = warning_dialog(_("Move to trash failed\n\n"), message, GTK_STOCK_DIALOG_ERROR, NULL);
+ generic_dialog_add_button(gd, GTK_STOCK_HELP, "Help", move_to_trash_failed_cb, FALSE);
+
+ g_free(message);
+ g_error_free(error);
+
+ /* A second warning dialog is not necessary */
+ // success = FALSE;
+ }
+ }
return success;
}