I've not researched it much, but on the Pandora it should be fairly typical.. (a little different perhaps, but typical.)
ie:
Drop an XML file into /usr/share/mime somewhere (we have /usr/share/mime/application) and then invoke update-mime-database (I don't know the args offhand, but I think it just scans all the xml files and updates its database accordingly.) Not sure if we need to kick the desktop env after this or not. Anyway.
So more or less the process would be libpnd (pndnotifyd at startup or user login or app install/removal/update) would drop out .xml files, and when done, fire off the update-mime-database.
This sounds like a reasonable amount of work and testing, so I don't want to hold up the current firmware drop (I think we're planning a release candidate tonight or tomorrow, or something soon), which includes the so-far file association work. Once this firmware is out and stable, we can work on building and testing this for the next cycle (and I imagine ED has no worry over releasing another firmware update if its significant to do so.)
So next steps would be..
- we need a PXML specification change request and review (I can make a recommendation, or you guys can; it doesn't have to all be me
- we can build it (I can do the libpnd work, no problem there)
- we build and test some apps
Now, that said .. since theres a lot of XML _stuff_ in these xml files (a lot of different kidns of info, and they can be quite lengthy.. or very short.) .. I'm not sure we want to have PXML thats 200b or whatever, and then a 5K xml chunk wrapped up inside of it.. especially if theres many of these XML bits.
So my no-thought-at-all proposal would be something like..
<associations>
<association ... />
<association .../>
<mimetype file="./foo.xml" />
<mimetype file="./bar.xml" />
</assocations>
Thus the actual xml files are _in the pnd_, and the PXML merely refers to them. This would be ideal since it keeps all the details out of PXML, excepting one thing.. mounting pnd's is slow work, especially if theres 50 apps that are doing this.. imagine burdening the system with mounting/unmounting all those in a row; our boot time would go down the toilet.
This means we either stuff it into PXML (sigh), or do some serious caching (better than we do for icons and so forth); no storing it in /tmp but instead storing it in flash (say, since SDs come and go), and checking the package or app versioning info in the cache, to know when to update it without doing scans. ie:
Concerns: if a pnd is removed (ie: say the SD is ejected), do we drop the new mimetypes? could be painful for rescans when SD comes back.. be better to just leave them and let the user break thigns.. if he pops out an SD while a mimetyype is needed, his own fault, should know better
(to wit, right now.. if you eject an SD with a file assoc'd app, how elegant is that? xfce will see the association vanish, but it will probably still keep the preferred application reference and just not do anything. Thats the best you can really do when the user is dropping apps live.. not a typical linux scenario
Likewise .. when a pnd(s) is newly found that has <mimetype..> references, it will have to be mounted to extract the xmls .. thats slow going.
--
So do we instead just put all that xml, shovel it right into the PXML? Then libpnd just vacuums it up, and writes it out, and no mounting malarky.
--
Last option .. clumsier:
App on first run installs the XML files.
ie: the app by this time is mounted, so the info is all there.
You simply do..
- assume you've got a 'mimefiles' directory say
if [ ! -e /usr/share/mime/application/myapp.xml ]
gksudo cp ./mimefiles/* /usr/share/mime/application # gui pops up sudo box to user
gksudo update-mime-database --foo --bar # no pop up this time, since they did it last time already
fi
That is probably the easiest; trivial to do in app, no crazy specification or mounting business.
Lets do it this way, and you can do it right now
--
So, yeah, _this_ is why I didn't want to go into it right now
Big mess
jeff