[Slim-Checkins] r33930 - in /7.8/trunk/server/Slim: Control/XMLBrowser.pm Menu/AlbumInfo.pm Menu/ArtistInfo.pm Menu/FolderInfo.pm Menu/GenreInfo.pm Menu/PlaylistInfo.pm Menu/TrackInfo.pm Menu/YearInfo.pm Plugin/Favorites/Plugin.pm

[email protected] Sun, 08 Apr 2012 09:32:55 -0000
Newsgroups gmane.music.equipment.slimdevices.cvs
Message-ID <[email protected]>
Author: ayoung
Date: Sun Apr  8 02:32:54 2012
New Revision: 33930

URL: http://svn.slimdevices.com/slim?rev=33930&view=rev
Log:
Styles for playlist-control actions.

Add styles for use in CMs for playlist-control actions: item_play (existing), item_add (existing), item_insert, item_playall, item_fav.

Modified:
    7.8/trunk/server/Slim/Control/XMLBrowser.pm
    7.8/trunk/server/Slim/Menu/AlbumInfo.pm
    7.8/trunk/server/Slim/Menu/ArtistInfo.pm
    7.8/trunk/server/Slim/Menu/FolderInfo.pm
    7.8/trunk/server/Slim/Menu/GenreInfo.pm
    7.8/trunk/server/Slim/Menu/PlaylistInfo.pm
    7.8/trunk/server/Slim/Menu/TrackInfo.pm
    7.8/trunk/server/Slim/Menu/YearInfo.pm
    7.8/trunk/server/Slim/Plugin/Favorites/Plugin.pm

Modified: 7.8/trunk/server/Slim/Control/XMLBrowser.pm
URL: http://svn.slimdevices.com/slim/7.8/trunk/server/Slim/Control/XMLBrowser.pm?rev=33930&r1=33929&r2=33930&view=diff
==============================================================================
--- 7.8/trunk/server/Slim/Control/XMLBrowser.pm (original)
+++ 7.8/trunk/server/Slim/Control/XMLBrowser.pm Sun Apr  8 02:32:54 2012
@@ -1080,6 +1080,12 @@
 							$hash{'style'} = 'itemplay';
 						}
 						
+						elsif (my $playcontrol = $item->{'playcontrol'}) {
+							if    ($playcontrol eq 'play')   {$hash{'style'} = 'item_play';}
+							elsif ($playcontrol eq 'add')    {$hash{'style'} = 'item_add';}
+							elsif ($playcontrol eq 'insert') {$hash{'style'} = 'item_insert';}
+						}
+						
 						my $itemText = $nameOrTitle;
 						if ($item->{'name2'}) {
 							$itemText .= "\n" . $item->{'name2'};
@@ -1134,7 +1140,7 @@
 						}
 
 						if ( $item->{type} && $item->{type} eq 'text' && !$item->{wrap} && !$item->{jive} ) {
-							$hash{'style'} = 'itemNoAction';
+							$hash{'style'} ||= 'itemNoAction';
 							$hash{'action'} = 'none';
 						}
 						
@@ -1799,6 +1805,7 @@
 		if ($action = _makePlayAction($subFeed, $item, 'insert', 'parentNoRefresh', $query, $item_id)) {
 			push @contextMenu, {
 				text => $request->string('PLAY_NEXT'),
+				style => 'item_insert',
 				actions => {go => $action},
 			},
 		}
@@ -1814,6 +1821,7 @@
 		if ($addPlayAll && ($action = _makePlayAction($subFeed, $item, 'playall', 'nowPlaying', $query, $request->getParam('item_id'), $sub_id))) {
 			push @contextMenu, {
 				text => $request->string('JIVE_PLAY_ALL_SONGS'),
+				style => 'item_playall',
 				actions => {go => $action},
 			},
 		}
@@ -1855,6 +1863,7 @@
 	
 		push @contextMenu, {
 			text => $request->string($token),
+			style => 'item_fav',
 			actions => $favoriteActions,
 		};
 	}

Modified: 7.8/trunk/server/Slim/Menu/AlbumInfo.pm
URL: http://svn.slimdevices.com/slim/7.8/trunk/server/Slim/Menu/AlbumInfo.pm?rev=33930&r1=33929&r2=33930&view=diff
==============================================================================
--- 7.8/trunk/server/Slim/Menu/AlbumInfo.pm (original)
+++ 7.8/trunk/server/Slim/Menu/AlbumInfo.pm Sun Apr  8 02:32:54 2012
@@ -424,7 +424,6 @@
 		type        => 'text',
 		playcontrol => 'play',
 		name        => cstring($client, 'PLAY'),
-		jive        => {style => 'itemplay'},
 	};
 }
 	

Modified: 7.8/trunk/server/Slim/Menu/ArtistInfo.pm
URL: http://svn.slimdevices.com/slim/7.8/trunk/server/Slim/Menu/ArtistInfo.pm?rev=33930&r1=33929&r2=33930&view=diff
==============================================================================
--- 7.8/trunk/server/Slim/Menu/ArtistInfo.pm (original)
+++ 7.8/trunk/server/Slim/Menu/ArtistInfo.pm Sun Apr  8 02:32:54 2012
@@ -195,9 +195,10 @@
 	$jive->{style} = 'itemplay';
 
 	push @{$items}, {
-		type => 'text',
-		name => $play_string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => 'play',
+		name        => $play_string,
+		jive        => $jive, 
 	};
 	
 	return $items;
@@ -243,9 +244,10 @@
 	$jive->{actions} = $actions;
 
 	push @{$items}, {
-		type => 'text',
-		name => $add_string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => $cmd,
+		name        => $add_string,
+		jive        => $jive, 
 	};
 	
 	return $items;

Modified: 7.8/trunk/server/Slim/Menu/FolderInfo.pm
URL: http://svn.slimdevices.com/slim/7.8/trunk/server/Slim/Menu/FolderInfo.pm?rev=33930&r1=33929&r2=33930&view=diff
==============================================================================
--- 7.8/trunk/server/Slim/Menu/FolderInfo.pm (original)
+++ 7.8/trunk/server/Slim/Menu/FolderInfo.pm Sun Apr  8 02:32:54 2012
@@ -101,9 +101,10 @@
 	$actions->{add}  = $actions->{go};
 
 	return [ {
-		type => 'text',
-		name => $label,
-		jive => {
+		type        => 'text',
+		playcontrol => $cmd,
+		name        => $label,
+		jive        => {
 			actions => $actions
 		}, 
 	} ];
@@ -130,9 +131,10 @@
 	$actions->{add}  = $actions->{go};
 
 	return [ {
-		type => 'text',
-		name => cstring($client, 'PLAY'),
-		jive => {
+		type        => 'text',
+		playcontrol => 'play',
+		name        => cstring($client, 'PLAY'),
+		jive        => {
 			actions => $actions
 		}, 
 	} ];

Modified: 7.8/trunk/server/Slim/Menu/GenreInfo.pm
URL: http://svn.slimdevices.com/slim/7.8/trunk/server/Slim/Menu/GenreInfo.pm?rev=33930&r1=33929&r2=33930&view=diff
==============================================================================
--- 7.8/trunk/server/Slim/Menu/GenreInfo.pm (original)
+++ 7.8/trunk/server/Slim/Menu/GenreInfo.pm Sun Apr  8 02:32:54 2012
@@ -197,9 +197,10 @@
 	$jive->{actions} = $actions;
 	$jive->{style} = 'itemplay';
 	push @{$items}, {
-		type => 'text',
-		name => $play_string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => 'play',
+		name        => $play_string,
+		jive        => $jive, 
 	};
 	
 	return $items;
@@ -245,9 +246,10 @@
 	$jive->{actions} = $actions;
 
 	push @{$items}, {
-		type => 'text',
-		name => $add_string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => $cmd,
+		name        => $add_string,
+		jive        => $jive, 
 	};
 	
 	return $items;

Modified: 7.8/trunk/server/Slim/Menu/PlaylistInfo.pm
URL: http://svn.slimdevices.com/slim/7.8/trunk/server/Slim/Menu/PlaylistInfo.pm?rev=33930&r1=33929&r2=33930&view=diff
==============================================================================
--- 7.8/trunk/server/Slim/Menu/PlaylistInfo.pm (original)
+++ 7.8/trunk/server/Slim/Menu/PlaylistInfo.pm Sun Apr  8 02:32:54 2012
@@ -223,9 +223,10 @@
 	$jive->{actions} = $actions;
 	$jive->{style} = 'itemplay';
 	push @{$items}, {
-		type => 'text',
-		name => $play_string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => 'play',
+		name        => $play_string,
+		jive        => $jive, 
 	};
 	
 	return $items;
@@ -272,9 +273,10 @@
 	$jive->{actions} = $actions;
 
 	push @{$items}, {
-		type => 'text',
-		name => $add_string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => $cmd,
+		name        => $add_string,
+		jive        => $jive, 
 	};
 	
 	return $items;

Modified: 7.8/trunk/server/Slim/Menu/TrackInfo.pm
URL: http://svn.slimdevices.com/slim/7.8/trunk/server/Slim/Menu/TrackInfo.pm?rev=33930&r1=33929&r2=33930&view=diff
==============================================================================
--- 7.8/trunk/server/Slim/Menu/TrackInfo.pm (original)
+++ 7.8/trunk/server/Slim/Menu/TrackInfo.pm Sun Apr  8 02:32:54 2012
@@ -481,9 +481,10 @@
 	$jive->{style} = 'itemplay';
 
 	push @{$items}, {
-		type => 'text',
-		name => $play_string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => 'play',
+		name        => $play_string,
+		jive        => $jive, 
 	};
 	
 	return $items;
@@ -492,30 +493,37 @@
 sub addTrackNext {
 	my ( $client, $url, $track, $remoteMeta, $tags ) = @_;
 	my $string = cstring($client, 'PLAY_NEXT');
-	my $cmd = $tags->{menuContext} eq 'playlist' ? 'playlistnext' : 'insert';
-	
-	return addTrack( $client, $url, $track, $remoteMeta, $tags, $string, $cmd );
+	my ($cmd, $playcontrol);
+	if ($tags->{menuContext} eq 'playlist') {
+		$cmd         = 'playlistnext';
+	} else {
+		$cmd         = 'insert';
+		$playcontrol = 'insert'
+	}
+	
+	return addTrack( $client, $url, $track, $remoteMeta, $tags, $string, $cmd, $playcontrol );
 }
 
 sub addTrackEnd {
 	my ( $client, $url, $track, $remoteMeta, $tags ) = @_;
 
-	my ($string, $cmd);
+	my ($string, $cmd, $playcontrol);
 
 	# "Add Song" in current playlist context is 'delete'
 	if ( $tags->{menuContext} eq 'playlist' ) {
-		$string = cstring($client, 'REMOVE_FROM_PLAYLIST');
-		$cmd    = 'delete';
+		$string      = cstring($client, 'REMOVE_FROM_PLAYLIST');
+		$cmd         = 'delete';
 	} else {
-		$string = cstring($client, 'ADD_TO_END');
-		$cmd    = 'add';
-	}
-	
-	return addTrack( $client, $url, $track, $remoteMeta, $tags, $string, $cmd );
+		$string      = cstring($client, 'ADD_TO_END');
+		$cmd         = 'add';
+		$playcontrol = 'add'
+	}
+	
+	return addTrack( $client, $url, $track, $remoteMeta, $tags, $string, $cmd, $playcontrol );
 }
 
 sub addTrack {
-	my ( $client, $url, $track, $remoteMeta, $tags , $string, $cmd ) = @_;
+	my ( $client, $url, $track, $remoteMeta, $tags , $string, $cmd, $playcontrol ) = @_;
 
 	my $items = [];
 	my $jive;
@@ -590,9 +598,10 @@
 	$jive->{actions} = $actions;
 
 	push @{$items}, {
-		type => 'text',
-		name => $string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => $playcontrol,
+		name        => $string,
+		jive        => $jive,
 	};
 	
 	return $items;

Modified: 7.8/trunk/server/Slim/Menu/YearInfo.pm
URL: http://svn.slimdevices.com/slim/7.8/trunk/server/Slim/Menu/YearInfo.pm?rev=33930&r1=33929&r2=33930&view=diff
==============================================================================
--- 7.8/trunk/server/Slim/Menu/YearInfo.pm (original)
+++ 7.8/trunk/server/Slim/Menu/YearInfo.pm Sun Apr  8 02:32:54 2012
@@ -188,9 +188,10 @@
 	$jive->{style} = 'itemplay';
 
 	push @{$items}, {
-		type => 'text',
-		name => $play_string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => 'play',
+		name        => $play_string,
+		jive        => $jive, 
 	};
 	
 	return $items;
@@ -200,7 +201,7 @@
 	my ( $client, $url, $year, $remoteMeta, $tags ) = @_;
 	my $add_string   = cstring($client, 'ADD_TO_END');
 	my $cmd = 'add';
-	addYear( $client, $url, $year, $remoteMeta, $tags, $add_string, $cmd ); 
+	addYear( $client, $url, $year, $remoteMeta, $tags, $add_string, $cmd, 'item_add'); 
 }
 
 
@@ -208,7 +209,7 @@
 	my ( $client, $url, $year, $remoteMeta, $tags ) = @_;
 	my $add_string   = cstring($client, 'PLAY_NEXT');
 	my $cmd = 'insert';
-	addYear( $client, $url, $year, $remoteMeta, $tags, $add_string, $cmd ); 
+	addYear( $client, $url, $year, $remoteMeta, $tags, $add_string, $cmd, 'item_insert' ); 
 }
 
 
@@ -237,9 +238,10 @@
 	$jive->{actions} = $actions;
 
 	push @{$items}, {
-		type => 'text',
-		name => $add_string,
-		jive => $jive, 
+		type        => 'text',
+		playcontrol => $cmd,
+		name        => $add_string,
+		jive        => $jive, 
 	};
 	return $items;
 }

Modified: 7.8/trunk/server/Slim/Plugin/Favorites/Plugin.pm
URL: http://svn.slimdevices.com/slim/7.8/trunk/server/Slim/Plugin/Favorites/Plugin.pm?rev=33930&r1=33929&r2=33930&view=diff
==============================================================================
--- 7.8/trunk/server/Slim/Plugin/Favorites/Plugin.pm (original)
+++ 7.8/trunk/server/Slim/Plugin/Favorites/Plugin.pm Sun Apr  8 02:32:54 2012
@@ -1031,7 +1031,7 @@
 	
 	my $index = Slim::Utils::Favorites->new($client)->findUrl($url);
 	
-	my $jive;
+	my $jive = {style => 'item_fav'};
 	my $title;
 	if ($objectType eq 'artist') {
 		$title = $obj->name;