IdeWorkbench

IdeWorkbench — window group for all windows within a project

Functions

Properties

IdeContext * context Read / Write / Construct Only
IdeVcs * vcs Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GtkWindowGroup
        ╰── IdeWorkbench

Implemented Interfaces

IdeWorkbench implements GActionGroup.

Description

The IdeWorkbench is a GtkWindowGroup containing the IdeContext (root data-structure for a project) and all of the windows associated with the project.

Usually, windows within the IdeWorkbench are an IdeWorkspace. They can react to changes in the IdeContext or its descendants to represent the project and it's state.

Functions

ide_workbench_new ()

IdeWorkbench *
ide_workbench_new (void);

Creates a new IdeWorkbench.

This does not create any windows, you'll need to request that a workspace be created based on the kind of workspace you want to display to the user.

Returns

an IdeWorkbench

Since: 3.32


ide_workbench_new_for_context ()

IdeWorkbench *
ide_workbench_new_for_context (IdeContext *context);

Creates a new IdeWorkbench using context for the “context”.

Returns

an IdeWorkbench.

[transfer full]

Since: 3.32


ide_workbench_activate ()

void
ide_workbench_activate (IdeWorkbench *self);

This function will attempt to raise the most recently focused workspace.

Parameters

self

a IdeWorkbench

 

Since: 3.32


ide_workbench_get_project_info ()

IdeProjectInfo *
ide_workbench_get_project_info (IdeWorkbench *self);

Gets the IdeProjectInfo for the workbench, if a project has been or is currently, loading.

Parameters

self

a IdeWorkbench

 

Returns

an IdeProjectInfo or NULL.

[transfer none][nullable]

Since: 3.32


ide_workbench_has_project ()

gboolean
ide_workbench_has_project (IdeWorkbench *self);

Returns TRUE if a project is loaded (or currently loading) in the workbench.

Parameters

self

a IdeWorkbench

 

Returns

TRUE if the workbench has a project

Since: 3.32


ide_workbench_get_context ()

IdeContext *
ide_workbench_get_context (IdeWorkbench *self);

Gets the IdeContext for the workbench.

Parameters

self

an IdeWorkbench

 

Returns

an IdeContext.

[transfer none]

Since: 3.32


ide_workbench_get_current_workspace ()

IdeWorkspace *
ide_workbench_get_current_workspace (IdeWorkbench *self);

Gets the most recently focused workspace, which may be used to deliver events such as opening new pages.

Parameters

self

a IdeWorkbench

 

Returns

an IdeWorkspace or NULL.

[transfer none][nullable]

Since: 3.32


ide_workbench_get_workspace_by_type ()

IdeWorkspace *
ide_workbench_get_workspace_by_type (IdeWorkbench *self,
                                     GType type);

Gets the most-recently-used workspace that matches type .

Parameters

self

a IdeWorkbench

 

type

a GType of a subclass of IdeWorkspace

 

Returns

an IdeWorkspace or NULL.

[transfer none][nullable]

Since: 3.32


ide_workbench_get_search_engine ()

IdeSearchEngine *
ide_workbench_get_search_engine (IdeWorkbench *self);

Gets the search engine for the workbench, if any.

Parameters

self

a IdeWorkbench

 

Returns

an IdeSearchEngine.

[transfer none]

Since: 3.32


ide_workbench_from_widget ()

IdeWorkbench *
ide_workbench_from_widget (GtkWidget *widget);

Finds the IdeWorkbench associated with a widget.

Parameters

widget

a GtkWidget

 

Returns

an IdeWorkbench or NULL.

[nullable][transfer none]

Since: 3.32


ide_workbench_add_workspace ()

void
ide_workbench_add_workspace (IdeWorkbench *self,
                             IdeWorkspace *workspace);

Adds workspace to workbench .

Parameters

self

an IdeWorkbench

 

workspace

an IdeWorkspace

 

Since: 3.32


ide_workbench_remove_workspace ()

void
ide_workbench_remove_workspace (IdeWorkbench *self,
                                IdeWorkspace *workspace);

Removes workspace from workbench .

Parameters

self

an IdeWorkbench

 

workspace

an IdeWorkspace

 

Since: 3.32


ide_workbench_focus_workspace ()

void
ide_workbench_focus_workspace (IdeWorkbench *self,
                               IdeWorkspace *workspace);

Requests that workspace be raised in the windows of self , and displayed to the user.

Parameters

self

an IdeWorkbench

 

workspace

an IdeWorkspace

 

Since: 3.32


ide_workbench_foreach_workspace ()

void
ide_workbench_foreach_workspace (IdeWorkbench *self,
                                 GtkCallback callback,
                                 gpointer user_data);

Iterates the available workspaces in the workbench. Workspaces are iterated in most-recently-used order.

Parameters

self

an IdeWorkbench

 

callback

a GtkCallback to call for each IdeWorkspace.

[scope call]

user_data

user data for callback

 

Since: 3.32


ide_workbench_foreach_page ()

void
ide_workbench_foreach_page (IdeWorkbench *self,
                            GtkCallback callback,
                            gpointer user_data);

Calls callback for every page loaded in the workbench, by iterating workspaces in order of most-recently-used.

Parameters

self

a IdeWorkbench

 

callback

a callback to execute for each page.

[scope call]

user_data

closure data for callback

 

Since: 3.32


ide_workbench_load_project_async ()

void
ide_workbench_load_project_async (IdeWorkbench *self,
                                  IdeProjectInfo *project_info,
                                  GType workspace_type,
                                  GCancellable *cancellable,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);

Requests that a project be opened in the workbench.

project_info should contain enough information to discover and load the project. Depending on the various fields of the IdeProjectInfo, different plugins may become active as part of loading the project.

Note that this may only be called once for an IdeWorkbench. If you need to open a second project, you need to create and register a second workbench first, and then open using that secondary workbench.

callback should call ide_workbench_load_project_finish() to obtain the result of the open request.

Parameters

self

a IdeWorkbench

 

project_info

an IdeProjectInfo describing the project to open

 

cancellable

a GCancellable or NULL.

[nullable]

callback

a GAsyncReadyCallback to execute upon completion.

[nullable]

user_data

user data for callback

 

Since: 3.32


ide_workbench_load_project_finish ()

gboolean
ide_workbench_load_project_finish (IdeWorkbench *self,
                                   GAsyncResult *result,
                                   GError **error);

Completes an asynchronous request to open a project using ide_workbench_load_project_async().

Parameters

self

a IdeWorkbench

 

Returns

TRUE if the project was successfully opened; otherwise FALSE and error is set.

Since: 3.32


ide_workbench_unload_async ()

void
ide_workbench_unload_async (IdeWorkbench *self,
                            GCancellable *cancellable,
                            GAsyncReadyCallback callback,
                            gpointer user_data);

Asynchronously unloads the workbench.

All IdeWorkspace windows will be closed after calling this function.

Parameters

self

an IdeWorkbench

 

cancellable

a GCancellable.

[nullable]

callback

a GAsyncReadyCallback to execute upon completion

 

user_data

closure data for callback

 

Since: 3.32


ide_workbench_unload_finish ()

gboolean
ide_workbench_unload_finish (IdeWorkbench *self,
                             GAsyncResult *result,
                             GError **error);

Completes a request to unload the workbench.

Parameters

self

an IdeWorkbench

 

result

a GAsyncResult provided to callback

 

error

a location for a GError, or NULL

 

Returns

TRUE if the workbench was unloaded successfully, otherwise FALSE and error is set.

Since: 3.32


ide_workbench_open_async ()

void
ide_workbench_open_async (IdeWorkbench *self,
                          GFile *file,
                          const gchar *hint,
                          IdeBufferOpenFlags flags,
                          GCancellable *cancellable,
                          GAsyncReadyCallback callback,
                          gpointer user_data);

Requests that the workbench open file .

If hint is provided, that will be used to determine what workbench addin to use when opening the file. The hint name should match the module name of the plugin.

flags may be ignored by some backends.

Parameters

self

an IdeWorkbench

 

file

a GFile

 

hint

an optional hint about what addin to use.

[nullable]

flags

optional flags when opening the file

 

cancellable

a GCancellable.

[nullable]

callback

a GAsyncReadyCallback to execute upon completion

 

user_data

closure data for callback

 

Since: 3.32


ide_workbench_open_at_async ()

void
ide_workbench_open_at_async (IdeWorkbench *self,
                             GFile *file,
                             const gchar *hint,
                             gint at_line,
                             gint at_line_offset,
                             IdeBufferOpenFlags flags,
                             GCancellable *cancellable,
                             GAsyncReadyCallback callback,
                             gpointer user_data);

Like ide_workbench_open_async(), this allows opening a file within the workbench. However, it also allows specifying a line and column offset within the file to focus. Usually, this only makes sense for files that can be opened in an editor.

at_line and at_line_offset may be < 0 to ignore the parameters.

flags may be ignored by some backends

Use ide_workbench_open_finish() to receive teh result of this asynchronous operation.

Parameters

self

an IdeWorkbench

 

file

a GFile

 

hint

an optional hint about what addin to use.

[nullable]

at_line

the line number to open at, or -1 to ignore

 

at_line_offset

the line offset to open at, or -1 to ignore

 

flags

optional IdeBufferOpenFlags

 

cancellable

a GCancellable.

[nullable]

callback

a GAsyncReadyCallback to execute upon completion

 

user_data

closure data for callback

 

Since: 3.32


ide_workbench_open_all_async ()

void
ide_workbench_open_all_async (IdeWorkbench *self,
                              GFile **files,
                              guint n_files,
                              const gchar *hint,
                              GCancellable *cancellable,
                              GAsyncReadyCallback callback,
                              gpointer user_data);

Requests that the workbench open all of the GFile denoted by files .

If hint is provided, that will be used to determine what workbench addin to use when opening the file. The hint name should match the module name of the plugin.

Call ide_workbench_open_finish() from callback to complete this operation.

Parameters

self

an IdeWorkbench

 

files

an array of GFile.

[array length=n_files]

n_files

number of GFiles contained in files

 

hint

an optional hint about what addin to use.

[nullable]

cancellable

a GCancellable.

[nullable]

callback

a GAsyncReadyCallback to execute upon completion

 

user_data

closure data for callback

 

Since: 3.32


ide_workbench_open_finish ()

gboolean
ide_workbench_open_finish (IdeWorkbench *self,
                           GAsyncResult *result,
                           GError **error);

Completes a request to open a file using either ide_workbench_open_async() or ide_workbench_open_at_async().

Parameters

self

an IdeWorkbench

 

result

a GAsyncResult provided to callback

 

error

a location for a GError, or NULL

 

Returns

TRUE if the file was successfully opened; otherwise FALSE and error is set.

Since: 3.32


ide_workbench_get_vcs ()

IdeVcs *
ide_workbench_get_vcs (IdeWorkbench *self);

Gets the IdeVcs that has been loaded for the workbench, if any.

Parameters

self

a IdeWorkbench

 

Returns

an IdeVcs or NULL.

[transfer none][nullable]

Since: 3.32


ide_workbench_set_vcs ()

void
ide_workbench_set_vcs (IdeWorkbench *self,
                       IdeVcs *vcs);

Sets the IdeVcs for the workbench.

Parameters

self

a IdeWorkbench

 

vcs

an IdeVcs.

[nullable]

Since: 3.32


ide_workbench_get_vcs_monitor ()

IdeVcsMonitor *
ide_workbench_get_vcs_monitor (IdeWorkbench *self);

Gets the IdeVcsMonitor for the workbench, if any.

Parameters

self

a IdeWorkbench

 

Returns

an IdeVcsMonitor or NULL.

[transfer none][nullable]

Since: 3.32


ide_workbench_get_build_system ()

IdeBuildSystem *
ide_workbench_get_build_system (IdeWorkbench *self);

Gets the IdeBuildSystem for the workbench, if any.

Parameters

self

a IdeWorkbench

 

Returns

an IdeBuildSystem or NULL.

[transfer none][nullable]

Since: 3.32


ide_workbench_set_build_system ()

void
ide_workbench_set_build_system (IdeWorkbench *self,
                                IdeBuildSystem *build_system);

Sets the IdeBuildSystem for the workbench.

If build_system is NULL, then a fallback build system will be used instead. It does not provide building capabilities, but allows for some components that require a build system to continue functioning.

Parameters

self

a IdeWorkbench

 

build_system

an IdeBuildSystem or NULL.

[nullable]

Since: 3.32


ide_workbench_resolve_file_async ()

void
ide_workbench_resolve_file_async (IdeWorkbench *self,
                                  const gchar *filename,
                                  GCancellable *cancellable,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);

This function will try to locate a given file based on the filename, possibly resolving it from a build directory, or source directory.

If no file was discovered, some attempt will be made to locate a file that matches appropriately.

Parameters

self

a IdeWorkbench

 

filename

the filename to discover

 

Since: 3.32


ide_workbench_resolve_file_finish ()

GFile *
ide_workbench_resolve_file_finish (IdeWorkbench *self,
                                   GAsyncResult *result,
                                   GError **error);

Completes an asynchronous request to ide_workbench_resolve_file_async().

Parameters

self

a IdeWorkbench

 

result

a GAsyncResult

 

error

a location for a GError

 

Returns

a GFile, or NULL and error is set.

[transfer full]

Since: 3.32

Types and Values

IDE_TYPE_WORKBENCH

#define IDE_TYPE_WORKBENCH (ide_workbench_get_type())

IdeWorkbench

typedef struct _IdeWorkbench IdeWorkbench;

Property Details

The “context” property

  “context”                  IdeContext *

The "context" property is the IdeContext for the project.

The IdeContext is the root IdeObject used in the tree of objects representing the project and the workings of the IDE.

Flags: Read / Write / Construct Only

Since: 3.32


The “vcs” property

  “vcs”                      IdeVcs *

The "vcs" property contains an IdeVcs that represents the version control system that is currently loaded for the project.

The IdeVcs is registered by an IdeWorkbenchAddin when loading a project.

Flags: Read / Write

Since: 3.32