From 1f511be08328646ab61663c9daa56f044ce12350 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Sat, 29 Dec 2012 19:56:55 +0200 Subject: [PATCH] thunar: add a patch for configurable trash patch found by urjaman in ArchLinux AUR thunar-notrash package history, edited to default to off. --- .../Ability_to_disable_trash_on_Thunar.patch | 170 ++++++++++++++++++ recipes/xfce-base/thunar_1.0.2.bb | 5 +- 2 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 recipes/xfce-base/thunar/Ability_to_disable_trash_on_Thunar.patch diff --git a/recipes/xfce-base/thunar/Ability_to_disable_trash_on_Thunar.patch b/recipes/xfce-base/thunar/Ability_to_disable_trash_on_Thunar.patch new file mode 100644 index 0000000000..5fc8b55316 --- /dev/null +++ b/recipes/xfce-base/thunar/Ability_to_disable_trash_on_Thunar.patch @@ -0,0 +1,170 @@ +diff -ur 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 2009-01-12 21:38:48.000000000 +0100 ++++ Thunar-1.0.2/thunar/thunar-application.c 2009-06-21 02:07:38.000000000 +0200 +@@ -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 -ur 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 2009-01-12 21:38:48.000000000 +0100 ++++ Thunar-1.0.2/thunar/thunar-preferences-dialog.c 2009-06-21 02:19:11.000000000 +0200 +@@ -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 (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); +@@ -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 (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); +@@ -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 (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); +@@ -591,6 +591,13 @@ + 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")); ++ ++ 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); ++ + #if !GTK_CHECK_VERSION(2,9,0) + g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (g_object_notify), "active"); + #endif +@@ -608,7 +615,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 -ur 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 2009-01-12 21:38:48.000000000 +0100 ++++ Thunar-1.0.2/thunar/thunar-preferences.c 2009-06-21 02:07:38.000000000 +0200 +@@ -71,6 +71,7 @@ + PROP_MISC_VOLUME_MANAGEMENT, + PROP_MISC_CASE_SENSITIVE, + PROP_MISC_DATE_STYLE, ++ PROP_MISC_ENABLE_TRASH, + PROP_MISC_FOLDERS_FIRST, + PROP_MISC_HORIZONTAL_WHEEL_NAVIGATES, + PROP_MISC_RECURSIVE_PERMISSIONS, +@@ -664,6 +665,19 @@ + THUNAR_TYPE_ICON_SIZE, + THUNAR_ICON_SIZE_SMALLEST, + 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", ++ FALSE, ++ EXO_PARAM_READWRITE)); + } + + +diff -ur 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 2009-01-12 21:38:48.000000000 +0100 ++++ Thunar-1.0.2/thunar/thunar-shortcuts-model.c 2009-06-21 12:25:04.000000000 +0200 +@@ -34,6 +34,7 @@ + #include + #endif + ++#include + #include + #include + #include +@@ -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) */ +@@ -323,6 +327,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 + + /* determine the file for the path */ diff --git a/recipes/xfce-base/thunar_1.0.2.bb b/recipes/xfce-base/thunar_1.0.2.bb index d35c44d668..b5e399a9db 100644 --- a/recipes/xfce-base/thunar_1.0.2.bb +++ b/recipes/xfce-base/thunar_1.0.2.bb @@ -10,7 +10,10 @@ inherit xfce46 XFCE_VERSION = "4.6.2" -SRC_URI = "http://www.us.xfce.org/archive/xfce-${XFCE_VERSION}/src/Thunar-${PV}.tar.bz2" +SRC_URI = " \ + http://www.us.xfce.org/archive/xfce-${XFCE_VERSION}/src/Thunar-${PV}.tar.bz2 \ + file://Ability_to_disable_trash_on_Thunar.patch;patch=1 \ +" S = "${WORKDIR}/Thunar-${PV}/" -- 2.39.5