[cheese/shareable-media] Take care of the cursor if multiple children



commit 4c8dd3e61b877612298aeb01322a78fb73a96833
Author: Patricia Santana Cruz <patriciasantanacruz gmail com>
Date:   Thu Dec 29 11:34:32 2011 +0000

    Take care of the cursor if multiple children
    
    Leave the cursor busy while there is still a child available and just
    set it back to normal when the last child terminates.

 src/cheese-shareable-media.vala |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/cheese-shareable-media.vala b/src/cheese-shareable-media.vala
index dc16dba..f7b6594 100644
--- a/src/cheese-shareable-media.vala
+++ b/src/cheese-shareable-media.vala
@@ -4,6 +4,7 @@
 namespace ShareableMedia {
   private const string SENDTO_EXEC = "nautilus-sendto";
   private Cheese.MainWindow window;
+  private int num_children = 0;
 
   void child_finished (Pid pid, int status)
   {
@@ -13,7 +14,10 @@ namespace ShareableMedia {
       warning ("A problem occured while loading the file(s)");
 
     Process.close_pid(pid);
-    window.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
+
+    --num_children;
+    if (num_children == 0)
+      window.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
   }
 
   public void files_share (Cheese.MainWindow mainWindow, GLib.List<GLib.File> files)
@@ -34,12 +38,17 @@ namespace ShareableMedia {
                               out child_pid))
       {
         ChildWatch.add (child_pid, child_finished);
-        window.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.WATCH));
+
+        ++num_children;
+        // Keep busy the cursor if there are children. It just needs to be
+        // done for the first child.
+        if (num_children == 1)
+          window.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.WATCH));
       }
 
     } catch (Error error) {
       window.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
-      stdout.printf ("Unable to launch nautilus-sendto: %s\n", error.message);
+      warning ("Unable to launch nautilus-sendto: %s\n", error.message);
     }
   }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]