[gtksourceview/wip/word-completion] CompletionWords: add the activation property
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/word-completion] CompletionWords: add the activation property
- Date: Mon, 10 Jun 2013 12:15:21 +0000 (UTC)
commit 17ab0d05119758e5804c0f42e825bcc5d26fbd21
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Jun 10 12:25:43 2013 +0200
CompletionWords: add the activation property
Useful to disable interactive completion, for example.
.../words/gtksourcecompletionwords.c | 41 ++++++++++++++++++-
1 files changed, 38 insertions(+), 3 deletions(-)
---
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
b/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
index c8c590e..6812f4e 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
@@ -34,9 +34,10 @@
#include "gtksourcecompletionwordslibrary.h"
#include "gtksourcecompletionwordsbuffer.h"
#include "gtksourcecompletionwordsutils.h"
+#include "gtksourceview/gtksource.h"
+#include "gtksourceview/gtksourceview-typebuiltins.h"
+#include "gtksourceview/gtksourceview-i18n.h"
-#include <gtksourceview/gtksourcecompletion.h>
-#include <gtksourceview/gtksourceview-i18n.h>
#include <string.h>
#define GTK_SOURCE_COMPLETION_WORDS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object),
GTK_SOURCE_TYPE_COMPLETION_WORDS, GtkSourceCompletionWordsPrivate))
@@ -53,7 +54,8 @@ enum
PROP_SCAN_BATCH_SIZE,
PROP_MINIMUM_WORD_SIZE,
PROP_INTERACTIVE_DELAY,
- PROP_PRIORITY
+ PROP_PRIORITY,
+ PROP_ACTIVATION
};
struct _GtkSourceCompletionWordsPrivate
@@ -79,6 +81,7 @@ struct _GtkSourceCompletionWordsPrivate
gint interactive_delay;
gint priority;
+ GtkSourceCompletionActivation activation;
};
typedef struct
@@ -349,6 +352,10 @@ gtk_source_completion_words_set_property (GObject *object,
self->priv->priority = g_value_get_int (value);
break;
+ case PROP_ACTIVATION:
+ self->priv->activation = g_value_get_flags (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -393,6 +400,10 @@ gtk_source_completion_words_get_property (GObject *object,
g_value_set_int (value, self->priv->priority);
break;
+ case PROP_ACTIVATION:
+ g_value_set_flags (value, self->priv->activation);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -475,6 +486,23 @@ gtk_source_completion_words_class_init (GtkSourceCompletionWordsClass *klass)
0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ /**
+ * GtkSourceCompletionWords:activation:
+ *
+ * The type of activation.
+ *
+ * Since: 3.10
+ */
+ g_object_class_install_property (object_class,
+ PROP_ACTIVATION,
+ g_param_spec_flags ("activation",
+ _("Activation"),
+ _("The type of activation"),
+ GTK_SOURCE_TYPE_COMPLETION_ACTIVATION,
+ GTK_SOURCE_COMPLETION_ACTIVATION_INTERACTIVE |
+ GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
g_type_class_add_private (object_class, sizeof(GtkSourceCompletionWordsPrivate));
}
@@ -511,6 +539,12 @@ gtk_source_completion_words_get_priority (GtkSourceCompletionProvider *provider)
return GTK_SOURCE_COMPLETION_WORDS (provider)->priv->priority;
}
+static GtkSourceCompletionActivation
+gtk_source_completion_words_get_activation (GtkSourceCompletionProvider *provider)
+{
+ return GTK_SOURCE_COMPLETION_WORDS (provider)->priv->activation;
+}
+
static void
gtk_source_completion_words_iface_init (GtkSourceCompletionProviderIface *iface)
{
@@ -520,6 +554,7 @@ gtk_source_completion_words_iface_init (GtkSourceCompletionProviderIface *iface)
iface->get_start_iter = gtk_source_completion_words_get_start_iter;
iface->get_interactive_delay = gtk_source_completion_words_get_interactive_delay;
iface->get_priority = gtk_source_completion_words_get_priority;
+ iface->get_activation = gtk_source_completion_words_get_activation;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]