[Muine] Song button patch



Hi,

Peter told me to send this here for him to look at. Basically it adds
a buttonbar that plugins can add buttons to, that could do
anything...But the purpose of it is for actions that affect the
currently playing song.

http://blogs.gnome.org/view/iain/2006/04/18/0 shows the patch in
action. In it there's a button on the left that comes from a lyrics
plugin, and the right one comes from a modified Muinescrobbler that
doesn't actually do anything yet.

Basically, all the patch does is adds an empty GtkHBox to the display
beside the time display (so its just in dead space) and adds a method
to IPlayer to get the box, and then the PlaylistWindow object
implements the method. It's about 10 lines of code.

What the plugin has to do to support it is to create a button, use the
SongButtonBox accessor in IPlayer and add the button to it...not
tricky at all.

Open issue:

* To avoid this being abused we need to define what goes in there, so
that random plugins dont start adding "About plugin" "Configure
plugin" buttons to it.

Basically the options are, does the button act on the currently
playing song, or the currently selected song(s)? I would go for
currently playing because the use case I can see (for the lyrics
plugin at least) goes like this

Song A plays
User opens lyrics window
Song A's lyrics appear
User sings along with song A
Song B starts
Song B's lyrics appear
User sings...

The point being that the lyrics would change as the song changes and
the user doesn't need to refresh. This behaviour could be annoying if
a metadata editor was popped up and the song changed, but it would be
even more annoying if the action was bound to the selection, because
lyrics might change as the user selected something to delete from the
playlist.

Also what does it mean if you click the lyrics button if a whole bunch
of songs are selected, do you want to get all the lyrics? It just
feels a bit weird really.

My vote is for the button to be bound to the currently playing song,
and insensitive when no song is playing.

The rest of the information in that part of the window doesn't change
with the selection, so the buttons shouldn't either.

Enjoy.

iain
Index: PluginLib/IPlayer.cs
===================================================================
RCS file: /cvs/gnome/muine/PluginLib/IPlayer.cs,v
retrieving revision 1.11
diff -U2 -r1.11 IPlayer.cs
--- PluginLib/IPlayer.cs	14 Jun 2005 13:37:15 -0000	1.11
+++ PluginLib/IPlayer.cs	20 Apr 2006 23:37:18 -0000
@@ -92,4 +92,8 @@
 		}
 
+		Gtk.Box SongButtonBox {
+			get;
+		}
+
 		uint BusyLevel {
 			set;
Index: data/glade/PlaylistWindow.glade
===================================================================
RCS file: /cvs/gnome/muine/data/glade/PlaylistWindow.glade,v
retrieving revision 1.41
diff -U2 -r1.41 PlaylistWindow.glade
--- data/glade/PlaylistWindow.glade	14 Jun 2005 07:50:50 -0000	1.41
+++ data/glade/PlaylistWindow.glade	20 Apr 2006 23:37:18 -0000
@@ -19,4 +19,5 @@
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
 
   <child>
@@ -457,20 +458,50 @@
 
 		  <child>
-		    <widget class="GtkLabel" id="time_label">
+		    <widget class="GtkHBox" id="hbox12">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes"></property>
-		      <property name="use_underline">False</property>
-		      <property name="use_markup">False</property>
-		      <property name="justify">GTK_JUSTIFY_LEFT</property>
-		      <property name="wrap">False</property>
-		      <property name="selectable">False</property>
-		      <property name="xalign">0</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xpad">0</property>
-		      <property name="ypad">0</property>
-		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		      <property name="width_chars">-1</property>
-		      <property name="single_line_mode">False</property>
-		      <property name="angle">0</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">18</property>
+
+		      <child>
+			<widget class="GtkLabel" id="time_label">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes"></property>
+			  <property name="use_underline">False</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkHBox" id="song_button_box">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">6</property>
+
+			  <child>
+			    <placeholder/>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
 		    </widget>
 		    <packing>
Index: src/PlaylistWindow.cs
===================================================================
RCS file: /cvs/gnome/muine/src/PlaylistWindow.cs,v
retrieving revision 1.244
diff -U2 -r1.244 PlaylistWindow.cs
--- src/PlaylistWindow.cs	21 Mar 2006 08:26:06 -0000	1.244
+++ src/PlaylistWindow.cs	20 Apr 2006 23:37:19 -0000
@@ -171,4 +171,6 @@
 		[Glade.Widget] private Button       add_album_button  ;		
 
+		[Glade.Widget] private Box song_button_box;
+
 		private VolumeButton volume_button;
 
@@ -365,4 +367,9 @@
 		}
 
+		// Properties :: SongButtonBox (get;) (IPlayer)
+		public Box SongButtonBox {
+			get { return song_button_box; }
+		}
+
 		// Properties :: BusyLevel (set; get;) (IPlayer)
 		public uint BusyLevel {




















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