Hello Everybody.

Like many here, I do 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 automatically,
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 thunar/thunar-application.c thunar-marcos/thunar-application.c
1062a1063
>   gboolean        trashEnable;
1072,1073d1072
<   /* check if we should permanently delete the files (user holds shift) */
<   permanently = (gtk_get_current_event_state (&state) && (state & GDK_SHIFT_MASK) != 0);
1074a1074,1090
>   /* 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;
>   }
>   
diff thunar/thunar-preferences.c thunar-marcos/thunar-preferences.c
80a81
>   PROP_MISC_ENABLE_TRASH,
593a595,612
>   /************************************************* */
>   /**
>    * 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));
>   
>     /************************************************* */
>      
diff thunar/thunar-preferences-dialog.c thunar-marcos/thunar-preferences-dialog.c
533c533
<   table = gtk_table_new (2, 2, FALSE);
---
>   table = gtk_table_new (3, 2, FALSE);
550a551,559
> 
> 
>   button = gtk_check_button_new_with_mnemonic (_("Move items to Trash 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);
> 
>   
_______________________________________________
Thunar-dev mailing list
Thunar-dev@xfce.org
http://foo-projects.org/mailman/listinfo/thunar-dev

Reply via email to