[gnome-builder] rename: add buffer property to rename providers
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] rename: add buffer property to rename providers
- Date: Thu, 30 Mar 2017 02:30:30 +0000 (UTC)
commit aae6ea21baba8eb1e87c5b2c738c59e947c9235c
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 29 20:29:20 2017 -0600
rename: add buffer property to rename providers
libide/langserv/ide-langserv-rename-provider.c | 25 ++++++++++++++++++++++++
libide/rename/ide-rename-provider.c | 8 +++++++
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/libide/langserv/ide-langserv-rename-provider.c b/libide/langserv/ide-langserv-rename-provider.c
index ea74427..56e2b14 100644
--- a/libide/langserv/ide-langserv-rename-provider.c
+++ b/libide/langserv/ide-langserv-rename-provider.c
@@ -21,7 +21,9 @@
#include <jsonrpc-glib.h>
#include "ide-debug.h"
+#include "ide-macros.h"
+#include "buffers/ide-buffer.h"
#include "files/ide-file.h"
#include "langserv/ide-langserv-client.h"
#include "langserv/ide-langserv-rename-provider.h"
@@ -30,6 +32,7 @@
typedef struct
{
IdeLangservClient *client;
+ IdeBuffer *buffer;
} IdeLangservRenameProviderPrivate;
static void rename_provider_iface_init (IdeRenameProviderInterface *iface);
@@ -40,6 +43,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (IdeLangservRenameProvider, ide_langserv_rename
enum {
PROP_0,
+ PROP_BUFFER,
PROP_CLIENT,
N_PROPS
};
@@ -47,12 +51,22 @@ enum {
static GParamSpec *properties [N_PROPS];
static void
+ide_langserv_rename_provider_set_buffer (IdeLangservRenameProvider *self,
+ IdeBuffer *buffer)
+{
+ IdeLangservRenameProviderPrivate *priv = ide_langserv_rename_provider_get_instance_private (self);
+
+ ide_set_weak_pointer (&priv->buffer, buffer);
+}
+
+static void
ide_langserv_rename_provider_finalize (GObject *object)
{
IdeLangservRenameProvider *self = (IdeLangservRenameProvider *)object;
IdeLangservRenameProviderPrivate *priv = ide_langserv_rename_provider_get_instance_private (self);
g_clear_object (&priv->client);
+ ide_clear_weak_pointer (&priv->buffer);
G_OBJECT_CLASS (ide_langserv_rename_provider_parent_class)->finalize (object);
}
@@ -86,6 +100,10 @@ ide_langserv_rename_provider_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_BUFFER:
+ ide_langserv_rename_provider_set_buffer (self, g_value_get_object (value));
+ break;
+
case PROP_CLIENT:
ide_langserv_rename_provider_set_client (self, g_value_get_object (value));
break;
@@ -111,6 +129,13 @@ ide_langserv_rename_provider_class_init (IdeLangservRenameProviderClass *klass)
IDE_TYPE_LANGSERV_CLIENT,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
+ properties [PROP_BUFFER] =
+ g_param_spec_object ("buffer",
+ "Buffer",
+ "The buffer for renames",
+ IDE_TYPE_BUFFER,
+ (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
+
g_object_class_install_properties (object_class, N_PROPS, properties);
}
diff --git a/libide/rename/ide-rename-provider.c b/libide/rename/ide-rename-provider.c
index 35ef018..702624c 100644
--- a/libide/rename/ide-rename-provider.c
+++ b/libide/rename/ide-rename-provider.c
@@ -21,6 +21,7 @@
#include "ide-context.h"
#include "ide-debug.h"
+#include "buffers/ide-buffer.h"
#include "rename/ide-rename-provider.h"
G_DEFINE_INTERFACE (IdeRenameProvider, ide_rename_provider, IDE_TYPE_OBJECT)
@@ -66,6 +67,13 @@ ide_rename_provider_default_init (IdeRenameProviderInterface *iface)
{
iface->rename_async = ide_rename_provider_real_rename_async;
iface->rename_finish = ide_rename_provider_real_rename_finish;
+
+ g_object_interface_install_property (iface,
+ g_param_spec_object ("buffer",
+ "Buffer",
+ "Buffer",
+ IDE_TYPE_BUFFER,
+ (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)));
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]