ide-context: LibIDE Reference Manual

## ide-context ide-context |

## Functions

#define | IDE_TYPE_CONTEXT
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 ()
IdeDeviceManager * | ide_context_get_device_manager ()
IdeProject * | ide_context_get_project ()
GtkRecentManager * | ide_context_get_recent_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_release ()

## Properties

IdeBackForwardList * | back-forward-list | Read
IdeBufferManager * | buffer-manager | Read
IdeBuildSystem * | build-system | Read
IdeDeviceManager * | device-manager | Read
IdeProject * | project | Read
GFile * | project-file | Read / Write / Construct Only
gchar * | root-build-dir | Read / Write
IdeScriptManager * | script-manager | Read
IdeSearchEngine * | search-engine | Read
IdeSourceSnippetsManager * | snippets-manager | Read / Write
IdeUnsavedFiles * | unsaved-files | Read
IdeVcs * | vcs | Read

## Types and Values

| IdeContext

## Object Hierarchy

        GObject
        ╰── IdeContext

## Implemented Interfaces

IdeContext implements GAsyncInitable.

## Description

## Functions

### IDE_TYPE_CONTEXT

    #define IDE_TYPE_CONTEXT (ide_context_get_type())

### 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 there 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_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_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`.

[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_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 |

## Types and Values

### IdeContext

    typedef struct _IdeContext IdeContext;

## Property Details

### The `“back-forward-list”` property

      “back-forward-list”        IdeBackForwardList *

Back/forward navigation history for the context.

Flags: Read

### The `“buffer-manager”` property

      “buffer-manager”           IdeBufferManager *

The buffer manager for the context.

Flags: Read

### The `“build-system”` property

      “build-system”             IdeBuildSystem *

The build system used by the context.

Flags: Read

### The `“device-manager”` property

      “device-manager”           IdeDeviceManager *

The device manager for the context.

Flags: Read

### The `“project”` property

      “project”                  IdeProject *

The project for the context.

Flags: Read

### The `“project-file”` property

      “project-file”             GFile *

The project file for the context.

Flags: Read / Write / Construct Only

### The `“root-build-dir”` property

      “root-build-dir”           gchar *

The root directory to perform builds within.

Flags: Read / Write

Default value: NULL

### The `“script-manager”` property

      “script-manager”           IdeScriptManager *

The script manager for the context.

Flags: Read

### The `“search-engine”` property

      “search-engine”            IdeSearchEngine *

The search engine for the context.

Flags: Read

### The `“snippets-manager”` property

      “snippets-manager”         IdeSourceSnippetsManager *

The snippets manager for the context.

Flags: Read / Write

### The `“unsaved-files”` property

      “unsaved-files”            IdeUnsavedFiles *

The unsaved files in the context.

Flags: Read

### The `“vcs”` property

      “vcs”                      IdeVcs *

The VCS for the context.

Flags: Read