Bug 5500 - Allow argument from custom.map to be passed to through Choice.pm
: Allow argument from custom.map to be passed to through Choice.pm
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Player UI
: unspecified
: PC All
: P2 enhancement (vote)
: ---
Assigned To: Squeezebox QA Team email alias
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-16 02:18 UTC by Erland Isaksson
Modified: 2007-09-23 05:58 UTC (History)
0 users

See Also:
Category: ---


Attachments
Patch for 7.0 (446 bytes, patch)
2007-09-16 02:19 UTC, Erland Isaksson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erland Isaksson 2007-09-16 02:18:56 UTC
It would be great if Slim::Buttons::Input::Choice would pass the argument part in the plugin.

The problem occurs when I in a plugin like to use the Input::Choice for a menu.

This is some sample code from the Custom Browse plugin:
====================
# Registration part
my %choiceFunctions =  %{Slim::Buttons::Input::Choice::getFunctions()};
$choiceFunctions{'createmix'} = sub {Slim::Buttons::Input::Choice::callCallback('onCreateMix', @_)};
Slim::Buttons::Common::addMode('PLUGIN.CustomBrowse.Choice',\%choiceFunctions,\&Slim::Buttons::Input::Choice::setMode);

# Usage part (more parameters are defied in the real implementation, this is just a sample
my %params = (
	listRef    => \@listRef,
	onCreateMix => 
		sub {
			my ($client, $item, $functarg) = @_;
			# Some code here
		},				
	onPlay => 
		sub {
			my ($client, $item) = @_;
			# Some code here
		},
	onAdd => 
		sub {
			my ($client, $item) = @_;
			# Some code here
		},
);
Slim::Buttons::Common::pushModeLeft($client, 'PLUGIN.CustomBrowse.Choice', \%params);
====================

The problem is that the $functarg parameter to the onCreateMix function is never passed from Input::Choice, instead it only passes the $client and $item.

The result is that you can't define a custom.map IR entry like the following:
0.hold = modefunction_PLUGIN.CustomBrowse.Choice->createmix_artistmix

If the $functarg parameter was passed through, it would for this sample be equal to "artistmix". This is also how the custom.map information is passed through the IR/command mechanism in other situations, but it isn't if you use Input:Choice.

The attached patch solves the problem.
Comment 1 Erland Isaksson 2007-09-16 02:19:54 UTC
Created attachment 2139 [details]
Patch for 7.0
Comment 2 Adrian Smith 2007-09-18 15:20:49 UTC
Applied - change 13087

Please close if you are happy!