Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GCompletion

[27:7] extends: object

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 [func@GLib.Completion.new]. Target items are added and removed with [method@GLib.Completion.add_items], [method@GLib.Completion.remove_items] and [method@GLib.Completion.clear_items]. A completion attempt is requested with [method@GLib.Completion.complete] or [method@GLib.Completion.complete_utf8]. When no longer needed, the GCompletion is freed with [method@GLib.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 [type@GLib.CompletionFunc] in [func@GLib.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 [type@GLib.CompletionStrncmpFunc] in [method@GLib.Completion.set_compare]. GCompletion has been marked as deprecated, since this API is rarely used and not very actively maintained.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GCompletion (Handle = null)

    Creates a new Completion by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • add_items (list items)

    Adds items to the #GCompletion.

    • @p items is the list of items to add..
    • @r None.
  • clear_items ()

    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.

    • @r None.
  • complete (string prefix, string new_prefix)

    Attempts to complete the string @prefix using the #GCompletion target items.

    • @p prefix is the prefix string, typically typed by the user, which is compared with each of the items..
    • @p new_prefix is if non-%NULL, returns the longest prefix which is common to all items that matched @prefix, or %NULL if no items matched
    • @prefix. This string should be freed when no longer needed..
    • @r the list of items whose strings begin with @prefix. This should not be changed..
  • complete_utf8 (string prefix, string new_prefix)

    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.

    • @p prefix is the prefix string, typically used by the user, which is compared with each of the items.
    • @p new_prefix is if non-%NULL, returns the longest prefix which is common to all items that matched @prefix, or %NULL if no items matched
    • @prefix. This string should be freed when no longer needed..
    • @r the list of items whose strings begin with @prefix. This should not be changed..
  • free ()

    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.

    • @r None.
  • remove_items (list items)

    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.

    • @p items is the items to remove..
    • @r None.
  • set_compare (object strncmp_func)

    Sets the function to use for string comparisons. The default string comparison function is strncmp().

    • @p strncmp_func is the string comparison function..
    • @r None.
  • complete_list ()

    Returns complete as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use complete() when lazy or change-notify access is required.

    • @r An Aussom list of elements.
  • complete_utf8_list ()

    Returns complete_utf8 as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use complete_utf8() when lazy or change-notify access is required.

    • @r An Aussom list of elements.