[pygtk] [on gnome] finding registered applications + icon(s) for MIME type

Osmo Maatta osmoma at gmail.com
Fri Feb 19 16:47:17 WST 2010


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
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20100219/71e67637/attachment.htm 


More information about the pygtk mailing list