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

## Properties

gchar * | description | Read / Write
gchar * | extension | Read / Write
GOFileFormatLevel | format-level | Read / Write
gchar * | id | Read / Write / Construct Only
gboolean | interactive-only | Read / Write
gchar * | mime-type | Read / Write
gboolean | overwrite | Read / Write
GOFileSaveScope | scope | Read / Write

## Signals

gboolean | set-export-options | Run Last

## 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 with given `filename` , registered using go_file_opener_register

#### Parameters

file_name | name |

#### Returns

GOFileSaver object or NULL if opener cannot be found.

[transfer none]

### 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 object or NULL if saver cannot be found.

[transfer none]

### 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` , or `NULL`.

[transfer none]

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

[transfer none]

### go_file_saver_get_description ()

    char const *
    go_file_saver_get_description (GOFileSaver const *fs);

#### Returns

### go_file_saver_get_extension ()

    char const *
    go_file_saver_get_extension (GOFileSaver const *fs);

#### Returns

### go_file_saver_get_format_level ()

    GOFileFormatLevel
    go_file_saver_get_format_level (GOFileSaver const *fs);

#### Returns

### go_file_saver_get_id ()

    char const *
    go_file_saver_get_id (GOFileSaver const *fs);

#### Returns

### go_file_saver_get_mime_type ()

    char const *
    go_file_saver_get_mime_type (GOFileSaver const *fs);

#### Returns

### go_file_saver_get_save_scope ()

    GOFileSaveScope
    go_file_saver_get_save_scope (GOFileSaver const *fs);

#### Returns

### 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 | 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. | [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);

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

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

GObjectClass `parent_class`; | parent class. |
`save` () | saves the file. |
`set_export_options` () | set the options. |

## Property Details

### The `“description”` property

      “description”              gchar *

The description of the saver.

Flags: Read / Write

Default value: NULL

### The `“extension”` property

      “extension”                gchar *

The standard file name extension of the saver.

Flags: Read / Write

Default value: NULL

### The `“format-level”` property

      “format-level”             GOFileFormatLevel

?.

Flags: Read / Write

Default value: GO_FILE_FL_NEW

### The `“id”` property

      “id”                       gchar *

The identifier of the saver.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“interactive-only”` property

      “interactive-only”         gboolean

TRUE if this saver requires interaction.

Flags: Read / Write

Default value: FALSE

### The `“mime-type”` property

      “mime-type”                gchar *

The MIME type of the saver.

Flags: Read / Write

Default value: NULL

### The `“overwrite”` property

      “overwrite”                gboolean

Whether the saver will overwrite files.

Flags: Read / Write

Default value: TRUE

### The `“scope”` property

      “scope”                    GOFileSaveScope

How much of a document is saved.

Flags: Read / Write

Default value: GO_FILE_SAVE_WORKBOOK

## Signal Details

### The `“set-export-options”` signal

    gboolean
    user_function (GOFileSaver *gofilesaver,
                   GODoc       *arg1,
                   gchar       *arg2,
                   gpointer     arg3,
                   gpointer     user_data)

#### Parameters

gofilesaver | the object which received the signal. |
user_data | user data set when the signal handler was connected. |

#### Returns

Flags: Run Last