<!--
SPDX-FileCopyrightText: 2021 GNOME Foundation

SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
-->

{% extends "base.html" %}

{% block title %}{{ namespace.name }}.{{ class.name }}::{{ signal.name }}{% endblock %}

{% block meta_other %}
  <meta property="og:title" content="{{ namespace.name }}.{{ class.name }}::{{ signal.name }}"/>
  <meta property="og:description" content="Reference for signal {{ namespace.name }}.{{ class.name }}::{{ signal.name }}"/>
  <meta name="twitter:title" content="{{ namespace.name }}.{{ class.name }}::{{ signal.name }}"/>
  <meta name="twitter:description" content="Reference for signal {{ namespace.name }}.{{ class.name }}::{{ signal.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>Signals</h5>
  <div class="links">
  {% for s in class.signals %}
    <a class="signal{% if s.name == signal.name %} current{% endif %}" href="signal.{{ class.name }}.{{ s.name }}.html">{{ s.name }}</a>
  {% endfor %}
  </div>
</div>
{% endblock %}

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

  <section>
    <div class="declaration toggle-wrapper">
      <h4 id="declaration">
        Declaration
        <a href="#declaration" class="anchor"></a>
      </h4>

      <div class="docblock">
        <pre><code>{{ signal.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 signal.docs_location %}
        <a class="srclink" title="go to source location" href="{{ CONFIG.source_link(signal.docs_location) }}">[src]</a>
        {% endif %}
      </h4>

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

      <div class="docblock">
        <table>
          <tr><td>Default handler:</td><td> {{ signal.when }}</td></tr>
          {% if signal.no_recurse %}
          <tr><td colspan="2">Signal emission will restart instead of recursing</td></tr>
          {% endif %}
          {% if signal.is_action %}
          <tr><td colspan="2">The signal can be emitted directly</td></tr>
          {% endif %}
          {% if signal.is_detailed %}
          <tr><td colspan="2">The signal can be detailed</td></tr>
          {% endif %}
          {% if signal.no_hooks %}
          <tr><td colspan="2">Hooks are disabled for this signal</td></tr>
          {% endif %}
          {% if signal.stability %}
          <tr><td>Stability:</td><td>{{ signal.stability }}</td></tr>
          {% endif %}
          {% if signal.available_since %}
          <tr><td>Available since:</td><td>{{ signal.available_since }}</td></tr>
          {% endif %}
          {% if signal.deprecated_since %}
          <tr><td>Deprecated since:</td><td>{{ signal.deprecated_since.version }}</td></tr>
          <tr><td colspan="2">{{ signal.deprecated_since.message }}</td></tr>
          {% endif %}
        </table>
      </div>

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

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

      <div class="docblock">
        <table class="arguments">
          {% for arg in signal.arguments %}
          <tr class="arg-name">
            <td><code>{{ arg.name }}</code></td>
            <td>
            {%- 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 -%}
            </td>
          </tr>
          <tr class="arg-description">
            <td>&nbsp;</td>
            <td>{{ arg.description|safe }}</td>
          </tr>
          {% if arg.direction != "in" %}<tr><td>&nbsp;</td><td title="direction: {{ arg.direction}}">{{ arg.direction_note }}</td></tr>{% endif %}
          {% if arg.direction == "in" and arg.is_pointer and arg.nullable %}<tr><td>&nbsp;</td><td>The argument can be <code>NULL</code>.</td></tr>{% endif %}
          {% if arg.direction == "out" and arg.is_pointer and arg.nullable %}<tr><td>&nbsp;</td><td>The argument can be set to <code>NULL</code>.</td></tr>{% endif %}
          {% if arg.optional %}<tr><td>&nbsp;</td><td>The argument can be <code>NULL</code>.</td></tr>{% endif %}
          {% if arg.is_array and arg.zero_terminated %}<tr><td>&nbsp;</td><td>The array must be <code>NULL</code>-terminated.</td></tr>{% endif %}
          {% if arg.is_array and arg.fixed_size > 0 %}<tr><td>&nbsp;</td><td>The array must have {{ arg.fixed_size }} elements.</td></tr>{% endif %}
          {% if arg.is_array and arg.len_arg %}<tr><td>&nbsp;</td><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>&nbsp;</td><td title="transfer: {{ arg.transfer }}">{{ arg.transfer_note }}</td></tr>{% endif %}
          {% if arg.string_note %}<tr><td>&nbsp;</td><td>{{ arg.string_note }}</td></tr>{% endif %}
          {% endfor %}
          {% if signal.throws %}
          <tr class="arg-name">
            <td><code>error</code></td>
            <td><code>GError **</code></td>
          </tr>
          <tr class="arg-description">
            <td>&nbsp;</td>
            <td>The return location for a <code>GError*</code>, or <code>NULL</code>.</td>
          </tr>
          {% endif %}
        </table>
      </div>
    </div>
    {% endif %}

    {% if signal.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">
        <table class="returns">
          <tr class="arg-name">
            <td>Returns:</td>
            <td>
            {%- if signal.return_value.is_array -%}An array of&nbsp;{%- endif -%}
            {%- if signal.return_value.is_list -%}A list of&nbsp;{%- endif -%}
            {%- if signal.return_value.link -%}
            {{ signal.return_value.link|safe }}
            {%- else -%}
            <code>{{ signal.return_value.type_cname }}</code>
            {%- endif -%}
            </td>
          </tr>
          <tr class="arg-description">
            <td>&nbsp;</td>
            <td>{{ signal.return_value.description|safe }}</td>
          </tr>
          {% if signal.return_value.is_array and signal.return_value.zero_terminated %}<tr><td>&nbsp;</td><td>The array is <code>NULL</code>-terminated.</td></tr>{% endif %}
          {% if signal.return_value.is_array and signal.return_value.fixed_size > 0 %}<tr><td>&nbsp;</td><td>The array has {{ signal.return_value.fixed_size }} elements.</td></tr>{% endif %}
          {% if signal.return_value.is_array and signal.return_value.len_arg %}<tr><td>&nbsp;</td><td>The length of the array is in the <code>{{ signal.return_value.len_arg }}</code> argument.</td></tr>{% endif %}
          {% if signal.return_value.is_pointer %}<tr><td>&nbsp;</td><td title="transfer: {{ signal.return_value.transfer }}">{{ signal.return_value.transfer_note }}</td></tr>{% endif %}
          {% if signal.return_value.is_pointer and signal.return_value.nullable %}<tr><td>&nbsp;</td><td>The return value can be <code>NULL</code>.</td></tr>{% endif %}
          {% if signal.return_value.string_note %}<tr><td>&nbsp;</td><td>{{ signal.return_value.string_note }}</td></tr>{% endif %}
        </table>
      </div>
    </div>
    {% endif %}

  </section>
</section>
{% endblock %}
