CajaFileInfo: Caja Extension Reference Manual

## CajaFileInfo CajaFileInfo — File interface for caja extensions |

## Functions

CajaFileInfo * | caja_file_info_create ()
CajaFileInfo * | caja_file_info_create_for_uri ()
CajaFileInfo * | (*caja_file_info_getter) ()
GList * | caja_file_info_list_copy ()
void | caja_file_info_list_free ()
CajaFileInfo * | caja_file_info_lookup ()
CajaFileInfo * | caja_file_info_lookup_for_uri ()
gboolean | caja_file_info_is_gone ()
GFileType | caja_file_info_get_file_type ()
GFile * | caja_file_info_get_location ()
char * | caja_file_info_get_name ()
char * | caja_file_info_get_uri ()
char * | caja_file_info_get_activation_uri ()
GFile * | caja_file_info_get_parent_location ()
char * | caja_file_info_get_parent_uri ()
GMount * | caja_file_info_get_mount ()
char * | caja_file_info_get_uri_scheme ()
CajaFileInfo * | caja_file_info_get_parent_info ()
char * | caja_file_info_get_mime_type ()
gboolean | caja_file_info_is_mime_type ()
gboolean | caja_file_info_is_directory ()
gboolean | caja_file_info_can_write ()
void | caja_file_info_add_emblem ()
char * | caja_file_info_get_string_attribute ()
void | caja_file_info_add_string_attribute ()
void | caja_file_info_invalidate_extension_info ()

## Types and Values

#define | CAJA_FILE_DEFINED
typedef | CajaFile
typedef | CajaFileInfo
struct | CajaFileInfoIface

## Object Hierarchy

        GInterface
        ╰── CajaFileInfo

## Prerequisites

CajaFileInfo requires GObject.

## Includes

    #include <libcaja-extension/caja-file-info.h>

## Description

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

## Functions

### caja_file_info_create ()

    CajaFileInfo *
    caja_file_info_create (GFile *location);

#### Parameters

location | the location to create the file info for |

#### Returns

a CajaFileInfo.

[transfer full]

### caja_file_info_create_for_uri ()

    CajaFileInfo *
    caja_file_info_create_for_uri (const char *uri);

#### Parameters

uri | the URI to lookup the file info for |

#### Returns

a CajaFileInfo.

[transfer full]

### caja_file_info_getter ()

    CajaFileInfo *
    (*caja_file_info_getter) (GFile *location,
                              gboolean create);

### caja_file_info_list_copy ()

    GList *
    caja_file_info_list_copy (GList *files);

#### Parameters

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

#### Returns

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

[element-type CajaFileInfo][transfer full]

### caja_file_info_list_free ()

    void
    caja_file_info_list_free (GList *files);

#### Parameters

files | a list created with caja_file_info_list_copy. | [element-type CajaFileInfo]

### caja_file_info_lookup ()

    CajaFileInfo *
    caja_file_info_lookup (GFile *location);

#### Parameters

location | the location to lookup the file info for |

#### Returns

a CajaFileInfo.

[transfer full]

### caja_file_info_lookup_for_uri ()

    CajaFileInfo *
    caja_file_info_lookup_for_uri (const char *uri);

#### Parameters

uri | the URI to lookup the file info for |

#### Returns

a CajaFileInfo.

[transfer full]

### caja_file_info_is_gone ()

    gboolean
    caja_file_info_is_gone (CajaFileInfo *file);

### caja_file_info_get_file_type ()

    GFileType
    caja_file_info_get_file_type (CajaFileInfo *file);

### caja_file_info_get_location ()

    GFile *
    caja_file_info_get_location (CajaFileInfo *file);

#### Parameters

file | a CajaFileInfo |

#### Returns

a GFile for the location of `file` .

[transfer full]

### caja_file_info_get_name ()

    char *
    caja_file_info_get_name (CajaFileInfo *file);

### caja_file_info_get_uri ()

    char *
    caja_file_info_get_uri (CajaFileInfo *file);

### caja_file_info_get_activation_uri ()

    char *
    caja_file_info_get_activation_uri (CajaFileInfo *file);

### caja_file_info_get_parent_location ()

    GFile *
    caja_file_info_get_parent_location (CajaFileInfo *file);

#### Parameters

file | a CajaFileInfo |

#### Returns

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

[allow-none][transfer full]

### caja_file_info_get_parent_uri ()

    char *
    caja_file_info_get_parent_uri (CajaFileInfo *file);

### caja_file_info_get_mount ()

    GMount *
    caja_file_info_get_mount (CajaFileInfo *file);

#### Parameters

file | a CajaFileInfo |

#### Returns

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

[allow-none][transfer full]

### caja_file_info_get_uri_scheme ()

    char *
    caja_file_info_get_uri_scheme (CajaFileInfo *file);

### caja_file_info_get_parent_info ()

    CajaFileInfo *
    caja_file_info_get_parent_info (CajaFileInfo *file);

#### Parameters

file | a CajaFileInfo |

#### Returns

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

[allow-none][transfer full]

### caja_file_info_get_mime_type ()

    char *
    caja_file_info_get_mime_type (CajaFileInfo *file);

### caja_file_info_is_mime_type ()

    gboolean
    caja_file_info_is_mime_type (CajaFileInfo *file,
                                 const char *mime_type);

### caja_file_info_is_directory ()

    gboolean
    caja_file_info_is_directory (CajaFileInfo *file);

### caja_file_info_can_write ()

    gboolean
    caja_file_info_can_write (CajaFileInfo *file);

### caja_file_info_add_emblem ()

    void
    caja_file_info_add_emblem (CajaFileInfo *file,
                               const char *emblem_name);

### caja_file_info_get_string_attribute ()

    char *
    caja_file_info_get_string_attribute (CajaFileInfo *file,
                                         const char *attribute_name);

### caja_file_info_add_string_attribute ()

    void
    caja_file_info_add_string_attribute (CajaFileInfo *file,
                                         const char *attribute_name,
                                         const char *value);

### caja_file_info_invalidate_extension_info ()

    void
    caja_file_info_invalidate_extension_info
                                   (CajaFileInfo *file);

## Types and Values

### CAJA_FILE_DEFINED

    #define CAJA_FILE_DEFINED

### CajaFile

    typedef struct CajaFile            CajaFile;

### CajaFileInfo

    typedef CajaFile                   CajaFileInfo;

### struct CajaFileInfoIface

    struct CajaFileInfoIface {
        GTypeInterface g_iface;

        gboolean      (*is_gone)              (CajaFileInfo *file);

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

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

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

        char         *(*get_activation_uri)   (CajaFileInfo *file);

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

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

#### Members

`is_gone` () | Returns whether the file info is gone. See `caja_file_info_is_gone()` for details. |
`get_name` () | Returns the file name as a string. See `caja_file_info_get_name()` for details. |
`get_uri` () | Returns the file URI as a string. See `caja_file_info_get_uri()` for details. |
`get_parent_uri` () | Returns the file parent URI as a string. See `caja_file_info_get_parent_uri()` for details. |
`get_uri_scheme` () | Returns the file URI scheme as a string. See `caja_file_info_get_uri_scheme()` for details. |
`get_mime_type` () | Returns the file mime type as a string. See `caja_file_info_get_mime_type()` for details. |
`is_mime_type` () | Returns whether the file is the given mime type. See `caja_file_info_is_mime_type()` for details. |
`is_directory` () | Returns whether the file is a directory. See `caja_file_info_is_directory()` for details. |
`add_emblem` () | Adds an emblem to this file. See `caja_file_info_add_emblem()` for details. |
`get_string_attribute` () | Returns the specified file attribute as a string. See `caja_file_info_get_string_attribute()` for details. |
`add_string_attribute` () | Sets the specified string file attribute value. See `caja_file_info_add_string_attribute()` for details. |
`invalidate_extension_info` () | Invalidates information of the file provided by extensions. See `caja_file_info_invalidate_extension_info()` for details. |
`get_activation_uri` () | Returns the file activation URI as a string. See `caja_file_info_get_activation_uri()` for details. |
`get_file_type` () | Returns the file type. See `caja_file_info_get_file_type()` for details. |
`get_location` () | Returns the file location as a GFile. See `caja_file_info_get_location()` for details. |
`get_parent_location` () | Returns the file parent location as a GFile. See `caja_file_info_get_parent_location()` for details. |
`get_parent_info` () | Returns the file parent CajaFileInfo. See `caja_file_info_get_parent_info()` for details. |
`get_mount` () | Returns the file mount as a GMount. See `caja_file_info_get_mount()` for details. |
`can_write` () | Returns whether the file is writable. See `caja_file_info_can_write()` for details. |