Make sure signal works when there isn't one specified
authorJohan Dahlin <jdahlin@litl.com>
Sat, 13 Aug 2011 15:45:12 +0000 (12:45 -0300)
committerJohan Dahlin <jdahlin@litl.com>
Sat, 13 Aug 2011 15:45:12 +0000 (12:45 -0300)
giscanner/ast.py
giscanner/gdumpparser.py
giscanner/girparser.py
giscanner/girwriter.py

index 2b1c6f582db6af7b8f54c8c5983043792357acae..d63fdb884c0f38e31f91c958ba34a7eb041d3fe3 100644 (file)
@@ -874,7 +874,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)
index be25d614802e4229ffea1b336bc1009736475328..f94917e6f11d771cb47e592a70cb6c253e6a12b4 100644 (file)
@@ -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'
index 5e1866d241f2f6cc21cfe4d1919029ea687fb5a0..d7a59b83efd14a74d4c54c06ed98812239146a87 100644 (file)
@@ -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',
index 591c7aeaeeda5a05a4a1cef95ae30a5b2e42d613..f9937291835ac2c55f5d844f5e38268599452087 100644 (file)
@@ -554,8 +554,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: