Commit 10b768a7 authored by Christian Hergert's avatar Christian Hergert

snippets: switch to new snippet engine

This breaks a bit of code intermediately while we land things, but such is
life with such a complicated refactoring.
parent 3cd417a3
......@@ -53,7 +53,7 @@
#include "runtimes/ide-runtime-manager.h"
#include "search/ide-search-engine.h"
#include "search/ide-search-provider.h"
#include "snippets/ide-source-snippets-manager.h"
#include "snippets/ide-snippet-storage.h"
#include "testing/ide-test-manager.h"
#include "toolchain/ide-toolchain-manager.h"
#include "transfers/ide-transfer-manager.h"
......@@ -82,7 +82,7 @@
* #IdeBufferManager, #IdeBuildManager, #IdeBuildSystem,
* #IdeConfigurationManager, #IdeDiagnosticsManager, #IdeDebugManager,
* #IdeDeviceManager, #IdeRuntimeManager, #IdeRunManager, #IdeSearchEngine,
* #IdeSourceSnippetsManager, #IdeTestManager, #IdeProject, and #IdeVcs.
* #IdeSnippetStorage, #IdeTestManager, #IdeProject, and #IdeVcs.
*
* ## Services
*
......@@ -124,7 +124,7 @@ struct _IdeContext
IdeRuntimeManager *runtime_manager;
IdeToolchainManager *toolchain_manager;
IdeSearchEngine *search_engine;
IdeSourceSnippetsManager *snippets_manager;
IdeSnippetStorage *snippets;
IdeTestManager *test_manager;
IdeProject *project;
GFile *project_file;
......@@ -168,7 +168,7 @@ enum {
PROP_RUNTIME_MANAGER,
PROP_TOOLCHAIN_MANAGER,
PROP_SEARCH_ENGINE,
PROP_SNIPPETS_MANAGER,
PROP_SNIPPETS,
PROP_VCS,
PROP_UNSAVED_FILES,
LAST_PROP
......@@ -316,18 +316,20 @@ ide_context_get_documentation (IdeContext *self)
}
/**
* ide_context_get_snippets_manager:
* ide_context_get_snippets:
*
* Gets the #IdeContext:snippets-manager property.
* Gets the #IdeContext:snippets property.
*
* Returns: (transfer none): An #IdeSourceSnippetsManager.
* Returns: (transfer none): An #IdeSnippetStorage.
*
* Since: 3.30
*/
IdeSourceSnippetsManager *
ide_context_get_snippets_manager (IdeContext *self)
IdeSnippetStorage *
ide_context_get_snippets (IdeContext *self)
{
g_return_val_if_fail (IDE_IS_CONTEXT (self), NULL);
return self->snippets_manager;
return self->snippets;
}
/**
......@@ -675,8 +677,8 @@ ide_context_get_property (GObject *object,
g_value_set_object (value, ide_context_get_search_engine (self));
break;
case PROP_SNIPPETS_MANAGER:
g_value_set_object (value, ide_context_get_snippets_manager (self));
case PROP_SNIPPETS:
g_value_set_object (value, ide_context_get_snippets (self));
break;
case PROP_UNSAVED_FILES:
......@@ -793,12 +795,12 @@ ide_context_class_init (IdeContextClass *klass)
IDE_TYPE_SEARCH_ENGINE,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
properties [PROP_SNIPPETS_MANAGER] =
g_param_spec_object ("snippets-manager",
"Snippets Manager",
properties [PROP_SNIPPETS] =
g_param_spec_object ("snippets",
"Snippets",
"The snippets manager for the context.",
IDE_TYPE_SOURCE_SNIPPETS_MANAGER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
IDE_TYPE_SNIPPET_STORAGE,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
properties [PROP_UNSAVED_FILES] =
g_param_spec_object ("unsaved-files",
......@@ -935,7 +937,7 @@ ide_context_init (IdeContext *self)
"context", self,
NULL);
self->snippets_manager = g_object_new (IDE_TYPE_SOURCE_SNIPPETS_MANAGER, NULL);
self->snippets = ide_snippet_storage_new ();
IDE_EXIT;
}
......@@ -1270,13 +1272,15 @@ ide_context_init_snippets_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
IdeSourceSnippetsManager *manager = (IdeSourceSnippetsManager *)object;
IdeSnippetStorage *storage = (IdeSnippetStorage *)object;
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
g_return_if_fail (IDE_IS_SOURCE_SNIPPETS_MANAGER (manager));
g_assert (IDE_IS_SNIPPET_STORAGE (storage));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_TASK (task));
if (!ide_source_snippets_manager_load_finish (manager, result, &error))
if (!ide_snippet_storage_load_finish (storage, result, &error))
ide_task_return_error (task, g_steal_pointer (&error));
else
ide_task_return_boolean (task, TRUE);
......@@ -1295,10 +1299,10 @@ ide_context_init_snippets (gpointer source_object,
task = ide_task_new (self, cancellable, callback, user_data);
ide_source_snippets_manager_load_async (self->snippets_manager,
cancellable,
ide_context_init_snippets_cb,
g_object_ref (task));
ide_snippet_storage_load_async (self->snippets,
cancellable,
ide_context_init_snippets_cb,
g_object_ref (task));
}
static void
......
......@@ -68,8 +68,8 @@ IDE_AVAILABLE_IN_ALL
IdeSettings *ide_context_get_settings (IdeContext *self,
const gchar *schema_id,
const gchar *relative_path);
IDE_AVAILABLE_IN_ALL
IdeSourceSnippetsManager *ide_context_get_snippets_manager (IdeContext *self);
IDE_AVAILABLE_IN_3_30
IdeSnippetStorage *ide_context_get_snippets (IdeContext *self);
IDE_AVAILABLE_IN_3_28
IdeTestManager *ide_context_get_test_manager (IdeContext *self);
IDE_AVAILABLE_IN_ALL
......
......@@ -110,11 +110,6 @@ typedef struct _IdeSnippet IdeSnippet;
typedef struct _IdeSnippetChunk IdeSnippetChunk;
typedef struct _IdeSnippetContext IdeSnippetContext;
typedef struct _IdeSnippetStorage IdeSnippetStorage;
typedef struct _IdeSourceSnippet IdeSourceSnippet;
typedef struct _IdeSourceSnippetChunk IdeSourceSnippetChunk;
typedef struct _IdeSourceSnippetContext IdeSourceSnippetContext;
typedef struct _IdeSourceSnippets IdeSourceSnippets;
typedef struct _IdeSourceSnippetsManager IdeSourceSnippetsManager;
typedef struct _IdeSubprocess IdeSubprocess;
typedef struct _IdeSubprocessLauncher IdeSubprocessLauncher;
......
......@@ -164,12 +164,6 @@ G_BEGIN_DECLS
#include "snippets/ide-snippet-context.h"
#include "snippets/ide-snippet-parser.h"
#include "snippets/ide-snippet-storage.h"
#include "snippets/ide-source-snippet-chunk.h"
#include "snippets/ide-source-snippet-context.h"
#include "snippets/ide-source-snippet-parser.h"
#include "snippets/ide-source-snippet.h"
#include "snippets/ide-source-snippets-manager.h"
#include "snippets/ide-source-snippets.h"
#include "sourceview/ide-indenter.h"
#include "sourceview/ide-language.h"
#include "sourceview/ide-source-map.h"
......
/* ide-source-snippet-chunk.c
*
* Copyright 2013 Christian Hergert <christian@hergert.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define G_LOG_DOMAIN "ide-source-snippet"
#include "config.h"
#include <glib/gi18n.h>
#include "snippets/ide-source-snippet-chunk.h"
#include "snippets/ide-source-snippet-context.h"
/**
* SECTION:ide-source-snippet-chunk
* @title: IdeSourceSnippetChunk
* @short_description: An chunk of text within the source snippet
*
* The #IdeSourceSnippetChunk represents a single chunk of text that
* may or may not be an edit point within the snippet. Chunks that are
* an edit point (also called a tab stop) have the
* #IdeSourceSnippetChunk:tab-stop property set.
*
* Since: 3.18
*/
struct _IdeSourceSnippetChunk
{
GObject parent_instance;
IdeSourceSnippetContext *context;
guint context_changed_handler;
gint tab_stop;
gchar *spec;
gchar *text;
guint text_set : 1;
};
G_DEFINE_TYPE (IdeSourceSnippetChunk, ide_source_snippet_chunk, G_TYPE_OBJECT)
enum {
PROP_0,
PROP_CONTEXT,
PROP_SPEC,
PROP_TAB_STOP,
PROP_TEXT,
PROP_TEXT_SET,
LAST_PROP
};
static GParamSpec *properties[LAST_PROP];
IdeSourceSnippetChunk *
ide_source_snippet_chunk_new (void)
{
return g_object_new (IDE_TYPE_SOURCE_SNIPPET_CHUNK, NULL);
}
/**
* ide_source_snippet_chunk_copy:
*
* Copies the source snippet.
*
* Returns: (transfer full): An #IdeSourceSnippetChunk.
*/
IdeSourceSnippetChunk *
ide_source_snippet_chunk_copy (IdeSourceSnippetChunk *chunk)
{
IdeSourceSnippetChunk *ret;
g_return_val_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk), NULL);
ret = g_object_new (IDE_TYPE_SOURCE_SNIPPET_CHUNK,
"spec", chunk->spec,
"tab-stop", chunk->tab_stop,
NULL);
return ret;
}
static void
on_context_changed (IdeSourceSnippetContext *context,
IdeSourceSnippetChunk *chunk)
{
gchar *text;
g_assert (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk));
g_assert (IDE_IS_SOURCE_SNIPPET_CONTEXT (context));
if (!chunk->text_set)
{
text = ide_source_snippet_context_expand (context, chunk->spec);
ide_source_snippet_chunk_set_text (chunk, text);
g_free (text);
}
}
/**
* ide_source_snippet_chunk_get_context:
*
* Gets the context for the snippet insertion.
*
* Returns: (transfer none): An #IdeSourceSnippetContext.
*/
IdeSourceSnippetContext *
ide_source_snippet_chunk_get_context (IdeSourceSnippetChunk *chunk)
{
g_return_val_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk), NULL);
return chunk->context;
}
void
ide_source_snippet_chunk_set_context (IdeSourceSnippetChunk *chunk,
IdeSourceSnippetContext *context)
{
g_return_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk));
g_return_if_fail (!context || IDE_IS_SOURCE_SNIPPET_CONTEXT (context));
if (context != chunk->context)
{
if (chunk->context_changed_handler)
{
g_signal_handler_disconnect (chunk->context,
chunk->context_changed_handler);
chunk->context_changed_handler = 0;
}
g_clear_object (&chunk->context);
if (context != NULL)
{
chunk->context = g_object_ref (context);
chunk->context_changed_handler =
g_signal_connect_object (chunk->context,
"changed",
G_CALLBACK (on_context_changed),
chunk,
0);
}
g_object_notify_by_pspec (G_OBJECT (chunk), properties[PROP_CONTEXT]);
}
}
const gchar *
ide_source_snippet_chunk_get_spec (IdeSourceSnippetChunk *chunk)
{
g_return_val_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk), NULL);
return chunk->spec;
}
void
ide_source_snippet_chunk_set_spec (IdeSourceSnippetChunk *chunk,
const gchar *spec)
{
g_return_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk));
g_free (chunk->spec);
chunk->spec = g_strdup (spec);
g_object_notify_by_pspec (G_OBJECT (chunk), properties[PROP_SPEC]);
}
gint
ide_source_snippet_chunk_get_tab_stop (IdeSourceSnippetChunk *chunk)
{
g_return_val_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk), 0);
return chunk->tab_stop;
}
void
ide_source_snippet_chunk_set_tab_stop (IdeSourceSnippetChunk *chunk,
gint tab_stop)
{
g_return_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk));
chunk->tab_stop = tab_stop;
g_object_notify_by_pspec (G_OBJECT (chunk), properties[PROP_TAB_STOP]);
}
const gchar *
ide_source_snippet_chunk_get_text (IdeSourceSnippetChunk *chunk)
{
g_return_val_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk), NULL);
return chunk->text ? chunk->text : "";
}
void
ide_source_snippet_chunk_set_text (IdeSourceSnippetChunk *chunk,
const gchar *text)
{
g_return_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk));
if (chunk->text != text)
{
g_free (chunk->text);
chunk->text = g_strdup (text);
g_object_notify_by_pspec (G_OBJECT (chunk), properties[PROP_TEXT]);
}
}
gboolean
ide_source_snippet_chunk_get_text_set (IdeSourceSnippetChunk *chunk)
{
g_return_val_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk), FALSE);
return chunk->text_set;
}
void
ide_source_snippet_chunk_set_text_set (IdeSourceSnippetChunk *chunk,
gboolean text_set)
{
g_return_if_fail (IDE_IS_SOURCE_SNIPPET_CHUNK (chunk));
text_set = !!text_set;
if (chunk->text_set != text_set)
{
chunk->text_set = text_set;
g_object_notify_by_pspec (G_OBJECT (chunk), properties[PROP_TEXT_SET]);
}
}
static void
ide_source_snippet_chunk_finalize (GObject *object)
{
IdeSourceSnippetChunk *chunk = (IdeSourceSnippetChunk *)object;
g_clear_pointer (&chunk->spec, g_free);
g_clear_pointer (&chunk->text, g_free);
g_clear_object (&chunk->context);
G_OBJECT_CLASS (ide_source_snippet_chunk_parent_class)->finalize (object);
}
static void
ide_source_snippet_chunk_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
IdeSourceSnippetChunk *chunk = IDE_SOURCE_SNIPPET_CHUNK (object);
switch (prop_id)
{
case PROP_CONTEXT:
g_value_set_object (value, ide_source_snippet_chunk_get_context (chunk));
break;
case PROP_SPEC:
g_value_set_string (value, ide_source_snippet_chunk_get_spec (chunk));
break;
case PROP_TAB_STOP:
g_value_set_int (value, ide_source_snippet_chunk_get_tab_stop (chunk));
break;
case PROP_TEXT:
g_value_set_string (value, ide_source_snippet_chunk_get_text (chunk));
break;
case PROP_TEXT_SET:
g_value_set_boolean (value, ide_source_snippet_chunk_get_text_set (chunk));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
ide_source_snippet_chunk_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
IdeSourceSnippetChunk *chunk = IDE_SOURCE_SNIPPET_CHUNK (object);
switch (prop_id)
{
case PROP_CONTEXT:
ide_source_snippet_chunk_set_context (chunk, g_value_get_object (value));
break;
case PROP_TAB_STOP:
ide_source_snippet_chunk_set_tab_stop (chunk, g_value_get_int (value));
break;
case PROP_SPEC:
ide_source_snippet_chunk_set_spec (chunk, g_value_get_string (value));
break;
case PROP_TEXT:
ide_source_snippet_chunk_set_text (chunk, g_value_get_string (value));
break;
case PROP_TEXT_SET:
ide_source_snippet_chunk_set_text_set (chunk, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
ide_source_snippet_chunk_class_init (IdeSourceSnippetChunkClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = ide_source_snippet_chunk_finalize;
object_class->get_property = ide_source_snippet_chunk_get_property;
object_class->set_property = ide_source_snippet_chunk_set_property;
properties[PROP_CONTEXT] =
g_param_spec_object ("context",
"Context",
"The snippet context.",
IDE_TYPE_SOURCE_SNIPPET_CONTEXT,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_SPEC] =
g_param_spec_string ("spec",
"Spec",
"The specification to expand using the context.",
NULL,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_TAB_STOP] =
g_param_spec_int ("tab-stop",
"Tab Stop",
"The tab stop for the chunk.",
-1,
G_MAXINT,
-1,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_TEXT] =
g_param_spec_string ("text",
"Text",
"The text for the chunk.",
NULL,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_TEXT_SET] =
g_param_spec_boolean ("text-set",
"Text Set",
"If the text property has been manually set.",
FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, LAST_PROP, properties);
}
static void
ide_source_snippet_chunk_init (IdeSourceSnippetChunk *chunk)
{
chunk->tab_stop = -1;
chunk->spec = g_strdup ("");
}
/* ide-source-snippet-chunk.h
*
* Copyright 2013 Christian Hergert <christian@hergert.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "ide-types.h"
#include "ide-version-macros.h"
G_BEGIN_DECLS
#define IDE_TYPE_SOURCE_SNIPPET_CHUNK (ide_source_snippet_chunk_get_type())
IDE_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (IdeSourceSnippetChunk, ide_source_snippet_chunk,
IDE, SOURCE_SNIPPET_CHUNK, GObject)
IDE_AVAILABLE_IN_ALL
IdeSourceSnippetChunk *ide_source_snippet_chunk_new (void);
IDE_AVAILABLE_IN_ALL
IdeSourceSnippetChunk *ide_source_snippet_chunk_copy (IdeSourceSnippetChunk *chunk);
IDE_AVAILABLE_IN_ALL
IdeSourceSnippetContext *ide_source_snippet_chunk_get_context (IdeSourceSnippetChunk *chunk);
IDE_AVAILABLE_IN_ALL
void ide_source_snippet_chunk_set_context (IdeSourceSnippetChunk *chunk,
IdeSourceSnippetContext *context);
IDE_AVAILABLE_IN_ALL
const gchar *ide_source_snippet_chunk_get_spec (IdeSourceSnippetChunk *chunk);
IDE_AVAILABLE_IN_ALL
void ide_source_snippet_chunk_set_spec (IdeSourceSnippetChunk *chunk,
const gchar *spec);
IDE_AVAILABLE_IN_ALL
gint ide_source_snippet_chunk_get_tab_stop (IdeSourceSnippetChunk *chunk);
IDE_AVAILABLE_IN_ALL
void ide_source_snippet_chunk_set_tab_stop (IdeSourceSnippetChunk *chunk,
gint tab_stop);
IDE_AVAILABLE_IN_ALL
const gchar *ide_source_snippet_chunk_get_text (IdeSourceSnippetChunk *chunk);
IDE_AVAILABLE_IN_ALL
void ide_source_snippet_chunk_set_text (IdeSourceSnippetChunk *chunk,
const gchar *text);
IDE_AVAILABLE_IN_ALL
gboolean ide_source_snippet_chunk_get_text_set (IdeSourceSnippetChunk *chunk);
IDE_AVAILABLE_IN_ALL
void ide_source_snippet_chunk_set_text_set (IdeSourceSnippetChunk *chunk,
gboolean text_set);
G_END_DECLS
/* ide-source-snippet-completion-item.c
*
* Copyright 2013 Christian Hergert <christian@hergert.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gio/gio.h>
#include <glib/gi18n.h>
#include "snippets/ide-source-snippet-completion-item.h"
struct _IdeSourceSnippetCompletionItem
{
GObject parent_instance;
IdeSourceSnippet *snippet;
};
enum {
PROP_0,
PROP_SNIPPET,
LAST_PROP
};
static GParamSpec *properties [LAST_PROP];
static void init_proposal_iface (GtkSourceCompletionProposalIface *iface);
G_DEFINE_TYPE_WITH_CODE (IdeSourceSnippetCompletionItem,
ide_source_snippet_completion_item,
G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROPOSAL,
init_proposal_iface))
GtkSourceCompletionProposal *
ide_source_snippet_completion_item_new (IdeSourceSnippet *snippet)
{
g_return_val_if_fail (!snippet || IDE_IS_SOURCE_SNIPPET (snippet), NULL);
return g_object_new (IDE_TYPE_SOURCE_SNIPPET_COMPLETION_ITEM,
"snippet", snippet,
NULL);
}
IdeSourceSnippet *
ide_source_snippet_completion_item_get_snippet (IdeSourceSnippetCompletionItem *item)
{
g_return_val_if_fail (IDE_IS_SOURCE_SNIPPET_COMPLETION_ITEM (item), NULL);
return item->snippet;
}
void
ide_source_snippet_completion_item_set_snippet (IdeSourceSnippetCompletionItem *item,
IdeSourceSnippet *snippet)
{
g_return_if_fail (IDE_IS_SOURCE_SNIPPET_COMPLETION_ITEM (item));
g_clear_object (&item->snippet);
item->snippet = g_object_ref (snippet);
}
static void
ide_source_snippet_completion_item_finalize (GObject *object)
{
IdeSourceSnippetCompletionItem *self = IDE_SOURCE_SNIPPET_COMPLETION_ITEM (object);
g_clear_object (&self->snippet);
G_OBJECT_CLASS (ide_source_snippet_completion_item_parent_class)->finalize (object);
}
static void
ide_source_snippet_completion_item_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
IdeSourceSnippetCompletionItem *item = IDE_SOURCE_SNIPPET_COMPLETION_ITEM (object);
switch (prop_id)
{
case PROP_SNIPPET:
g_value_set_object (value, ide_source_snippet_completion_item_get_snippet (item));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
ide_source_snippet_completion_item_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
IdeSourceSnippetCompletionItem *item = IDE_SOURCE_SNIPPET_COMPLETION_ITEM (object);
switch (prop_id)
{
case PROP_SNIPPET:
ide_source_snippet_completion_item_set_snippet (item, g_value_get_object (value));
break;