rygel r555 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r555 - trunk/src/rygel
- Date: Mon, 9 Feb 2009 22:29:00 +0000 (UTC)
Author: zeeshanak
Date: Mon Feb 9 22:29:00 2009
New Revision: 555
URL: http://svn.gnome.org/viewvc/rygel?rev=555&view=rev
Log:
Provide a simple implementation of AsyncResult: SimpleAsyncResult.
Modified:
trunk/src/rygel/rygel-media-container.vala
Modified: trunk/src/rygel/rygel-media-container.vala
==============================================================================
--- trunk/src/rygel/rygel-media-container.vala (original)
+++ trunk/src/rygel/rygel-media-container.vala Mon Feb 9 22:29:00 2009
@@ -71,3 +71,61 @@
*/
public abstract MediaObject? find_object (string id) throws Error;
}
+
+/**
+ * A simple implementation of GLib.AsyncResult, very similar to
+ * GLib.SimpleAsyncResult that provides holders for a string, object and
+ * error reference.
+ */
+public class Rygel.SimpleAsyncResult : GLib.Object, GLib.AsyncResult {
+ private Object source_object;
+ private AsyncReadyCallback callback;
+
+ public string str;
+ public Object obj;
+
+ public Error error;
+
+ public SimpleAsyncResult (Object source_object,
+ AsyncReadyCallback callback,
+ Object? obj,
+ string? str) {
+ this.source_object = source_object;
+ this.callback = callback;
+
+ this.obj = obj;
+ this.str = str;
+ }
+
+ public SimpleAsyncResult.from_error (Object source_object,
+ AsyncReadyCallback callback,
+ Error error) {
+ this.source_object = source_object;
+ this.callback = callback;
+
+ this.error = error;
+ }
+
+ public unowned GLib.Object get_source_object () {
+ return this.source_object;
+ }
+
+ public void* get_user_data () {
+ return null;
+ }
+
+ public void complete () {
+ this.callback (this.source_object, this);
+ }
+
+ public void complete_in_idle () {
+ Idle.add_full (Priority.DEFAULT, idle_func);
+ }
+
+ private bool idle_func () {
+ this.complete ();
+
+ return false;
+ }
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]