## GtkSourceCompletionProposal GtkSourceCompletionProposal — Completion proposal interface |

## Functions

gchar * | gtk_source_completion_proposal_get_label ()
gchar * | gtk_source_completion_proposal_get_markup ()
gchar * | gtk_source_completion_proposal_get_text ()
GdkPixbuf * | gtk_source_completion_proposal_get_icon ()
const gchar * | gtk_source_completion_proposal_get_icon_name ()
GIcon * | gtk_source_completion_proposal_get_gicon ()
gchar * | gtk_source_completion_proposal_get_info ()
void | gtk_source_completion_proposal_changed ()
guint | gtk_source_completion_proposal_hash ()
gboolean | gtk_source_completion_proposal_equal ()

## Signals

void | changed | Action

## Types and Values

| GtkSourceCompletionProposal
struct | GtkSourceCompletionProposalIface

## Object Hierarchy

        GInterface
        ╰── GtkSourceCompletionProposal

## Prerequisites

GtkSourceCompletionProposal requires GObject.

## Known Implementations

GtkSourceCompletionProposal is implemented by GtkSourceCompletionItem.

## Includes

    #include <gtksourceview/gtksource.h>

## Description

The proposal interface represents a completion item in the completion window. It provides information on how to display the completion item and what action should be taken when the completion item is activated.

The proposal is displayed in the completion window with a label and optionally an icon. The label may be specified using plain text or markup by implementing the corresponding get function. Only one of those get functions should return a value different from `NULL`. The icon may be specified as a GdkPixbuf, as an icon name or as a GIcon by implementing the corresponding get function. At most one of those get functions should return a value different from `NULL`, if they all return `NULL` no icon will be used.

## Functions

### gtk_source_completion_proposal_get_label ()

    gchar *
    gtk_source_completion_proposal_get_label
                                   (GtkSourceCompletionProposal *proposal);

Gets the label of `proposal` . The label is shown in the list of proposals as plain text. If you need any markup (such as bold or italic text), you have to implement `gtk_source_completion_proposal_get_markup()`. The returned string must be freed with `g_free()`.

#### Parameters

proposal | a GtkSourceCompletionProposal. |

#### Returns

a new string containing the label of `proposal` .

### gtk_source_completion_proposal_get_markup ()

    gchar *
    gtk_source_completion_proposal_get_markup
                                   (GtkSourceCompletionProposal *proposal);

Gets the label of `proposal` with markup. The label is shown in the list of proposals and may contain markup. This will be used instead of `gtk_source_completion_proposal_get_label()` if implemented. The returned string must be freed with `g_free()`.

#### Parameters

proposal | a GtkSourceCompletionProposal. |

#### Returns

a new string containing the label of `proposal` with markup.

### gtk_source_completion_proposal_get_text ()

    gchar *
    gtk_source_completion_proposal_get_text
                                   (GtkSourceCompletionProposal *proposal);

Gets the text of `proposal` . The text that is inserted into the text buffer when the proposal is activated by the default activation. You are free to implement a custom activation handler in the provider and not implement this function. For more information, see `gtk_source_completion_provider_activate_proposal()`. The returned string must be freed with `g_free()`.

#### Parameters

proposal | a GtkSourceCompletionProposal. |

#### Returns

a new string containing the text of `proposal` .

### gtk_source_completion_proposal_get_icon ()

    GdkPixbuf *
    gtk_source_completion_proposal_get_icon
                                   (GtkSourceCompletionProposal *proposal);

Gets the GdkPixbuf for the icon of `proposal` .

#### Parameters

proposal | a GtkSourceCompletionProposal. |

#### Returns

A GdkPixbuf with the icon of `proposal` .

[nullable][transfer none]

### gtk_source_completion_proposal_get_icon_name ()

    const gchar *
    gtk_source_completion_proposal_get_icon_name
                                   (GtkSourceCompletionProposal *proposal);

Gets the icon name of `proposal` .

#### Parameters

proposal | a GtkSourceCompletionProposal. |

#### Returns

The icon name of `proposal` .

[nullable][transfer none]

Since: 3.18

### gtk_source_completion_proposal_get_gicon ()

    GIcon *
    gtk_source_completion_proposal_get_gicon
                                   (GtkSourceCompletionProposal *proposal);

Gets the GIcon for the icon of `proposal` .

#### Parameters

proposal | a GtkSourceCompletionProposal. |

#### Returns

A GIcon with the icon of `proposal` .

[nullable][transfer none]

Since: 3.18

### gtk_source_completion_proposal_get_info ()

    gchar *
    gtk_source_completion_proposal_get_info
                                   (GtkSourceCompletionProposal *proposal);

Gets extra information associated to the proposal. This information will be used to present the user with extra, detailed information about the selected proposal. The returned string must be freed with `g_free()`.

#### Parameters

proposal | a GtkSourceCompletionProposal. |

#### Returns

a newly-allocated string containing extra information of `proposal` or `NULL` if no extra information is associated to `proposal` .

[nullable][transfer full]

### gtk_source_completion_proposal_changed ()

    void
    gtk_source_completion_proposal_changed
                                   (GtkSourceCompletionProposal *proposal);

Emits the "changed" signal on `proposal` . This should be called by implementations whenever the name, icon or info of the proposal has changed.

#### Parameters

proposal | a GtkSourceCompletionProposal. |

### gtk_source_completion_proposal_hash ()

    guint
    gtk_source_completion_proposal_hash (GtkSourceCompletionProposal *proposal);

Get the hash value of `proposal` . This is used to (together with `gtk_source_completion_proposal_equal()`) to match proposals in the completion model. By default, it uses a direct hash (`g_direct_hash()`).

#### Parameters

proposal | a GtkSourceCompletionProposal. |

#### Returns

The hash value of `proposal` .

### gtk_source_completion_proposal_equal ()

    gboolean
    gtk_source_completion_proposal_equal (GtkSourceCompletionProposal *proposal,
                                          GtkSourceCompletionProposal *other);

Get whether two proposal objects are the same. This is used to (together with `gtk_source_completion_proposal_hash()`) to match proposals in the completion model. By default, it uses direct equality (`g_direct_equal()`).

#### Parameters

proposal | a GtkSourceCompletionProposal. |
other | a GtkSourceCompletionProposal. |

#### Returns

`TRUE` if `proposal` and `object` are the same proposal

## Types and Values

### GtkSourceCompletionProposal

    typedef struct _GtkSourceCompletionProposal GtkSourceCompletionProposal;

### struct GtkSourceCompletionProposalIface

    struct GtkSourceCompletionProposalIface {
    	GTypeInterface parent;

    	/* Interface functions */
    	gchar		*(*get_label)		(GtkSourceCompletionProposal *proposal);
    	gchar		*(*get_markup)		(GtkSourceCompletionProposal *proposal);
    	gchar		*(*get_text)		(GtkSourceCompletionProposal *proposal);

    	GdkPixbuf *(*get_icon)		(GtkSourceCompletionProposal *proposal);
    	const gchar *(*get_icon_name) (GtkSourceCompletionProposal *proposal);
    	GIcon		*(*get_gicon)		(GtkSourceCompletionProposal *proposal);

    	gchar		*(*get_info)		(GtkSourceCompletionProposal *proposal);

    	guint		 (*hash)		(GtkSourceCompletionProposal *proposal);
    	gboolean	 (*equal)		(GtkSourceCompletionProposal *proposal,
    						 GtkSourceCompletionProposal *other);

    	/* Signals */
    	void		 (*changed)		(GtkSourceCompletionProposal *proposal);
    };

The virtual function table for GtkSourceCompletionProposal.

#### Members

GTypeInterface `parent`; | The parent interface. |
`get_label` () | The virtual function pointer for `gtk_source_completion_proposal_get_label()`. By default, `NULL` is returned. |
`get_markup` () | The virtual function pointer for `gtk_source_completion_proposal_get_markup()`. By default, `NULL` is returned. |
`get_text` () | The virtual function pointer for `gtk_source_completion_proposal_get_text()`. By default, `NULL` is returned. |
`get_icon` () | The virtual function pointer for `gtk_source_completion_proposal_get_icon()`. By default, `NULL` is returned. |
`get_icon_name` () | The virtual function pointer for `gtk_source_completion_proposal_get_icon_name()`. By default, `NULL` is returned. |
`get_gicon` () | The virtual function pointer for `gtk_source_completion_proposal_get_gicon()`. By default, `NULL` is returned. |
`get_info` () | The virtual function pointer for `gtk_source_completion_proposal_get_info()`. By default, `NULL` is returned. |
`hash` () | The virtual function pointer for `gtk_source_completion_proposal_hash()`. By default, it uses a direct hash (`g_direct_hash()`). |
`equal` () | The virtual function pointer for `gtk_source_completion_proposal_equal()`. By default, it uses direct equality (`g_direct_equal()`). |
`changed` () | The function pointer for the “changed” signal. |

## Signal Details

### The `“changed”` signal

    void
    user_function (GtkSourceCompletionProposal *proposal,
                   gpointer                     user_data)

Emitted when the proposal has changed. The completion popup will react to this by updating the shown information.

#### Parameters

proposal | The GtkSourceCompletionProposal |
user_data | user data set when the signal handler was connected. |

Flags: Action