## ide-context

ide-context

## Functions

IdeBackForwardList * | ide_context_get_back_forward_list ()
GFile * | ide_context_get_project_file ()
IdeBufferManager * | ide_context_get_buffer_manager ()
IdeBuildSystem * | ide_context_get_build_system ()
IdeConfigurationManager * | ide_context_get_configuration_manager ()
IdeDeviceManager * | ide_context_get_device_manager ()
IdeProject * | ide_context_get_project ()
GtkRecentManager * | ide_context_get_recent_manager ()
IdeRuntimeManager * | ide_context_get_runtime_manager ()
IdeScriptManager * | ide_context_get_script_manager ()
IdeSearchEngine * | ide_context_get_search_engine ()
IdeSettings * | ide_context_get_settings ()
IdeSourceSnippetsManager * | ide_context_get_snippets_manager ()
IdeUnsavedFiles * | ide_context_get_unsaved_files ()
IdeVcs * | ide_context_get_vcs ()
const gchar * | ide_context_get_root_build_dir ()
gpointer | ide_context_get_service_typed ()
void | ide_context_unload_async ()
gboolean | ide_context_unload_finish ()
void | ide_context_new_async ()
IdeContext * | ide_context_new_finish ()
void | ide_context_set_root_build_dir ()
void | ide_context_restore_async ()
gboolean | ide_context_restore_finish ()
void | ide_context_hold ()
void | ide_context_hold_for_object ()
void | ide_context_release ()
void | ide_context_warning ()

## Types and Values

#define | IDE_TYPE_CONTEXT
| IdeContext

## Description

## Functions

### ide_context_get_back_forward_list ()

    IdeBackForwardList *
    ide_context_get_back_forward_list (IdeContext *self);

Retrieves the global back forward list for the IdeContext.

Consumers of this should branch the IdeBackForwardList and merge them when their document stack is closed.

See `ide_back_forward_list_branch()` and `ide_back_forward_list_merge()` for more information.

#### Returns

An IdeBackForwardList.

[transfer none]

### ide_context_get_project_file ()

    GFile *
    ide_context_get_project_file (IdeContext *self);

Retrieves a GFile containing the project file that was used to load the context.

#### Returns

A GFile.

[transfer none]

### ide_context_get_buffer_manager ()

    IdeBufferManager *
    ide_context_get_buffer_manager (IdeContext *self);

Gets the “buffer-manager” property. The buffer manager is responsible for loading and saving buffers (files) within the IdeContext. It provides a convenient place for scripts to hook into the load and save process.

#### Returns

An IdeBufferManager.

[transfer none]

### ide_context_get_build_system ()

    IdeBuildSystem *
    ide_context_get_build_system (IdeContext *self);

Fetches the "build-system" property of `context` .

#### Returns

An IdeBuildSystem.

[transfer none]

### ide_context_get_configuration_manager ()

    IdeConfigurationManager *
    ide_context_get_configuration_manager (IdeContext *self);

Gets the IdeConfigurationManager for the context.

The configuration manager is responsible for loading and saving configurations. Configurations consist of information about how to perform a particular build. Such information includes the target IdeDevice, the IdeRuntime to use, and various other build options.

#### Parameters

self | An IdeContext |

#### Returns

An IdeConfigurationManager.

[transfer none]

### ide_context_get_device_manager ()

    IdeDeviceManager *
    ide_context_get_device_manager (IdeContext *self);

Retrieves the "device-manager" property. The device manager is responsible for connecting and disconnecting to physical or virtual devices within LibIDE.

#### Returns

An IdeDeviceManager.

[transfer none]

### ide_context_get_project ()

    IdeProject *
    ide_context_get_project (IdeContext *self);

Retrieves the IdeProject for the context.

#### Returns

An IdeContext.

[transfer none]

### ide_context_get_recent_manager ()

    GtkRecentManager *
    ide_context_get_recent_manager (IdeContext *self);

Gets the IdeContext:recent-manager property. The recent manager is a GtkRecentManager instance that should be used for the workbench.

#### Returns

A GtkRecentManager.

[transfer none]

### ide_context_get_runtime_manager ()

    IdeRuntimeManager *
    ide_context_get_runtime_manager (IdeContext *self);

Gets the IdeRuntimeManager for the LibIDE context.

The runtime manager provies access to IdeRuntime instances via the GListModel interface. These can provide support for building projects in various runtimes such as xdg-app.

#### Parameters

self | An IdeContext |

#### Returns

An IdeRuntimeManager.

[transfer none]

### ide_context_get_script_manager ()

    IdeScriptManager *
    ide_context_get_script_manager (IdeContext *self);

Retrieves the script manager for the context.

#### Returns

An IdeScriptManager.

[transfer none]

### ide_context_get_search_engine ()

    IdeSearchEngine *
    ide_context_get_search_engine (IdeContext *self);

Retrieves the search engine for the context.

#### Returns

An IdeSearchEngine.

[transfer none]

### ide_context_get_settings ()

    IdeSettings *
    ide_context_get_settings (IdeContext *self,
                              const gchar *schema_id,
                              const gchar *relative_path);

Gets an IdeSettings representing the given GSettingsSchema.

relative_path will be used to apply multiple layers of settings. Project settings will be applied to first, followed by global settings.

#### Returns

An IdeSettings.

[transfer full]

### ide_context_get_snippets_manager ()

    IdeSourceSnippetsManager *
    ide_context_get_snippets_manager (IdeContext *self);

Gets the “snippets-manager” property.

#### Returns

An IdeSourceSnippetsManager.

[transfer none]

### ide_context_get_unsaved_files ()

    IdeUnsavedFiles *
    ide_context_get_unsaved_files (IdeContext *self);

Returns the unsaved files for the IdeContext. These are the contents of open buffers in the IDE.

#### Returns

An IdeUnsavedFiles.

[transfer none]

### ide_context_get_vcs ()

    IdeVcs *
    ide_context_get_vcs (IdeContext *self);

Retrieves the IdeVcs used to load the project. If no version control system could be found, this will return an IdeDirectoryVcs.

#### Returns

An IdeVcs.

[transfer none]

### ide_context_get_root_build_dir ()

    const gchar *
    ide_context_get_root_build_dir (IdeContext *self);

Retrieves the "root-build-dir" for the context. This is the root directory that will contain builds made for various devices.

#### Returns

A string containing the "root-build-dir" property.

### ide_context_get_service_typed ()

    gpointer
    ide_context_get_service_typed (IdeContext *self,
                                   GType service_type);

Retrieves a service matching `service_type` . If no match was found, a type implementing the requested service type will be returned. If no matching service type could be found, then an instance of the service will be created, started, and returned.

#### Parameters

service_type | A GType of the service desired. |

#### Returns

An IdeService or `NULL`.

[type Ide.Service][transfer none][nullable]

### ide_context_unload_async ()

    void
    ide_context_unload_async (IdeContext *self,
                              GCancellable *cancellable,
                              GAsyncReadyCallback callback,
                              gpointer user_data);

This function attempts to unload various components in the IdeContext. This should be called before you dispose the context. Unsaved buffers will be persisted to the drafts directory. More operations may be added in the future.

If there is a hold on the IdeContext, created by `ide_context_hold()`, then the unload request will be delayed until the appropriate number of calls to `ide_context_release()` have been called.

### ide_context_unload_finish ()

    gboolean
    ide_context_unload_finish (IdeContext *self,
                               GAsyncResult *result,
                               GError **error);

### ide_context_new_async ()

    void
    ide_context_new_async (GFile *project_file,
                           GCancellable *cancellable,
                           GAsyncReadyCallback callback,
                           gpointer user_data);

### ide_context_new_finish ()

    IdeContext *
    ide_context_new_finish (GAsyncResult *result,
                            GError **error);

#### Returns

An IdeContext or `NULL` upon failure and `error` is set.

[transfer full]

### ide_context_set_root_build_dir ()

    void
    ide_context_set_root_build_dir (IdeContext *self,
                                    const gchar *root_build_dir);

Sets the "root-build-dir" property. This is the root directory that will be used when building projects for projects that support building out of tree.

#### Parameters

root_build_dir | the path to the root build directory. |

### ide_context_restore_async ()

    void
    ide_context_restore_async (IdeContext *self,
                               GCancellable *cancellable,
                               GAsyncReadyCallback callback,
                               gpointer user_data);

### ide_context_restore_finish ()

    gboolean
    ide_context_restore_finish (IdeContext *self,
                                GAsyncResult *result,
                                GError **error);

### ide_context_hold ()

    void
    ide_context_hold (IdeContext *self);

Puts a hold on the IdeContext, preventing the context from being unloaded until a call to `ide_context_release()`.

If `ide_context_unload_async()` is called while a hold is in progress, the unload will be delayed until `ide_context_release()` has been called the same number of times as `ide_context_hold()`.

#### Parameters

self | the IdeContext |

### ide_context_hold_for_object ()

    void
    ide_context_hold_for_object (IdeContext *self,
                                 gpointer instance);

Adds a hold on `self` for the lifetime of `instance` .

#### Parameters

self | An IdeContext |
instance | A GObject instance. | [type GObject.Object]

### ide_context_release ()

    void
    ide_context_release (IdeContext *self);

Releases a hold on the context previously created with `ide_context_hold()`.

If a pending unload of the context has been requested, it will be dispatched once the hold count reaches zero.

#### Parameters

self | the IdeContext |

### ide_context_warning ()

    void
    ide_context_warning (IdeContext *self,
                         const gchar *format,
                         ...);

## Types and Values

### IDE_TYPE_CONTEXT

    #define IDE_TYPE_CONTEXT (ide_context_get_type())

### IdeContext

    typedef struct _IdeContext IdeContext;