diff -ru Thunar-1.0.2.orig/thunar/thunar-application.c Thunar-1.0.2/thunar/thunar-application.c
--- Thunar-1.0.2.orig/thunar/thunar-application.c 2010-06-01 15:36:41.000000000 -0400
+++ Thunar-1.0.2/thunar/thunar-application.c 2010-06-02 16:07:06.000000000 -0400
@@ -1328,13 +1328,20 @@
gchar *message;
guint n_path_list = 0;
gint response;
+ gboolean isTrashEnabled;
_thunar_return_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WIDGET (parent));
_thunar_return_if_fail (THUNAR_IS_APPLICATION (application));
-
+
/* check if we should permanently delete the files (user holds shift) */
permanently = (gtk_get_current_event_state (&state) && (state & GDK_SHIFT_MASK) != 0);
+ g_object_get (G_OBJECT (application->preferences), "misc-enable-trash", &isTrashEnabled, NULL);
+ if (!isTrashEnabled)
+ {
+ permanently = TRUE;
+ }
+
/* determine the paths for the files */
for (lp = g_list_last (file_list); lp != NULL; lp = lp->prev, ++n_path_list)
{
@@ -1354,8 +1361,8 @@
if (G_UNLIKELY (permanently))
{
/* parse the parent pointer */
- screen = thunar_util_parse_parent (parent, &window);
-
+ screen = thunar_util_parse_parent (parent, &window);
+
/* generate the question to confirm the delete operation */
if (G_LIKELY (n_path_list == 1))
{
diff -ru Thunar-1.0.2.orig/thunar/thunar-file.c Thunar-1.0.2/thunar/thunar-file.c
--- Thunar-1.0.2.orig/thunar/thunar-file.c 2010-06-01 15:36:41.000000000 -0400
+++ Thunar-1.0.2/thunar/thunar-file.c 2010-06-02 16:59:05.000000000 -0400
@@ -49,6 +49,7 @@
#include <thunar/thunar-file.h>
#include <thunar/thunar-file-monitor.h>
#include <thunar/thunar-gobject-extensions.h>
+#include <thunar/thunar-preferences.h>
#include <thunar/thunar-private.h>
#include <thunar/thunar-util.h>
@@ -571,7 +572,41 @@
g_object_unref (G_OBJECT (monitor));
}
+/**
+ * thunar_file_get_display_name:
+ * @file : a #ThunarFile instance.
+ *
+ * Returns the @file name in the UTF-8 encoding, which is
+ * suitable for displaying the file name in the GUI.
+ *
+ * Return value: the @file name suitable for display.
+ **/
+const gchar*
+thunar_file_get_display_name (const ThunarFile *file)
+{
+ gchar *absolute_path;
+ gboolean desktop_nolie;
+
+ g_object_get(G_OBJECT (thunar_preferences_get ()), "misc-desktop-nolie", &desktop_nolie, NULL);
+
+ if (desktop_nolie)
+ {
+ absolute_path = thunar_vfs_path_dup_string (THUNAR_FILE(file)->info->path);
+ if (strcmp(g_path_get_basename(g_path_get_dirname(absolute_path)), "Desktop") == 0)
+ {
+ return THUNAR_FILE (file)->info->display_name;
+ }
+ else
+ {
+ return g_filename_display_name(g_path_get_basename(absolute_path));
+ }
+ }
+ else
+ {
+ return THUNAR_FILE (file)->info->display_name;
+ }
+}
/**
* thunar_file_get_for_info:
diff -ru Thunar-1.0.2.orig/thunar/thunar-file.h Thunar-1.0.2/thunar/thunar-file.h
--- Thunar-1.0.2.orig/thunar/thunar-file.h 2010-06-01 15:36:41.000000000 -0400
+++ Thunar-1.0.2/thunar/thunar-file.h 2010-06-02 16:46:54.000000000 -0400
@@ -494,17 +494,6 @@
&& !exo_str_is_equal (thunar_vfs_path_get_name (thunar_file_get_path ((file))), ".directory"))
/**
- * thunar_file_get_display_name:
- * @file : a #ThunarFile instance.
- *
- * Returns the @file name in the UTF-8 encoding, which is
- * suitable for displaying the file name in the GUI.
- *
- * Return value: the @file name suitable for display.
- **/
-#define thunar_file_get_display_name(file) (THUNAR_FILE ((file))->info->display_name)
-
-/**
* thunar_file_read_link:
* @file : a #ThunarFile instance.
* @error : return location for errors or %NULL.
diff -ru Thunar-1.0.2.orig/thunar/thunar-preferences-dialog.c Thunar-1.0.2/thunar/thunar-preferences-dialog.c
--- Thunar-1.0.2.orig/thunar/thunar-preferences-dialog.c 2010-06-01 15:36:41.000000000 -0400
+++ Thunar-1.0.2/thunar/thunar-preferences-dialog.c 2010-06-02 16:14:23.000000000 -0400
@@ -373,7 +373,7 @@
gtk_frame_set_label_widget (GTK_FRAME (frame), label);
gtk_widget_show (label);
- table = gtk_table_new (2, 2, FALSE);
+ table = gtk_table_new (4, 2, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
@@ -418,7 +418,7 @@
gtk_frame_set_label_widget (GTK_FRAME (frame), label);
gtk_widget_show (label);
- table = gtk_table_new (2, 2, FALSE);
+ table = gtk_table_new (4, 2, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
@@ -573,7 +573,7 @@
gtk_frame_set_label_widget (GTK_FRAME (frame), label);
gtk_widget_show (label);
- table = gtk_table_new (2, 2, FALSE);
+ table = gtk_table_new (4, 2, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
@@ -591,6 +591,7 @@
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Ask everytime"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Apply to Folder Only"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Apply to Folder and Contents"));
+
#if !GTK_CHECK_VERSION(2,9,0)
g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (g_object_notify), "active");
#endif
@@ -599,6 +600,18 @@
thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), combo);
gtk_widget_show (combo);
+ button = gtk_check_button_new_with_mnemonic (_("Move items to Trash when on _delete."));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-enable-trash", G_OBJECT (button), "active");
+ thunar_gtk_widget_set_tooltip (button, _( "By default, items are sent to the Trash on delete. By disabling this option, items will be removed on delete and will be lost forever. (DANGEROUS)" ) );
+ gtk_table_attach (GTK_TABLE (table), button, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ button = gtk_check_button_new_with_mnemonic (_("Only _lie about names of desktop files on the Desktop."));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-desktop-nolie", G_OBJECT (button), "active");
+ thunar_gtk_widget_set_tooltip (button, _( "If this is checked, files ending in .desktop will have their true names displayed in regular folders." ) );
+ gtk_table_attach (GTK_TABLE (table), button, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
gtk_widget_show (frame);
@@ -608,7 +621,7 @@
gtk_frame_set_label_widget (GTK_FRAME (frame), label);
gtk_widget_show (label);
- table = gtk_table_new (2, 2, FALSE);
+ table = gtk_table_new (3, 2, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
diff -ru Thunar-1.0.2.orig/thunar/thunar-preferences.c Thunar-1.0.2/thunar/thunar-preferences.c
--- Thunar-1.0.2.orig/thunar/thunar-preferences.c 2010-06-01 15:36:41.000000000 -0400
+++ Thunar-1.0.2/thunar/thunar-preferences.c 2010-06-02 16:15:42.000000000 -0400
@@ -71,6 +71,8 @@
PROP_MISC_VOLUME_MANAGEMENT,
PROP_MISC_CASE_SENSITIVE,
PROP_MISC_DATE_STYLE,
+ PROP_MISC_DESKTOP_NOLIE,
+ PROP_MISC_ENABLE_TRASH,
PROP_MISC_FOLDERS_FIRST,
PROP_MISC_HORIZONTAL_WHEEL_NAVIGATES,
PROP_MISC_RECURSIVE_PERMISSIONS,
@@ -664,6 +666,32 @@
THUNAR_TYPE_ICON_SIZE,
THUNAR_ICON_SIZE_SMALLEST,
EXO_PARAM_READWRITE));
+
+ /**
+ * ThunarPreferences:misc-desktop-nolie:
+ *
+ * If nolie is turned on, .desktop files have their true names displayed in most places
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_MISC_DESKTOP_NOLIE,
+ g_param_spec_boolean ("misc-desktop-nolie",
+ "misc-desktop-nolie",
+ "misc-desktop-nolie",
+ TRUE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * ThunarPreferences:misc-enable-trash:
+ *
+ * If trash is disabled, files will be deleted permanently
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_MISC_ENABLE_TRASH,
+ g_param_spec_boolean ("misc-enable-trash",
+ "misc-enable-trash",
+ "misc-enable-trash",
+ TRUE,
+ EXO_PARAM_READWRITE));
}
diff -ru Thunar-1.0.2.orig/thunar/thunar-shortcuts-model.c Thunar-1.0.2/thunar/thunar-shortcuts-model.c
--- Thunar-1.0.2.orig/thunar/thunar-shortcuts-model.c 2010-06-01 15:36:41.000000000 -0400
+++ Thunar-1.0.2/thunar/thunar-shortcuts-model.c 2010-06-02 16:07:06.000000000 -0400
@@ -34,6 +34,7 @@
#include <locale.h>
#endif
+#include <thunar/thunar-preferences.h>
#include <thunar/thunar-file.h>
#include <thunar/thunar-shortcuts-model.h>
#include <thunar/thunar-private.h>
@@ -63,7 +64,6 @@
} ThunarShortcutType;
-
static void thunar_shortcuts_model_class_init (ThunarShortcutsModelClass *klass);
static void thunar_shortcuts_model_tree_model_init (GtkTreeModelIface *iface);
static void thunar_shortcuts_model_drag_source_init (GtkTreeDragSourceIface *iface);
@@ -278,6 +278,8 @@
guint n;
gchar *desktop_path = NULL;
guint desktop_index;
+ gboolean isTrashEnabled;
+
#ifndef NDEBUG
model->stamp = g_random_int ();
@@ -292,6 +294,8 @@
system_path_list[0] = thunar_vfs_path_get_for_home ();
system_path_list[1] = thunar_vfs_path_get_for_trash ();
+ g_object_get (G_OBJECT (thunar_preferences_get ()), "misc-enable-trash", &isTrashEnabled, NULL);
+
#if GLIB_CHECK_VERSION(2,14,0)
desktop_path = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
#else /* GLIB_CHECK_VERSION(2,14,0) */
@@ -322,6 +326,12 @@
{
thunar_vfs_path_unref (system_path_list[n]);
continue;
+ }
+ /* we exclude the trash */
+ if (n == 1 && !isTrashEnabled)
+ {
+ thunar_vfs_path_unref (system_path_list[n]);
+ continue;
}
#endif
diff -ru Thunar-1.0.2.orig/thunar-vfs/thunar-vfs-io-local.c Thunar-1.0.2/thunar-vfs/thunar-vfs-io-local.c
--- Thunar-1.0.2.orig/thunar-vfs/thunar-vfs-io-local.c 2010-06-01 15:36:40.000000000 -0400
+++ Thunar-1.0.2/thunar-vfs/thunar-vfs-io-local.c 2010-06-02 16:39:55.000000000 -0400
@@ -972,6 +972,7 @@
gchar *dir_name;
gchar *dst_name;
gchar *dst_path;
+ gboolean desktop_lie = TRUE;
_thunar_vfs_return_val_if_fail (*name != '\0' && strchr (name, G_DIR_SEPARATOR) == NULL, FALSE);
_thunar_vfs_return_val_if_fail (_thunar_vfs_path_is_local (info->path), FALSE);
@@ -981,9 +982,18 @@
/* determine the source path */
if (thunar_vfs_path_to_string (info->path, src_path, sizeof (src_path), error) < 0)
return FALSE;
-
+
+ /* if ".desktop" appears in the new name it is very likely that the user has name lying turned off */
+ if (strcmp(g_path_get_basename(g_path_get_dirname(src_path)), "Desktop"))
+ {
+ if (g_strrstr(name, ".desktop"))
+ {
+ desktop_lie = FALSE;
+ }
+ }
+
/* check if we have a .desktop (and NOT a .directory) file here */
- if (G_UNLIKELY (info->mime_info == _thunar_vfs_mime_application_x_desktop && strcmp (thunar_vfs_path_get_name (info->path), ".directory") != 0))
+ if (G_UNLIKELY ((desktop_lie) && (info->mime_info == _thunar_vfs_mime_application_x_desktop) && (strcmp (thunar_vfs_path_get_name (info->path), ".directory") != 0)))
{
/* try to update the name in the .desktop file */
if (!_thunar_vfs_desktop_file_set_value (src_path, "Name", name, error))