GOFileOpeners: GOffice Reference Manual

## GOFileOpeners GOFileOpeners |

## Functions

void | (*GOFileOpenerOpenFunc) ()
void | (*GOFileOpenerOpenFuncWithEnc) ()
gboolean | (*GOFileOpenerProbeFunc) ()
gboolean | go_file_opener_can_probe ()
GOFileOpener * | go_file_opener_for_id ()
char const * | go_file_opener_get_description ()
char const * | go_file_opener_get_id ()
GSList const * | go_file_opener_get_mimes ()
GSList const * | go_file_opener_get_suffixes ()
gboolean | go_file_opener_is_encoding_dependent ()
GOFileOpener * | go_file_opener_new ()
GOFileOpener * | go_file_opener_new_with_enc ()
void | go_file_opener_open ()
gboolean | go_file_opener_probe ()
void | go_file_opener_register ()
void | go_file_opener_unregister ()

## Types and Values

| GOFileOpener
| GOFileOpenerClass

## Object Hierarchy

        GObject
        ╰── GOFileOpener

## Description

## Functions

### GOFileOpenerOpenFunc ()

    void
    (*GOFileOpenerOpenFunc) (GOFileOpener const *fo,
                             GOIOContext *io_context,
                             GoView *view,
                             GsfInput *input);

### GOFileOpenerOpenFuncWithEnc ()

    void
    (*GOFileOpenerOpenFuncWithEnc) (GOFileOpener const *fo,
                                    gchar const *enc,
                                    GOIOContext *io_context,
                                    GoView *view,
                                    GsfInput *input);

### GOFileOpenerProbeFunc ()

    gboolean
    (*GOFileOpenerProbeFunc) (GOFileOpener const *fo,
                              GsfInput *input,
                              GOFileProbeLevel pl);

### go_file_opener_can_probe ()

    gboolean
    go_file_opener_can_probe (GOFileOpener const *fo,
                              GOFileProbeLevel pl);

#### Parameters

fo | GOFileOpener to query |
pl | probe level |

#### Returns

`TRUE` if `fo` has a probe function

### go_file_opener_for_id ()

    GOFileOpener *
    go_file_opener_for_id (char const *id);

Searches for file opener with given `id` , registered using go_file_opener_register

#### Parameters

id | File opener's ID |

#### Returns

GOFileOpener with given id.

[transfer none][nullable]

### go_file_opener_get_description ()

    char const *
    go_file_opener_get_description (GOFileOpener const *fo);

#### Parameters

fo | GOFileOpener to query |

#### Returns

the description of `fo` .

[transfer none]

### go_file_opener_get_id ()

    char const *
    go_file_opener_get_id (GOFileOpener const *fo);

#### Parameters

fo | GOFileOpener to query |

#### Returns

the id of `fo` .

[transfer none][nullable]

### go_file_opener_get_mimes ()

    GSList const *
    go_file_opener_get_mimes (GOFileOpener const *fo);

#### Parameters

fo | GOFileOpener to query |

#### Returns

the supported mime types.

[element-type utf8][transfer none]

### go_file_opener_get_suffixes ()

    GSList const *
    go_file_opener_get_suffixes (GOFileOpener const *fo);

#### Parameters

fo | GOFileOpener |

#### Returns

the suffixes for the supported file types.

[element-type utf8][transfer none]

### go_file_opener_is_encoding_dependent ()

    gboolean
    go_file_opener_is_encoding_dependent (GOFileOpener const *fo);

#### Parameters

fo | GOFileOpener to query |

#### Returns

`TRUE` if `fo` is encoding dependent

### go_file_opener_new ()

    GOFileOpener *
    go_file_opener_new (char const *id,
                        char const *description,
                        GSList *suffixes,
                        GSList *mimes,
                        GOFileOpenerProbeFunc probe_func,
                        GOFileOpenerOpenFunc open_func);

Creates new GOFileOpener object. Optional `id` will be used after registering it with go_file_opener_register function.

#### Parameters

id | Optional ID of the opener. | [nullable]
description | Description of supported file format |
suffixes | List of suffixes to associate with the opener. | [element-type utf8][transfer full]
mimes | List of mime types to associate with the opener. | [element-type utf8][transfer full]
probe_func | "probe" function. | [scope async][nullable]
open_func | "open" function. | [scope async]

#### Returns

newly created GOFileOpener object.

[transfer full]

### go_file_opener_new_with_enc ()

    GOFileOpener *
    go_file_opener_new_with_enc (char const *id,
                                 char const *description,
                                 GSList *suffixes,
                                 GSList *mimes,
                                 GOFileOpenerProbeFunc probe_func,
                                 GOFileOpenerOpenFuncWithEnc open_func);

Creates new GOFileOpener object. Optional `id` will be used after registering it with go_file_opener_register function.

#### Parameters

id | Optional ID of the opener. | [nullable]
description | Description of supported file format |
suffixes | List of suffixes to associate with the opener. | [element-type utf8][transfer full]
mimes | List of mime types to associate with the opener. | [element-type utf8][transfer full]
probe_func | "probe" function. | [scope async][nullable]
open_func | "open" function. | [scope async]

#### Returns

newly created GOFileOpener object.

[transfer full]

### go_file_opener_open ()

    void
    go_file_opener_open (GOFileOpener const *fo,
                         gchar const *opt_enc,
                         GOIOContext *io_context,
                         GoView *view,
                         GsfInput *input);

Reads content of `file_name` file into workbook `wbv` is attached to. Results are reported using `io_context` object, use go_io_error_occurred to find out if operation was successful. The state of `wbv` and its workbook is undefined if operation fails, you should destroy them in that case.

#### Parameters

fo | GOFileOpener object |
opt_enc | Optional encoding. | [nullable]
io_context | Context for i/o operation |
view | GoView |
input | Gsf input stream |

### go_file_opener_probe ()

    gboolean
    go_file_opener_probe (GOFileOpener const *fo,
                          GsfInput *input,
                          GOFileProbeLevel pl);

Checks if a given file is supported by the opener.

#### Parameters

fo | GOFileOpener |
input | GsfInput |
pl | GOFileProbeLevel |

#### Returns

`TRUE`, if the opener can read given file and `FALSE` otherwise.

### go_file_opener_register ()

    void
    go_file_opener_register (GOFileOpener *fo,
                             gint priority);

Adds `fo` opener to the list of available file openers, making it available for Gnumeric i/o routines. The opener is registered with given `priority` . The priority is used to determine the order in which openers will be tried when reading a file. The higher the priority, the sooner it will be tried. Default XML-based Gnumeric file opener is registered at priority 50. Recommended range for `priority` is [0, 100]. Reference count for the opener is incremented inside the function, but you don't have to (and shouldn't) call g_object_unref on it if it's floating object (for example, when you pass object newly created with go_file_opener_new and not referenced anywhere).

#### Parameters

fo | GOFileOpener object |
priority | Opener's priority |

### go_file_opener_unregister ()

    void
    go_file_opener_unregister (GOFileOpener *fo);

Removes `fo` opener from list of available file openers. Reference count for the opener is decremented inside the function.

#### Parameters

fo | GOFileOpener object previously registered using go_file_opener_register |

## Types and Values

### GOFileOpener

    typedef struct _GOFileOpener GOFileOpener;

### GOFileOpenerClass

    typedef struct {
    	GObjectClass parent_class;

    	/* private */
    	gboolean  (*can_probe) (GOFileOpener const *fo,
    				GOFileProbeLevel pl);
    	gboolean  (*probe) (GOFileOpener const *fo,
    	                    GsfInput *input,
    	                    GOFileProbeLevel pl);
    	void      (*open)  (GOFileOpener const *fo,
    			    gchar const *opt_enc,
    	                    GOIOContext *io_context,
    	                    GoView *view,
    	                    GsfInput *input);
    } GOFileOpenerClass;

File opener base class.

#### Members

`can_probe` () | returns `TRUE` if the files can be probed. |
`probe` () | probes the file. |
`open` () | opens and reads the file. |