## GtkSourceCompletionContext GtkSourceCompletionContext — The context of a completion |

## Synopsis

    #include <gtksourceview/gtksource.h>

    enum                GtkSourceCompletionActivation;
                        GtkSourceCompletionContext;
    void                gtk_source_completion_context_add_proposals
                                                            (GtkSourceCompletionContext *context,
                                                             GtkSourceCompletionProvider *provider,
                                                             GList *proposals,
                                                             gboolean finished);
    void                gtk_source_completion_context_get_iter
                                                            (GtkSourceCompletionContext *context,
                                                             GtkTextIter *iter);
    GtkSourceCompletionActivation gtk_source_completion_context_get_activation
                                                            (GtkSourceCompletionContext *context);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkSourceCompletionContext

## Properties

      "activation"               GtkSourceCompletionActivation  : Read / Write
      "completion"               GtkSourceCompletion*  : Read / Write / Construct Only
      "iter"                     GtkTextIter*          : Read / Write

## Signals

      "cancelled"                                      : Action

## Description

A completion context is created when a completion occurs. The completion can be activated by several means, listed in GtkSourceCompletionActivation.

The completion can be activated by user request, i.e. when the user presses Control+space, by default.

The completion can also be activated interactively, on each insertion or deletion in the GtkTextBuffer.

A GtkTextIter is associated with the context, this is where the completion takes place. With this GtkTextIter, you can get the associated GtkTextBuffer with `gtk_text_iter_get_buffer()`.

Once the context is created, the eligible providers are asked to add proposals with `gtk_source_completion_context_add_proposals()`.

## Details

### enum GtkSourceCompletionActivation

    typedef enum {
    	GTK_SOURCE_COMPLETION_ACTIVATION_NONE = 0,
    	GTK_SOURCE_COMPLETION_ACTIVATION_INTERACTIVE = 1 << 0,
    	GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED = 1 << 1
    } GtkSourceCompletionActivation;

`GTK_SOURCE_COMPLETION_ACTIVATION_NONE` | none.
`GTK_SOURCE_COMPLETION_ACTIVATION_INTERACTIVE` | interactive activation
`GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED` | user requested activation (e.g. through a keyboard accelerator from the view)

### GtkSourceCompletionContext

    typedef struct _GtkSourceCompletionContext GtkSourceCompletionContext;

### gtk_source_completion_context_add_proposals ()

    void                gtk_source_completion_context_add_proposals
                                                            (GtkSourceCompletionContext *context,
                                                             GtkSourceCompletionProvider *provider,
                                                             GList *proposals,
                                                             gboolean finished);

Providers can use this function to add proposals to the completion. They can do so asynchronously by means of the `finished` argument. Providers must ensure that they always call this function with `finished` set to `TRUE` once each population (even if no proposals need to be added). Population occurs when the `gtk_source_completion_provider_populate()` function is called.

`context` : | a GtkSourceCompletionContext.
`provider` : | a GtkSourceCompletionProvider. [type GtkSource.CompletionProvider]
`proposals` : | The list of proposals to add. [element-type GtkSource.CompletionProposal]
`finished` : | Whether the provider is finished adding proposals.

### gtk_source_completion_context_get_iter ()

    void                gtk_source_completion_context_get_iter
                                                            (GtkSourceCompletionContext *context,
                                                             GtkTextIter *iter);

Get the iter at which the completion was invoked. Providers can use this to determine how and if to match proposals.

`context` : | a GtkSourceCompletionContext.
`iter` : | a GtkTextIter. [out]

### gtk_source_completion_context_get_activation ()

    GtkSourceCompletionActivation gtk_source_completion_context_get_activation
                                                            (GtkSourceCompletionContext *context);

Get the context activation.

`context` : | a GtkSourceCompletionContext.
Returns : | The context activation.

## Property Details

### The `"activation"` property

      "activation"               GtkSourceCompletionActivation  : Read / Write

The completion activation

### The `"completion"` property

      "completion"               GtkSourceCompletion*  : Read / Write / Construct Only

The GtkSourceCompletion associated with the context.

### The `"iter"` property

      "iter"                     GtkTextIter*          : Read / Write

The GtkTextIter at which the completion is invoked.

## Signal Details

### The `"cancelled"` signal

    void                user_function                      (GtkSourceCompletionContext *arg0,
                                                            gpointer                    user_data)      : Action

Emitted when the current population of proposals has been cancelled. Providers adding proposals asynchronously should connect to this signal to know when to cancel running proposal queries.

`user_data` : | user data set when the signal handler was connected.