[aravis] fake: allow fake device creation.



commit 7d129f68d22e7cf9ea02d713ab6b44252137a697
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Thu May 13 21:39:12 2010 +0200

    fake: allow fake device creation.

 src/arvfakeinterface.c |    3 +++
 src/arvsystem.c        |   12 ++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/arvfakeinterface.c b/src/arvfakeinterface.c
index 319b6ba..297f9f9 100644
--- a/src/arvfakeinterface.c
+++ b/src/arvfakeinterface.c
@@ -38,6 +38,9 @@ arv_fake_interface_update_device_list (ArvInterface *interface)
 static ArvDevice *
 arv_fake_interface_new_device (ArvInterface *interface, const char *name)
 {
+	if (g_strcmp0 (name, "Fake_1") == 0)
+		return arv_fake_device_new ("1");
+
 	return NULL;
 }
 
diff --git a/src/arvsystem.c b/src/arvsystem.c
index 601b1b0..67067a0 100644
--- a/src/arvsystem.c
+++ b/src/arvsystem.c
@@ -22,6 +22,7 @@
 
 #include <arvsystem.h>
 #include <arvgvinterface.h>
+#include <arvfakeinterface.h>
 #include <arvdevice.h>
 
 ArvDevice *
@@ -30,12 +31,15 @@ arv_new_device (const char *name)
 	ArvInterface *interface;
 	ArvDevice *device;
 
+	interface = arv_fake_interface_get_instance ();
+	device = arv_interface_new_device (interface, name);
+		if (device != NULL)
+			return device;
+
 	interface = arv_gv_interface_get_instance ();
-	if (ARV_IS_INTERFACE (interface)) {
-		device = arv_interface_new_device (interface, name);
-		if (ARV_IS_DEVICE (device))
+	device = arv_interface_new_device (interface, name);
+		if (device != NULL)
 			return device;
-	}
 
 	return NULL;
 }



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