IdeContext

IdeContext — the root object for a project

Functions

Properties

gchar * project-id Read / Write
gchar * title Read / Write
GFile * workdir Read / Write

Signals

void log Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── IdeObject
        ╰── IdeContext

Description

The IdeContext object is the root object for a project. Everything in a project is contained by this object.

Functions

ide_context_new ()

IdeContext *
ide_context_new (void);

Creates a new IdeContext.

This only creates the context object. After creating the object you need to set a number of properties and then initialize asynchronously using g_async_initable_init_async().

Returns

an IdeContext.

[transfer full]

Since: 3.32


ide_context_has_project ()

gboolean
ide_context_has_project (IdeContext *self);

Checks to see if a project has been loaded in context .

Parameters

self

a IdeContext

 

Returns

TRUE if a project has been, or is currently, loading.

Since: 3.32


ide_context_peek_child_typed ()

gpointer
ide_context_peek_child_typed (IdeContext *self,
                              GType type);

Looks for the first child matching type , and returns it. No reference is taken to the child, so you should avoid using this except as used by compatability functions.

This may only be called from the main thread or you risk the objects being finalized before your caller has a chance to reference them.

Parameters

self

a IdeContext

 

type

the GType of the child

 

Returns

an IdeObject that matches type if successful; otherwise NULL.

[transfer none][type IdeObject][nullable]

Since: 3.32


ide_context_dup_project_id ()

gchar *
ide_context_dup_project_id (IdeContext *self);

Copies the project-id and returns it to the caller.

Parameters

self

a IdeContext

 

Returns

a project-id as a string.

[transfer full]

Since: 3.32


ide_context_set_project_id ()

void
ide_context_set_project_id (IdeContext *self,
                            const gchar *project_id);

Sets the project-id for the context.

Generally, this should only be done once after loading a project.

Parameters

self

a IdeContext

 

Since: 3.32


ide_context_dup_title ()

gchar *
ide_context_dup_title (IdeContext *self);

Parameters

self

a IdeContext

 

Returns

a string containing the title.

[transfer full]

Since: 3.32


ide_context_set_title ()

void
ide_context_set_title (IdeContext *self,
                       const gchar *title);

Sets the “title” property. This is used by various components to show the user the name of the project. This may include the omnibar and the window title.

Parameters

self

an IdeContext

 

title

the title for the project or NULL.

[nullable]

Since: 3.32


ide_context_ref_workdir ()

GFile *
ide_context_ref_workdir (IdeContext *self);

Gets the working-directory of the context and increments the reference count by one.

Parameters

self

a IdeContext

 

Returns

a GFile.

[transfer full]

Since: 3.32


ide_context_set_workdir ()

void
ide_context_set_workdir (IdeContext *self,
                         GFile *workdir);

Sets the working directory for the project.

This should generally only be set once after checking out the project.

In future releases, changes may be made to change this in support of git-worktrees or similar workflows.

Parameters

self

a IdeContext

 

workdir

a GFile

 

Since: 3.32


ide_context_build_file ()

GFile *
ide_context_build_file (IdeContext *self,
                        const gchar *path);

Creates a new GFile for the path.

Parameters

self

a IdeContext

 

path

a path to the file.

[nullable]

Returns

a GFile.

[transfer full]

Since: 3.32


ide_context_build_filename ()

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.

Parameters

self

a IdeContext

 

first_part

first path part

 

Returns

a string containing the new path.

[transfer full]

Since: 3.32


ide_context_cache_file ()

GFile *
ide_context_cache_file (IdeContext *self,
                        const gchar *first_part,
                        ...);

Like ide_context_cache_filename() but returns a GFile.

Parameters

self

a IdeContext

 

first_part

The first part of the path

 

Returns

a GFile for the cache file.

[transfer full]

Since: 3.32


ide_context_cache_filename ()

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().

Parameters

self

a IdeContext

 

first_part

the first part of the filename

 

Returns

A new string containing the cache filename.

[transfer full]

Since: 3.32


ide_context_ref_project_settings ()

GSettings *
ide_context_ref_project_settings (IdeContext *self);

Gets an org.gnome.builder.project GSettings.

This creates a new GSettings instance for the project.

Parameters

self

a IdeContext

 

Returns

a GSettings.

[transfer full]

Since: 3.32


ide_object_ref_context ()

IdeContext *
ide_object_ref_context (IdeObject *self);

Gets the root IdeContext for the object, if any.

Parameters

self

a IdeContext

 

Returns

an IdeContext or NULL.

[transfer full][nullable]

Since: 3.32


ide_object_get_context ()

IdeContext *
ide_object_get_context (IdeObject *object);

Gets the IdeContext for the object.

Parameters

object

a IdeObject

 

Returns

an IdeContext.

[transfer none][nullable]

Since: 3.32


ide_object_set_context ()

void
ide_object_set_context (IdeObject *object,
                        IdeContext *context);

ide_context_log ()

void
ide_context_log (IdeContext *self,
                 GLogLevelFlags level,
                 const gchar *domain,
                 const gchar *message);

ide_context_warning()

#define             ide_context_warning(instance, format, ...)

Types and Values

IDE_TYPE_CONTEXT

#define IDE_TYPE_CONTEXT (ide_context_get_type())

IdeContext

typedef struct _IdeContext IdeContext;

Property Details

The “project-id” property

  “project-id”               gchar *

The "project-id" property is the identifier to use when creating files and folders for this project. It has a mutated form of either the directory or some other discoverable trait of the project.

It has also been modified to remove spaces and other unsafe characters for file-systems.

This may change during runtime, but usually only once when the project has been initialize loaded.

Before any project has loaded, this is "empty" to allow flexibility for non-project use.

Flags: Read / Write

Default value: "empty"

Since: 3.32


The “title” property

  “title”                    gchar *

The "title" property is a descriptive name for the project.

Flags: Read / Write

Default value: NULL

Since: 3.32


The “workdir” property

  “workdir”                  GFile *

The "workdir" property is the best guess at the working directory for the context. This may be discovered using a common parent if multiple files are opened without a project.

Flags: Read / Write

Since: 3.32

Signal Details

The “log” signal

void
user_function (IdeContext *self,
               guint       severity,
               gchar      *domain,
               gchar      *message,
               gpointer    user_data)

This signal is emitted when a log item has been added for the context.

Parameters

self

an IdeContext

 

severity

the log severity

 

domain

the log domain

 

message

the log message

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.32