Comment 15 for bug 115071

Revision history for this message
In , clemens (clemens-endorphin) wrote :

The Gnome API to get the list of all applications registered for a mimetype call gnome_vfs_mime_get_all_application(const char *mimetype);

The implementation could look like:

NS_IMETHODIMP
nsGnomeVFSService::GetAllAppsForMimeType(const nsACString &aMimeType,
                                      nsIGnomeVFSMimeApp** aApp)
{
   *aApps = nsnull;
   GList *apps =
    gnome_vfs_mime_get_all_application(PromiseFlatCString(aMimeType).get());

    while(apps) {
       GList *next = apps->next;
       nsGnomeVFSMimeApp *mozApp = new nsGnomeVFSMimeApp(apps->data);
       NS_ENSURE_TRUE(mozApp, NS_ERROR_OUT_OF_MEMORY);

       NS_ADDREF(apps->data = mozApp);
   }
   return NS_OK;
}