Re: libgnome: gnome-open.c

Magnus Therning <[email protected]>
Newsgroups gmane.comp.gnome.devel
Message-ID <[email protected]>
On Sun, Jun 17, 2007 at 17:32:30 +0200, Alp Özmert wrote:
>
>Wouter Bolsterlee <[email protected]> writes:
>
>> 2007-06-17 klockan 14:23 skrev Alp Özmert:
>>> I came upon 'gnome-open' while looking for a way to make Emacs/Gnus
>>> call the application associated by Gnome as an external viewer for
>>> attached files.  The impediment is that I couldn't make gnome-open
>>> wait until the process finishes, neither did I have success with
>>> gnome_url_show().
>>> 
>>> I would be delighted by any given insight to this first-time gnome
>>> hacker to enable him to construct a blocking call to
>>> gnome_url_show().
>>
>> This is not really possible to do reliably. Many Gnome
>> applications are single instance apps (e.g. Evince). This means
>> that a second application instance will just pass through the
>> command line arguments (e.g. the filename to show) to the already
>> running applications, and quit immediately afterwards.
>
>Is there a simple way to find the path to the associated
>application? For now that would be sufficient.

I ran into that problem a while ago.  Don't know if it helps but here's
a dirty Python script I hacked up and run from inside mutt in order to
use GNOME's MIME data rather than mailcap:

  #! /usr/bin/env python

  import gnomevfs
  import os
  import sys

  mime_type = gnomevfs.get_mime_type(sys.argv[1])
  mime_app = gnomevfs.mime_get_default_application(mime_type)
  application = os.popen('whereis %s' % mime_app[2]).readline().split(' ')[1]

  os.execl(application, application, sys.argv[1])

Taken from [1].

/M

[1]: http://therning.org/magnus/archives/251

-- 
Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
[email protected]             Jabber: [email protected]
http://therning.org/magnus

_______________________________________________
gnome-devel-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-devel-list
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBGdXIYiMWTaatN+6QRAlMLAKCkxfQo/4lmK/q7L4HA0CPLl3iaHwCgz5Ox
LUC7OBroOSVdK1ianelWarM=
=8bKx
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.