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

## Functions

void | (*IdeBufferForeachFunc) ()
IdeBufferManager * | ide_buffer_manager_from_context ()
void | ide_buffer_manager_foreach ()
void | ide_buffer_manager_load_file_async ()
IdeBuffer * | ide_buffer_manager_load_file_finish ()
void | ide_buffer_manager_save_all_async ()
gboolean | ide_buffer_manager_save_all_finish ()
gboolean | ide_buffer_manager_has_file ()
IdeBuffer * | ide_buffer_manager_find_buffer ()
gssize | ide_buffer_manager_get_max_file_size ()
void | ide_buffer_manager_set_max_file_size ()
void | ide_buffer_manager_apply_edits_async ()
gboolean | ide_buffer_manager_apply_edits_finish ()

## Properties

gint64 | max-file-size | Read / Write

## Signals

void | buffer-loaded | Run Last
void | buffer-saved | Run Last
void | buffer-unloaded | Run Last
void | load-buffer | Run Last

## Types and Values

enum | IdeBufferOpenFlags
#define | IDE_TYPE_BUFFER_MANAGER
| IdeBufferManager

## Object Hierarchy

        GFlags
        ╰── IdeBufferOpenFlags
        GObject
        ╰── IdeObject
            ╰── IdeBufferManager

## Implemented Interfaces

IdeBufferManager implements GListModel.

## Description

## Functions

### IdeBufferForeachFunc ()

    void
    (*IdeBufferForeachFunc) (IdeBuffer *buffer,
                             gpointer user_data);

Callback prototype for `ide_buffer_manager_foreach()`.

#### Parameters

buffer | an IdeBuffer |
user_data | closure data |

Since: 3.32

### ide_buffer_manager_from_context ()

    IdeBufferManager *
    ide_buffer_manager_from_context (IdeContext *context);

Gets the IdeBufferManager for the IdeContext.

#### Returns

an IdeBufferManager.

[transfer none]

Since: 3.32

### ide_buffer_manager_foreach ()

    void
    ide_buffer_manager_foreach (IdeBufferManager *self,
                                IdeBufferForeachFunc foreach_func,
                                gpointer user_data);

Calls `foreach_func` for every buffer registered.

#### Parameters

self | a IdeBufferManager |
foreach_func | an IdeBufferForeachFunc. | [scope call]
user_data | closure data for `foreach_func` |

Since: 3.32

### ide_buffer_manager_load_file_async ()

    void
    ide_buffer_manager_load_file_async (IdeBufferManager *self,
                                        GFile *file,
                                        IdeBufferOpenFlags flags,
                                        IdeNotification *notif,
                                        GCancellable *cancellable,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);

Requests that `file` be loaded by the buffer manager. Depending on `flags` , this may result in a new view being displayed in a Builder workspace.

If `file` is `NULL`, then a new temporary file is created with an incrementing number to denote the document, such as "unsaved file 1".

After completion, `callback` will be executed and you can receive the buffer that was loaded with `ide_buffer_manager_load_file_finish()`.

If a buffer has already been loaded from `file` , the operation will complete using that existing buffer.

If a buffer is currently loading for `file` , the operation will complete using that existing buffer after it has completed loading.

If `notif` is non-NULL, it will be updated with status information while loading the document.

#### Parameters

self | an IdeBufferManager |
file | a GFile. | [nullable]
flags | optional flags for loading the buffer |
notif | a location for an IdeNotification, or `NULL`. | [nullable]
cancellable | a GCancellable or `NULL`. | [nullable]
callback | a callback to execute upon completion of the operation |
user_data | closure data for `callback` |

Since: 3.32

### ide_buffer_manager_load_file_finish ()

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

Completes an asynchronous request to `ide_buffer_manager_laod_file_async()`.

#### Parameters

self | an IdeBufferManager |
result | a GAsyncResult provided to callback |
error | a location for a GError, or `NULL` |

#### Returns

an IdeBuffer.

[transfer full]

Since: 3.32

### ide_buffer_manager_save_all_async ()

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

Asynchronously requests that the IdeBufferManager save all of the loaded buffers to disk.

`callback` will be executed after all the buffers have been saved.

#### Parameters

self | an IdeBufferManager |
cancellable | a GCancellable. | [nullable]
callback | a callback to execute upon completion |
user_data | closure data for `callback` |

Since: 3.32

### ide_buffer_manager_save_all_finish ()

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

Completes an asynchronous request to save all buffers.

#### Parameters

self | an IdeBufferManager |
result | a GAsyncResult |
error | a location for a GError, or `NUL` |

#### Returns

`TRUE` if all the buffers were saved successfully

Since: 3.32

### ide_buffer_manager_has_file ()

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

Checks to see if a buffer has been loaded which contains the contents of `file` .

#### Parameters

self | an IdeBufferManager |
file | a GFile |

#### Returns

`TRUE` if a buffer exists for `file`

Since: 3.32

### ide_buffer_manager_find_buffer ()

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

Locates the IdeBuffer that matches GFile, if any.

#### Parameters

self | an IdeBufferManager |
file | a GFile |

#### Returns

an IdeBuffer or `NULL`.

[transfer full]

Since: 3.32

### ide_buffer_manager_get_max_file_size ()

    gssize
    ide_buffer_manager_get_max_file_size (IdeBufferManager *self);

Gets the max file size that will be allowed to be loaded from disk. This is useful to protect Builder from files that would overload the various subsystems.

#### Parameters

self | an IdeBufferManager |

#### Returns

the max file size in bytes or -1 for unlimited

Since: 3.32

### ide_buffer_manager_set_max_file_size ()

    void
    ide_buffer_manager_set_max_file_size (IdeBufferManager *self,
                                          gssize max_file_size);

### ide_buffer_manager_apply_edits_async ()

    void
    ide_buffer_manager_apply_edits_async (IdeBufferManager *self,
                                          GPtrArray *edits,
                                          GCancellable *cancellable,
                                          GAsyncReadyCallback callback,
                                          gpointer user_data);

Asynchronously requests that all of `edits` are applied to the buffers in the project. If the buffer has not been loaded for a particular edit, it will be loaded.

`callback` should call `ide_buffer_manager_apply_edits_finish()` to get the result of this operation.

#### Parameters

self | An IdeBufferManager |
edits | An GPtrArray of IdeTextEdit. | [transfer full][element-type IdeTextEdit]
cancellable | a GCancellable or `NULL`. | [allow-none]
callback | the callback to complete the request |
user_data | user data for `callback` |

Since: 3.32

### ide_buffer_manager_apply_edits_finish ()

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

## Types and Values

### enum IdeBufferOpenFlags

The IdeBufferOpenFlags enumeration is used to specify how a document should be opened by the workbench. Plugins may want to have a bit of control over where the document is opened, and this provides a some control over that.

#### Members

IDE_BUFFER_OPEN_FLAGS_NONE | No special processing will be performed |
IDE_BUFFER_OPEN_FLAGS_BACKGROUND | Open the document in the background (behind current view) |
IDE_BUFFER_OPEN_FLAGS_NO_VIEW | Open the document but do not create a new view for it |
IDE_BUFFER_OPEN_FLAGS_FORCE_RELOAD |  |

Since: 3.32

### IDE_TYPE_BUFFER_MANAGER

    #define IDE_TYPE_BUFFER_MANAGER (ide_buffer_manager_get_type())

### IdeBufferManager

    typedef struct _IdeBufferManager IdeBufferManager;

## Property Details

### The `“max-file-size”` property

      “max-file-size”            gint64

The "max-file-size" property is the largest file size in bytes that Builder will attempt to load. Larger files will fail to load to help ensure that Builder's buffer manager does not attempt to load files that will slow the buffer management beyond usefulness.

Owner: IdeBufferManager

Flags: Read / Write

Allowed values: >= -1

Default value: 10485760

Since: 3.32

## Signal Details

### The `“buffer-loaded”` signal

    void
    user_function (IdeBufferManager *self,
                   IdeBuffer        *buffer,
                   gpointer          user_data)

The "buffer-loaded" signal is emitted when an IdeBuffer has loaded a file from storage.

#### Parameters

self | an IdeBufferManager |
buffer | an IdeBuffer |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.32

### The `“buffer-saved”` signal

    void
    user_function (IdeBufferManager *self,
                   IdeBuffer        *buffer,
                   gpointer          user_data)

The "buffer-saved" signal is emitted when an IdeBuffer has been saved to storage.

#### Parameters

self | an IdeBufferManager |
buffer | an IdeBuffer |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.32

### The `“buffer-unloaded”` signal

    void
    user_function (IdeBufferManager *self,
                   IdeBuffer        *buffer,
                   gpointer          user_data)

The "buffer-unloaded" signal is emitted when an IdeBuffer has been unloaded from the buffer manager.

#### Parameters

self | an IdeBufferManager |
buffer | an IdeBuffer |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.32

### The `“load-buffer”` signal

    void
    user_function (IdeBufferManager *idebuffermanager,
                   IdeBuffer        *arg1,
                   gboolean          arg2,
                   gpointer          user_data)

Flags: Run Last