[banshee] [TrackEditor] Blank spin buttons when 0 (bgo#407406)



commit d649bad5a4effaa5bd6ea7b215ffc431dee9e1d7
Author: Samuel Gyger <samuel gyger at>
Date:   Wed Nov 17 23:29:20 2010 +0200

    [TrackEditor] Blank spin buttons when 0 (bgo#407406)
    
    Signed-off-by: Gabriel Burt <gabriel burt gmail com>

 .../Banshee.Gui.TrackEditor/RangeEntry.cs          |   13 +++++++++++++
 src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs |   13 +++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/RangeEntry.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/RangeEntry.cs
index e2aed7a..7860b24 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/RangeEntry.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/RangeEntry.cs
@@ -74,6 +74,8 @@ namespace Banshee.Gui.TrackEditor
 
             from_entry.ValueChanged += OnChanged;
             to_entry.ValueChanged += OnChanged;
+            from_entry.Output += OnOutput;
+            to_entry.Output += OnOutput;
         }
 
         public void SetAsReadOnly ()
@@ -86,6 +88,17 @@ namespace Banshee.Gui.TrackEditor
             return from_entry.MnemonicActivate(group_cycling);
         }
 
+        protected void OnOutput (object o, OutputArgs args) {
+            SpinButtonEntry entry = (SpinButtonEntry) o;
+
+            if (0 == entry.ValueAsInt) {
+                entry.Text = "";
+            } else {
+                entry.Text = entry.ValueAsInt.ToString();
+            }
+            args.RetVal = true;
+        }
+
         private class AutoOrderButton : Button
         {
             public AutoOrderButton ()
diff --git a/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs b/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs
index 2d7797e..20fa88f 100644
--- a/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs
+++ b/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs
@@ -85,6 +85,7 @@ namespace Banshee.Bpm
             bpm_entry.Digits = 0;
             bpm_entry.Numeric = true;
             bpm_entry.ValueChanged += OnChanged;
+            bpm_entry.Output += OnOutput;
             Add (bpm_entry);
 
             if (detector != null) {
@@ -185,5 +186,17 @@ namespace Banshee.Bpm
                 (actions["StopWhenFinishedAction"] as Gtk.ToggleAction).Active = true;
             }
         }
+
+        private void OnOutput (object o, OutputArgs args)
+        {
+            SpinButton entry = (SpinButton) o;
+
+            if (0 == entry.ValueAsInt) {
+                entry.Text = "";
+            } else {
+                entry.Text = entry.ValueAsInt.ToString();
+            }
+            args.RetVal = true;
+        }
     }
 }



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