diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,49 @@
 2008-12-06  Andreas Rottmann  <a.rottmann@gmx.at>
-
+	Bug 556489 – callback annotations
+	
+	* tools/generate.c (write_callable_info): Write out the new scope,
+	closure and destroy attributes.
+
+	* giscanner/transformer.py (Transformer._type_is_callback): New
+	method, checking if a given type is a callback.
+	(Transformer._augment_callback_params): New method; adds
+	information (closure, destroy) to callback parameters.
+	(Transformer._create_function): Call _augment_callback_params().
+	(Transformer._create_parameter): Handle scope option.
+
+	(Transformer._create_typedef_callback): New method, creates a
+	callback, and registers it in the typedef namespace
+	(Transformer._create_typedef): Use _create_typedef_callback()
+	instead of the plain _create_callback().
+
+	* giscanner/ast.py (Parameter): Added callback-related fields.
+	* giscanner/girwriter.py: Write out new Parameter fields.
+
+	* girepository/girnode.h (GIrNodeParam): Added fields has_closure,
+	has_destroy, scope, closure and destroy.
+	* girepository/gtypelib.h (ArgBlob): Ditto.
+	* girepository/girparser.c (start_parameter): Handle new fields.
+
+	* girepository/girmodule.c (g_ir_module_build_typelib): Adjust
+	arg_blob_size, bump major version due to this change.
+	* girepository/girnode.c (g_ir_node_get_full_size_internal)
+	(g_ir_node_build_typelib)
+	* girepository/gtypelib.c (g_typelib_check_sanity): ArgBlob size
+	adjustments.
+	(g_ir_node_build_typelib): Fill in new ArgBlob flags from param. 
+
+	* girepository/girepository.h (GIScope): New enumeration, listing
+	the different possible scopes for callbacks.
+
+	* girepository/ginfo.c (g_arg_info_get_scope)
+	(g_arg_info_get_closure, g_arg_info_get_destroy): Accessors for
+	callback-related argument indices (callback scope, closure for a
+	callback, destroy notification for a callback).
+
+	* tests/scanner/: Added testcases for new features.
+
+	Bug 563464 – Include libgthread in the typelib for GLib
+	
 	* gir/Makefile.am (Glib-2.0.gir): Add gthread shared library.
 
 2008-12-03  Christophe Fergeau  <teuf@gnome.org>
diff --git a/girepository/ginfo.c b/girepository/ginfo.c
--- a/girepository/ginfo.c
+++ b/girepository/ginfo.c
@@ -741,12 +741,45 @@
     return GI_TRANSFER_NOTHING;
 }
 
+GIScope
+g_arg_info_get_scope (GIArgInfo *info)
+{
+  GIBaseInfo *base = (GIBaseInfo *)info;
+  ArgBlob *blob = (ArgBlob *)&base->typelib->data[base->offset];
+
+  return blob->scope;
+}
+
+gint
+g_arg_info_get_closure (GIArgInfo *info)
+{
+  GIBaseInfo *base = (GIBaseInfo *)info;
+  ArgBlob *blob = (ArgBlob *)&base->typelib->data[base->offset];
+
+  if (blob->has_closure)
+    return blob->closure;
+  else
+    return -1;
+}
+
+gint
+g_arg_info_get_destroy (GIArgInfo *info)
+{
+  GIBaseInfo *base = (GIBaseInfo *)info;
+  ArgBlob *blob = (ArgBlob *)&base->typelib->data[base->offset];
+
+  if (blob->has_destroy)
+    return blob->destroy;
+  else
+    return -1;
+}
+
 GITypeInfo *
 g_arg_info_get_type (GIArgInfo *info)
 {
   GIBaseInfo *base = (GIBaseInfo *)info;
  
-  return g_type_info_new (base, base->typelib, base->offset + 8);
+  return g_type_info_new (base, base->typelib, base->offset + 12);
 }
 
 /* GITypeInfo functions */
diff --git a/girepository/girepository.h b/girepository/girepository.h
--- a/girepository/girepository.h
+++ b/girepository/girepository.h
@@ -269,12 +269,23 @@
   GI_DIRECTION_INOUT
 } GIDirection;
 
+typedef enum {
+  GI_SCOPE_INVALID,
+  GI_SCOPE_CALL,
+  GI_SCOPE_OBJECT,
+  GI_SCOPE_ASYNC,
+  GI_SCOPE_NOTIFIED
+} GIScope;
+
 GIDirection            g_arg_info_get_direction          (GIArgInfo *info);
 gboolean               g_arg_info_is_dipper              (GIArgInfo *info);
 gboolean               g_arg_info_is_return_value        (GIArgInfo *info);
 gboolean               g_arg_info_is_optional            (GIArgInfo *info);
 gboolean               g_arg_info_may_be_null            (GIArgInfo *info);
 GITransfer             g_arg_info_get_ownership_transfer (GIArgInfo *info);
+GIScope                g_arg_info_get_scope              (GIArgInfo *info);
+gint                   g_arg_info_get_closure            (GIArgInfo *info);
+gint                   g_arg_info_get_destroy            (GIArgInfo *info);
 GITypeInfo *           g_arg_info_get_type               (GIArgInfo *info);
 
 
diff --git a/girepository/girmodule.c b/girepository/girmodule.c
--- a/girepository/girmodule.c
+++ b/girepository/girmodule.c
@@ -190,7 +190,7 @@
   /* fill in header */
   header = (Header *)data;
   memcpy (header, G_IR_MAGIC, 16);
-  header->major_version = 1;
+  header->major_version = 2;
   header->minor_version = 0;
   header->reserved = 0;
   header->n_entries = n_entries;
@@ -213,7 +213,7 @@
   header->callback_blob_size = 12;
   header->signal_blob_size = 12;
   header->vfunc_blob_size = 16;
-  header->arg_blob_size = 12;
+  header->arg_blob_size = 16;
   header->property_blob_size = 12;
   header->field_blob_size = 12;
   header->value_blob_size = 12;
diff --git a/girepository/girnode.c b/girepository/girnode.c
--- a/girepository/girnode.c
+++ b/girepository/girnode.c
@@ -582,7 +582,7 @@
       {
 	GIrNodeParam *param = (GIrNodeParam *)node;
 	
-	size = 12;
+	size = 16;
 	if (node->name)
 	  size += ALIGN_VALUE (strlen (node->name) + 1, 4);
 	size += g_ir_node_get_full_size_internal (node, (GIrNode *)param->type);	
@@ -1764,7 +1764,7 @@
 	ArgBlob *blob = (ArgBlob *)&data[*offset];
 	GIrNodeParam *param = (GIrNodeParam *)node;
 	
-	*offset += 8;
+	*offset += 12;
 
  	blob->name = write_string (node->name, strings, data, offset2);
  	blob->in = param->in;
@@ -1775,8 +1775,13 @@
 	blob->transfer_ownership = param->transfer;
 	blob->transfer_container_ownership = param->shallow_transfer;
 	blob->return_value = param->retval;
+        blob->has_closure = param->has_closure;
+        blob->has_destroy = param->has_destroy;
+        blob->scope = param->scope;
 	blob->reserved = 0;
-
+        blob->closure = param->closure;
+        blob->destroy = param->destroy;
+        
         g_ir_node_build_typelib ((GIrNode *)param->type, module, modules, 
 				 strings, types, data, offset, offset2);
       }
diff --git a/girepository/girnode.h b/girepository/girnode.h
--- a/girepository/girnode.h
+++ b/girepository/girnode.h
@@ -143,6 +143,12 @@
   gboolean allow_none;
   gboolean transfer;
   gboolean shallow_transfer;
+  gboolean has_closure;
+  gboolean has_destroy;
+  GIScope scope;
+  
+  gint closure;
+  gint destroy;
   
   GIrNodeType *type;
 };
diff --git a/girepository/girparser.c b/girepository/girparser.c
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -859,6 +859,9 @@
   const gchar *optional;
   const gchar *allow_none;
   const gchar *transfer;
+  const gchar *scope;
+  const gchar *closure;
+  const gchar *destroy;
   GIrNodeParam *param;
       
   if (!(strcmp (element_name, "parameter") == 0 &&
@@ -872,7 +875,10 @@
   optional = find_attribute ("optional", attribute_names, attribute_values);
   allow_none = find_attribute ("allow-none", attribute_names, attribute_values);
   transfer = find_attribute ("transfer-ownership", attribute_names, attribute_values);
-
+  scope = find_attribute ("scope", attribute_names, attribute_values);
+  closure = find_attribute ("closure", attribute_names, attribute_values);
+  destroy = find_attribute ("destroy", attribute_names, attribute_values);
+  
   if (name == NULL)
     name = "unknown";
 
@@ -921,6 +927,28 @@
 
   parse_param_transfer (param, transfer);
 
+  if (scope && strcmp (scope, "call") == 0)
+    param->scope = GI_SCOPE_CALL;
+  else if (scope && strcmp (scope, "object") == 0)
+    param->scope = GI_SCOPE_OBJECT;
+  else if (scope && strcmp (scope, "async") == 0)
+    param->scope = GI_SCOPE_ASYNC;
+  else if (scope && strcmp (scope, "notified") == 0)
+    param->scope = GI_SCOPE_NOTIFIED;
+  else
+    param->scope = GI_SCOPE_INVALID;
+  
+  if (closure)
+    {
+      param->has_closure = TRUE;
+      param->closure = atoi (closure);
+    }
+  if (destroy)
+    {
+      param->has_destroy = TRUE;
+      param->destroy = atoi (destroy);
+    }
+  
   ((GIrNode *)param)->name = g_strdup (name);
 	  
   switch (CURRENT_NODE (ctx)->type)
diff --git a/girepository/gtypelib.c b/girepository/gtypelib.c
--- a/girepository/gtypelib.c
+++ b/girepository/gtypelib.c
@@ -164,7 +164,7 @@
   CHECK_SIZE (Header, 108);
   CHECK_SIZE (DirEntry, 12);
   CHECK_SIZE (SimpleTypeBlob, 4);
-  CHECK_SIZE (ArgBlob, 12);
+  CHECK_SIZE (ArgBlob, 16);
   CHECK_SIZE (SignatureBlob, 8);
   CHECK_SIZE (CommonBlob, 8);
   CHECK_SIZE (FunctionBlob, 20);
@@ -286,7 +286,7 @@
       
     }
 
-  if (header->major_version != 1 || header->minor_version != 0)
+  if (header->major_version != 2 || header->minor_version != 0)
     {
       g_set_error (error,
 		   G_TYPELIB_ERROR,
@@ -319,7 +319,7 @@
       header->callback_blob_size != 12 ||
       header->signal_blob_size != 12 ||
       header->vfunc_blob_size != 16 ||
-      header->arg_blob_size != 12 ||
+      header->arg_blob_size != 16 ||
       header->property_blob_size != 12 ||
       header->field_blob_size != 12 ||
       header->value_blob_size != 12 ||
diff --git a/girepository/gtypelib.h b/girepository/gtypelib.h
--- a/girepository/gtypelib.h
+++ b/girepository/gtypelib.h
@@ -132,7 +132,13 @@
   guint          transfer_ownership           : 1;
   guint          transfer_container_ownership : 1;
   guint          return_value                 : 1;
-  guint          reserved                     :24;
+  guint          has_closure                  : 1;
+  guint          has_destroy                  : 1;
+  guint          scope                        : 3;
+  guint          reserved                     :19;
+
+  guint16        closure;
+  guint16        destroy;
 
   SimpleTypeBlob arg_type;
 } ArgBlob;
diff --git a/giscanner/ast.py b/giscanner/ast.py
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -288,7 +288,8 @@
 class Parameter(TypeContainer):
 
     def __init__(self, name, typenode, direction=PARAM_DIRECTION_IN,
-                 transfer=None, allow_none=False):
+                 transfer=None, allow_none=False,
+                 scope=None, closure_name=None, destroy_name=None):
         TypeContainer.__init__(self, name, typenode, transfer)
         if direction in [PARAM_DIRECTION_IN, PARAM_DIRECTION_OUT,
                          PARAM_DIRECTION_INOUT]:
@@ -297,6 +298,11 @@
             self.direction = PARAM_DIRECTION_IN
 
         self.allow_none = not not allow_none
+        self.scope = scope
+        self.closure_name = closure_name
+        self.closure_index = -1
+        self.destroy_name = destroy_name
+        self.destroy_index = -1
 
     def __repr__(self):
         return 'Parameter(%r, %r)' % (self.name, self.type)
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -157,6 +157,12 @@
                      parameter.transfer))
         if parameter.allow_none:
             attrs.append(('allow-none', '1'))
+        if parameter.scope:
+            attrs.append(('scope', parameter.scope))
+        if parameter.closure_index >= 0:
+            attrs.append(('closure', '%d' % parameter.closure_index))
+        if parameter.destroy_index >= 0:
+            attrs.append(('destroy', '%d' % parameter.destroy_index))
         with self.tagcontext('parameter', attrs):
             self._write_type(parameter.type)
 
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -262,6 +262,43 @@
         if isinstance(return_.type, Array):
             self._pair_array(params, return_)
 
+    def _type_is_callback(self, type):
+        return (isinstance(type, Callback) \
+                    or isinstance(self._typedefs_ns.get(type.name), Callback))
+
+    def _augment_callback_params(self, params):
+
+        def handle_closure(param, i, x):
+            if x.type.name == 'any' and x.name == 'user_data':
+                param.closure_name = x.name
+                param.closure_index = i
+                return True
+            return False
+
+        def handle_destroy(param, i, x):
+            if ((self._namespace.name == 'GLib' and
+                 x.type.name == 'DestroyNotify') or
+                x.type.name == 'GLib.DestroyNotify'):
+                param.destroy_name = x.name
+                param.destroy_index = i
+                return True
+            return False
+
+        for i, param in enumerate(params):
+            if self._type_is_callback(param.type):
+                j = i + 1
+                if j == len(params):
+                    continue
+                had_closure = handle_closure(param, j, params[j])
+                had_destroy = handle_destroy(param, j, params[j])
+                j += 1
+                if j == len(params) or not (had_closure or had_destroy):
+                    continue
+                if not had_closure:
+                    handle_closure(param, j, params[j])
+                if not had_destroy:
+                    handle_destroy(param, j, params[j])
+
     # We take the annotations from the parser as strings; here we
     # want to split them into components, so:
     # (transfer full) -> {'transfer' : [ 'full' ]}
@@ -280,6 +317,7 @@
             symbol.base_type, directives))
         return_ = self._create_return(symbol.base_type.base_type,
                                       directives.get('return', {}))
+        self._augment_callback_params(parameters)
         self._pair_annotations(parameters, return_)
         name = self._strip_namespace_func(symbol.ident)
         func = Function(name, return_, parameters, symbol.ident)
@@ -348,7 +386,7 @@
         ctype = symbol.base_type.type
         if (ctype == CTYPE_POINTER and
             symbol.base_type.base_type.type == CTYPE_FUNCTION):
-            node = self._create_callback(symbol)
+            node = self._create_typedef_callback(symbol)
         elif (ctype == CTYPE_POINTER and
             symbol.base_type.base_type.type == CTYPE_STRUCT):
             node = self._create_typedef_struct(symbol, disguised=True)
@@ -576,6 +614,8 @@
                 pass
             elif option in ('transfer', 'transfer-inferred'):
                 pass
+            elif option == 'scope':
+                param.scope = data[0]
             else:
                 print 'Unhandled parameter annotation option: %r' % (
                     option, )
@@ -631,6 +671,11 @@
         self._typedefs_ns[symbol.ident] = union
         self._create_union(symbol)
         return union
+
+    def _create_typedef_callback(self, symbol):
+        callback = self._create_callback(symbol)
+        self._typedefs_ns[callback.name] = callback
+        return callback
 
     def _create_struct(self, symbol):
         struct = self._typedefs_ns.get(symbol.ident, None)
diff --git a/tests/scanner/annotation-1.0-expected.gir b/tests/scanner/annotation-1.0-expected.gir
--- a/tests/scanner/annotation-1.0-expected.gir
+++ b/tests/scanner/annotation-1.0-expected.gir
@@ -235,6 +235,22 @@
           </parameter>
         </parameters>
       </method>
+      <method name="foreach" c:identifier="annotation_object_foreach">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="func"
+                     transfer-ownership="none"
+                     scope="call"
+                     closure="2">
+            <type name="ForeachFunc" c:type="AnnotationForeachFunc"/>
+          </parameter>
+          <parameter name="user_data" transfer-ownership="none">
+            <type name="any" c:type="gpointer"/>
+          </parameter>
+        </parameters>
+      </method>
       <method name="do_not_use"
               c:identifier="annotation_object_do_not_use"
               deprecated="Use annotation_object_create_object() instead."
@@ -252,6 +268,22 @@
         <type name="GObject.ObjectClass" c:type="GObjectClass"/>
       </field>
     </record>
+    <callback name="ForeachFunc" c:type="AnnotationForeachFunc">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="object" transfer-ownership="none">
+          <type name="Object" c:type="AnnotationObject*"/>
+        </parameter>
+        <parameter name="item" transfer-ownership="none">
+          <type name="utf8" c:type="char*"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <type name="any" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </callback>
     <function name="init" c:identifier="annotation_init">
       <return-value transfer-ownership="none">
         <type name="none" c:type="void"/>
diff --git a/tests/scanner/annotation-1.0-expected.tgir b/tests/scanner/annotation-1.0-expected.tgir
--- a/tests/scanner/annotation-1.0-expected.tgir
+++ b/tests/scanner/annotation-1.0-expected.tgir
@@ -224,6 +224,19 @@
           </parameter>
         </parameters>
       </method>
+      <method name="foreach" c:identifier="annotation_object_foreach">
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="func" transfer-ownership="none" scope="call" closure="2">
+            <type name="ForeachFunc"/>
+          </parameter>
+          <parameter name="user_data" transfer-ownership="none">
+            <type name="any"/>
+          </parameter>
+        </parameters>
+      </method>
       <method name="do_not_use" c:identifier="annotation_object_do_not_use" deprecated="1">
         <return-value transfer-ownership="full">
           <type name="GObject.Object"/>
@@ -235,6 +248,22 @@
         <type name="GObject.ObjectClass"/>
       </field>
     </record>
+    <callback name="ForeachFunc">
+      <return-value transfer-ownership="none">
+        <type name="none"/>
+      </return-value>
+      <parameters>
+        <parameter name="object" transfer-ownership="none">
+          <type name="Object"/>
+        </parameter>
+        <parameter name="item" transfer-ownership="none">
+          <type name="utf8"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <type name="any"/>
+        </parameter>
+      </parameters>
+    </callback>
     <function name="init" c:identifier="annotation_init">
       <return-value transfer-ownership="none">
         <type name="none"/>
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -292,6 +292,22 @@
 }
 
 /**
+ * annotation_object_foreach:
+ * @object: a #AnnotationObject
+ * @func: (scope call): Callback to invoke
+ * @user_data: Callback user data
+ *
+ * Test taking a call-scoped callback
+ **/
+void
+annotation_object_foreach (AnnotationObject *object,
+                           AnnotationForeachFunc func,
+                           gpointer user_data)
+{
+  
+}
+
+/**
  * annotation_object_allow_none:
  * @object: a #GObject
  * @somearg: (allow-none):
diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h
--- a/tests/scanner/annotation.h
+++ b/tests/scanner/annotation.h
@@ -21,6 +21,10 @@
 
 typedef struct _AnnotationObject          AnnotationObject;
 typedef struct _AnnotationObjectClass     AnnotationObjectClass;
+
+typedef void (*AnnotationForeachFunc) (AnnotationObject *object,
+                                       const char *item,
+                                       gpointer user_data);
 
 struct _AnnotationObject
 {
@@ -73,7 +77,9 @@
 void     annotation_object_parse_args   (AnnotationObject *object,
                                          int              *argc,
                                          char           ***argv);
-
+void     annotation_object_foreach      (AnnotationObject *object,
+                                         AnnotationForeachFunc func,
+                                         gpointer user_data);
 GObject* annotation_object_do_not_use   (AnnotationObject *object);
 
 
diff --git a/tests/scanner/utility-1.0-expected.gir b/tests/scanner/utility-1.0-expected.gir
--- a/tests/scanner/utility-1.0-expected.gir
+++ b/tests/scanner/utility-1.0-expected.gir
@@ -12,6 +12,28 @@
            parent="GObject.Object"
            glib:type-name="UtilityObject"
            glib:get-type="utility_object_get_type">
+      <method name="watch_dir" c:identifier="utility_object_watch_dir">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="path" transfer-ownership="none">
+            <type name="utf8" c:type="char*"/>
+          </parameter>
+          <parameter name="func"
+                     transfer-ownership="none"
+                     closure="3"
+                     destroy="4">
+            <type name="FileFunc" c:type="UtilityFileFunc"/>
+          </parameter>
+          <parameter name="user_data" transfer-ownership="none">
+            <type name="any" c:type="gpointer"/>
+          </parameter>
+          <parameter name="destroy" transfer-ownership="none">
+            <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+          </parameter>
+        </parameters>
+      </method>
       <field name="parent_instance">
         <type name="GObject.Object" c:type="GObject"/>
       </field>
@@ -21,6 +43,19 @@
         <type name="GObject.ObjectClass" c:type="GObjectClass"/>
       </field>
     </record>
+    <callback name="FileFunc" c:type="UtilityFileFunc">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="path" transfer-ownership="none">
+          <type name="utf8" c:type="char*"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <type name="any" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </callback>
     <enumeration name="EnumType" c:type="UtilityEnumType">
       <member name="a" value="0" c:identifier="UTILITY_ENUM_A"/>
       <member name="b" value="1" c:identifier="UTILITY_ENUM_B"/>
@@ -58,5 +93,21 @@
         <type name="double" c:type="double"/>
       </field>
     </union>
+    <function name="dir_foreach" c:identifier="utility_dir_foreach">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="path" transfer-ownership="none">
+          <type name="utf8" c:type="char*"/>
+        </parameter>
+        <parameter name="func" transfer-ownership="none" closure="2">
+          <type name="FileFunc" c:type="UtilityFileFunc"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <type name="any" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </function>
   </namespace>
 </repository>
diff --git a/tests/scanner/utility-1.0-expected.tgir b/tests/scanner/utility-1.0-expected.tgir
--- a/tests/scanner/utility-1.0-expected.tgir
+++ b/tests/scanner/utility-1.0-expected.tgir
@@ -10,12 +10,44 @@
       <field name="parent_instance">
         <type name="GObject.Object"/>
       </field>
+      <method name="watch_dir" c:identifier="utility_object_watch_dir">
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="path" transfer-ownership="none">
+            <type name="utf8"/>
+          </parameter>
+          <parameter name="func" transfer-ownership="none" closure="3" destroy="4">
+            <type name="FileFunc"/>
+          </parameter>
+          <parameter name="user_data" transfer-ownership="none">
+            <type name="any"/>
+          </parameter>
+          <parameter name="destroy" transfer-ownership="none">
+            <type name="GLib.DestroyNotify"/>
+          </parameter>
+        </parameters>
+      </method>
     </class>
     <record name="ObjectClass">
       <field name="parent_class">
         <type name="GObject.ObjectClass"/>
       </field>
     </record>
+    <callback name="FileFunc">
+      <return-value transfer-ownership="none">
+        <type name="none"/>
+      </return-value>
+      <parameters>
+        <parameter name="path" transfer-ownership="none">
+          <type name="utf8"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <type name="any"/>
+        </parameter>
+      </parameters>
+    </callback>
     <enumeration name="EnumType">
       <member name="a" value="0"/>
       <member name="b" value="1"/>
@@ -53,5 +85,21 @@
         <type name="double"/>
       </field>
     </union>
+    <function name="dir_foreach" c:identifier="utility_dir_foreach">
+      <return-value transfer-ownership="none">
+        <type name="none"/>
+      </return-value>
+      <parameters>
+        <parameter name="path" transfer-ownership="none">
+          <type name="utf8"/>
+        </parameter>
+        <parameter name="func" transfer-ownership="none" closure="2">
+          <type name="FileFunc"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <type name="any"/>
+        </parameter>
+      </parameters>
+    </function>
   </namespace>
 </repository>
diff --git a/tests/scanner/utility.c b/tests/scanner/utility.c
--- a/tests/scanner/utility.c
+++ b/tests/scanner/utility.c
@@ -14,3 +14,18 @@
 
 }
 
+void
+utility_object_watch_dir (UtilityObject *object,
+                          const char *path,
+                          UtilityFileFunc func,
+                          gpointer user_data,
+                          GDestroyNotify destroy)
+{
+
+}
+
+void
+utility_dir_foreach (const char *path, UtilityFileFunc func, gpointer user_data)
+{
+
+}
diff --git a/tests/scanner/utility.h b/tests/scanner/utility.h
--- a/tests/scanner/utility.h
+++ b/tests/scanner/utility.h
@@ -23,7 +23,14 @@
 /* This one is similar to Pango.Glyph */
 typedef guint32 UtilityGlyph;
 
+typedef void (*UtilityFileFunc)(const char *path, gpointer user_data);
+
 GType                 utility_object_get_type          (void) G_GNUC_CONST;
+void                  utility_object_watch_dir         (UtilityObject *object,
+                                                        const char *path,
+                                                        UtilityFileFunc func,
+                                                        gpointer user_data,
+                                                        GDestroyNotify destroy);
 
 typedef enum
 {
@@ -53,5 +60,7 @@
   glong integer;
   double real;
 } UtilityUnion;
-  
+
+void utility_dir_foreach (const char *path, UtilityFileFunc func, gpointer user_data);
+
 #endif /* __UTILITY_H__ */
diff --git a/tools/generate.c b/tools/generate.c
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -455,6 +455,30 @@
       
       if (g_arg_info_is_optional (arg))
 	xml_printf (file, " optional=\"1\"");
+
+      switch (g_arg_info_get_scope (arg))
+        {
+        case GI_SCOPE_INVALID:
+          break;
+        case GI_SCOPE_CALL:
+          xml_printf (file, " scope=\"call\"");
+          break;
+        case GI_SCOPE_OBJECT:
+          xml_printf (file, " scope=\"object\"");
+          break;
+        case GI_SCOPE_ASYNC:
+          xml_printf (file, " scope=\"async\"");
+          break;
+        case GI_SCOPE_NOTIFIED:
+          xml_printf (file, " scope=\"notified\"");
+          break;
+        }
+      
+      if (g_arg_info_get_closure (arg) >= 0)
+        xml_printf (file, " closure=\"%d\"", g_arg_info_get_closure (arg));
+      
+      if (g_arg_info_get_destroy (arg) >= 0)
+        xml_printf (file, " destroy=\"%d\"", g_arg_info_get_destroy (arg));
       
       type = g_arg_info_get_type (arg);
       write_type_info (namespace, type, file);
