Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: StringListMeta

[216:14] static extends: object

Generated metadata helpers for StringList class surfaces.

Methods

  • properties ()

    Returns property metadata for StringList.

    • @r A list.

class: StringList

[23:7] extends: object

A list model that wraps an array of strings. The objects in the model are of type [class@Gtk.StringObject] and have a "string" property that can be used inside expressions. GtkStringList is well-suited for any place where you would typically use a char*[], but need a list model. ## GtkStringList as GtkBuildable The GtkStringList implementation of the GtkBuildable interface supports adding items directly using the <items> element and specifying <item> elements for each item. Each <item> element supports the regular translation attributes “translatable”, “context” and “comments”. Here is a UI definition fragment specifying a GtkStringList xml <object class="GtkStringList"> <items> <item translatable="yes">Factory</item> <item translatable="yes">Home</item> <item translatable="yes">Subway</item> </items> </object>

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • StringList (strings = null)

    Creates a new GtkStringList with the given @strings.

    • @p strings is The strings to put in the model.
  • 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.
  • asObject ()

    Wraps this handle as Object.

    • @r A Object object.
  • asListModel ()

    Wraps this handle as ListModel.

    • @r A ListModel object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • append (string arg1String)

    Appends @string to @self. The @string will be copied. See [method@Gtk.StringList.take] for a way to avoid that.

    • @p string is the string to insert.
    • @r None.
  • find (string arg1String)

    Gets the position of the @string in @self. If @self does not contain

    • @string item, G_MAXUINT is returned.
    • @p string is the string to find.
  • get_string (int position)

    Gets the string that is at @position in @self. If @self does not contain

    • @position items, %NULL is returned. This function returns the const char *. To get the object wrapping it, use g_list_model_get_item().
    • @p position is the position to get the string for.
  • remove (int position)

    Removes the string at @position from @self. @position must be smaller than the current length of the list.

    • @p position is the position of the string that is to be removed.
    • @r None.
  • splice (int position, int n_removals, list additions)

    Changes @self by removing @n_removals strings and adding @additions to it. This function is more efficient than [method@Gtk.StringList.append] and [method@Gtk.StringList.remove], because it only emits the ::items-changed signal once for the change. This function copies the strings in @additions. The parameters @position and @n_removals must be correct (ie: @position + @n_removals must be less than or equal to the length of the list at the time this function is called).

    • @p position is the position at which to make the change.
    • @p n_removals is the number of strings to remove.
    • @p additions is The strings to add.
    • @r None.
  • take (string arg1String)

    Adds @string to self at the end, and takes ownership of it. This variant of [method@Gtk.StringList.append] is convenient for formatting strings: c gtk_string_list_take (self, g_strdup_print ("%d dollars", lots));

    • @p string is the string to insert.
    • @r None.