Top | ![]() |
![]() |
![]() |
![]() |
IdeBufferManager * | buffer-manager | Read |
IdeBuildSystem * | build-system | Read |
IdeConfigurationManager * | configuration-manager | Read |
IdeDeviceManager * | device-manager | Read |
IdeProject * | project | Read |
GFile * | project-file | Read / Write / Construct Only |
IdeRuntimeManager * | runtime-manager | Read |
IdeSearchEngine * | search-engine | Read |
IdeSnippetStorage * | snippets | Read |
IdeToolchainManager * | toolchain-manager | Read |
IdeUnsavedFiles * | unsaved-files | Read |
IdeVcs * | vcs | Read |
The IdeContext encapsulates all processing related to a project. This includes everything from project management, version control, debugging, building, running the project, and more.
The context is broken into a series of subsystems which can be accessed via accessors on the IdeContext. Some subsystems include IdeBufferManager, IdeBuildManager, IdeBuildSystem, IdeConfigurationManager, IdeDiagnosticsManager, IdeDebugManager, IdeDeviceManager, IdeRuntimeManager, IdeRunManager, IdeSearchEngine, IdeSnippetStorage, IdeTestManager, IdeProject, and IdeVcs.
If you need a long running service that has it's life-time synchronized to the lifetime of the IdeContext, you may want to use IdeService. It allows a simple addin interface to provide long-running services to your plugin.
The context can be unloaded with ide_context_unload_async()
, which should
generally only be called by the IdeWorkbench when closing the project. If
you want to prevent unloading of the context during an operation, use the
ide_context_hold()
and ide_context_release()
functions to prevent
pre-mature unloading.
GFile *
ide_context_get_project_file (IdeContext *self
);
Retrieves a GFile containing the project file that was used to load the context.
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.
IdeBuildManager *
ide_context_get_build_manager (IdeContext *self
);
IdeBuildSystem *
ide_context_get_build_system (IdeContext *self
);
Fetches the "build-system" property of context
.
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.
IdeDebugManager *
ide_context_get_debug_manager (IdeContext *self
);
Gets the debug manager for the context.
IdeDiagnosticsManager *
ide_context_get_diagnostics_manager (IdeContext *self
);
Gets the IdeDiagnosticsManager for the context.
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.
IdeProject *
ide_context_get_project (IdeContext *self
);
Retrieves the IdeProject for the context.
GSettings *
ide_context_get_project_settings (IdeContext *self
);
Gets an org.gnome.builder.project GSettings.
This creates a new GSettings instance for the project.
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.
IdeRunManager *
ide_context_get_run_manager (IdeContext *self
);
Gets the IdeRunManager for the context. This manager object simplifies the process of running an IdeBuildTarget from the build system. Primarily, it enforces that only a single target may be run at a time, since that is what the UI will expect.
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.
IdeToolchainManager *
ide_context_get_toolchain_manager (IdeContext *self
);
Gets the IdeToolchainManager for the LibIDE context.
The toolchain manager provies access to IdeToolchain instances via the GListModel interface. These can provide support for building projects using different specified toolchains.
IdeSearchEngine *
ide_context_get_search_engine (IdeContext *self
);
Retrieves the search engine for the context.
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.
self |
an IdeContext |
|
schema_id |
the GSettings schema identifier |
|
relative_path |
the path for the settings or |
[nullable] |
IdeSnippetStorage *
ide_context_get_snippets (IdeContext *self
);
Gets the “snippets” property.
Since: 3.30
IdeTestManager *
ide_context_get_test_manager (IdeContext *self
);
Gets the test manager for the IdeContext.
Since: 3.28
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.
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.
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.
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.
gboolean ide_context_unload_finish (IdeContext *self
,GAsyncResult *result
,GError **error
);
void ide_context_new_async (GFile *project_file
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
IdeContext * ide_context_new_finish (GAsyncResult *result
,GError **error
);
void ide_context_restore_async (IdeContext *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
gboolean ide_context_restore_finish (IdeContext *self
,GAsyncResult *result
,GError **error
);
void ide_context_add_pausable (IdeContext *self
,IdePausable *pausable
);
Adds a pausable which can be used to associate pausable actions with the context. Various UI in Builder may use this to present pausable actions to the user.
Since: 3.26
void ide_context_remove_pausable (IdeContext *self
,IdePausable *pausable
);
Remove a previously registered IdePausable.
Since: 3.26
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()
.
void ide_context_hold_for_object (IdeContext *self
,gpointer instance
);
Adds a hold on self
for the lifetime of instance
.
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.
void ide_context_message (IdeContext *self
,const gchar *format
,...
);
Emits a log message for the context, which is useful so that messages may be displayed to the user in the workbench window.
Thread-safety: you may call this from any thread, so long as the thread owns a reference to the context.
Since: 3.28
void ide_context_warning (IdeContext *self
,const gchar *format
,...
);
Emits a log message for the context, which is useful so that error messages may be displayed to the user in the workbench window.
Thread-safety: you may call this from any thread, so long as the thread owns a reference to the context.
void ide_context_emit_log (IdeContext *self
,GLogLevelFlags log_level
,const gchar *message
,gssize message_len
);
Emits the “log” signal, possibly after sending the message to the main loop.
Thread-safety: you may call this from any thread that holds a reference to the IdeContext object.
gchar * ide_context_build_filename (IdeContext *self
,const gchar *first_part
,...
);
Creates a new path that starts from the working directory of the loaded project.
Since: 3.28
GFile * ide_context_cache_file (IdeContext *self
,const gchar *first_part
,...
);
Like ide_context_cache_filename()
but returns a GFile.
Since: 3.28
gchar * ide_context_cache_filename (IdeContext *self
,const gchar *first_part
,...
);
Creates a new filename that will be located in the projects cache directory. This makes it convenient to remove files when a project is deleted as all cache files will share a unified parent directory.
The file will be located in a directory similar to
~/.cache/gnome-builder/project_name. This may change based on the value
of g_get_user_cache_dir()
.
Since: 3.28
IdeVcsMonitor *
ide_context_get_monitor (IdeContext *self
);
Gets a DzlRecursiveFileMonitor that monitors the project directory recursively. You can use this to track changes across the project tree without creating your own GFileMonitor.
Since: 3.28
gboolean
ide_context_is_unloading (IdeContext *self
);
Checks if ide_context_unload_async()
has been called.
You might use this to avoid starting any new work once the context has started the shutdown sequence.
Since: 3.28
GtkWidget *
ide_context_get_workbench (IdeContext *self
);
When a workbench has registered itself with this context, you can use this to get the IdeWorkbench instance.
Since: 3.30
“buffer-manager”
property“buffer-manager” IdeBufferManager *
The buffer manager for the context.
Flags: Read
“build-system”
property“build-system” IdeBuildSystem *
The build system used by the context.
Flags: Read
“configuration-manager”
property“configuration-manager” IdeConfigurationManager *
The configuration manager for the context.
Flags: Read
“device-manager”
property“device-manager” IdeDeviceManager *
The device manager for the context.
Flags: Read
“project-file”
property “project-file” GFile *
The project file for the context.
Flags: Read / Write / Construct Only
“search-engine”
property“search-engine” IdeSearchEngine *
The search engine for the context.
Flags: Read
“snippets”
property“snippets” IdeSnippetStorage *
The snippets manager for the context.
Flags: Read
“toolchain-manager”
property “toolchain-manager” IdeToolchainManager *
Toolchain Manager.
Flags: Read
“unsaved-files”
property“unsaved-files” IdeUnsavedFiles *
The unsaved files in the context.
Flags: Read
“loaded”
signalvoid user_function (IdeContext *idecontext, gpointer user_data)
This signal is emitted when loading of the context has completed. Plugins and services might want to get notified of this to perform work that requires subsystems that may not be loaded during context startup.
Flags: Run Last
“log”
signalvoid user_function (IdeContext *self, guint log_level, gchar *message, gpointer user_data)
The "log" signal is emitted when ide_context_warning()
or other log messages are sent.
self |
an IdeContext |
|
log_level |
the GLogLevelFlags |
|
message |
the log message |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 3.28