Enlightenment CVS committal

Author  : tsauerbeck
Project : e17
Module  : apps/euphoria

Dir     : e17/apps/euphoria/lib


Modified Files:
        playlist.rb playlist_item.rb 


Log Message:
when items are removed from the playlist, the position of the items after the 
one that was removed need to be adjusted
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/lib/playlist.rb,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- playlist.rb 22 May 2005 17:52:17 -0000      1.20
+++ playlist.rb 22 May 2005 20:48:33 -0000      1.21
@@ -1,4 +1,4 @@
-# $Id: playlist.rb,v 1.20 2005/05/22 17:52:17 tsauerbeck Exp $
+# $Id: playlist.rb,v 1.21 2005/05/22 20:48:33 tsauerbeck Exp $
 
 require "euphoria/playlist_item"
 
@@ -133,6 +133,11 @@
 
                item.hide if item.visible?
                super
+
+               # fix up positions of the remaining items
+               self[item.position..-1].each do |item|
+                       item.position -= 1
+               end
        end
 
        def clear
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/lib/playlist_item.rb,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- playlist_item.rb    22 May 2005 17:51:18 -0000      1.10
+++ playlist_item.rb    22 May 2005 20:48:33 -0000      1.11
@@ -1,7 +1,7 @@
-# $Id: playlist_item.rb,v 1.10 2005/05/22 17:51:18 tsauerbeck Exp $
+# $Id: playlist_item.rb,v 1.11 2005/05/22 20:48:33 tsauerbeck Exp $
 
 class PlaylistItem
-       attr_reader :id, :edje
+       attr_reader :id, :edje, :position
 
        def initialize(id, xmms, playlist)
                @id = id
@@ -87,6 +87,11 @@
                set_parts_text unless @edje.nil?
        end
 
+       def position=(pos)
+               @position = pos
+               set_parts_text unless @edje.nil?
+       end
+
        private
        def set_parts_text
                @edje.part("duration").text =




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to