## GOFileSaver

GOFileSaver

## Functions

void | (*GOFileSaverSaveFunc) ()
GOFileSaver * | go_file_saver_for_file_name ()
GOFileSaver * | go_file_saver_for_id ()
GOFileSaver * | go_file_saver_for_mime_type ()
GOFileSaver * | go_file_saver_get_default ()
char const * | go_file_saver_get_description ()
char const * | go_file_saver_get_extension ()
GOFileFormatLevel | go_file_saver_get_format_level ()
char const * | go_file_saver_get_id ()
char const * | go_file_saver_get_mime_type ()
GOFileSaveScope | go_file_saver_get_save_scope ()
GOFileSaver * | go_file_saver_new ()
void | go_file_saver_register ()
void | go_file_saver_register_as_default ()
void | go_file_saver_save ()
gboolean | go_file_saver_set_export_options ()
void | go_file_saver_set_overwrite_files ()
void | go_file_saver_set_save_scope ()
void | go_file_saver_unregister ()

## Types and Values

| GOFileSaver
| GOFileSaverClass

## Object Hierarchy

        GObject
        ╰── GOFileSaver

## Description

## Functions

### GOFileSaverSaveFunc ()

    void
    (*GOFileSaverSaveFunc) (GOFileSaver const *fs,
                            GOIOContext *io_context,
                            GoView const *view,
                            GsfOutput *output);

### go_file_saver_for_file_name ()

    GOFileSaver *
    go_file_saver_for_file_name (char const *file_name);

Searches for file saver matching the given `file_name` , registered using go_file_saver_register.

#### Parameters

file_name | name |

#### Returns

GOFileSaver for `file_name` .

[transfer none][nullable]

### 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.

#### Parameters

id | File saver's ID |

#### Returns

GOFileSaver with given id.

[transfer none][nullable]

### go_file_saver_for_mime_type ()

    GOFileSaver *
    go_file_saver_for_mime_type (char const *mime_type);

#### Parameters

mime_type | A mime type |

#### Returns

A GOFileSaver object associated with `mime_type` .

[transfer none][nullable]

### 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 for the highest priority default saver.

[transfer none][nullable]

### go_file_saver_get_description ()

    char const *
    go_file_saver_get_description (GOFileSaver const *fs);

#### Parameters

fs | GOFileSaver to query |

#### Returns

The description of `fs` .

[transfer none]

### go_file_saver_get_extension ()

    char const *
    go_file_saver_get_extension (GOFileSaver const *fs);

#### Parameters

fs | GOFileSaver to query |

#### Returns

The default extensions for files saved by `fs` .

[nullable][transfer none]

### go_file_saver_get_format_level ()

    GOFileFormatLevel
    go_file_saver_get_format_level (GOFileSaver const *fs);

#### Parameters

fs | GOFileSaver to query |

#### Returns

The format level of `fs` .

### go_file_saver_get_id ()

    char const *
    go_file_saver_get_id (GOFileSaver const *fs);

#### Parameters

fs | GOFileSaver to query |

#### Returns

The id of `fs` .

[nullable][transfer none]

### go_file_saver_get_mime_type ()

    char const *
    go_file_saver_get_mime_type (GOFileSaver const *fs);

#### Parameters

fs | GOFileSaver to query |

#### Returns

The mime type of the `fs` .

[nullable][transfer none]

### go_file_saver_get_save_scope ()

    GOFileSaveScope
    go_file_saver_get_save_scope (GOFileSaver const *fs);

#### Parameters

fs | GOFileSaver to query |

#### Returns

The save scope of `fs` .

### go_file_saver_new ()

    GOFileSaver *
    go_file_saver_new (char const *id,
                       char const *extension,
                       char const *description,
                       GOFileFormatLevel 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.

#### Parameters

id | ID of the saver. | [nullable]
extension | Default extension of saved files. | [nullable]
description | Description of supported file format |
level | File format level |
save_func | Pointer to "save" function. | [scope async]

#### 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.

#### Parameters

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].

#### Parameters

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

### go_file_saver_save ()

    void
    go_file_saver_save (GOFileSaver const *fs,
                        GOIOContext *io_context,
                        GoView *view,
                        GsfOutput *output);

Saves `wbv` and the workbook it is attached to into `output` stream. Results are reported using `io_context` object, use go_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.

#### Parameters

fs | GOFileSaver object |
io_context | Context for i/o operation |
view | GoView |
output | Output stream |

### go_file_saver_set_export_options ()

    gboolean
    go_file_saver_set_export_options (GOFileSaver *fs,
                                      GODoc *doc,
                                      const char *options,
                                      GError **err);

### 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.

#### Parameters

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,
                                  GOFileSaveScope 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.

#### Parameters

fs | GOFileSaver object previously registered using go_file_saver_register or go_file_saver_register_as_default |

## Types and Values

### GOFileSaver

    typedef struct _GOFileSaver GOFileSaver;

### GOFileSaverClass

    typedef struct {
    	GObjectClass parent_class;

    	/* private */
    	void (*save) (GOFileSaver const *fs,
    	              GOIOContext *io_context,
    	              GoView const *view,
    	              GsfOutput *output);

    	gboolean (*set_export_options) (GOFileSaver *fs,
    					const char *options,
    					GError **err);
    } GOFileSaverClass;

File saver base class.

#### Members

`save` () | saves the file. |
`set_export_options` () | set the options. |