{% extends "base.html" %}

{% block title %}{{ namespace.name }}.{{ class.name }}.{{ type_func.name }}{% endblock %}

{% block meta_other %}
  <meta property="og:title" content="{{ namespace.name }}.{{ class.name }}.{{ type_func.name }}"/>
  <meta property="og:description" content="Reference for {{ namespace.name }}.{{ class.name }}.{{ type_func.name }}"/>
  <meta name="twitter:title" content="{{ namespace.name }}.{{ class.name }}.{{ type_func.name }}"/>
  <meta name="twitter:description" content="Reference for {{ namespace.name }}.{{ class.name }}.{{ type_func.name }}"/>
{% endblock %}

{% block sidebar %}
<div class="section">
  <h5>Type</h5>
  <div class="links">
    <a href="{{ class.link_prefix }}.{{ class.name }}.html">{{ class.name }}</a>
  </div>
</div>
<div class="section">
  <h5>Functions</h5>
  <div class="links">
  {% for m in class.type_funcs %}
    <a class="method{% if type_func.name == m.name %} current{% endif %}" href="type_func.{{ class.name }}.{{ m.name }}.html">{{ m.name }}</a>
  {% endfor %}
  </div>
</div>
{% endblock %}

{% block content %}
<section id="main" class="content">
  <header>
    <h3>Function</h3>
    <h1><a href="index.html">{{ namespace.name }}</a><span class="sep"></span><a href="{{ class.link_prefix }}.{{class.name}}.html">{{ class.name }}</a><span class="sep"></span>{{ type_func.name }}</h1>
  </header>

  <section>
    <div class="docblock">
      <p>
      {%- if CONFIG.is_unstable(type_func.available_since) -%}
      <span class="emblem available-next" title="This function will be available in the next stable release">unstable</span>&nbsp;
      {%- endif %}
      {%- if type_func.deprecated_since -%}
      <span class="emblem deprecated">deprecated: {{ type_func.deprecated_since.version }}</span>&nbsp;
      {%- endif -%}
      {%- if type_func.available_since -%}
      <span class="emblem available">since: {{ type_func.available_since }}</span>
      {%- endif -%}
      </p>
    </div>
    <div class="declaration toggle-wrapper">
      <h4 id="declaration" style="display:flex;">
        Declaration
        <a href="#declaration" class="anchor"></a>
        {% if CONFIG.source_location_url and type_func.source_location %}
        <a class="srclink" title="go to source location" href="{{ CONFIG.source_link(type_func.source_location) }}">[src]</a>
        {% endif %}
      </h4>

      <div class="docblock">
        <pre><code>{{ type_func.c_decl }}</code></pre>
      </div>
    </div>

    <div class="description toggle-wrapper">
      <h4 id="description" style="display:flex;">
        Description
        <a href="#description" class="anchor"></a>
        {% if CONFIG.source_location_url and type_func.docs_location %}
        <a class="srclink" title="go to source location" href="{{ CONFIG.source_link(type_func.docs_location) }}">[src]</a>
        {% endif %}
      </h4>

      <div class="docblock">
        {{ type_func.description }}
      </div>

      <div class="docblock">
        {% if type_func.stability -%}
        <p>Stability: {{ type_func.stability }}</p>
        {%- endif %}
        {% if type_func.available_since -%}
        <p>Available since: {{ type_func.available_since }}</p>
        {%- endif %}
        {% if type_func.deprecated_since -%}
        <div class="admonition deprecation">
          <p class="admonition-title">Deprecated since: {{ type_func.deprecated_since.version }}</p>
          {%- if type_func.deprecated_since.message -%}
          {{ type_func.deprecated_since.message }}
          {%- else -%}
          <p>Do not use in newly written code.</p>
          {%- endif -%}
        </div>
        {%- endif %}
        {% if type_func.finish_func -%}
        <p>This function completes asynchronously. Use <a href="type_func.{{class.name}}.{{type_func.finish_func}}.html"><code>{{type_func.finish_func_symbol}}()</code></a> inside the <code>GAsyncReadyCallback</code> to obtain the result of the operation.</p>
        {%- endif %}
        {% if not type_func.introspectable -%}
        <p>This function is not directly available to language bindings.</p>
        {%- endif %}
        {% if type_func.shadows -%}
        <p>This function is renamed to <a href="type_func.{{class.name}}.{{type_func.shadows}}.html"><code>{{type_func.shadows_symbol}}()</code></a> in language bindings.</p>
        {%- endif %}
        {% if type_func.shadowed_by -%}
        <p>The implementation of this function is provided by <a href="type_func.{{class.name}}.{{type_func.shadowed_by}}.html"><code>{{type_func.shadowed_by_symbol}}()</code></a> in language bindings.</p>
        {%- endif %}
      </div>

      {% if type_func.attributes %}
      <div class="docblock">
        <table>
        {% for (key, value) in type_func.attributes.items()|sort %}
          <tr><td>{{ key|escape }}</td><td>{{ value|escape }}</td></tr>
        {% endfor %}
        </table>
      </div>
      {% endif %}
    </div>

    {% if type_func.arguments|length != 0 %}
    <div class="parameters toggle-wrapper">
      <h4 id="parameters">
        Parameters
        <a href="#parameters" class="anchor"></a>
      </h4>

      <div class="docblock">
        <dl class="arguments">
          {% for arg in type_func.arguments %}
          <dt class="arg-name"><code>{{ arg.name }}</code></dt>
          <dd class="arg-description">
            <p><em>Type:</em>&nbsp;
            {%- if arg.is_array -%}An array of&nbsp;{%- endif -%}
            {%- if arg.is_list -%}A list of&nbsp;{%- endif -%}
            {%- if arg.link -%}
            {{ arg.link|safe }}
            {%- else -%}
            <code>{{ arg.type_cname }}</code>
            {%- endif -%}
            </p>
            {{ arg.description|safe }}
            <table>
            {% if arg.direction != "in" %}<tr><td title="direction: {{ arg.direction}}">{{ arg.direction_note }}</td></tr>{% endif %}
            {% if arg.direction == "in" and arg.is_pointer and arg.nullable %}<tr><td>The argument can be <code>NULL</code>.</td></tr>{% endif %}
            {% if arg.direction == "out" and arg.is_pointer and arg.nullable %}<tr><td>The argument can be set to <code>NULL</code> by the function.</td></tr>{% endif %}
            {% if arg.optional %}<tr><td>The argument can be <code>NULL</code>.</td></tr>{% endif %}
            {% if arg.is_array and arg.zero_terminated %}<tr><td>The array must be <code>NULL</code>-terminated.</td></tr>{% endif %}
            {% if arg.is_array and arg.fixed_size > 0 %}<tr><td>The array must have {{ arg.fixed_size }} elements.</td></tr>{% endif %}
            {% if arg.is_array and arg.len_arg %}<tr><td>The length of the array is specified in the <code>{{ arg.len_arg }}</code> argument.</td></tr>{% endif %}
            {% if arg.is_pointer %}<tr><td title="transfer: {{ arg.transfer }}">{{ arg.transfer_note }}</td></tr>{% endif %}
            {% if arg.string_note %}<tr><td>{{ arg.string_note }}</td></tr>{% endif %}
            </table>
          </dd>
          {% endfor %}

          {% if type_func.throws %}
          <dt class="arg-name"><code>error</code></dt>
          <dd class="arg-description">
            <p><em>Type:</em>&nbsp;<a href="javascript:void(0)" data-namespace="GLib" data-link="struct.Error.html" class="external"><code>GError **</code></a></p>
            <p>The return location for <a href="https://docs.gtk.org/glib/error-reporting.html#rules-for-use-of-gerror">a recoverable error</a>.</p>
            <table>
              <tr><td>The argument can be <code>NULL</code>.</td></tr>
              <tr><td>If the return location is not <code>NULL</code>, then you must initialize it to a <code>NULL</code> <code>GError*</code>.</td></tr>
              <tr><td>The argument will be left initialized to <code>NULL</code> by the function if there are no errors.</td></tr>
              <tr><td>In case of error, the argument will be set to a newly allocated <code>GError</code>; the caller will take ownership of the data, and be responsible for freeing it.</td></tr>
            </table>
          </dd>
          {% endif %}
        </dl>
      </div>
    </div>
    {% endif %}

    {% if type_func.return_value %}
    <div class="return-value toggle-wrapper">
      <h4 id="return-value">
        Return value
        <a href="#return-value" class="anchor"></a>
      </h4>

      <div class="docblock">
        <div class="returns">
          <div class="arg-description">
            <p><em>Type:</em>&nbsp;
            {%- if type_func.return_value.is_array -%}An array of&nbsp;{%- endif -%}
            {%- if type_func.return_value.is_list -%}A list of&nbsp;{%- endif -%}
            {%- if type_func.return_value.is_list_model -%}A list model of&nbsp;{%- endif -%}
            {%- if type_func.return_value.link -%}
            {{ type_func.return_value.link|safe }}
            {%- else -%}
            <code>{{ type_func.return_value.type_cname }}</code>
            {%- endif -%}
            </p>
            {{ type_func.return_value.description|safe }}
          </div>
          <div>
            <table>
            {% if type_func.return_value.is_array and type_func.return_value.zero_terminated %}<tr><td>The array is <code>NULL</code>-terminated.</td></tr>{% endif %}
            {% if type_func.return_value.is_array and type_func.return_value.fixed_size > 0 %}<tr><td>The array has {{ type_func.return_value.fixed_size }} elements.</td></tr>{% endif %}
            {% if type_func.return_value.is_array and type_func.return_value.len_arg %}<tr><td>The length of the array is in the <code>{{ type_func.return_value.len_arg }}</code> argument.</td></tr>{% endif %}
            {% if type_func.return_value.is_pointer %}<tr><td title="transfer: {{ type_func.return_value.transfer }}">{{ type_func.return_value.transfer_note }}</td></tr>{% endif %}
            {% if type_func.return_value.is_pointer and type_func.return_value.nullable %}<tr><td>The return value can be <code>NULL</code>.</td></tr>{% endif %}
            {% if type_func.return_value.string_note %}<tr><td>{{ type_func.return_value.string_note }}</td></tr>{% endif %}
            </table>
          </div>
        </div>
      </div>
    </div>
    {% endif %}
  </section>
</section>
{% endblock %}
