## PeonyFileInfo

PeonyFileInfo — File interface for peony extensions

## Functions

PeonyFileInfo * | peony_file_info_create ()
PeonyFileInfo * | peony_file_info_create_for_uri ()
PeonyFileInfo * | (*peony_file_info_getter) ()
GList * | peony_file_info_list_copy ()
void | peony_file_info_list_free ()
PeonyFileInfo * | peony_file_info_lookup ()
PeonyFileInfo * | peony_file_info_lookup_for_uri ()
gboolean | peony_file_info_is_gone ()
GFileType | peony_file_info_get_file_type ()
GFile * | peony_file_info_get_location ()
char * | peony_file_info_get_name ()
char * | peony_file_info_get_uri ()
char * | peony_file_info_get_activation_uri ()
GFile * | peony_file_info_get_parent_location ()
char * | peony_file_info_get_parent_uri ()
GMount * | peony_file_info_get_mount ()
char * | peony_file_info_get_uri_scheme ()
PeonyFileInfo * | peony_file_info_get_parent_info ()
char * | peony_file_info_get_mime_type ()
gboolean | peony_file_info_is_mime_type ()
gboolean | peony_file_info_is_directory ()
gboolean | peony_file_info_can_write ()
void | peony_file_info_add_emblem ()
char * | peony_file_info_get_string_attribute ()
void | peony_file_info_add_string_attribute ()
void | peony_file_info_invalidate_extension_info ()

## Types and Values

#define | PEONY_FILE_DEFINED
typedef | PeonyFile
typedef | PeonyFileInfo
struct | PeonyFileInfoIface

## Object Hierarchy

        GInterface
        ╰── PeonyFileInfo

## Prerequisites

PeonyFileInfo requires GObject.

## Includes

    #include <libpeony-extension/peony-file-info.h>

## Description

PeonyFileInfo provides methods to get and modify information about file objects in the file manager.

## Functions

### peony_file_info_create ()

    PeonyFileInfo *
    peony_file_info_create (GFile *location);

#### Parameters

location | the location to create the file info for |

#### Returns

a PeonyFileInfo.

[transfer full]

### peony_file_info_create_for_uri ()

    PeonyFileInfo *
    peony_file_info_create_for_uri (const char *uri);

#### Parameters

uri | the URI to lookup the file info for |

#### Returns

a PeonyFileInfo.

[transfer full]

### peony_file_info_getter ()

    PeonyFileInfo *
    (*peony_file_info_getter) (GFile *location,
                               gboolean create);

### peony_file_info_list_copy ()

    GList *
    peony_file_info_list_copy (GList *files);

#### Parameters

files | the files to copy. | [element-type PeonyFileInfo]

#### Returns

a copy of `files` . Use peony_file_info_list_free to free the list and unref its contents.

[element-type PeonyFileInfo][transfer full]

### peony_file_info_list_free ()

    void
    peony_file_info_list_free (GList *files);

#### Parameters

files | a list created with peony_file_info_list_copy. | [element-type PeonyFileInfo]

### peony_file_info_lookup ()

    PeonyFileInfo *
    peony_file_info_lookup (GFile *location);

#### Parameters

location | the location to lookup the file info for |

#### Returns

a PeonyFileInfo.

[transfer full]

### peony_file_info_lookup_for_uri ()

    PeonyFileInfo *
    peony_file_info_lookup_for_uri (const char *uri);

#### Parameters

uri | the URI to lookup the file info for |

#### Returns

a PeonyFileInfo.

[transfer full]

### peony_file_info_is_gone ()

    gboolean
    peony_file_info_is_gone (PeonyFileInfo *file);

### peony_file_info_get_file_type ()

    GFileType
    peony_file_info_get_file_type (PeonyFileInfo *file);

### peony_file_info_get_location ()

    GFile *
    peony_file_info_get_location (PeonyFileInfo *file);

#### Parameters

file | a PeonyFileInfo |

#### Returns

a GFile for the location of `file` .

[transfer full]

### peony_file_info_get_name ()

    char *
    peony_file_info_get_name (PeonyFileInfo *file);

### peony_file_info_get_uri ()

    char *
    peony_file_info_get_uri (PeonyFileInfo *file);

### peony_file_info_get_activation_uri ()

    char *
    peony_file_info_get_activation_uri (PeonyFileInfo *file);

### peony_file_info_get_parent_location ()

    GFile *
    peony_file_info_get_parent_location (PeonyFileInfo *file);

#### Parameters

file | a PeonyFileInfo |

#### Returns

a GFile for the parent location of `file` , or `NULL` if `file` has no parent.

[allow-none][transfer full]

### peony_file_info_get_parent_uri ()

    char *
    peony_file_info_get_parent_uri (PeonyFileInfo *file);

### peony_file_info_get_mount ()

    GMount *
    peony_file_info_get_mount (PeonyFileInfo *file);

#### Parameters

file | a PeonyFileInfo |

#### Returns

a GMount for the mount of `file` , or `NULL` if `file` has no mount.

[allow-none][transfer full]

### peony_file_info_get_uri_scheme ()

    char *
    peony_file_info_get_uri_scheme (PeonyFileInfo *file);

### peony_file_info_get_parent_info ()

    PeonyFileInfo *
    peony_file_info_get_parent_info (PeonyFileInfo *file);

#### Parameters

file | a PeonyFileInfo |

#### Returns

a PeonyFileInfo for the parent of `file` , or `NULL` if `file` has no parent.

[allow-none][transfer full]

### peony_file_info_get_mime_type ()

    char *
    peony_file_info_get_mime_type (PeonyFileInfo *file);

### peony_file_info_is_mime_type ()

    gboolean
    peony_file_info_is_mime_type (PeonyFileInfo *file,
                                  const char *mime_type);

### peony_file_info_is_directory ()

    gboolean
    peony_file_info_is_directory (PeonyFileInfo *file);

### peony_file_info_can_write ()

    gboolean
    peony_file_info_can_write (PeonyFileInfo *file);

### peony_file_info_add_emblem ()

    void
    peony_file_info_add_emblem (PeonyFileInfo *file,
                                const char *emblem_name);

### peony_file_info_get_string_attribute ()

    char *
    peony_file_info_get_string_attribute (PeonyFileInfo *file,
                                          const char *attribute_name);

### peony_file_info_add_string_attribute ()

    void
    peony_file_info_add_string_attribute (PeonyFileInfo *file,
                                          const char *attribute_name,
                                          const char *value);

### peony_file_info_invalidate_extension_info ()

    void
    peony_file_info_invalidate_extension_info
                                   (PeonyFileInfo *file);

## Types and Values

### PEONY_FILE_DEFINED

    #define PEONY_FILE_DEFINED

### PeonyFile

    typedef struct PeonyFile            PeonyFile;

### PeonyFileInfo

    typedef PeonyFile                   PeonyFileInfo;

### struct PeonyFileInfoIface

    struct PeonyFileInfoIface {
        GTypeInterface g_iface;

        gboolean      (*is_gone)              (PeonyFileInfo *file);

        char         *(*get_name)             (PeonyFileInfo *file);
        char         *(*get_uri)              (PeonyFileInfo *file);
        char         *(*get_parent_uri)       (PeonyFileInfo *file);
        char         *(*get_uri_scheme)       (PeonyFileInfo *file);

        char         *(*get_mime_type)        (PeonyFileInfo *file);
        gboolean      (*is_mime_type)         (PeonyFileInfo *file,
                                               const char   *mime_Type);
        gboolean      (*is_directory)         (PeonyFileInfo *file);

        void          (*add_emblem)           (PeonyFileInfo *file,
                                               const char   *emblem_name);
        char         *(*get_string_attribute) (PeonyFileInfo *file,
                                               const char   *attribute_name);
        void          (*add_string_attribute) (PeonyFileInfo *file,
                                               const char   *attribute_name,
                                               const char   *value);
        void          (*invalidate_extension_info) (PeonyFileInfo *file);

        char         *(*get_activation_uri)   (PeonyFileInfo *file);

        GFileType     (*get_file_type)        (PeonyFileInfo *file);
        GFile        *(*get_location)         (PeonyFileInfo *file);
        GFile        *(*get_parent_location)  (PeonyFileInfo *file);
        PeonyFileInfo *(*get_parent_info)      (PeonyFileInfo *file);
        GMount       *(*get_mount)            (PeonyFileInfo *file);
        gboolean      (*can_write)            (PeonyFileInfo *file);
    };

Interface for extensions to get and modify information about file objects.

#### Members

`is_gone` () | Returns whether the file info is gone. See `peony_file_info_is_gone()` for details. |
`get_name` () | Returns the file name as a string. See `peony_file_info_get_name()` for details. |
`get_uri` () | Returns the file URI as a string. See `peony_file_info_get_uri()` for details. |
`get_parent_uri` () | Returns the file parent URI as a string. See `peony_file_info_get_parent_uri()` for details. |
`get_uri_scheme` () | Returns the file URI scheme as a string. See `peony_file_info_get_uri_scheme()` for details. |
`get_mime_type` () | Returns the file mime type as a string. See `peony_file_info_get_mime_type()` for details. |
`is_mime_type` () | Returns whether the file is the given mime type. See `peony_file_info_is_mime_type()` for details. |
`is_directory` () | Returns whether the file is a directory. See `peony_file_info_is_directory()` for details. |
`add_emblem` () | Adds an emblem to this file. See `peony_file_info_add_emblem()` for details. |
`get_string_attribute` () | Returns the specified file attribute as a string. See `peony_file_info_get_string_attribute()` for details. |
`add_string_attribute` () | Sets the specified string file attribute value. See `peony_file_info_add_string_attribute()` for details. |
`invalidate_extension_info` () | Invalidates information of the file provided by extensions. See `peony_file_info_invalidate_extension_info()` for details. |
`get_activation_uri` () | Returns the file activation URI as a string. See `peony_file_info_get_activation_uri()` for details. |
`get_file_type` () | Returns the file type. See `peony_file_info_get_file_type()` for details. |
`get_location` () | Returns the file location as a GFile. See `peony_file_info_get_location()` for details. |
`get_parent_location` () | Returns the file parent location as a GFile. See `peony_file_info_get_parent_location()` for details. |
`get_parent_info` () | Returns the file parent PeonyFileInfo. See `peony_file_info_get_parent_info()` for details. |
`get_mount` () | Returns the file mount as a GMount. See `peony_file_info_get_mount()` for details. |
`can_write` () | Returns whether the file is writable. See `peony_file_info_can_write()` for details. |