Index: tests/test_gio.py
===================================================================
--- tests/test_gio.py	(revision 931)
+++ tests/test_gio.py	(working copy)
@@ -351,7 +351,36 @@
                                               10, gio.FILE_QUERY_INFO_NONE)
                 self.assertEqual(ret, True)
 
+    def testReplaceContents(self):
+        self.file.replace_contents("testing replace_contents")
+        cont, leng, etag = self.file.load_contents()
+        self.assertEqual(cont, "testing replace_contents")
 
+        self.file.replace_contents("testing replace_contents again")
+        cont, leng, etag = self.file.load_contents()
+        self.assertEqual(cont, "testing replace_contents again")
+
+    def testReplaceContentsAsync(self):
+
+        def callback(contents, result):
+            try:
+                newetag = contents.replace_contents_finish(result)
+                cont, leng, etag = self.file.load_contents()
+                self.assertEqual(cont, "testing replace_contents_async")
+                self.assertEqual(leng, 30)
+                self.assertEqual(etag, newetag)
+                self.assertNotEqual(newetag, '')
+            finally:
+                loop.quit()
+
+        canc = gio.Cancellable()
+        self.file.replace_contents_async("testing replace_contents_async", callback, cancellable=canc)
+
+        loop = glib.MainLoop()
+        loop.run()
+
+    
+
 class TestGFileEnumerator(unittest.TestCase):
     def setUp(self):
         self.file = gio.File(".")
Index: gio/gio.defs
===================================================================
--- gio/gio.defs	(revision 931)
+++ gio/gio.defs	(working copy)
@@ -2263,6 +2263,16 @@
 )
 
 (define-method replace_contents
+  (docstring
+  "F.replace_contents(contents, [etag, [make_backup, [flags, [cancellable]]]]) -> etag_out\n\n"
+  "Replaces the content of the file, returning the new etag value for the file.\n"
+  "If an etag is specified, any existing file must have that etag, or the\n"
+  "error gio.IO_ERROR_WRONG_ETAG will be returned.\n"
+  "If make_backup is True, this method will attempt to make a backup of the file.\n"
+  "If cancellable is not None, then the operation can be cancelled by\n"
+  "triggering the cancellable object from another thread. If the operation\n"
+  "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n"
+  )
   (of-object "GFile")
   (c-name "g_file_replace_contents")
   (return-type "gboolean")
@@ -2279,6 +2289,18 @@
 )
 
 (define-method replace_contents_async
+  (docstring
+  "F.replace_contents_async(contents, callback, [etag, [make_backup, [flags, [cancellable]]]]) -> etag_out\n\n"
+  "Starts an asynchronous replacement of the file with the given contents.\n"
+  "For more details, see F.replace_contents() which is the synchronous\n"
+  "version of this call.\n\n"
+  "When the load operation has completed, callback will be called with\n"
+  "user data. To finish the operation, call F.replace_contents_finish() with\n"
+  "the parameter 'res' returned by the callback.\n\n"
+  "If cancellable is not None, then the operation can be cancelled by\n"
+  "triggering the cancellable object from another thread. If the operation\n"
+  "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n"
+  )
   (of-object "GFile")
   (c-name "g_file_replace_contents_async")
   (return-type "none")
@@ -2295,6 +2317,11 @@
 )
 
 (define-method replace_contents_finish
+  (docstring
+  "F.replace_contents_finish(res) -> etag_out\n\n"
+  "Finishes an asynchronous replacement of the file's contents.\n"
+  "The new entity tag for the file is returned.\n"
+  )
   (of-object "GFile")
   (c-name "g_file_replace_contents_finish")
   (return-type "gboolean")
Index: gio/gfile.override
===================================================================
--- gio/gfile.override	(revision 931)
+++ gio/gfile.override	(working copy)
@@ -975,14 +975,158 @@
     Py_INCREF(Py_None);
     return Py_None;
 }
+%%
+override g_file_replace_contents kwargs
+static PyObject *
+_wrap_g_file_replace_contents(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "contents", "etag", "make_backup",
+                              "flags", "cancellable", NULL };
+    GCancellable *cancellable;
+    PyGObject *pycancellable = NULL;
+    GFileCreateFlags flags = G_FILE_CREATE_NONE;
+    PyObject *py_flags = NULL;
+    gsize length;
+    gboolean make_backup = FALSE;
+    char *contents;
+    char *etag = NULL;
+    char *new_etag;
+    GError *error = NULL;
+    gboolean ret;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "s#|sbOO:File.replace_contents",
+                                     kwlist,
+                                     &contents,
+                                     &length,
+                                     &etag,
+                                     &make_backup,
+                                     &flags,
+                                     &cancellable))
+    {
+        return NULL;
+    }
+
+    if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+                                        py_flags, (gpointer)&flags))
+        return NULL;
+
+    if (!pygio_check_cancellable(pycancellable, &cancellable))
+        return NULL;
+
+    ret = g_file_replace_contents(G_FILE(self->obj), contents, length, etag,
+                                  make_backup, flags, &new_etag, cancellable,
+                                  &error);
+
+    if (pyg_error_check(&error))
+        return NULL;
+
+    if (ret) {
+        PyObject *py_ret = PyString_FromString(new_etag);
+        g_free(new_etag);
+        return py_ret;
+    } else {
+        Py_INCREF(Py_None);
+        return Py_None;
+    }
+}
+%%
+override g_file_replace_contents_finish kwargs
+static PyObject *
+_wrap_g_file_replace_contents_finish(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "res", NULL };
+    PyGObject *res;
+    gchar *etag_out;
+    GError *error = NULL;
+    gboolean ret;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "O!:File.replace_contents_finish",
+                                      kwlist,
+                                      &PyGAsyncResult_Type,
+                                      &res))
+        return NULL;
+
+    ret = g_file_replace_contents_finish(G_FILE(self->obj),
+                                         G_ASYNC_RESULT(res->obj), &etag_out,
+                                         &error);
+
+    if (pyg_error_check(&error))
+        return NULL;
+
+    if (ret) {
+        PyObject *py_ret = PyString_FromString(etag_out);
+        g_free(etag_out);
+        return py_ret;
+    } else {
+        Py_INCREF(Py_None);
+        return Py_None;
+    }
+}
+%%
+override g_file_replace_contents_async kwargs
+static PyObject *
+_wrap_g_file_replace_contents_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "contents", "callback", "etag", "make_backup",
+                              "flags", "cancellable", "user_data", NULL };
+    GCancellable *cancellable;
+    PyGObject *pycancellable = NULL;
+    PyGIONotify *notify;
+    GFileCreateFlags flags = G_FILE_CREATE_NONE;
+    PyObject *py_flags = NULL;
+    gsize length;
+    gboolean make_backup = FALSE;
+    char *contents;
+    char *etag = NULL;
+
+    notify = g_slice_new0(PyGIONotify);
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "s#O|sbOOO:File.replace_contents_async",
+                                      kwlist,
+                                      &contents,
+                                      &length,
+                                      &notify->callback,
+                                      &etag,
+                                      &make_backup,
+                                      &py_flags,
+                                      &pycancellable,
+                                      &notify->data))
+    {
+      g_slice_free(PyGIONotify, notify);
+      return NULL;
+    }
+
+    if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+                                        py_flags, (gpointer)&flags))
+        return NULL;
+
+    if (!pygio_check_cancellable(pycancellable, &cancellable))
+        return NULL;
+
+    Py_INCREF(notify->callback);
+    Py_XINCREF(notify->data);
+    g_file_replace_contents_async(G_FILE(self->obj),
+                                  contents,
+                                  length,
+                                  etag,
+                                  make_backup,
+                                  flags,
+                                  cancellable,
+                                  (GAsyncReadyCallback)async_result_callback_marshal,
+                                  notify);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
 /* GFile.eject_mountable */
 /* GFile.find_enclosing_mount_async */
-/* GFile.replace_contents_async */
 /* GFile.set_attributes_async */
 /* GFile.set_display_name_async */
 /* GFile.load_partial_contents_async: No ArgType for GFileReadMoreCallback */
 /* GFile.move: No ArgType for GFileProgressCallback */
 /* GFile.set_attributes_finish: No ArgType for GFileInfo** */
 /* GFile.load_partial_contents_finish: No ArgType for char** */
-/* GFile.replace_contents: No ArgType for char** */
-/* GFile.replace_contents_finish: No ArgType for char** */
