## ide-buffer-manager ide-buffer-manager |

## Functions

IdeBuffer * | ide_buffer_manager_create_temporary_buffer ()
void | ide_buffer_manager_load_file_async ()
IdeBuffer * | ide_buffer_manager_load_file_finish ()
void | ide_buffer_manager_save_file_async ()
gboolean | ide_buffer_manager_save_file_finish ()
void | ide_buffer_manager_save_all_async ()
gboolean | ide_buffer_manager_save_all_finish ()
IdeBuffer * | ide_buffer_manager_get_focus_buffer ()
void | ide_buffer_manager_set_focus_buffer ()
GPtrArray * | ide_buffer_manager_get_buffers ()
GtkSourceCompletionWords * | ide_buffer_manager_get_word_completion ()
guint | ide_buffer_manager_get_n_buffers ()
gboolean | ide_buffer_manager_has_file ()
IdeBuffer * | ide_buffer_manager_find_buffer ()
gsize | ide_buffer_manager_get_max_file_size ()
void | ide_buffer_manager_set_max_file_size ()

## Types and Values

#define | IDE_TYPE_BUFFER_MANAGER
| IdeBufferManager

## Description

## Functions

### ide_buffer_manager_create_temporary_buffer ()

    IdeBuffer *
    ide_buffer_manager_create_temporary_buffer
                                   (IdeBufferManager *self);

Creates a new IdeBuffer that does not yet have a backing file attached to it. Interfaces should perform a save-as operation to save the file to a real file.

ide_file_get_file() will return `NULL` to denote this type of buffer.

#### Returns

A newly created IdeBuffer.

[transfer full]

### ide_buffer_manager_load_file_async ()

    void
    ide_buffer_manager_load_file_async (IdeBufferManager *self,
                                        IdeFile *file,
                                        gboolean force_reload,
                                        IdeWorkbenchOpenFlags flags,
                                        IdeProgress **progress,
                                        GCancellable *cancellable,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);

Asynchronously requests that the file represented by `file` is loaded. If the file is already loaded, the previously loaded version of the file will be returned, asynchronously.

Before loading the file, IdeBufferManager will check the file size to help protect itself from the user accidentally loading very large files. You can change the maximum size of file that will be loaded with the “max-file-size” property.

See `ide_buffer_manager_load_file_finish()` for how to complete this asynchronous request.

#### Parameters

progress | A location for an IdeProgress or `NULL`. | [out][nullable]

### ide_buffer_manager_load_file_finish ()

    IdeBuffer *
    ide_buffer_manager_load_file_finish (IdeBufferManager *self,
                                         GAsyncResult *result,
                                         GError **error);

Completes an asynchronous request to load a file via `ide_buffer_manager_load_file_async()`. If the buffer was already loaded, this function will return a reference to the previous buffer with its reference count incremented by one.

#### Returns

An IdeBuffer if successful; otherwise `NULL` and `error` is set.

[transfer full]

### ide_buffer_manager_save_file_async ()

    void
    ide_buffer_manager_save_file_async (IdeBufferManager *self,
                                        IdeBuffer *buffer,
                                        IdeFile *file,
                                        IdeProgress **progress,
                                        GCancellable *cancellable,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);

This function asynchronously requests that a buffer be saved to the storage represented by `file` . `buffer` should be a previously loaded buffer owned by `self` , such as one loaded with `ide_buffer_manager_load_file_async()`.

Call `ide_buffer_manager_save_file_finish()` to complete this asynchronous request.

### ide_buffer_manager_save_file_finish ()

    gboolean
    ide_buffer_manager_save_file_finish (IdeBufferManager *self,
                                         GAsyncResult *result,
                                         GError **error);

This function completes an asynchronous request to save a buffer to storage using `ide_buffer_manager_save_file_async()`. Upon failure, `FALSE` is returned and `error` is set.

#### Returns

`TRUE` if successful `FALSE` upon failure and `error` is set.

### ide_buffer_manager_save_all_async ()

    void
    ide_buffer_manager_save_all_async (IdeBufferManager *self,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

### ide_buffer_manager_save_all_finish ()

    gboolean
    ide_buffer_manager_save_all_finish (IdeBufferManager *self,
                                        GAsyncResult *result,
                                        GError **error);

### ide_buffer_manager_get_focus_buffer ()

    IdeBuffer *
    ide_buffer_manager_get_focus_buffer (IdeBufferManager *self);

Gets the “focus-buffer” property. This is the buffer behind the current selected view.

#### Returns

An IdeBuffer or `NULL`.

[transfer none]

### ide_buffer_manager_set_focus_buffer ()

    void
    ide_buffer_manager_set_focus_buffer (IdeBufferManager *self,
                                         IdeBuffer *buffer);

### ide_buffer_manager_get_buffers ()

    GPtrArray *
    ide_buffer_manager_get_buffers (IdeBufferManager *self);

Returns a newly allocated GPtrArray of all the buffers managed by the IdeBufferManager instance.

Buffers are generally not added to the buffer list until they have been loaded.

#### Returns

A GPtrArray of buffers.

[transfer container][element-type IdeBuffer*]

### ide_buffer_manager_get_word_completion ()

    GtkSourceCompletionWords *
    ide_buffer_manager_get_word_completion
                                   (IdeBufferManager *self);

Gets the GtkSourceCompletionWords completion provider that will complete words using the loaded documents.

#### Parameters

self | A IdeBufferManager. |

#### Returns

A GtkSourceCompletionWords.

[transfer none]

### ide_buffer_manager_get_n_buffers ()

    guint
    ide_buffer_manager_get_n_buffers (IdeBufferManager *self);

### ide_buffer_manager_has_file ()

    gboolean
    ide_buffer_manager_has_file (IdeBufferManager *self,
                                 GFile *file);

Checks to see if the buffer manager has the file loaded.

#### Parameters

self | An IdeBufferManager. | [in]
file | An IdeFile. | [in]

#### Returns

`TRUE` if `file` is loaded.

### ide_buffer_manager_find_buffer ()

    IdeBuffer *
    ide_buffer_manager_find_buffer (IdeBufferManager *self,
                                    GFile *file);

Gets the buffer for a given file. If it has not yet been loaded, `NULL` is returned.

#### Parameters

self | An IdeBufferManager. | [in]
file | A GFile. | [in]

#### Returns

An IdeBuffer or `NULL`.

[transfer none][nullable]

### ide_buffer_manager_get_max_file_size ()

    gsize
    ide_buffer_manager_get_max_file_size (IdeBufferManager *self);

Gets the “max-file-size” property. This contains the maximum file size in bytes that a file may be to be loaded by the IdeBufferManager.

If zero, no size limits will be enforced.

#### Parameters

self | An IdeBufferManager. |

#### Returns

A gsize in bytes or zero.

### ide_buffer_manager_set_max_file_size ()

    void
    ide_buffer_manager_set_max_file_size (IdeBufferManager *self,
                                          gsize max_file_size);

Sets the maximum file size in bytes, that will be loaded by the IdeBufferManager.

#### Parameters

self | An IdeBufferManager. |
max_file_size | The maximum file size in bytes, or zero for no limit. |

## Types and Values

### IDE_TYPE_BUFFER_MANAGER

    #define IDE_TYPE_BUFFER_MANAGER (ide_buffer_manager_get_type())

### IdeBufferManager

    typedef struct _IdeBufferManager IdeBufferManager;