## GOFileSaver

GOFileSaver

## Synopsis

                        GOFileSaver;
                        GOFileSaverClass;
    void                (*GOFileSaverSaveFunc)              (GOFileSaver const *fs,
                                                             GOIOContext *io_context,
                                                             GoView const *view,
                                                             GsfOutput *output);
    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);
    char const *        go_file_saver_get_description       (GOFileSaver const *fs);
    char const *        go_file_saver_get_extension         (GOFileSaver const *fs);
    GOFileFormatLevel   go_file_saver_get_format_level      (GOFileSaver const *fs);
    char const *        go_file_saver_get_id                (GOFileSaver const *fs);
    char const *        go_file_saver_get_mime_type         (GOFileSaver const *fs);
    GOFileSaveScope     go_file_saver_get_save_scope        (GOFileSaver const *fs);
    GOFileSaver *       go_file_saver_new                   (char const *id,
                                                             char const *extension,
                                                             char const *description,
                                                             GOFileFormatLevel 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,
                                                             GOIOContext *io_context,
                                                             GoView *view,
                                                             GsfOutput *output);
    gboolean            go_file_saver_set_export_options    (GOFileSaver *fs,
                                                             GODoc *doc,
                                                             const char *options,
                                                             GError **err);
    void                go_file_saver_set_overwrite_files   (GOFileSaver *fs,
                                                             gboolean overwrite);
    void                go_file_saver_set_save_scope        (GOFileSaver *fs,
                                                             GOFileSaveScope scope);
    void                go_file_saver_unregister            (GOFileSaver *fs);

## Object Hierarchy

      GObject
       +----GOFileSaver

## Properties

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

## Signals

      "set-export-options"                             : Run Last

## Description

## Details

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

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

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

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

`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);

`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);

### go_file_saver_get_extension ()

    char const *        go_file_saver_get_extension         (GOFileSaver const *fs);

### go_file_saver_get_format_level ()

    GOFileFormatLevel   go_file_saver_get_format_level      (GOFileSaver const *fs);

### go_file_saver_get_id ()

    char const *        go_file_saver_get_id                (GOFileSaver const *fs);

### go_file_saver_get_mime_type ()

    char const *        go_file_saver_get_mime_type         (GOFileSaver const *fs);

### go_file_saver_get_save_scope ()

    GOFileSaveScope     go_file_saver_get_save_scope        (GOFileSaver const *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.

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

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

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

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

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

## Property Details

### The `"description"` property

      "description"              gchar*                : Read / Write

The description of the saver.

Default value: NULL

### The `"extension"` property

      "extension"                gchar*                : Read / Write

The standard file name extension of the saver.

Default value: NULL

### The `"format-level"` property

      "format-level"             GOFileFormatLevel     : Read / Write

?.

Default value: GO_FILE_FL_NEW

### The `"id"` property

      "id"                       gchar*                : Read / Write / Construct Only

The identifier of the saver.

Default value: NULL

### The `"mime-type"` property

      "mime-type"                gchar*                : Read / Write

The MIME type of the saver.

Default value: NULL

### The `"overwrite"` property

      "overwrite"                gboolean              : Read / Write

Whether the saver will overwrite files.

Default value: TRUE

### The `"scope"` property

      "scope"                    GOFileSaveScope       : Read / Write

How much of a document is saved.

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)        : Run Last

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