IAnjutaFileSavable

## IAnjutaFileSavable IAnjutaFileSavable — Implemented by plugins that can save files. |

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <libanjuta/interfaces/ianjuta-file-savable.h>

    #define             IANJUTA_FILE_SAVABLE_ERROR
    struct              IAnjutaFileSavableIface;
    GQuark              ianjuta_file_savable_error_quark    (void);
    gboolean            ianjuta_file_savable_is_conflict    (IAnjutaFileSavable *obj,
                                                             GError **err);
    gboolean            ianjuta_file_savable_is_dirty       (IAnjutaFileSavable *obj,
                                                             GError **err);
    gboolean            ianjuta_file_savable_is_read_only   (IAnjutaFileSavable *obj,
                                                             GError **err);
    void                ianjuta_file_savable_save           (IAnjutaFileSavable *obj,
                                                             GError **err);
    void                ianjuta_file_savable_save_as        (IAnjutaFileSavable *obj,
                                                             GFile *file,
                                                             GError **err);
    void                ianjuta_file_savable_set_dirty      (IAnjutaFileSavable *obj,
                                                             gboolean dirty,
                                                             GError **err);

## Description

Plugins implementing IAnjutaFile inteface that can also save files should also implement this interface.

## Details

### IANJUTA_FILE_SAVABLE_ERROR

    #define IANJUTA_FILE_SAVABLE_ERROR ianjuta_file_savable_error_quark()

### struct IAnjutaFileSavableIface

    struct IAnjutaFileSavableIface {
    	IAnjutaFileIface g_iface;

    	/* Signal */
    	void (*saved) (IAnjutaFileSavable *obj, GFile* file);
    	/* Signal */
    	void (*update_save_ui) (IAnjutaFileSavable *obj);

    	gboolean (*is_conflict) (IAnjutaFileSavable *obj, GError **err);
    	gboolean (*is_dirty) (IAnjutaFileSavable *obj, GError **err);
    	gboolean (*is_read_only) (IAnjutaFileSavable *obj, GError **err);
    	void (*save) (IAnjutaFileSavable *obj, GError **err);
    	void (*save_as) (IAnjutaFileSavable *obj, GFile* file, GError **err);
    	void (*set_dirty) (IAnjutaFileSavable *obj, gboolean dirty, GError **err);
    };

### ianjuta_file_savable_error_quark ()

    GQuark              ianjuta_file_savable_error_quark    (void);

### ianjuta_file_savable_is_conflict ()

    gboolean            ianjuta_file_savable_is_conflict    (IAnjutaFileSavable *obj,
                                                             GError **err);

Return is the file is in conflict. It means the file has been modified externally and the user needs to tell which version he wants to use.

`obj` : | Self
`err` : | Error propagation and reporting
Returns : | TRUE if conflict, FALSE otherwise.

### ianjuta_file_savable_is_dirty ()

    gboolean            ianjuta_file_savable_is_dirty       (IAnjutaFileSavable *obj,
                                                             GError **err);

Returns the dirty status of the content.

`obj` : | Self
`err` : | Error propagation and reporting
Returns : | TRUE if dirty, FALSE otherwise.

### ianjuta_file_savable_is_read_only ()

    gboolean            ianjuta_file_savable_is_read_only   (IAnjutaFileSavable *obj,
                                                             GError **err);

Return is the file is read-only

`obj` : | Self
`err` : | Error propagation and reporting
Returns : | TRUE if read-only, FALSE otherwise.

### ianjuta_file_savable_save ()

    void                ianjuta_file_savable_save           (IAnjutaFileSavable *obj,
                                                             GError **err);

Saves the content to the original file from which it was loaded. The signal saved is always emitted even if the save fails.

`obj` : | Self
`err` : | Error propagation and reporting

### ianjuta_file_savable_save_as ()

    void                ianjuta_file_savable_save_as        (IAnjutaFileSavable *obj,
                                                             GFile *file,
                                                             GError **err);

Saves the content to a different File. The signal saved is always emitted even if the save fails.

`obj` : | Self
`file` : | File to save the content.
`err` : | Error propagation and reporting

### ianjuta_file_savable_set_dirty ()

    void                ianjuta_file_savable_set_dirty      (IAnjutaFileSavable *obj,
                                                             gboolean dirty,
                                                             GError **err);

if `dirty` is TRUE, sets dirty for the content. Save point will be left and the content will be considered not saved. Otherwise, content will considered saved and save-point will be entered.

`obj` : | Self
`dirty` : | Whether the file was edited or not
`err` : | Error propagation and reporting

## See Also

IAnjutaFile