Adding a 'X-Plasma-MainScript' entry to plasmoid metadata.desktop files?

Aaron J. Seigo aseigo at kde.org
Wed Jul 2 21:17:02 CEST 2008


On Wednesday 02 July 2008, Richard Dale wrote:
> > I think that would make sense from the JS point of view too.
>
> OK, please find attached a patch to try it out. 

i don't think this makes much sense for ecmascript stuff, it's just another bit 
of complexity. i understand why you are doing it for ruby, however, based on 
previous conversations we've had.

so ... the question is how to implement this properly.

all of this belongs in a PackageStructure: no code in Applet or AppletScript 
should be touched. the moment that happens, it's a sign something is wrong =)

in your patch, by commenting out the setRequred mainscript line in 
AppletPackage, it's now impossible to either verify or create packages 
properly: with the patch it's completely valid to have plasmoids without 
mainscripts. so we don't want that =)

there are two ways of going about this:

* define a separate PackageStructure for plasmoid bundles with configurable main 
scripts and leave PlasmoidPackage as it is
	* benefits: it keeps PlasmoidPackage loading simple
	* cons: we now have to define the PackageStructure in all ruby (or whatever 
other) metadata.desktop files

* modify PlasmoidPackage properly and make dynmic-mainscript-location a 
possibility for all packages
	* benefits: keeps things simpler for dynamic main script location packages: 
don't have to define the PackageStructure in the metadata.desktop file
	* cons: means we read the PackageMetadata again for every plasmoid loaded

the latter is *probably* the better of the two options from the user's POV but 
is worse from a performance POV.

what needs to happen in the code is a protected void 
PlasmoidPackage::patchChanged() method needs to be added. this will get called 
whenever it's path() changes.

in that method it will need to create a PackageMetadata for itself and read 
out the value of the main script if it exists.

the default should remain as is.

i think this will end up need some more API for PackageStructure in 4.2 to:

	* make adjusting existing keys more straightforward
	* allow defining which keys are configurable for package creation tools

anyways, see attached patch. 16 lines of additions, including whitespace; 
really only 6 lines of interesting code. it's untested (well it compiles ;) 
but it should work by all intentions.

the lack of documentation for this part of libplasma really sucks; i really do 
need to do something about that =( it makes it seem like you have to around 
changing stuff all over libplasma in big patches instead of just adding 6 new 
lines =)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech

-------------- next part --------------
A non-text attachment was scrubbed...
Name: configurable_mainscript.diff
Type: text/x-patch
Size: 1190 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080702/3647dec3/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080702/3647dec3/attachment-0001.pgp 


More information about the Panel-devel mailing list