[cheese] Add test application for device monitor
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [cheese] Add test application for device monitor
- Date: Wed, 2 Dec 2009 18:01:39 +0000 (UTC)
commit a4f10acf3d3386478408bc1965e400199220425e
Author: Bastien Nocera <hadess hadess net>
Date: Wed Dec 2 18:00:46 2009 +0000
Add test application for device monitor
libcheese/Makefile.am | 5 +++--
libcheese/cheese-test-monitor.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 2 deletions(-)
---
diff --git a/libcheese/Makefile.am b/libcheese/Makefile.am
index f8000bb..1c07288 100644
--- a/libcheese/Makefile.am
+++ b/libcheese/Makefile.am
@@ -42,7 +42,8 @@ libcheese_gtk_la_LIBADD = \
libcheesecommon.la \
$(CHEESE_LIBS)
-noinst_PROGRAMS = cheese-test-widget
+noinst_PROGRAMS = cheese-test-widget cheese-test-monitor
cheese_test_widget_SOURCES = cheese-test-widget.c
cheese_test_widget_LDADD = $(CHEESE_LIBS) libcheese-gtk.la libcheesecommon.la
-
+cheese_test_monitor_SOURCES = cheese-test-monitor.c
+cheese_test_monitor_LDADD = $(CHEESE_LIBS) libcheese-gtk.la libcheesecommon.la
diff --git a/libcheese/cheese-test-monitor.c b/libcheese/cheese-test-monitor.c
new file mode 100644
index 0000000..b81783a
--- /dev/null
+++ b/libcheese/cheese-test-monitor.c
@@ -0,0 +1,35 @@
+#include <glib.h>
+
+#include "cheese-camera-device-monitor.h"
+
+static void
+added_cb (CheeseCameraDeviceMonitor *monitor,
+ CheeseCameraDevice *device)
+{
+ g_message ("Added new device with ID '%s'", device->hal_udi);
+}
+
+static void
+removed_cb (CheeseCameraDeviceMonitor *monitor,
+ const char *id)
+{
+ g_message ("Removed device with ID '%s'", id);
+}
+
+int main (int argc, char **argv)
+{
+ CheeseCameraDeviceMonitor *monitor;
+
+ g_type_init ();
+
+ monitor = cheese_camera_device_monitor_new ();
+ g_signal_connect (G_OBJECT (monitor), "added",
+ G_CALLBACK (added_cb), NULL);
+ g_signal_connect (G_OBJECT (monitor), "removed",
+ G_CALLBACK (removed_cb), NULL);
+ cheese_camera_device_monitor_coldplug (monitor);
+
+ g_main_loop_run (g_main_loop_new (NULL, FALSE));
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]