IdeVcs

IdeVcs

Functions

Properties

gchar * branch-name Read
GFile * working-directory Read

Signals

void changed Run Last

Types and Values

#define IDE_TYPE_VCS
struct IdeVcsInterface
  IdeVcs

Object Hierarchy

    GInterface
    ╰── IdeVcs

Prerequisites

IdeVcs requires IdeObject.

Known Implementations

IdeVcs is implemented by IdeDirectoryVcs.

Description

Functions

ide_vcs_register_ignored ()

void
ide_vcs_register_ignored (const gchar *pattern);

ide_vcs_get_buffer_change_monitor ()

IdeBufferChangeMonitor *
ide_vcs_get_buffer_change_monitor (IdeVcs *self,
                                   IdeBuffer *buffer);

Gets an IdeBufferChangeMonitor for the buffer provided. If the IdeVcs implementation does not support change monitoring, or cannot for the current file, then NULL is returned.

Returns

An IdeBufferChangeMonitor or NULL.

[transfer full][nullable]


ide_vcs_get_working_directory ()

GFile *
ide_vcs_get_working_directory (IdeVcs *self);

Retrieves the working directory for the context. This is the root of where the project files exist.

This function is safe to call from threads holding a reference to self .

Parameters

self

An IdeVcs.

 

Returns

a GFile.

[transfer none]

Since: 3.18


ide_vcs_new_async ()

void
ide_vcs_new_async (IdeContext *context,
                   int io_priority,
                   GCancellable *cancellable,
                   GAsyncReadyCallback callback,
                   gpointer user_data);

ide_vcs_new_finish ()

IdeVcs *
ide_vcs_new_finish (GAsyncResult *result,
                    GError **error);

Completes a call to ide_vcs_new_async().

Returns

An IdeVcs.

[transfer full]


ide_vcs_is_ignored ()

gboolean
ide_vcs_is_ignored (IdeVcs *self,
                    GFile *file,
                    GError **error);

This function will check if file is considered an "ignored file" by the underlying Version Control System.

For convenience, this function will return TRUE if file is NULL.

If self is NULL, only static checks against known ignored files will be performed (such as .git, .flatpak-builder, etc).

Parameters

self

An IdeVcs

 

file

a GFile.

[nullable]

error

A location for a GError, or NULL

 

Returns

TRUE if the path should be ignored.

Thread safety: This function is safe to call from a thread as IdeVcs implementations are required to ensure this function is thread-safe.

Since: 3.18


ide_vcs_path_is_ignored ()

gboolean
ide_vcs_path_is_ignored (IdeVcs *self,
                         const gchar *path,
                         GError **error);

This function acts like ide_vcs_is_ignored() except that it allows for using a regular file-system path.

It will check if the path is absolute or relative to the project directory and adjust as necessary.

For convenience, this function will return TRUE if path is NULL.

If self is NULL, only registered ignore patterns will be checked.

Parameters

self

An IdeVcs

 

path

The path to check.

[nullable]

error

A location for a GError, or NULL

 

Returns

TRUE if the path should be ignored.

Thread safety: This function is safe to call from a thread as IdeVcs implementations are required to ensure this function is thread-safe.

Since: 3.28


ide_vcs_get_priority ()

gint
ide_vcs_get_priority (IdeVcs *self);

ide_vcs_emit_changed ()

void
ide_vcs_emit_changed (IdeVcs *self);

ide_vcs_get_config ()

IdeVcsConfig *
ide_vcs_get_config (IdeVcs *self);

Retrieves an IdeVcsConfig for the IdeVcs provided. If the IdeVcs implementation does not support access to configuration, then NULL is returned.

Returns

An IdeVcsConfig or NULL.

[transfer full][nullable]


ide_vcs_get_branch_name ()

gchar *
ide_vcs_get_branch_name (IdeVcs *self);

Retrieves the name of the branch in the current working directory.

Returns

A string containing the branch name.

[transfer full]


ide_vcs_list_status_async ()

void
ide_vcs_list_status_async (IdeVcs *self,
                           GFile *directory_or_file,
                           gboolean include_descendants,
                           gint io_priority,
                           GCancellable *cancellable,
                           GAsyncReadyCallback callback,
                           gpointer user_data);

Retrieves the status of the files matching the request. If directory_or_file is a directory, then all files within that directory will be scanned for changes. If include_descendants is TRUE, the IdeVcs will scan sub-directories for changes as well.

The function specified by callback should call ide_vcs_list_status_finish() to retrieve the result of this asynchronous operation.

Parameters

self

a IdeVcs

 

directory_or_file

a GFile containing a file or directory within the working tree to retrieve the status of.

 

include_descendants

if descendants of directory_or_file should be included when retrieving status information.

 

io_priority

a priority for the IO, such as G_PRIORITY_DEFAULT.

 

cancellable

A GCancellable or NULL.

[nullable]

callback

a callback for the operation

 

user_data

closure data for callback

 

Since: 3.28


ide_vcs_list_status_finish ()

GListModel *
ide_vcs_list_status_finish (IdeVcs *self,
                            GAsyncResult *result,
                            GError **error);

Completes an asynchronous request to ide_vcs_list_status_async().

The result of this function is a GListModel containing objects that are IdeVcsFileInfo.

Parameters

self

a IdeVcs

 

result

a GAsyncResult provided to the callback

 

error

a location for a GError

 

Returns

A GListModel containing an IdeVcsFileInfo for each of the files scanned by the IdeVcs. Upon failure, NULL is returned and error is set.

[transfer full][nullable]

Since: 3.28

Types and Values

IDE_TYPE_VCS

#define IDE_TYPE_VCS (ide_vcs_get_type())

struct IdeVcsInterface

struct IdeVcsInterface {
  GTypeInterface            parent_interface;

  GFile                  *(*get_working_directory)     (IdeVcs               *self);
  IdeBufferChangeMonitor *(*get_buffer_change_monitor) (IdeVcs               *self,
                                                        IdeBuffer            *buffer);
  gboolean                (*is_ignored)                (IdeVcs               *self,
                                                        GFile                *file,
                                                        GError              **error);
  gint                    (*get_priority)              (IdeVcs               *self);
  void                    (*changed)                   (IdeVcs               *self);
  IdeVcsConfig           *(*get_config)                (IdeVcs               *self);
  gchar                  *(*get_branch_name)           (IdeVcs               *self);
  void                    (*list_status_async)         (IdeVcs               *self,
                                                        GFile                *directory_or_file,
                                                        gboolean              include_descendants,
                                                        gint                  io_priority,
                                                        GCancellable         *cancellable,
                                                        GAsyncReadyCallback   callback,
                                                        gpointer              user_data);
  GListModel             *(*list_status_finish)        (IdeVcs               *self,
                                                        GAsyncResult         *result,
                                                        GError              **error);
};

IdeVcs

typedef struct _IdeVcs IdeVcs;

Property Details

The “branch-name” property

  “branch-name”              gchar *

The current name of the branch.

Flags: Read

Default value: NULL


The “working-directory” property

  “working-directory”        GFile *

The working directory for the VCS.

Flags: Read

Signal Details

The “changed” signal

void
user_function (IdeVcs  *idevcs,
               gpointer user_data)

The "changed" signal should be emitted when the VCS has detected a change to the underlying VCS storage. This can be used by consumers to reload their respective data structures.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last