[Thunar-workers] [Thunar File Manager] page added: playground:ability_to_disable_trash.patch

thunar-workers at xfce.org thunar-workers at xfce.org
Sat Dec 30 14:09:16 CET 2006


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2006/12/30 13:09
Browser     : Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7
IP-Address  : 89.245.85.149
Hostname    : i59F55595.versanet.de
Old Revision: none
New Revision: http://thunar.xfce.org/pwiki/playground/ability_to_disable_trash.patch
Edit Summary: created
User        : bugshideout_yahoo.com

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 <benny at xfce.org>

        * thunar/thunar-window.c(thunar_window_init): Add shortcuts <control>1,
diff -ru Thunar-0.5.1svn-r24061/thunar/thunar-application.c Thunar-patched/thuna r/thunar-application.c
--- Thunar-0.5.1svn-r24061/thunar/thunar-application.c  2006-10-17 17:48:58.0000 00000 +0000
+++ Thunar-patched/thunar/thunar-application.c  2006-12-08 23:33:19.000000000 +0 000
@@ -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_WI DGET (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_MAS K) != 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", &tras hEnable, 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_M ASK) != 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/thuna r/thunar-preferences.c
--- Thunar-0.5.1svn-r24061/thunar/thunar-preferences.c  2006-10-17 17:48:57.0000 00000 +0000
+++ Thunar-patched/thunar/thunar-preferences.c  2006-12-08 23:41:47.000000000 +0 000
@@ -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 trash can.
+   * 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-patche d/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.0000 00000 +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 Cont ents"));
+
+
+  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. (DAN GEROUS)" ) );
+  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



-- 
This mail was generated by DokuWiki at
http://thunar.xfce.org/pwiki/




More information about the Thunar-workers mailing list