Hi Osmo,

Many thanks for your excellent help. That works perfectly for my purposes. 

Just one question: how can I find out which *command* (not just the name of the 
executable) gets executed when I use one of those applications returned by 
gio.gio.app_info_get_all_for_type?

In GNOME vfs, I got back a structure in which the third element was the actual 
command string, eg:

> app = gnomevfs.mime_get_all_applications('text/plain')[1]
> print app[2]
wine start /ProgIDOpen txtfile
>

I thought that in GIO get_commandline() 
[http://library.gnome.org/devel/pygobject/stable/class-gioappinfo.html#method-gioappinfo--get-commandline]
  would do that for me, but I can't seem to get it to work on Python:

> app = gio.app_info_get_all_for_type('text/plain')[1]
> app.get_commandline()
AttributeError

In pygtk how can I get the command that is run when this app is used to launch 
a file?

Many thanks for your help,

lara

--- On Fri, 2/19/10, Osmo Maatta <[email protected]> wrote:

> From: Osmo Maatta <[email protected]>
> Subject: Re: [pygtk] [on gnome] finding registered applications + icon(s) for 
> MIME type
> To: 
> Cc: "Lara Michaels" <[email protected]>, [email protected]
> Date: Friday, February 19, 2010, 8:47 AM
> 
> 
> 
>   
> 
>  
> Typo.
> 
> The reference should be 
> 
>  
> http://code.google.com/p/gscreendump/source/browse/trunk/src/sd_interface.c
> 
> 
> 
> 
> 
> 
> 
> Osmo Maatta wrote:
> Hello,
>   
> 
>   
> 
> In my Gscreendump app I've used the following code.
>   
> 
> http://code.google.com/p/gscreendump/source/browse/trunk/src/sd_interface.
>   
> 
> Search for "g_app_info_get_all_for_type"
> function.
>   
> 
>   
> 
> That converted to Python becomes:
>   
> 
>   
> 
> import gio
>   
> 
>   
> 
> # Mime type
>   
> 
> mime_type = "image/png"
>   
> 
>   
> 
> # Get list of supported apps
>   
> 
> l = gio.app_info_get_all_for_type(mime_type)
>   
> 
> print "l=", l
>   
> 
>   
> 
> # For each app (GAppInfo *app) in the list
>   
> 
> # See:
> http://library.gnome.org/devel/pygobject/stable/class-gioappinfo.html
>   
> 
> for app in l:
>   
> 
>    app_id = app.get_id()
>   
> 
>   
> 
>    # Returns gio.Icon object. Read the manual
> page.
>   
> 
>    app_icon = app.get_icon()  
> 
>    app_name = app.get_name()
>   
> 
>   
> 
>    print "app_name=%s  id=%s 
> icon=%s" % (app_name, app_id, app_icon)
>   
> 
>   
> 
>   
> 
> # To start an application, do
>   
> 
> app.launch_uris("/home/moma/Screenshots/screenshot046.png",
> None)
>   
> 
> Check the manual page before using this.
>   
> 
> -------------
>   
> 
>   
> 
> // Moma Antero
>   
> 
>   
> 
>   
> 
>   
> 
>   
> 
> 
> 
> 
>  
> 
> 


      
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to