[gnome-builder] snippets: add filter to guess instance variable name.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] snippets: add filter to guess instance variable name.
- Date: Wed, 10 Sep 2014 09:37:24 +0000 (UTC)
commit 080ad6bf29fcedd75a8e2050fb138301cd44479a
Author: Christian Hergert <christian hergert me>
Date: Wed Sep 10 02:37:15 2014 -0700
snippets: add filter to guess instance variable name.
src/editor/gb-source-snippet-context.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-source-snippet-context.c b/src/editor/gb-source-snippet-context.c
index 7419fa6..55db1f6 100644
--- a/src/editor/gb-source-snippet-context.c
+++ b/src/editor/gb-source-snippet-context.c
@@ -332,6 +332,29 @@ filter_class (const gchar *input)
}
static gchar *
+filter_instance (const gchar *input)
+{
+ const gchar *tmp;
+ gchar *funct = NULL;
+ gchar *ret;
+
+ if (!strchr (input, '_'))
+ {
+ funct = filter_functify (input);
+ input = funct;
+ }
+
+ if ((tmp = strchr (input, '_')))
+ ret = g_strdup (tmp+1);
+ else
+ ret = g_strdup (input);
+
+ g_free (funct);
+
+ return ret;
+}
+
+static gchar *
filter_space (const gchar *input)
{
GString *str;
@@ -602,6 +625,7 @@ gb_source_snippet_context_class_init (GbSourceSnippetContextClass *klass)
g_hash_table_insert (gFilters, (gpointer) "class", filter_class);
g_hash_table_insert (gFilters, (gpointer) "space", filter_space);
g_hash_table_insert (gFilters, (gpointer) "stripsuffix", filter_stripsuffix);
+ g_hash_table_insert (gFilters, (gpointer) "instance", filter_instance);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]