Author: benny
Date: 2006-07-30 23:14:26 +0000 (Sun, 30 Jul 2006)
New Revision: 22584

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/thunar-vfs/thunar-vfs-transfer-job.c
   thunar/trunk/thunar/thunar-dialogs.c
Log:
2006-07-31      Benedikt Meurer <[EMAIL PROTECTED]>

        * thunar-vfs/thunar-vfs-transfer-job.c, thunar/thunar-dialogs.c:
          Add "No to all" response to the transfer progress dialog, which
          allows to skip all further overwrite dialogs. Bug #1666.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog      2006-07-30 22:49:35 UTC (rev 22583)
+++ thunar/trunk/ChangeLog      2006-07-30 23:14:26 UTC (rev 22584)
@@ -1,5 +1,11 @@
 2006-07-31     Benedikt Meurer <[EMAIL PROTECTED]>
 
+       * thunar-vfs/thunar-vfs-transfer-job.c, thunar/thunar-dialogs.c:
+         Add "No to all" response to the transfer progress dialog, which
+         allows to skip all further overwrite dialogs. Bug #1666.
+
+2006-07-31     Benedikt Meurer <[EMAIL PROTECTED]>
+
        * thunar/thunar-dbus-service-infos.xml, thunar/thunar-dbus-service.c:
          Add DisplayChooserDialog() to the org.xfce.FileManager interface,
          which pops up the "Open With" dialog, optionally allowing the user

Modified: thunar/trunk/thunar/thunar-dialogs.c
===================================================================
--- thunar/trunk/thunar/thunar-dialogs.c        2006-07-30 22:49:35 UTC (rev 
22583)
+++ thunar/trunk/thunar/thunar-dialogs.c        2006-07-30 23:14:26 UTC (rev 
22584)
@@ -258,7 +258,7 @@
   GString     *secondary = g_string_sized_new (256);
   GString     *primary = g_string_sized_new (256);
   gint         response;
-  gint         n;
+  gint         n, m;
 
   g_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), 
THUNAR_VFS_JOB_RESPONSE_CANCEL);
   g_return_val_if_fail (g_utf8_validate (question, -1, NULL), 
THUNAR_VFS_JOB_RESPONSE_CANCEL);
@@ -309,9 +309,13 @@
     gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), 
"%s", secondary->str);
 
   /* add the buttons based on the possible choices */
-  for (n = 3; n >= 0; --n)
+  for (n = 4; n >= 0; --n)
     {
-      response = choices & (1 << n);
+      /* "Cancel" should be the last button, but "No to all" was added last */
+      m = (n == 4) ? 3 : (n == 3) ? 4 : n;
+
+      /* check if the response is set */
+      response = choices & (1 << m);
       if (response == 0)
         continue;
 
@@ -329,6 +333,10 @@
           mnemonic = _("_No");
           break;
 
+        case THUNAR_VFS_JOB_RESPONSE_NO_ALL:
+          mnemonic = _("N_o to all");
+          break;
+
         case THUNAR_VFS_JOB_RESPONSE_CANCEL:
           response = GTK_RESPONSE_CANCEL;
           mnemonic = _("_Cancel");

Modified: thunar/trunk/thunar-vfs/thunar-vfs-transfer-job.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-transfer-job.c   2006-07-30 22:49:35 UTC 
(rev 22583)
+++ thunar/trunk/thunar-vfs/thunar-vfs-transfer-job.c   2006-07-30 23:14:26 UTC 
(rev 22584)
@@ -298,6 +298,14 @@
           /* try to remove the target file if we should overwrite */
           if (response == THUNAR_VFS_JOB_RESPONSE_YES && 
!_thunar_vfs_io_ops_remove (target_path, THUNAR_VFS_IO_OPS_IGNORE_ENOENT, &err))
             break;
+
+          /* check if we should skip this file */
+          if (response == THUNAR_VFS_JOB_RESPONSE_NO)
+            {
+              /* tell the caller that we skipped this one */
+              *target_path_return = NULL;
+              return TRUE;
+            }
         }
     }
 
@@ -356,30 +364,34 @@
       /* copy the item specified by this node (not recursive!) */
       if (thunar_vfs_transfer_job_copy_file (transfer_job, 
transfer_node->source_path, target_path, &target_path_return, &err))
         {
-          /* check if we have children to copy */
-          if (transfer_node->children != NULL)
+          /* target_path_return == NULL: skip this file */
+          if (G_LIKELY (target_path_return != NULL))
             {
-              /* copy all children for this node */
-              thunar_vfs_transfer_job_node_copy (transfer_job, 
transfer_node->children, NULL, target_path_return, NULL);
+              /* check if we have children to copy */
+              if (transfer_node->children != NULL)
+                {
+                  /* copy all children for this node */
+                  thunar_vfs_transfer_job_node_copy (transfer_job, 
transfer_node->children, NULL, target_path_return, NULL);
 
-              /* free the resources allocated to the children */
-              thunar_vfs_transfer_node_free (transfer_node->children);
-              transfer_node->children = NULL;
-            }
+                  /* free the resources allocated to the children */
+                  thunar_vfs_transfer_node_free (transfer_node->children);
+                  transfer_node->children = NULL;
+                }
 
-          /* add the real target path to the return list */
-          if (G_LIKELY (target_path_list_return != NULL))
-            *target_path_list_return = g_list_prepend 
(*target_path_list_return, target_path_return);
-          else
-            thunar_vfs_path_unref (target_path_return);
-        }
+              /* add the real target path to the return list */
+              if (G_LIKELY (target_path_list_return != NULL))
+                *target_path_list_return = g_list_prepend 
(*target_path_list_return, target_path_return);
+              else
+                thunar_vfs_path_unref (target_path_return);
 
-      /* try to remove the source directory if we should move and didn't fail 
so far */
-      if (err == NULL && transfer_job->move && !_thunar_vfs_io_ops_remove 
(transfer_node->source_path, THUNAR_VFS_IO_OPS_IGNORE_ENOENT, &err))
-        {
-          /* we can ignore ENOTEMPTY (which is mapped to G_FILE_ERROR_FAILED) 
*/
-          if (err->domain == G_FILE_ERROR && err->code == G_FILE_ERROR_FAILED)
-            g_clear_error (&err);
+              /* try to remove the source directory if we should move instead 
of just copy */
+              if (transfer_job->move && !_thunar_vfs_io_ops_remove 
(transfer_node->source_path, THUNAR_VFS_IO_OPS_IGNORE_ENOENT, &err))
+                {
+                  /* we can ignore ENOTEMPTY (which is mapped to 
G_FILE_ERROR_FAILED) */
+                  if (err->domain == G_FILE_ERROR && err->code == 
G_FILE_ERROR_FAILED)
+                    g_clear_error (&err);
+                }
+            }
         }
 
       /* check if we failed (ENOSPC cannot be skipped) */

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to