...
 
Commits (2)
......@@ -1161,6 +1161,7 @@ girst_parser_object_get_signature (GirstParserObject *self)
{
g_autoptr(GString) str = NULL;
g_autoptr(GString) param_str = NULL;
const gchar *container_c_type = NULL;
g_autofree gchar *formatted = NULL;
GirstParserObject *return_value;
GirstParserObject *params;
......@@ -1173,10 +1174,13 @@ girst_parser_object_get_signature (GirstParserObject *self)
if (!GIRST_IS_FUNCTION (self) &&
!GIRST_IS_CALLBACK (self) &&
!GIRST_IS_CONSTRUCTOR (self) &&
!GIRST_IS_GLIB_SIGNAL (self) &&
!GIRST_IS_VIRTUAL_METHOD (self) &&
!GIRST_IS_METHOD (self))
return NULL;
container_c_type = find_object_c_type (self);
str = g_string_new (NULL);
param_str = g_string_new (NULL);
......@@ -1226,6 +1230,10 @@ girst_parser_object_get_signature (GirstParserObject *self)
g_string_append_printf (str, "%s ", c_identifier);
}
else if (GIRST_IS_GLIB_SIGNAL (self))
{
g_string_append (str, "user_function ");
}
else if (GIRST_IS_VIRTUAL_METHOD (self))
{
const gchar *c_identifier = girst_virtual_method_get_c_identifier (GIRST_VIRTUAL_METHOD (self));
......@@ -1250,7 +1258,11 @@ girst_parser_object_get_signature (GirstParserObject *self)
params = girst_parser_object_first_typed (self, GIRST_TYPE_PARAMETERS);
if (params == NULL)
if (GIRST_IS_GLIB_SIGNAL (self))
{
g_string_append_printf (param_str, "%s *self, ", container_c_type);
}
else if (params == NULL)
{
g_string_append (str, "void");
goto cleanup;
......@@ -1283,6 +1295,9 @@ girst_parser_object_get_signature (GirstParserObject *self)
g_string_append_printf (param_str, "%s %s, ", c_type, name);
}
if (GIRST_IS_GLIB_SIGNAL (self))
g_string_append (param_str, "gpointer user_data, ");
if (param_str->len > 2)
g_string_truncate (param_str, param_str->len - 2);
......
{{require GObject version "2.0"}}
{{require Girst version "1.0"}}
.. c:function:: {{container.c_type}}::{{signal.name}}
{{Girst.title3("The “" + signal.name + "” signal")}}
{{if signal.has_child_typed(Girst.Parameters)}}
{{for param in signal.first_typed(Girst.Parameters)}}
:param {{param.name}}:
:type {{param.name}}: :c:type:`{{param.type_name("c")}}`
{{if param.has_child_typed(Girst.Doc)}}
.. code-block:: c
{{param.first_typed(Girst.Doc).to_c(" ")}} {{param.annotations()}}
{{else}}
{{param.annotations()}}
{{end}}
{{signal.get_signature()}}
{{end}}
{{end}}
{{if signal.has_child_typed(Girst.ReturnValue)}}
{{return_value = signal.first_typed(Girst.ReturnValue)}}
{{if return_value.has_child_typed(Girst.Doc)}}
..
:returns:
{{return_value.first_typed(Girst.Doc).to_c(" ")}}
{{if signal.has_child_typed(Girst.Parameters)}}
{{Girst.title4("Parameters")}}
{{end}}
{{if return_value.to_c() != "void"}}
:rtype: :c:type:`{{return_value.to_c()}}`
{{for param in signal.get_parameters()}}
- **{{param.name}}**: {{if param.annotations()}}{{param.annotations()}}: {{end}}{{if param.has_child_typed(Girst.Doc)}}{{Girst.one_line(param.first_typed(Girst.Doc).inner_text, "c")}}{{else}}{{Girst.clink_full(param.get_lhs_ctype(), param.get_lhs(), "")}}{{end}}
{{end}}
{{end}}
{{if signal.version}}
.. versionadded:: {{signal.version}}
{{end}}
{{if signal.get_lhs_ctype() != "void"}}
{{Girst.title4("Returns")}}
{{if signal.stability == "Unstable"}}
{{for return_value in signal.get_children_typed(Girst.ReturnValue)}}
{{Girst.clink_full(signal.get_lhs_ctype(), signal.get_lhs(), "")}}: {{if return_value.annotations()}}{{return_value.annotations()}}: {{end}}{{if return_value.has_child_typed(Girst.Doc)}}{{Girst.one_line(return_value.first_typed(Girst.Doc).inner_text, "c")}}{{end}}
.. warning:: Method is currently considered unstable.
{{end}}
{{if signal.deprecated}}
{{end}}
.. deprecated:: {{signal.deprecated_version}}
{{if signal.has_child_typed(Girst.DocDeprecated)}}
{{Girst.one_line(signal.first_typed(Girst.DocDeprecated).inner_text, "c")}}
{{end}}
{{if signal.stability == "Unstable"}}
.. warning:: This signal is currently considered unstable.
{{else if signal.stability == "Private"}}
.. note:: This signal is currently considered private.
{{end}}
{{if signal.has_child_typed(Girst.Doc)}}
{{signal.first_typed(Girst.Doc).to_c(" ")}}
{{if signal.version}}
.. versionadded:: {{signal.version}}
{{end}}
{{if signal.introspectable == "0"}}
.. note:: :c:func:`{{container.c_type}}::{{signal.name}}` is not introspectable.
{{if signal.deprecated_version}}
.. deprecated:: {{signal.deprecated_version}}
{{else if signal.deprecated}}
.. deprecated::
{{end}}
{{if signal.has_child_typed(Girst.DocDeprecated)}}
{{Girst.one_line(signal.first_typed(Girst.DocDeprecated).inner_text, "c")}}
{{end}}