No application for this file type…
Anyone know how I could hook PackageKit into this UI so that it handles some recognised formats?

For instance, in this case, we could prompt to install Inkscape to view the file. But I don’t want to do lots of waiting if PackageKit can’t find anything that matches the mimetype. Ideas welcome, as I’m really not sure how this code works at all. I’m guessing nautilus, but it could be gio for all I know….
Tags: PackageKit
May 2nd, 2008 at 4:06 am
How does this work?
I would say not very well - http://bugzilla.gnome.org/show_bug.cgi?id=92497
May 2nd, 2008 at 4:09 am
Inkscape can’t open cdr files.
May 2nd, 2008 at 4:11 am
Suggert you have a look at ubuntu nautilus patchs as gnome-app-install does this already
gnome-app-install
–mime-type=MIME_TYPE
Show only applications that handle the given file type
http://www.google.com/codesearch?hl=en&q=+gnome-app-install+nautilus+mime-type+show:d_xW7luglZA:pERfhuwTefM:pBX7cDoFMGM&sa=N&cd=2&ct=rc&cs_p=http://utnubu.alioth.debian.org&cs_f=scottish/by_maint/joss%40debian.org/large/nautilus_1:2.19.2-0ubuntu2#first
May 2nd, 2008 at 4:25 am
>Inkscape can’t open cdr files.
It can
May 2nd, 2008 at 4:53 am
Sorry I’m no help, but it sounds like an amazing feature to have! I’m a Debian user currently, but if politics prevents an awesome project like this from being available to me… I’ll switch!
Keep up the good work!
May 2nd, 2008 at 5:05 am
Ubuntu already does something like this, I don’t know which package it is though. There is also this:
http://packages.ubuntu.com/intrepid/command-not-found
May 2nd, 2008 at 6:12 am
“JustAGuy Says: ”
Unrelated to this issue. And we’re always looking for patches, so if you want to provide it…
“Richard Hughes says:
Anyone know how I could hook PackageKit into this UI so that it handles some recognised formats?”
To programmatically set an application as default for a type or extension, see g_app_info_set_as_default_for_type() and g_app_info_set_as_default_for_extension(). To just add an application as supporting the type, g_app_info_add_supports_type(). Pretty simple actually.
May 2nd, 2008 at 9:20 am
(re-read the post): If you want to put a “Search for applications to install and use for this type” button in that dialog, that will require some Nautilus work, but mostly work on your part (you’d need to have a list of installable applications by supported mime-type database somewhere, which I don’t think any package manager currently supports, though it probably wouldn’t be hard to do inside of your tool, you just need to index .desktop files).
May 2nd, 2008 at 9:20 am
Such “smart features” should be optional. Yeah my head will explode if too much ubuntuism spreads.
However, one way to solve it here which would be unobtrusive and nice, would be just to add a button “Help me find an application”/”Search for application”/whatever, that takes you to some sort of package kit helper.
May 2nd, 2008 at 9:22 am
Hi Richard,
You want to look at nautilus/libnautilus-private/nautilus-mime-actions.c, I believe this dialog is created there.
- Neil
May 2nd, 2008 at 10:47 am
[…] al lettore più intraprendente). È una semplice deduzione derivante dalla lettura di questo post di Richard Hughes
OOXML OpenSolaris Ottimizzare Oxygen PackageKit Parigi Photoshop Plasma Politica […]
May 2nd, 2008 at 10:53 am
>Yeah my head will explode if too much ubuntuism spreads
Ubuntuism? Seems pretty obvious to me.
May 2nd, 2008 at 11:00 am
It might be obvious, but is it relying on the extension name? Or will it try to detect the actual type of file?
May 2nd, 2008 at 12:28 pm
Hi Richard,
Is the intention here to have it display a list of applications, and make
it easy to install them from this dialog, or to just provide a button to pop
up a further dialog in which to search/install applications?
Thanks,
James
May 2nd, 2008 at 2:08 pm
Well, a proper dialog saying:
Do you want to search for applications?
[yes] [no]
(as this takes a few seconds to complete)
and then a list of applications that can be chosen and installed - we can make this very pretty - icons and localisations and that sort of thing.
Richard.
May 2nd, 2008 at 2:14 pm
I would say that this information would have to be integrated with yum. That way it could be updated when new packages could handle different file types and also it would re-use the cache system that already exists.
May 2nd, 2008 at 2:28 pm
Yes, I agree. Trying to maintain an out-of-band data source is not going to work. I’m working on adding a script to rpm to automatically pull out the mimetypes and add them as rpm-provides. This means we can just use yum and rpm for the yum backend. I think apt has a desktop file cache for this as well.
Unfortunatly, this means that we have to wait for F10 until this feature can be used in Fedora, as it needs all the applications to be rebuilt with the new provides
May 2nd, 2008 at 2:36 pm
Hi Richard,
apt doesn’t have this capability, but Ubuntu ships the information in a separate
package for the gnome-app-install tool. I’m not sure if mime types are there, but
they certainly could be.
The information could obviously be made available through apt as well.
Thanks,
James
May 2nd, 2008 at 5:05 pm
Hey Richard, I think this script would do the trick:
for f in `find /usr/share/applications -name ‘*.desktop’`; do
sed -n ’s/^ *MimeType=\(.*\)/\1/p’ $f | \
awk -F’;’ ‘{for(i=1;i<=NF;i++) if ($i) printf “mime(%s)\n”, $i}’
done
Adjusting the find to operate on $RPM_BUILD_ROOT and supplying the rpm macro magic as needed. Probably you could drop the sed and get it all in awk, but I’m not that talented. If you want any more help with this, I’m pretty keen to rpm and how it handles reqprov.
May 2nd, 2008 at 5:18 pm
Inkscape does support CDR, but doesn’t update it’s mime types so that it gets listed.
According to the desktop file we’re SVG only, and that kinda comes from the fact that other things need to be installed to make it work. So if you have Uniconverter and Inkscape, then you can view CDR files. I realize that’s complex, but I’m not sure how you’ll be able to represent that in the provides section of an RPM or DEB.
May 2nd, 2008 at 6:35 pm
Ted,
You could put it in and then use libpackagekit to install uniconverter from inkscape
if asked to open a CDR file.
James
May 3rd, 2008 at 2:27 pm
Please, take a look at this (proposed) freedesktop specification:
http://www.freedesktop.org/wiki/Specifications/mime-actions-spec
If I remember correctly, KDE implements it.