[gobject-introspection] [glibtransformer] Refactor field adding to a separate method



commit 5f246f8a851db8cdc07baae1b35ad67242d4653c
Author: Johan Dahlin <johan gnome org>
Date:   Sat Jun 12 15:54:23 2010 -0300

    [glibtransformer] Refactor field adding to a separate method

 giscanner/glibtransformer.py |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index b86a49d..b9b4cb6 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -741,16 +741,7 @@ class GLibTransformer(object):
         self._introspect_signals(node, xmlnode)
         self._introspect_implemented_interfaces(node, xmlnode)
 
-        # add record fields
-        record = self._get_attribute(node.name)
-        if record is not None:
-            node.fields = record.fields
-            for field in node.fields:
-                if isinstance(field, Field):
-                    # Object instance fields are assumed to be read-only
-                    # (see also _pair_class_record and transformer.py)
-                    field.writable = False
-
+        self._add_record_fields(node)
         self._add_attribute(node, replace=True)
         self._register_internal_type(type_name, node)
 
@@ -826,6 +817,18 @@ class GLibTransformer(object):
             node.signals.append(signal)
         node.signals = sorted(node.signals)
 
+    def _add_record_fields(self, node):
+        # add record fields
+        record = self._get_attribute(node.name)
+        if record is None:
+            return
+        node.fields = record.fields
+        for field in node.fields:
+            if isinstance(field, Field):
+                # Object instance fields are assumed to be read-only
+                # (see also _pair_class_record and transformer.py)
+                field.writable = False
+
     # Resolver
 
     def _resolve_type_name(self, type_name, ctype=None):



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