ruby: Add binding for guestfs_user_cancel.
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 15 Jul 2011 13:57:00 +0000 (14:57 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 15 Jul 2011 13:57:00 +0000 (14:57 +0100)
generator/generator_ruby.ml

index 7c8788d..a21334a 100644 (file)
@@ -303,6 +303,26 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
   return r;
 }
 
+/*
+ * call-seq:
+ *   g.user_cancel() -> nil
+ *
+ * Call
+ * +guestfs_user_cancel+[http://libguestfs.org/guestfs.3.html#guestfs_user_cancel]
+ * to cancel the current transfer.  This is safe to call from Ruby
+ * signal handlers and threads.
+ */
+static VALUE
+ruby_user_cancel (VALUE gv)
+{
+  guestfs_h *g;
+
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (g)
+    guestfs_user_cancel (g);
+  return Qnil;
+}
+
 ";
 
   List.iter (
@@ -570,6 +590,8 @@ void Init__guestfs ()
                     ruby_set_event_callback, 2);
   rb_define_method (c_guestfs, \"delete_event_callback\",
                     ruby_delete_event_callback, 1);
+  rb_define_method (c_guestfs, \"user_cancel\",
+                    ruby_user_cancel, 0);
 
 ";