GnomeIconLookup

## GnomeIconLookup GnomeIconLookup |

## Synopsis

    #include <libgnomeui/libgnomeui.h>

    enum                GnomeIconLookupFlags;
    enum                GnomeIconLookupResultFlags;
    char *              gnome_icon_lookup                   (GtkIconTheme *icon_theme,
                                                             GnomeThumbnailFactory *thumbnail_factory,
                                                             const char *file_uri,
                                                             const char *custom_icon,
                                                             GnomeVFSFileInfo *file_info,
                                                             const char *mime_type,
                                                             GnomeIconLookupFlags flags,
                                                             GnomeIconLookupResultFlags *result);
    char *              gnome_icon_lookup_sync              (GtkIconTheme *icon_theme,
                                                             GnomeThumbnailFactory *thumbnail_factory,
                                                             const char *file_uri,
                                                             const char *custom_icon,
                                                             GnomeIconLookupFlags flags,
                                                             GnomeIconLookupResultFlags *result);

## Description

## Details

### enum GnomeIconLookupFlags

    typedef enum {
      GNOME_ICON_LOOKUP_FLAGS_NONE = 0,
      GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT = 1<<0,
      GNOME_ICON_LOOKUP_FLAGS_SHOW_SMALL_IMAGES_AS_THEMSELVES = 1<<1,
      GNOME_ICON_LOOKUP_FLAGS_ALLOW_SVG_AS_THEMSELVES = 1<<2
    } GnomeIconLookupFlags;

### enum GnomeIconLookupResultFlags

    typedef enum {
      GNOME_ICON_LOOKUP_RESULT_FLAGS_NONE = 0,
      GNOME_ICON_LOOKUP_RESULT_FLAGS_THUMBNAIL = 1<<0
    } GnomeIconLookupResultFlags;

### gnome_icon_lookup ()

    char *              gnome_icon_lookup                   (GtkIconTheme *icon_theme,
                                                             GnomeThumbnailFactory *thumbnail_factory,
                                                             const char *file_uri,
                                                             const char *custom_icon,
                                                             GnomeVFSFileInfo *file_info,
                                                             const char *mime_type,
                                                             GnomeIconLookupFlags flags,
                                                             GnomeIconLookupResultFlags *result);

This function tries to locate an icon in `icon_theme` that can be used to represent the file passed. It can optionally also look for existing thumbnails. It does no I/O, so the lookup should be relatively fast.

If you don't know any information about the file already you can use `gnome_icon_lookup_sync()` which gets this information using gnome-vfs.

For backwards compatibility, this function also accepts a GnomeIconTheme instead of a GtkIconTheme.

The following `flags` are valid:

GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT - Return the text icon for scripts. This is useful if you do text embedding in the icons.

GNOME_ICON_LOOKUP_FLAGS_SHOW_SMALL_IMAGES_AS_THEMSELVES - Return the filename of the filename itself for small images. Only availible if you pass a thumbnail_factory.

Possible `result` flags:

GNOME_ICON_LOOKUP_RESULT_FLAGS_THUMBNAIL - The returned file is a thumbnail.

`icon_theme` : | a GtkIconTheme, or (deprecated) a GnomeIconTheme
`thumbnail_factory` : | an optional GnomeThumbnailFactory used to look up thumbnails
`file_uri` : | the uri of the file
`custom_icon` : | optionally the name of a custom icon to try
`file_info` : | information about the file from `gnome_vfs_get_file_info()`
`mime_type` : | the mime type of the icon
`flags` : | flags that affect the result of the lookup
`result` : | optionally result flags of the lookups are stored here
Returns : | The name of an icon or an absolute filename of an image to use for the file.

Since 2.2

### gnome_icon_lookup_sync ()

    char *              gnome_icon_lookup_sync              (GtkIconTheme *icon_theme,
                                                             GnomeThumbnailFactory *thumbnail_factory,
                                                             const char *file_uri,
                                                             const char *custom_icon,
                                                             GnomeIconLookupFlags flags,
                                                             GnomeIconLookupResultFlags *result);

This function tries to locate an icon in `icon_theme` that can be used to represent the file passed. See `gnome_icon_lookup()` for more information.

`icon_theme` : | a GtkIconTheme, or (deprecated) a GnomeIconTheme
`thumbnail_factory` : | an optional GnomeThumbnailFactory used to look up thumbnails
`file_uri` : | the uri of the file
`custom_icon` : | optionally the name of a custom icon to try
`flags` : | flags that affect the result of the lookup
`result` : | optionally result flags of the lookups are stored here
Returns : | The name of an icon or an absolute filename of an image to use for the file.

Since 2.2