StringCompletion

GCompletion provides support for automatic completion of a string using any group of target strings. It is typically used for file name completion as is common in many UNIX shells.

A GCompletion is created using g_completion_new(). Target items are added and removed with g_completion_add_items(), g_completion_remove_items() and g_completion_clear_items(). A completion attempt is requested with g_completion_complete() or g_completion_complete_utf8(). When no longer needed, the GCompletion is freed with g_completion_free().

Items in the completion can be simple strings (e.g. filenames), or pointers to arbitrary data structures. If data structures are used you must provide a GCompletionFunc in g_completion_new(), which retrieves the item's string from the data structure. You can change the way in which strings are compared by setting a different GCompletionStrncmpFunc in g_completion_set_compare().

GCompletion has been marked as deprecated, since this API is rarely used and not very actively maintained.

Constructors

this
this(GCompletion* gCompletion)

Sets our main struct and passes it to the parent class

this
this(GCompletionFunc func)

Creates a new GCompletion.

Members

Functions

addItems
void addItems(ListG items)

Warning g_completion_add_items has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API Adds items to the GCompletion.

clearItems
void clearItems()

Warning g_completion_clear_items has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API Removes all items from the GCompletion. The items are not freed, so if the memory was dynamically allocated, it should be freed after calling this function.

complete
ListG complete(string prefix, string newPrefix)

Warning g_completion_complete has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API Attempts to complete the string prefix using the GCompletion target items.

completeUtf8
ListG completeUtf8(string prefix, string newPrefix)

Warning g_completion_complete_utf8 has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API Attempts to complete the string prefix using the GCompletion target items. In contrast to g_completion_complete(), this function returns the largest common prefix that is a valid UTF-8 string, omitting a possible common partial character. You should use this function instead of g_completion_complete() if your items are UTF-8 strings. Since 2.4

free
void free()

Warning g_completion_free has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API Frees all memory used by the GCompletion. The items are not freed, so if the memory was dynamically allocated, it should be freed after calling this function.

getStringCompletionStruct
GCompletion* getStringCompletionStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

removeItems
void removeItems(ListG items)

Warning g_completion_remove_items has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API Removes items from a GCompletion. The items are not freed, so if the memory was dynamically allocated, free items with g_list_free_full() after calling this function.

setCompare
void setCompare(GCompletionStrncmpFunc strncmpFunc)

Warning g_completion_set_compare has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API Sets the function to use for string comparisons. The default string comparison function is strncmp().

Variables

gCompletion
GCompletion* gCompletion;

the main Gtk struct

Meta