[gnome-builder] libide: add ide_vcs_get_change_monitor()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: add ide_vcs_get_change_monitor()
- Date: Mon, 23 Mar 2015 23:44:45 +0000 (UTC)
commit 3a4cbd01d96cffd8b2b341dec3d57f9c5089ff2b
Author: Christian Hergert <christian hergert me>
Date: Thu Feb 26 16:43:10 2015 -0800
libide: add ide_vcs_get_change_monitor()
This function retrieves a change monitor that can be used for a given
file. The change monitor may be vcs implementation specific.
libide/ide-vcs.c | 29 ++++++++++++++++++++++++++++-
libide/ide-vcs.h | 22 +++++++++++++---------
2 files changed, 41 insertions(+), 10 deletions(-)
---
diff --git a/libide/ide-vcs.c b/libide/ide-vcs.c
index 38d8818..f49e163 100644
--- a/libide/ide-vcs.c
+++ b/libide/ide-vcs.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ide-buffer.h"
+#include "ide-buffer-change-monitor.h"
#include "ide-vcs.h"
G_DEFINE_ABSTRACT_TYPE (IdeVcs, ide_vcs, IDE_TYPE_OBJECT)
@@ -32,7 +34,7 @@ ide_vcs_init (IdeVcs *self)
/**
* ide_vcs_get_working_directory:
- * @vcs: An #IdeVcs.
+ * @self: An #IdeVcs.
*
* Retrieves the working directory for the context. This is the root of where
* the project files exist.
@@ -50,6 +52,31 @@ ide_vcs_get_working_directory (IdeVcs *self)
return NULL;
}
+/**
+ * ide_vcs_get_buffer_change_monitor:
+ *
+ * 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: (transfer full) (nullable): An #IdeBufferChangeMonitor or %NULL.
+ */
+IdeBufferChangeMonitor *
+ide_vcs_get_buffer_change_monitor (IdeVcs *self,
+ IdeBuffer *buffer)
+{
+ IdeBufferChangeMonitor *ret = NULL;
+
+ g_return_val_if_fail (IDE_IS_VCS (self), NULL);
+ g_return_val_if_fail (IDE_IS_BUFFER (buffer), NULL);
+
+ if (IDE_VCS_GET_CLASS (self)->get_buffer_change_monitor)
+ ret = IDE_VCS_GET_CLASS (self)->get_buffer_change_monitor (self, buffer);
+
+ g_return_val_if_fail (!ret || IDE_IS_BUFFER_CHANGE_MONITOR (ret), NULL);
+
+ return ret;
+}
+
void
ide_vcs_new_async (IdeContext *context,
int io_priority,
diff --git a/libide/ide-vcs.h b/libide/ide-vcs.h
index 91c89e1..103b72d 100644
--- a/libide/ide-vcs.h
+++ b/libide/ide-vcs.h
@@ -34,17 +34,21 @@ struct _IdeVcsClass
{
IdeObjectClass parent;
- GFile *(*get_working_directory) (IdeVcs *vcs);
+ GFile *(*get_working_directory) (IdeVcs *self);
+ IdeBufferChangeMonitor *(*get_buffer_change_monitor) (IdeVcs *self,
+ IdeBuffer *buffer);
};
-GFile *ide_vcs_get_working_directory (IdeVcs *self);
-void ide_vcs_new_async (IdeContext *context,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-IdeVcs *ide_vcs_new_finish (GAsyncResult *result,
- GError **error);
+IdeBufferChangeMonitor *ide_vcs_get_buffer_change_monitor (IdeVcs *self,
+ IdeBuffer *buffer);
+GFile *ide_vcs_get_working_directory (IdeVcs *self);
+void ide_vcs_new_async (IdeContext *context,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+IdeVcs *ide_vcs_new_finish (GAsyncResult *result,
+ GError **error);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]