[Xfce4-commits] [xfce/thunar] 01/03: Job is now optional for thunar_io_scan_directory

noreply at xfce.org noreply at xfce.org
Tue Apr 16 04:00:08 CEST 2019


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/thunar.

commit 03b8362dd9946fa4593497672ef4f341330170ed
Author: Andre Miranda <andreldm at xfce.org>
Date:   Sun Apr 14 15:06:35 2019 -0300

    Job is now optional for thunar_io_scan_directory
---
 thunar/thunar-io-scan-directory.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/thunar/thunar-io-scan-directory.c b/thunar/thunar-io-scan-directory.c
index 8f81724..33aa7af 100644
--- a/thunar/thunar-io-scan-directory.c
+++ b/thunar/thunar-io-scan-directory.c
@@ -52,13 +52,13 @@ thunar_io_scan_directory (ThunarJob          *job,
   const gchar     *namespace;
   ThunarFile      *thunar_file;
   gboolean         is_mounted;
+  GCancellable    *cancellable = NULL;
 
-  _thunar_return_val_if_fail (THUNAR_IS_JOB (job), NULL);
   _thunar_return_val_if_fail (G_IS_FILE (file), NULL);
   _thunar_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
   /* abort if the job was cancelled */
-  if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
+  if (job != NULL && exo_job_set_error_if_cancelled (EXO_JOB (job), error))
     return NULL;
 
   /* don't recurse when we are scanning prior to unlinking and the current
@@ -73,11 +73,14 @@ thunar_io_scan_directory (ThunarJob          *job,
       return NULL;
     }
 
+  if (job != NULL)
+    cancellable = exo_job_get_cancellable (EXO_JOB (job));
+
   /* query the file type */
-  type = g_file_query_file_type (file, flags, exo_job_get_cancellable (EXO_JOB (job)));
+  type = g_file_query_file_type (file, flags, cancellable);
 
   /* abort if the job was cancelled */
-  if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
+  if (job != NULL && exo_job_set_error_if_cancelled (EXO_JOB (job), error))
     return NULL;
 
   /* ignore non-directory nodes */
@@ -93,8 +96,7 @@ thunar_io_scan_directory (ThunarJob          *job,
 
   /* try to read from the direectory */
   enumerator = g_file_enumerate_children (file, namespace,
-                                          flags, exo_job_get_cancellable (EXO_JOB (job)),
-                                          &err);
+                                          flags, cancellable, &err);
 
   /* abort if there was an error or the job was cancelled */
   if (err != NULL)
@@ -104,12 +106,10 @@ thunar_io_scan_directory (ThunarJob          *job,
     }
 
   /* iterate over children one by one */
-  while (!exo_job_is_cancelled (EXO_JOB (job)))
+  while (job == NULL || !exo_job_is_cancelled (EXO_JOB (job)))
     {
       /* query info of the child */
-      info = g_file_enumerator_next_file (enumerator,
-                                          exo_job_get_cancellable (EXO_JOB (job)),
-                                          &err);
+      info = g_file_enumerator_next_file (enumerator, cancellable, &err);
 
       if (G_UNLIKELY (info == NULL))
         break;
@@ -171,7 +171,7 @@ thunar_io_scan_directory (ThunarJob          *job,
       thunar_g_file_list_free (files);
       return NULL;
     }
-  else if (exo_job_set_error_if_cancelled (EXO_JOB (job), &err))
+  else if (job != NULL && exo_job_set_error_if_cancelled (EXO_JOB (job), &err))
     {
       g_propagate_error (error, err);
       thunar_g_file_list_free (files);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list