[the-board/sound-thing] more sound thing



commit 9f0d45a8ce6a6663f7c091f6b4a6a0adb8348d63
Author: Lucas Rocha <lucasr gnome org>
Date:   Wed Jan 5 16:10:24 2011 +0000

    more sound thing

 data/things/sound/style.css |    8 ++++----
 src/js/ui/things/sound.js   |   16 +++++++++++-----
 2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/data/things/sound/style.css b/data/things/sound/style.css
index 2b6b370..3fe7121 100644
--- a/data/things/sound/style.css
+++ b/data/things/sound/style.css
@@ -6,7 +6,7 @@ TbBox#sound-thing-sound-box {
 
 TbBox#sound-thing-content-box {
     spacing: 5px;
-    padding: 2px 2px 5px 2px;
+    padding: 21px 2px 12px 2px;
 }
 
 TbBox#sound-thing-button-box {
@@ -17,12 +17,12 @@ TbBox#sound-thing-button-box {
 
 TbBox#sound-thing-controls-box {
     background-color: none;
-    padding: 15px;
+    padding: 10px;
 }
 
 TbBox#sound-thing-sound-controls-box {
     border-image: url('sound-controls-bg.png') 8;
-    padding: 6px 12px 6px 12px;
+    padding: 2px 12px 2px 12px;
     spacing: 10px; 
 }
 
@@ -44,7 +44,7 @@ TbBox#sound-thing-sound-border-box {
 }
 
 MxLabel#sound-thing-caption-label {
-    color: white;
+    color: black;
     font-size: 13;
     font-family: "Action Man";
 }
diff --git a/src/js/ui/things/sound.js b/src/js/ui/things/sound.js
index 50e2fac..7e161ba 100644
--- a/src/js/ui/things/sound.js
+++ b/src/js/ui/things/sound.js
@@ -46,8 +46,8 @@ SoundThing.prototype = {
         this._style = new Mx.Style();
         this._style.load_from_file(STYLE);
 
-        this._createSoundBox();
         this._createSoundPlayer();
+        this._createSoundBox();
         this._createCaptionText();
 
         Thing.Thing.prototype._init.apply(this, [args]);
@@ -69,6 +69,10 @@ SoundThing.prototype = {
     _createSoundPlayer : function() {
         this._player = new Tb.SoundPlayer();
 
+        this._player.connect("notify::progress",
+                             Lang.bind(this,
+                                       this._onPlayerProgressChanged));
+
         this._player.connect("notify::state",
                              Lang.bind(this,
                                        this._onPlayerStateChanged));
@@ -200,6 +204,7 @@ SoundThing.prototype = {
 
         this._captionLabel.set_style(this._style);
 
+        this._captionLabel.clutterText.maxLength = 25;
         this._captionLabel.clutterText.lineAlignment = Pango.Alignment.CENTER;
 
         this._captionLabel.connect("key-press-event",
@@ -303,7 +308,7 @@ SoundThing.prototype = {
     },
 
     _updateProgressBar : function() {
-        //this._progressBar.progress = this._sound.get_progress();
+        this._progressBar.progress = this._player.progress;
     },
 
     _formatTimeComponent : function(n) {
@@ -313,9 +318,8 @@ SoundThing.prototype = {
     },
 
     _updateTimeLabel : function() {
-        return;
         let currentTime =
-            Math.floor(this._player.duration * this._player.get_progress());
+            Math.floor(this._player.duration * this._player.progress);
 
         let hours = Math.floor(currentTime / 3600);
         currentTime -= hours * 3600;
@@ -360,7 +364,7 @@ SoundThing.prototype = {
             this._progressBar.get_transformed_position();
 
         let progress = (eventX - transformedX) / this._progressBar.width;
-        this._player.set_progress(progress);
+        this._player.progress = progress;
     },
 
     _onPlayerProgressChanged : function() {
@@ -384,6 +388,8 @@ SoundThing.prototype = {
         default:
             // do nothing
         }
+
+        this._playButton.toggled = this._player.playing;
     },
 
     enter : function() {



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