Notices


Reply
Thread Tools
rebhana's Avatar
Posts: 579 | Thanked: 471 times | Joined on Jan 2010 @ Austria
#221
Originally Posted by qole View Post
dbus-switchboard currently only handles files with file extensions.

The simple solution here is to download files and add extensions, then use the file manager to open the files with dbus-switchboard.
Since I need that so often, this is at least no good for me.

The more complex, but far better, solution is to figure out how to pass the detected mime type to dbus-switchboard and use that to determine the handler, rather than the file extension.
I would like to know how qwerty did it for evince. His evince.desktop file contains
Code:
Exec=evince
StartupNotify=true
Terminal=false
Type=Application
Icon=evince
X-Osso-Service=org.gnome.evince.ApplicationService
X-Osso-Type=application/x-executable
MimeType=application/pdf;application/x-bzpdf;application/x-gzpdf;application/x-dvi;application/x-bzdvi;application/x-gzdvi;image/vnd.djvu;image/tiff;application/x-cbr;application/x-cbz;application/x-cb7;image/*;application/vnd.sun.xml.impress;application/vnd.oasis.opendocument.presentation;
Could something like that be done for "debbie evince" as well?
__________________
Need more apps for the N900? Check out Qole's Easy Debian and read the wiki!
My Easy Debian installation log
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#222
Originally Posted by rebhana View Post
I would like to know how qwerty did it for evince. His evince.desktop file contains
Code:
Exec=evince
StartupNotify=true
Terminal=false
Type=Application
Icon=evince
X-Osso-Service=org.gnome.evince.ApplicationService
X-Osso-Type=application/x-executable
MimeType=application/pdf;application/x-bzpdf;application/x-gzpdf;application/x-dvi;application/x-bzdvi;application/x-gzdvi;image/vnd.djvu;image/tiff;application/x-cbr;application/x-cbz;application/x-cb7;image/*;application/vnd.sun.xml.impress;application/vnd.oasis.opendocument.presentation;
Could something like that be done for "debbie evince" as well?
I don't recall doing anything special for Evince. What I did do was add those entries to the desktop file, adding an XML describing the new types (dpkg -L evince / evince-common should pick it up) and adding an handler to Evince to open each file it recieves by name over D-Bus, which DBus Switchboard does.

I don't think you are passed the mimetype, but you are passed the full path which is enough to figure out the MIME type in your program (I think GnomeVFS has functions for this).
 

The Following 2 Users Say Thank You to qwerty12 For This Useful Post:
rebhana's Avatar
Posts: 579 | Thanked: 471 times | Joined on Jan 2010 @ Austria
#223
I had only inspected dpkg -L evince, not evince-common, so I missed
/usr/share/dbus-1/services/evince.service
Code:
[D-BUS Service]
Name=org.gnome.evince.ApplicationService
Exec=/usr/bin/evince
My question is whether there is a fundamental obstacle to have Easy Debian applications like "debbie evince" substituting /usr/bin/evince.

Btw, the Maemo port of evince is great - I'm just sorely missing postscript support.
__________________
Need more apps for the N900? Check out Qole's Easy Debian and read the wiki!
My Easy Debian installation log
 

The Following User Says Thank You to rebhana For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#224
Apologies if I'm misunderstanding you. I don't use Easy Debian so I'm unfamilar with its workings, but I believe you'd have to go through DBus Switchboard and get it to run Easy Debian Evince as the script wouldn't know of recieving arguments via D-Bus, which is part of how "associations" work in Maemo. Wow, reading that, I realise I bring nothing new... again, apologies.

Originally Posted by rebhana View Post
Btw, the Maemo port of evince is great - I'm just sorely missing postscript support.
Thank you. Postscript support required several large dependencies to be uploaded, last I checked. Being the lazy prick I am...

I should get to get to updating it though and making some interface changes. I think moving the contents list to a HildonTouchSelector would be nice...
 

The Following 2 Users Say Thank You to qwerty12 For This Useful Post:
rebhana's Avatar
Posts: 579 | Thanked: 471 times | Joined on Jan 2010 @ Austria
#225
Originally Posted by qwerty12 View Post
Apologies if I'm misunderstanding you. I don't use Easy Debian so I'm unfamilar with its workings, but I believe you'd have to go through DBus Switchboard and get it to run Easy Debian Evince as the script wouldn't know of recieving arguments via D-Bus, which is part of how "associations" work in Maemo.
I have to excuse for my silly questions I'm afraid.

Dbus-switchboard is in fact working for the Easy Debian applications. Only trouble is that it depends on explicit file types.
__________________
Need more apps for the N900? Check out Qole's Easy Debian and read the wiki!
My Easy Debian installation log
 

The Following User Says Thank You to rebhana For This Useful Post:
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#226
Originally Posted by qwerty12 View Post
...but you are passed the full path which is enough to figure out the MIME type in your program (I think GnomeVFS has functions for this).
Does anyone know how to do this in Python? What library would one use?
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#227
Originally Posted by qole View Post
Does anyone know how to do this in Python? What library would one use?
python-gnome was already installed here, so this worked:
from gnome import gnomevfs
print "%s" % gnomevfs.get_mime_type("/home/user/MyDocs/treeview-tutorial.pdf")

Python also has a standard mimetypes module if an external dependency is not your thing.

(Sorry it's not got CODE tags around it, but my JS is disabled in Tear and the symbol input fails to come up if the clipboard is populated)
 

The Following 2 Users Say Thank You to qwerty12 For This Useful Post:
rebhana's Avatar
Posts: 579 | Thanked: 471 times | Joined on Jan 2010 @ Austria
#228
Originally Posted by rebhana View Post
Btw, I noticed that the deinstallation is not restoring everything to the previous state. Before, /usr/share/applications/defaults.list was a symlink to /etc/gnome/defaults.list, and now they are separate with different contents. That doesn't seem to have any effects as far as I see, though.
On second thought - could that possibly interfere with other packages if they assume that /etc/gnome/defaults.list will be read by mime updates?
__________________
Need more apps for the N900? Check out Qole's Easy Debian and read the wiki!
My Easy Debian installation log
 
debernardis's Avatar
Posts: 2,142 | Thanked: 2,054 times | Joined on Dec 2006 @ Sicily
#229
Originally Posted by rebhana View Post
On second thought - could that possibly interfere with other packages if they assume that /etc/gnome/defaults.list will be read by mime updates?
I fear that it's exactly so, and I have already written down to myself to restore the link if I ever uninstall dbus-switchboard (unless Qole can correct the postinst script).

Back to the problem, an interim solution could be make dbus-switchboard ask for a manual xref when it can't find a known extension.
__________________
Ernesto de Bernardis

 

The Following 2 Users Say Thank You to debernardis For This Useful Post:
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#230
I find it interesting that Maemo pretends to use the /etc/gnome/defaults.list file but it doesn't really, it still uses the /usr/share/applications/defaults.list ...

I find it interesting, too, that I copy the original file to a safe location, and then copy it back in my postrm file. But how is it that the file that my postrm script copies back upon removal of dbus-switchboard is different than the file it was supposedly linked to?
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
Reply


 
Forum Jump


All times are GMT. The time now is 05:17.