Top | ![]() |
![]() |
![]() |
![]() |
GCancellable * | cancellable | Read / Write / Construct Only |
IdeObject * | parent | Read / Write / Construct Only |
GObject ╰── IdeObject ├── IdeFileSettings ├── IdeBufferChangeMonitor ├── IdeBufferManager ├── IdeBuildManager ├── IdeConfig ├── IdeConfigManager ├── IdeContext ├── IdeDebugManager ├── IdeDebugger ├── IdeDeployStrategy ├── IdeDevice ├── IdeDeviceManager ├── IdeDeviceProvider ├── IdeDiagnostic ├── IdeDiagnostics ├── IdeDiagnosticsManager ├── IdeDirectoryVcs ├── IdeExtensionAdapter ├── IdeExtensionSetAdapter ├── IdeFallbackBuildSystem ├── IdeHighlightEngine ├── IdeLspClient ├── IdeLspCompletionProvider ├── IdeLspDiagnosticProvider ├── IdeLspFormatter ├── IdeLspHighlighter ├── IdeLspHoverProvider ├── IdeLspRenameProvider ├── IdeLspSymbolResolver ├── IdeNotification ├── IdeNotifications ├── IdeObjectBox ├── IdePipeline ├── IdePipelineStage ├── IdeTransfer ├── IdeRunManager ├── IdeRunner ├── IdeRuntime ├── IdeRuntimeManager ├── IdeSearchEngine ├── IdeSimpleBuildSystemDiscovery ├── IdeSimpleBuildTarget ├── IdeToolchain ├── IdeSnippetStorage ├── IdeTestManager ├── IdeTestProvider ├── IdeTextEdit ├── IdeToolchainManager ├── IdeTreeModel ├── IdeUnsavedFiles ╰── IdeVcsMonitor
IdeObject is required by IdeBuildSystem, IdeBuildTarget, IdeCodeIndexer, IdeCommand, IdeConfigProvider, IdeDependencyUpdater, IdeDiagnosticProvider, IdeHighlighter, IdeIndenter, IdePipelineAddin, IdeRenameProvider, IdeRuntimeProvider, IdeSearchProvider, IdeSessionAddin, IdeSymbolResolver, IdeToolchainProvider and IdeVcs.
IdeObject is a specialized GObject for use in Builder. It provides a hierarchy of objects using a specialized tree similar to a DOM. You can insert/append/prepend objects to a parent node, and track their lifetime as part of the tree.
When an object is removed from the tree, it can automatically be destroyed via the “destroy” signal. This is useful as it may cause the children of that object to be removed, recursively destroying the objects descendants. This behavior is ideal when you want a large amount of objects to be reclaimed once an ancestor is no longer necessary.
IdeObject's may also have a GCancellable associated with them. The
cancellable is created on demand when ide_object_ref_cancellable()
is
called. When the object is destroyed, the “cancel” signal
is emitted. This allows automatic cleanup of asynchronous operations
when used properly.
gpointer ide_object_new (GType type
,IdeObject *parent
);
This is a convenience function for creating an IdeObject and appending it to a parent.
This function may only be called from the main-thread, as calling from any other thread would potentially risk being disposed before returning.
Since: 3.32
GCancellable *
ide_object_ref_cancellable (IdeObject *self
);
Gets a GCancellable for the object.
Since: 3.32
IdeObject *
ide_object_get_parent (IdeObject *self
);
Gets the parent IdeObject, if any.
This function may only be called from the main thread.
Since: 3.32
IdeObject *
ide_object_ref_parent (IdeObject *self
);
Gets the parent IdeObject, if any.
Since: 3.32
IdeObject *
ide_object_ref_root (IdeObject *self
);
Finds and returns the toplevel object in the tree.
Since: 3.32
gboolean
ide_object_is_root (IdeObject *self
);
Checks if self
is root, meaning it has no parent.
Since: 3.32
void
ide_object_lock (IdeObject *self
);
Acquires the lock for self
. This can be useful when you need to do
multi-threaded work with self
and want to ensure exclusivity.
Call ide_object_unlock()
to release the lock.
The synchronization used is a GRecMutex.
Since: 3.32
void
ide_object_unlock (IdeObject *self
);
Releases a previously acuiqred lock from ide_object_lock()
.
The synchronization used is a GRecMutex.
Since: 3.32
void ide_object_add (IdeObject *self
,IdeObject *sibling
,IdeObject *child
,IdeObjectLocation location
);
Adds child
to self
, with location dependent on location
.
Generally, it is simpler to use the helper functions such as
ide_object_append()
, ide_object_prepend()
, ide_object_insert_before()
,
or ide_object_insert_after()
.
This function is primarily meant for consumers that don't know the relative position they need until runtime.
Since: 3.32
void ide_object_append (IdeObject *self
,IdeObject *child
);
Inserts child
as the last child of self
.
Since: 3.32
void ide_object_prepend (IdeObject *self
,IdeObject *child
);
Inserts child
as the first child of self
.
Since: 3.32
void ide_object_insert_before (IdeObject *self
,IdeObject *sibling
,IdeObject *child
);
Inserts child
into self
's children, directly before sibling
.
sibling
MUST BE a child of self
.
Since: 3.32
void ide_object_insert_after (IdeObject *self
,IdeObject *sibling
,IdeObject *child
);
Inserts child
into self
's children, directly after sibling
.
sibling
MUST BE a child of self
.
Since: 3.32
void ide_object_insert_sorted (IdeObject *self
,IdeObject *child
,GCompareDataFunc func
,gpointer user_data
);
Locates the proper sibling for child
by using func
amongst self
's
children IdeObject. Those objects must already be sorted.
self |
||
child |
an IdeObject |
|
func |
a GCompareDataFunc that can be used to locate the proper sibling. |
[scope call] |
user_data |
user data for |
Since: 3.32
void ide_object_remove (IdeObject *self
,IdeObject *child
);
Removes child
from self
.
If child
is a borrowed reference, it may be finalized before this
function returns.
Since: 3.32
void ide_object_foreach (IdeObject *self
,GFunc callback
,gpointer user_data
);
Calls callback
for each child of self
.
callback
is allowed to remove children from self
, but only as long as they are
the child passed to callback (or child itself). See g_queue_foreach()
for more
details about what is allowed.
Since: 3.32
gboolean ide_object_set_error_if_destroyed (IdeObject *self
,GError **error
);
void
ide_object_destroyed (IdeObject **self
);
This function sets *object_pointer to NULL if object_pointer != NULL. It's
intended to be used as a callback connected to the "destroy" signal of a
object. You connect ide_object_destroyed()
as a signal handler, and pass the
address of your object variable as user data. Then when the object is
destroyed, the variable will be set to NULL. Useful for example to avoid
multiple copies of the same dialog.
Since: 3.32
guint
ide_object_get_position (IdeObject *self
);
Gets the position of self
within the parent node.
Since: 3.32
guint
ide_object_get_n_children (IdeObject *self
);
Gets the number of children for an object.
Since: 3.32
IdeObject * ide_object_get_nth_child (IdeObject *self
,guint nth
);
Gets the nth
child of self
.
A full reference to the child is returned.
Since: 3.32
gpointer ide_object_get_child_typed (IdeObject *self
,GType type
);
Finds the first child of self
that is of type
.
Since: 3.32
GPtrArray * ide_object_get_children_typed (IdeObject *self
,GType type
);
Gets all children matching type
.
Since: 3.32
gpointer ide_object_ensure_child_typed (IdeObject *self
,GType type
);
Like ide_object_get_child_typed()
except that it creates an object of
type
if it is missing.
Since: 3.32
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.
Since: 3.32
void ide_object_notify_by_pspec (gpointer instance
,GParamSpec *pspec
);
Like g_object_notify_by_pspec()
if the caller is in the main-thread.
Otherwise, the request is deferred to the main thread.
Since: 3.32
gchar *
ide_object_repr (IdeObject *self
);
This function is similar to Python's
which gives a string
representation for the object. It is useful when debugging Builder
or when writing plugins.repr()
Since: 3.32
void ide_object_log (gpointer instance
,GLogLevelFlags level
,const gchar *domain
,const gchar *format
,...
);
#define ide_object_message(instance, format, ...) ide_object_log(instance, G_LOG_LEVEL_MESSAGE, G_LOG_DOMAIN, format __VA_OPT__(,) __VA_ARGS__)
struct IdeObjectClass { GObjectClass parent_class; void (*destroy) (IdeObject *self); void (*add) (IdeObject *self, IdeObject *sibling, IdeObject *child, IdeObjectLocation location); void (*remove) (IdeObject *self, IdeObject *child); void (*parent_set) (IdeObject *self, IdeObject *parent); gchar *(*repr) (IdeObject *self); /*< private */ gpointer _reserved[16]; };
“cancellable”
property“cancellable” GCancellable *
The "cancellable" property is a GCancellable that can be used by operations
that will be cancelled when the “destroy” signal is emitted on self
.
This is convenient when you want operations to automatically be cancelled when part of teh object tree is segmented.
Flags: Read / Write / Construct Only
Since: 3.32
“destroy”
signalvoid user_function (IdeObject *ideobject, gpointer user_data)
The "destroy" signal is emitted when the object should destroy itself and cleanup any state that is no longer necessary. This happens when the object has been removed from the because it was requested to be destroyed, or because a parent object is being destroyed.
If you do not want to receive the "destroy" signal, then you must
manually remove the object from the tree using ide_object_remove()
while holding a reference to the object.
Flags: No Hooks
Since: 3.32