## 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
                        IAnjutaFileSavable;
                        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);

## Object Hierarchy

      GInterface
       +----IAnjutaFileSavable

## Prerequisites

IAnjutaFileSavable requires IAnjutaFile and GObject.

## Signals

      "saved"                                          : Run Last
      "update-save-ui"                                 : Run Last

## 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()

### IAnjutaFileSavable

    typedef struct _IAnjutaFileSavable IAnjutaFileSavable;

### IAnjutaFileSavableIface

    typedef struct {
    	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);
    } IAnjutaFileSavableIface;

### ianjuta_file_savable_error_quark ()

    GQuark              ianjuta_file_savable_error_quark    (void);

Returns : |

### 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
`err` : | Error propagation and reporting

## Signal Details

### The `"saved"` signal

    void                user_function                      (IAnjutaFileSavable *obj,
                                                            GObject            *file,
                                                            gpointer            user_data)      : Run Last

This signal is emitted when the content is saved.

`obj` : | Self
`file` : | file where the content is saved or NULL if save failed
`user_data` : | user data set when the signal handler was connected.

### The `"update-save-ui"` signal

    void                user_function                      (IAnjutaFileSavable *ianjutafilesavable,
                                                            gpointer            user_data)               : Run Last

`ianjutafilesavable` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

## See Also

IAnjutaFile