[Xfce4-commits] <thunar:master> Move some code around in size label.

Nick Schermer noreply at xfce.org
Sun Sep 16 20:16:12 CEST 2012


Updating branch refs/heads/master
         to 3867630a728710beda20142b2072c32d61280adf (commit)
       from f60c5c3443d87220b3be28157683e39d7ae32564 (commit)

commit 3867630a728710beda20142b2072c32d61280adf
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Sep 13 22:01:49 2012 +0200

    Move some code around in size label.

 thunar/thunar-size-label.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/thunar/thunar-size-label.c b/thunar/thunar-size-label.c
index 06f06ed..68d95b3 100644
--- a/thunar/thunar-size-label.c
+++ b/thunar/thunar-size-label.c
@@ -167,6 +167,14 @@ thunar_size_label_finalize (GObject *object)
 {
   ThunarSizeLabel *size_label = THUNAR_SIZE_LABEL (object);
 
+  /* cancel the pending job (if any) */
+  if (G_UNLIKELY (size_label->job != NULL))
+    {
+      g_signal_handlers_disconnect_matched (G_OBJECT (size_label->job), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, size_label);
+      exo_job_cancel (EXO_JOB (size_label->job));
+      g_object_unref (size_label->job);
+    }
+
   /* reset the file property */
   thunar_size_label_set_files (size_label, NULL);
 
@@ -300,6 +308,9 @@ thunar_size_label_files_changed (ThunarSizeLabel *size_label)
       g_signal_connect (size_label->job, "finished", G_CALLBACK (thunar_size_label_finished), size_label);
       g_signal_connect (size_label->job, "status-update", G_CALLBACK (thunar_size_label_status_update), size_label);
 
+      /* tell the user that we started calculation */
+      gtk_label_set_text (GTK_LABEL (size_label->label), _("Calculating..."));
+
       /* launch the job */
       exo_job_launch (EXO_JOB (size_label->job));
     }
@@ -476,15 +487,6 @@ thunar_size_label_set_files (ThunarSizeLabel *size_label,
   _thunar_return_if_fail (THUNAR_IS_SIZE_LABEL (size_label));
   _thunar_return_if_fail (files == NULL || THUNAR_IS_FILE (files->data));
 
-  /* stop a running job */
-  if (G_UNLIKELY (size_label->job != NULL))
-    {
-      g_signal_handlers_disconnect_matched (size_label->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, size_label);
-      exo_job_cancel (EXO_JOB (size_label->job));
-      g_object_unref (size_label->job);
-      size_label->job = NULL;
-    }
-
   /* disconnect from the previous files */
   for (lp = size_label->files; lp != NULL; lp = lp->next)
     {


More information about the Xfce4-commits mailing list