IdeObject: Builder SDK Reference

## IdeObject IdeObject — Base object for IdeContext related objects |

## Functions

IdeContext * | ide_object_get_context ()
void | ide_object_set_context ()
void | ide_object_new_for_extension_async ()
void | ide_object_new_async ()
IdeObject * | ide_object_new_finish ()
gboolean | ide_object_hold ()
void | ide_object_release ()
void | ide_object_notify_in_main ()
void | ide_object_message ()
void | ide_object_warning ()
gboolean | ide_object_is_unloading ()

## Properties

IdeContext * | context | Read / Write / Construct Only

## Signals

void | destroy | Run Last

## Types and Values

#define | IDE_TYPE_OBJECT
struct | IdeObjectClass
| IdeObject

## Object Hierarchy

        GObject
        ╰── IdeObject
            ├── IdeFileSettings
            ├── IdeBufferChangeMonitor
            ├── IdeBufferManager
            ├── IdeBuildManager
            ├── IdeBuildPipeline
            ├── IdeBuildStage
            ├── IdeConfiguration
            ├── IdeBuildconfigConfigurationProvider
            ├── IdeConfigurationManager
            ├── IdeDebugManager
            ├── IdeDebugger
            ├── IdeDeployStrategy
            ├── IdeDevice
            ├── IdeDeviceManager
            ├── IdeDeviceProvider
            ├── IdeDiagnosticsManager
            ├── IdeDirectoryBuildSystem
            ├── IdeDirectoryVcs
            ├── IdeDocumentation
            ├── IdeExtensionAdapter
            ├── IdeExtensionSetAdapter
            ├── IdeFile
            ├── IdeHighlightEngine
            ├── IdeLangservClient
            ├── IdeLangservCompletionProvider
            ├── IdeLangservDiagnosticProvider
            ├── IdeLangservFormatter
            ├── IdeLangservHighlighter
            ├── IdeLangservRenameProvider
            ├── IdeSymbolNode
            ├── IdeLangservSymbolResolver
            ├── IdeProject
            ├── IdeProjectItem
            ├── IdeRunManager
            ├── IdeRunner
            ├── IdeRuntime
            ├── IdeRuntimeManager
            ├── IdeSearchEngine
            ├── IdeSettings
            ├── IdeTestManager
            ├── IdeTestProvider
            ├── IdeUnsavedFiles
            ╰── IdeVcsMonitor

## Known Derived Interfaces

IdeObject is required by IdeBuildPipelineAddin, IdeBuildSystem, IdeBuildTarget, IdeCodeIndexer, IdeConfigurationProvider, IdeDependencyUpdater, IdeDiagnosticProvider, IdeDocumentationProvider, IdeHighlighter, IdeIndenter, IdeRenameProvider, IdeSearchProvider, IdeService, IdeSymbolResolver and IdeVcs.

## Description

The IdeObject abstract class provides a base class for ojects that are related to IdeContext. It provides easy access to the IdeContext using `ide_object_get_context()`.

#### Extensions

Some interfaces in Builder require that you use IdeObject as a base class. In these cases, inherit from IdeObject instead of GObject.

#### Lifecycle

If your subclass is going to do long running work which requires that the IdeContext cannot be unloaded until it has finished, use `ide_object_hold()` to ensure this property. Call `ide_object_release()` when no longer necessary.

## Functions

### ide_object_get_context ()

    IdeContext *
    ide_object_get_context (IdeObject *self);

Fetches the “context” property.

#### Returns

An IdeContext.

[transfer none]

Since: 3.18

### ide_object_set_context ()

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

Sets the IdeContext for the object.

#### Parameters

self | a IdeObject |
context | An IdeContext. | [nullable]

Since: 3.18

### ide_object_new_for_extension_async ()

    void
    ide_object_new_for_extension_async (GType interface_gtype,
                                        GCompareDataFunc sort_priority_func,
                                        gpointer sort_priority_data,
                                        int io_priority,
                                        GCancellable *cancellable,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data,
                                        const gchar *first_property,
                                        ...);

This function is similar to `ide_object_new_async()` but uses a specific interface GType to locate the plugin. The first matching interface which is successfully created is returned after asynchronous initialization.

Use `sort_priority_func` to alter the priority of the extensions before attempting to initialize them.

#### Parameters

interface_gtype | the GType of the extension interface |
sort_priority_func | a GCompareDataFunc or `NULL`. | [scope call][allow-none]
sort_priority_data | data for `sort_priority_func` . | [nullable]
io_priority | An io priority or `G_PRIORITY_DEFAULT` |
cancellable | a GCancellable or `NULL`. | [nullable]
callback | A callback to complete the request. | [nullable]
user_data | user data for `callback` . | [nullable]
first_property | The first property to set, or `NULL`. | [nullable]
... | the value for the first property |

Since: 3.22

### ide_object_new_async ()

    void
    ide_object_new_async (const gchar *extension_point,
                          int io_priority,
                          GCancellable *cancellable,
                          GAsyncReadyCallback callback,
                          gpointer user_data,
                          const gchar *first_property,
                          ...);

This helper creates a new IdeObject that is registered for a given extension point.

The result can be fetched by calling `ide_object_new_finish()` from the provided `callback` .

#### Parameters

extension_point | The identifier of the extension point |
io_priority | An io priority or `G_PRIORITY_DEFAULT` |
cancellable | a GCancellable or `NULL`. | [nullable]
callback | a GAsyncReadyCallback. | [nullable]
user_data | user data for `callback` |
first_property | the first property to set, or `NULL` |
... | the value for the first property |

Since: 3.18

### ide_object_new_finish ()

    IdeObject *
    ide_object_new_finish (GAsyncResult *result,
                           GError **error);

Completes an asynchronous request to create a new IdeObject subclass.

#### Parameters

result | a GAsyncResult provided to callback |
error | A location for a GError, or `NULL` |

#### Returns

An IdeObject subclass, or `NULL` and `error` is set.

[transfer full]

Since: 3.18

### ide_object_hold ()

    gboolean
    ide_object_hold (IdeObject *self);

This function will acquire a reference to the IdeContext that the object is a part of. This is useful if you are going to be doing a long running task (such as something in a thread) and want to ensure the context cannot be unloaded during your operation.

You should call `ide_object_release()` an equivalent number of times to ensure the context may be freed afterwards.

You should check the return value of this function to ensure that the context is not already in shutdown.

#### Parameters

self | the IdeObject |

#### Returns

`TRUE` if a hold was successfully created.

Since: 3.18

### ide_object_release ()

    void
    ide_object_release (IdeObject *self);

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

#### Parameters

self | the IdeObject. |

Since: 3.18

### ide_object_notify_in_main ()

    void
    ide_object_notify_in_main (gpointer instance,
                               GParamSpec *pspec);

This helper will perform a `g_object_notify_by_pspec()` with the added requirement that it is run from the applications main thread.

You may want to do this when modifying state from a thread, but only notify from the Gtk+ thread.

This will *always* return to the default main context, and never emit ::notify immediately.

#### Parameters

instance | a GObject. | [type GObject.Object]
pspec | a GParamSpec |

Since: 3.18

### ide_object_message ()

    void
    ide_object_message (gpointer instance,
                        const gchar *format,
                        ...);

### ide_object_warning ()

    void
    ide_object_warning (gpointer instance,
                        const gchar *format,
                        ...);

### ide_object_is_unloading ()

    gboolean
    ide_object_is_unloading (IdeObject *self);

## Types and Values

### IDE_TYPE_OBJECT

    #define IDE_TYPE_OBJECT (ide_object_get_type())

### struct IdeObjectClass

    struct IdeObjectClass {
      GObjectClass parent;

      void        (*destroy)     (IdeObject  *self);
      IdeContext *(*get_context) (IdeObject  *self);
      void        (*set_context) (IdeObject  *self,
                                  IdeContext *context);
    };

### IdeObject

    typedef struct _IdeObject IdeObject;

## Property Details

### The `“context”` property

      “context”                  IdeContext *

The context that owns the object.

Flags: Read / Write / Construct Only

## Signal Details

### The `“destroy”` signal

    void
    user_function (IdeObject *ideobject,
                   gpointer   user_data)

Flags: Run Last