[gobject-introspection/gir-docbook] Make sure signal works when there isn't one specified



commit c3a1333790dd1c25c2e19b80be84f6c8a84c91d6
Author: Johan Dahlin <jdahlin litl com>
Date:   Sat Aug 13 12:45:12 2011 -0300

    Make sure signal works when there isn't one specified

 giscanner/ast.py         |    2 +-
 giscanner/gdumpparser.py |    2 +-
 giscanner/girparser.py   |    2 +-
 giscanner/girwriter.py   |    5 +++--
 4 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/giscanner/ast.py b/giscanner/ast.py
index bf1ab97..c84bfc7 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -864,7 +864,7 @@ class Boxed(Node, Registered):
 
 class Signal(Callable):
 
-    def __init__(self, name, retval, parameters, when="first",
+    def __init__(self, name, retval, parameters, when=None,
                  no_recurse=False, detailed=False, action=False,
                  no_hooks=False):
         Callable.__init__(self, name, retval, parameters, False)
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index be25d61..f94917e 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -453,7 +453,7 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
             rtype = ast.Type.create_from_gtype_name(rctype)
             return_ = ast.Return(rtype)
             parameters = []
-            when = signal_info.attrib['when']
+            when = signal_info.attrib.get('when')
             no_recurse = signal_info.attrib.get('no-recurse', '0') == '1'
             detailed = signal_info.attrib.get('detailed', '0') == '1'
             action = signal_info.attrib.get('action', '0') == '1'
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index ffe0dbc..5184d16 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -300,7 +300,7 @@ class GIRParser(object):
             func = klass(name, retval, parameters, throws)
         elif klass is ast.Signal:
             func = klass(name, retval, parameters,
-                         when=node.attrib.get('when', 'first'),
+                         when=node.attrib.get('when'),
                          no_recurse=node.attrib.get('no-recurse', '0') == '1',
                          detailed=node.attrib.get('detailed', '0') == '1',
                          action=node.attrib.get('action', '0') == '1',
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index dc6db99..6299a79 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -552,8 +552,9 @@ and/or use gtk-doc annotations. ''')
                 self._write_type(field.type)
 
     def _write_signal(self, signal):
-        attrs = [('name', signal.name),
-                 ('when', signal.when)]
+        attrs = [('name', signal.name)]
+        if signal.when:
+            attrs.append(('when', signal.when))
         if signal.no_recurse:
             attrs.append(('no-recurse', '1'))
         if signal.detailed:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]