GeditCommands: gedit Reference Manual

## GeditCommands

GeditCommands

## Functions

void | gedit_commands_load_location ()
GSList * | gedit_commands_load_locations ()
void | gedit_commands_save_document ()
void | gedit_commands_save_document_async ()
gboolean | gedit_commands_save_document_finish ()
void | gedit_commands_save_all_documents ()

## Description

## Functions

### gedit_commands_load_location ()

    void
    gedit_commands_load_location (GeditWindow *window,
                                  GFile *location,
                                  const GtkSourceEncoding *encoding,
                                  gint line_pos,
                                  gint column_pos);

Loads `location` . Ignores non-existing locations.

#### Parameters

window | a GeditWindow |
location | a GFile to load |
encoding | the GtkSourceEncoding of `location` . | [allow-none]
line_pos | the line position to place the cursor |
column_pos | the line column to place the cursor |

### gedit_commands_load_locations ()

    GSList *
    gedit_commands_load_locations (GeditWindow *window,
                                   const GSList *locations,
                                   const GtkSourceEncoding *encoding,
                                   gint line_pos,
                                   gint column_pos);

Loads `locations` . Ignore non-existing locations.

#### Parameters

window | a GeditWindow |
locations | the locations to load. | [element-type Gio.File]
encoding | the GtkSourceEncoding. | [allow-none]
line_pos | the line position to place the cursor |
column_pos | the line column to place the cursor |

#### Returns

the locations that were loaded.

[element-type Gedit.Document][transfer container]

### gedit_commands_save_document ()

    void
    gedit_commands_save_document (GeditWindow *window,
                                  GeditDocument *document);

Asynchronously save `document` . `document` must belong to `window` . If you need the result of the operation, use `gedit_commands_save_document_async()`.

#### Parameters

window | a GeditWindow. |
document | the GeditDocument to save. |

### gedit_commands_save_document_async ()

    void
    gedit_commands_save_document_async (GeditDocument *document,
                                        GeditWindow *window,
                                        GCancellable *cancellable,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);

Asynchronously save the `document` . `document` must belong to `window` . The source object of the async task is `document` (which will be the first parameter of the GAsyncReadyCallback).

When the operation is finished, `callback` will be called. You can then call `gedit_commands_save_document_finish()` to get the result of the operation.

#### Parameters

document | the GeditDocument to save. |
window | a GeditWindow. |
cancellable | optional GCancellable object, `NULL` to ignore. | [nullable]
callback | a GAsyncReadyCallback to call when the operation is finished. | [scope async]
user_data | the data to pass to the `callback` function. | [closure]

Since: 3.14

### gedit_commands_save_document_finish ()

    gboolean
    gedit_commands_save_document_finish (GeditDocument *document,
                                         GAsyncResult *result);

Finishes an asynchronous document saving operation started with `gedit_commands_save_document_async()`.

Note that there is no error parameter because the errors are already handled by gedit.

#### Parameters

document | a GeditDocument. |
result | a GAsyncResult. |

#### Returns

`TRUE` if the document has been correctly saved, `FALSE` otherwise.

Since: 3.14

### gedit_commands_save_all_documents ()

    void
    gedit_commands_save_all_documents (GeditWindow *window);

Asynchronously save all documents belonging to `window` . The result of the operation is not available, so it's difficult to know whether all the documents are correctly saved.

#### Parameters

window | a GeditWindow. |