[gobject-introspection] doctool: prepend the emitting object for GJS signal callbacks
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] doctool: prepend the emitting object for GJS signal callbacks
- Date: Wed, 31 Aug 2022 04:17:10 +0000 (UTC)
commit 5743511f21c0597d70a148f05481e0c6f9666803
Author: Andy Holmes <andyholmes gnome org>
Date: Wed Aug 31 04:17:09 2022 +0000
doctool: prepend the emitting object for GJS signal callbacks
giscanner/doctemplates/devdocs/Gjs/_index.tmpl | 2 +-
giscanner/doctemplates/devdocs/Gjs/_method.tmpl | 9 ++++++++-
giscanner/doctemplates/devdocs/Gjs/_signals.tmpl | 2 +-
giscanner/docwriter.py | 6 ++++++
4 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/doctemplates/devdocs/Gjs/_index.tmpl b/giscanner/doctemplates/devdocs/Gjs/_index.tmpl
index f3d588ae5..e53f45589 100644
--- a/giscanner/doctemplates/devdocs/Gjs/_index.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/_index.tmpl
@@ -141,7 +141,7 @@
<tr>
<td class="${doc.deprecated_class(s)}">
<a href="#${formatter.make_anchor(s)}">${s.name}</a><!-- no space
- -->(${formatter.format_in_parameters(s)})
+ -->(${formatter.format_signal_parameters(s)})
</td>
</tr>
</%doc:introspectable>
diff --git a/giscanner/doctemplates/devdocs/Gjs/_method.tmpl b/giscanner/doctemplates/devdocs/Gjs/_method.tmpl
index 57520465c..3109fd1bb 100644
--- a/giscanner/doctemplates/devdocs/Gjs/_method.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/_method.tmpl
@@ -13,10 +13,17 @@
in_params = formatter.get_in_parameters(m)
out_params = formatter.get_out_parameters(m)
%>
- % if in_params:
+ % if in_params or isinstance(m, ast.Signal):
<dt>Parameters:</dt>
<dd>
<ul>
+ % if isinstance(m, ast.Signal):
+ <li>
+ <strong>${formatter.to_lower_camel_case(m.parent.name)}</strong>
+ (<code>${m.parent.gi_name}</code>)
+ — the emitting object
+ </li>
+ %endif
% for p in in_params:
<li>
<strong>${p.argname}</strong>
diff --git a/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl
b/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl
index cda46bd58..3c1ff4434 100644
--- a/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl
@@ -9,7 +9,7 @@
id="${formatter.make_anchor(s)}">
${s.name}<!-- no space
--></span><!--
- -->(${formatter.format_in_parameters(s)})
+ -->(${formatter.format_signal_parameters(s)})
</h3>
<dl>
<dt>Flags</dt>
diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py
index b72ab2ac9..cd49cea91 100644
--- a/giscanner/docwriter.py
+++ b/giscanner/docwriter.py
@@ -1274,6 +1274,12 @@ class DevDocsFormatterGjs(DocFormatterGjs):
def format_in_parameters(self, node):
return ', '.join(p.argname for p in self.get_in_parameters(node))
+ def format_signal_parameters(self, node):
+ emitter = self.to_lower_camel_case(node.parent.name)
+ in_params = self.format_in_parameters(node)
+
+ return '%s, %s' % (emitter, in_params) if in_params else emitter
+
LANGUAGES = {
"devdocs": {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]