As I mentioned earlier, I wrote a patch which allows the user remove files 
directly, instead of
sending the to the Trash


On the other hand, I just realized my patch does not conform to the standards 
expected on
Thunar/trunk/HACKING. 

This new patch
a) also adds a Changelog entry
b) was created with diff -ur , instead of just diff


as a colateral effect, it will might give a warning/error on older Thunar 
(0.5rc2) versions
because of the changelog will not be the same  entry. 


Benny, sorry for not doing the right way on first place. It won't happen again.


Marcos Diez
---------------------------------------------
Hello Everybody.

Like many here, I do believe not like the Trash can and would be happyer if I 
could just push
'del' to have my files removed from my system.


Since Thunar is really modular and well designed, I was able to do write a 
patch for it in only a
few hours.

my patch

a) adds a new option in the advanced tab called "Move items to trash on 
delete", which is on by
default
b) when the user tries to delete a file, if the box is checked, it deletes the 
file
autodmatically, still showing the confirmation dialog, but without sending it 
to the Trash

I hope you enjoy it!
ps: it was tested on Thunar-0.5.1svn-r24061
Marcos Diez


                
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
diff -ru Thunar-0.5.1svn-r24061/ChangeLog Thunar-patched/ChangeLog
--- Thunar-0.5.1svn-r24061/ChangeLog	2006-11-26 18:54:56.000000000 +0000
+++ Thunar-patched/ChangeLog	2006-12-09 11:50:38.000000000 +0000
@@ -1,3 +1,10 @@
+2006-12-09      Marcos Diez     <marcos*AT*unitron.com.br>
+	* thunar/thunar-preferences.c, thunar/thunar-preferences-dialog.c,
+	  thunar-application.c(thunar_application_unlink_files):
+	  Add a new option which allows the user to choose if deleted files
+	  should be send to the Trash or removed. Default is to use the Trash.
+	
+		
 2006-11-26	Benedikt Meurer <[EMAIL PROTECTED]>
 
 	* thunar/thunar-window.c(thunar_window_init): Add shortcuts <control>1,
diff -ru Thunar-0.5.1svn-r24061/thunar/thunar-application.c Thunar-patched/thunar/thunar-application.c
--- Thunar-0.5.1svn-r24061/thunar/thunar-application.c	2006-10-17 17:48:58.000000000 +0000
+++ Thunar-patched/thunar/thunar-application.c	2006-12-08 23:33:19.000000000 +0000
@@ -1060,6 +1060,7 @@
   GtkWindow      *window;
   GdkScreen      *screen;
   gboolean        permanently;
+  gboolean        trashEnable;
   GList          *path_list = NULL;
   GList          *lp;
   gchar          *message;
@@ -1069,9 +1070,24 @@
   _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);
 
+  /* in order to delete a file, we have to check if the trash can is anable and if shift is pressed */
+
+  
+  /* first we save somewhere if trash can is enable */
+  g_object_get (G_OBJECT (application->preferences), "misc_enable_trash", &trashEnable, NULL);
+
+  /* now we check it */
+  if( trashEnable ){
+    /* it's enable
+     */
+    /* check if we should permanently delete the files (user holds shift) */
+    permanently = (gtk_get_current_event_state (&state) && (state & GDK_SHIFT_MASK) != 0);
+  }else{
+    /* trash can is disable. let's purge files ! */
+    permanently= TRUE;
+  }
+  
   /* determine the paths for the files */
   for (lp = g_list_last (file_list); lp != NULL; lp = lp->prev, ++n_path_list)
     {
diff -ru Thunar-0.5.1svn-r24061/thunar/thunar-preferences.c Thunar-patched/thunar/thunar-preferences.c
--- Thunar-0.5.1svn-r24061/thunar/thunar-preferences.c	2006-10-17 17:48:57.000000000 +0000
+++ Thunar-patched/thunar/thunar-preferences.c	2006-12-08 23:41:47.000000000 +0000
@@ -78,6 +78,7 @@
   PROP_MISC_SINGLE_CLICK,
   PROP_MISC_SINGLE_CLICK_TIMEOUT,
   PROP_MISC_TEXT_BESIDE_ICONS,
+  PROP_MISC_ENABLE_TRASH,
   PROP_SHORTCUTS_ICON_EMBLEMS,
   PROP_SHORTCUTS_ICON_SIZE,
   PROP_TREE_ICON_EMBLEMS,
@@ -591,6 +592,24 @@
                                                          TRUE,
                                                          EXO_PARAM_READWRITE));
 
+  /************************************************* */
+  /**
+   * ThunarPreferences:misc_enable_trash:
+   *
+   * Whether the Trash will be used. If enable, files will be sent to the trashcan.
+   * If disable, files will be erased.
+   **/
+  
+  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));
+  
+    /************************************************* */
+     
   /**
    * ThunarPreferences:shortcuts-icon-size:
    *
diff -ru Thunar-0.5.1svn-r24061/thunar/thunar-preferences-dialog.c Thunar-patched/thunar/thunar-preferences-dialog.c
--- Thunar-0.5.1svn-r24061/thunar/thunar-preferences-dialog.c	2006-11-06 10:22:16.000000000 +0000
+++ Thunar-patched/thunar/thunar-preferences-dialog.c	2006-12-08 23:38:51.000000000 +0000
@@ -530,7 +530,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);
@@ -548,6 +548,15 @@
   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. (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
_______________________________________________
Thunar-dev mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/thunar-dev

Reply via email to