## GoFileSaver

GoFileSaver

## Synopsis

    GOFileSaver*        go_file_saver_for_file_name         (char const *file_name);
    GOFileSaver*        go_file_saver_for_id                (char const *id);
    GOFileSaver*        go_file_saver_for_mime_type         (char const *mime_type);
    GOFileSaver*        go_file_saver_get_default           (void);
    charconst *         go_file_saver_get_description       (GOFileSaver const *fs);
    charconst *         go_file_saver_get_extension         (GOFileSaver const *fs);
    FileFormatLevel     go_file_saver_get_format_level      (GOFileSaver const *fs);
    charconst *         go_file_saver_get_id                (GOFileSaver const *fs);
    charconst *         go_file_saver_get_mime_type         (GOFileSaver const *fs);
    FileSaveScope       go_file_saver_get_save_scope        (GOFileSaver const *fs);
    GType               go_file_saver_get_type              (void);
    GType               go_file_saver_level_get_type        (void);
    GOFileSaver*        go_file_saver_new                   (char const *id,
                                                             char const *extension,
                                                             char const *description,
                                                             FileFormatLevel level,
                                                             GOFileSaverSaveFunc save_func);
    void                go_file_saver_register              (GOFileSaver *fs);
    void                go_file_saver_register_as_default   (GOFileSaver *fs,
                                                             gint priority);
    void                go_file_saver_save                  (GOFileSaver const *fs,
                                                             IOContext *io_context,
                                                             gconstpointer FIXME_workbook_view,
                                                             GsfOutput *output);
    GType               go_file_saver_scope_get_type        (void);
    void                go_file_saver_set_overwrite_files   (GOFileSaver *fs,
                                                             gboolean overwrite);
    void                go_file_saver_set_save_scope        (GOFileSaver *fs,
                                                             FileSaveScope scope);
    void                go_file_saver_unregister            (GOFileSaver *fs);

## Description

## Details

### go_file_saver_for_file_name ()

    GOFileSaver*        go_file_saver_for_file_name         (char const *file_name);

Searches for file saver with given `filename`, registered using go_file_opener_register

`file_name` : | name
Returns : | GOFileSaver object or NULL if opener cannot be found.

### go_file_saver_for_id ()

    GOFileSaver*        go_file_saver_for_id                (char const *id);

Searches for file saver with given `id`, registered using go_file_saver_register or register_file_opener_as_default.

`id` : | File saver's ID
Returns : | GOFileSaver object or NULL if saver cannot be found.

### go_file_saver_for_mime_type ()

    GOFileSaver*        go_file_saver_for_mime_type         (char const *mime_type);

`mime_type` : | A mime type
Returns : | A GOFileSaver object associated with `mime_type`, or `NULL`

### go_file_saver_get_default ()

    GOFileSaver*        go_file_saver_get_default           (void);

Finds file saver registered as default saver with the highest priority. Reference count for the saver is NOT incremented.

Returns : | GOFileSaver object or NULL if default saver is not available.

### go_file_saver_get_description ()

    charconst *         go_file_saver_get_description       (GOFileSaver const *fs);

`fs` : |
Returns : |

### go_file_saver_get_extension ()

    charconst *         go_file_saver_get_extension         (GOFileSaver const *fs);

`fs` : |
Returns : |

### go_file_saver_get_format_level ()

    FileFormatLevel     go_file_saver_get_format_level      (GOFileSaver const *fs);

`fs` : |
Returns : |

### go_file_saver_get_id ()

    charconst *         go_file_saver_get_id                (GOFileSaver const *fs);

`fs` : |
Returns : |

### go_file_saver_get_mime_type ()

    charconst *         go_file_saver_get_mime_type         (GOFileSaver const *fs);

`fs` : |
Returns : |

### go_file_saver_get_save_scope ()

    FileSaveScope       go_file_saver_get_save_scope        (GOFileSaver const *fs);

`fs` : |
Returns : |

### go_file_saver_get_type ()

    GType               go_file_saver_get_type              (void);

Returns : |

### go_file_saver_level_get_type ()

    GType               go_file_saver_level_get_type        (void);

Returns : |

### go_file_saver_new ()

    GOFileSaver*        go_file_saver_new                   (char const *id,
                                                             char const *extension,
                                                             char const *description,
                                                             FileFormatLevel level,
                                                             GOFileSaverSaveFunc save_func);

Creates new GOFileSaver object. Optional `id` will be used after registering it with go_file_saver_register or go_file_saver_register_as_default function.

`id` : | Optional ID of the saver (or NULL)
`extension` : | Optional default extension of saved files (or NULL)
`description` : | Description of supported file format
`level` : | File format level
`save_func` : | Pointer to "save" function
Returns : | newly created GOFileSaver object.

### go_file_saver_register ()

    void                go_file_saver_register              (GOFileSaver *fs);

Adds `fs` saver to the list of available file savers, making it available for the user when selecting file format for save.

`fs` : | GOFileSaver object

### go_file_saver_register_as_default ()

    void                go_file_saver_register_as_default   (GOFileSaver *fs,
                                                             gint priority);

Adds `fs` saver to the list of available file savers, making it available for the user when selecting file format for save. The saver is also marked as default saver with given priority. When Gnumeric needs default file saver, it chooses the one with the highest priority. Recommended range for `priority` is [0, 100].

`fs` : | GOFileSaver object
`priority` : | Saver's priority

### go_file_saver_save ()

    void                go_file_saver_save                  (GOFileSaver const *fs,
                                                             IOContext *io_context,
                                                             gconstpointer FIXME_workbook_view,
                                                             GsfOutput *output);

Saves `wbv` and the workbook it is attached to into `output` stream. Results are reported using `io_context` object, use gnumeric_io_error_occurred to find out if operation was successful. It's possible that `file_name` is created and contain some data if operation fails, you should remove the file in that case.

`fs` : | GOFileSaver object
`io_context` : | Context for i/o operation
`FIXME_workbook_view` : | Workbook View
`output` : | Output stream

### go_file_saver_scope_get_type ()

    GType               go_file_saver_scope_get_type        (void);

Returns : |

### go_file_saver_set_overwrite_files ()

    void                go_file_saver_set_overwrite_files   (GOFileSaver *fs,
                                                             gboolean overwrite);

Changes behaviour of the saver when saving a file. If `overwrite` is set to TRUE, existing file will be overwritten. Otherwise, the saver will report an error without saving anything.

`fs` : | GOFileSaver object
`overwrite` : | A boolean value saying whether the saver should overwrite existing files.

### go_file_saver_set_save_scope ()

    void                go_file_saver_set_save_scope        (GOFileSaver *fs,
                                                             FileSaveScope scope);

`fs` : |
`scope` : |

### go_file_saver_unregister ()

    void                go_file_saver_unregister            (GOFileSaver *fs);

Removes `fs` saver from list of available file savers. Reference count for the saver is decremented inside the function.

`fs` : | GOFileSaver object previously registered using go_file_saver_register or go_file_saver_register_as_default