[longomatch] Pulse automatically when running the busy dialog sync



commit 1619c39e695dc3ce811558fa32e8bdc2f88bc409
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Jan 4 13:47:50 2015 +0100

    Pulse automatically when running the busy dialog sync

 LongoMatch.GUI.Helpers/Misc.cs          |    1 -
 LongoMatch.GUI/Gui/Dialog/BusyDialog.cs |   16 ++++++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.GUI.Helpers/Misc.cs b/LongoMatch.GUI.Helpers/Misc.cs
index 0cccb6d..bbd9ebd 100644
--- a/LongoMatch.GUI.Helpers/Misc.cs
+++ b/LongoMatch.GUI.Helpers/Misc.cs
@@ -311,7 +311,6 @@ namespace LongoMatch.Gui.Helpers
                                                busy.Destroy ();
                                        });
                                });
-                               busy.Pulse ();
                                task.Start ();
                                busy.ShowSync ();
                                
diff --git a/LongoMatch.GUI/Gui/Dialog/BusyDialog.cs b/LongoMatch.GUI/Gui/Dialog/BusyDialog.cs
index 9dea60e..1fa17a4 100644
--- a/LongoMatch.GUI/Gui/Dialog/BusyDialog.cs
+++ b/LongoMatch.GUI/Gui/Dialog/BusyDialog.cs
@@ -26,6 +26,7 @@ namespace LongoMatch.Gui.Dialog
                VBox box;
                Label titleLabel;
                ProgressBar progressBar;
+               uint timeout;
 
                public BusyDialog ()
                {
@@ -46,6 +47,15 @@ namespace LongoMatch.Gui.Dialog
                        SkipTaskbarHint = true;
                        DefaultWidth = 300;
                        DefaultHeight = 100;
+                       timeout = 0;
+               }
+
+               protected override void OnDestroyed ()
+               {
+                       if (timeout != 0) {
+                               GLib.Source.Remove (timeout);
+                       }
+                       base.OnDestroyed ();
                }
 
                public string Message {
@@ -61,8 +71,14 @@ namespace LongoMatch.Gui.Dialog
 
                public void ShowSync ()
                {
+                       GLib.Timeout.Add (200, OnTimeout);
                        Run ();
                }
+       
+               bool OnTimeout () {
+                       Pulse ();
+                       return true;
+               }
        }
 }
 


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