diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-08-01 19:05:46 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-08-15 20:02:21 +0800 |
commit | 9ee3b4ee8188f9ab48823c404f7d138acc517b02 (patch) | |
tree | e61c979c27493e654cfea5e942aabfa3824571b4 /libempathy | |
parent | 2ea5aa82155ce47ca9a91f5fa1a97b0610a487a3 (diff) | |
download | gsoc2013-empathy-9ee3b4ee8188f9ab48823c404f7d138acc517b02.tar gsoc2013-empathy-9ee3b4ee8188f9ab48823c404f7d138acc517b02.tar.gz gsoc2013-empathy-9ee3b4ee8188f9ab48823c404f7d138acc517b02.tar.bz2 gsoc2013-empathy-9ee3b4ee8188f9ab48823c404f7d138acc517b02.tar.lz gsoc2013-empathy-9ee3b4ee8188f9ab48823c404f7d138acc517b02.tar.xz gsoc2013-empathy-9ee3b4ee8188f9ab48823c404f7d138acc517b02.tar.zst gsoc2013-empathy-9ee3b4ee8188f9ab48823c404f7d138acc517b02.zip |
CameraMonitor: add ::added and ::removed signals
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-camera-monitor.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libempathy/empathy-camera-monitor.c b/libempathy/empathy-camera-monitor.c index 694e6ff96..d3d8beb80 100644 --- a/libempathy/empathy-camera-monitor.c +++ b/libempathy/empathy-camera-monitor.c @@ -44,6 +44,15 @@ enum PROP_AVAILABLE, }; +enum +{ + CAMERA_ADDED, + CAMERA_REMOVED, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL]; + G_DEFINE_TYPE (EmpathyCameraMonitor, empathy_camera_monitor, G_TYPE_OBJECT); static EmpathyCameraMonitor *manager_singleton = NULL; @@ -114,6 +123,8 @@ on_camera_added (CheeseCameraDeviceMonitor *device, if (self->priv->num_cameras == 1) g_object_notify (G_OBJECT (self), "available"); + + g_signal_emit (self, signals[CAMERA_ADDED], 0, camera); } static void @@ -137,6 +148,8 @@ on_camera_removed (CheeseCameraDeviceMonitor *device, if (self->priv->num_cameras == 0) g_object_notify (G_OBJECT (self), "available"); + g_signal_emit (self, signals[CAMERA_REMOVED], 0, camera); + empathy_camera_free (camera); } @@ -227,6 +240,20 @@ empathy_camera_monitor_class_init (EmpathyCameraMonitorClass *klass) g_param_spec_boolean ("available", "Available", "Camera available", TRUE, G_PARAM_READABLE)); + signals[CAMERA_ADDED] = + g_signal_new ("added", G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + 0, NULL, NULL, + g_cclosure_marshal_VOID__BOXED, + G_TYPE_NONE, 1, EMPATHY_TYPE_CAMERA); + + signals[CAMERA_REMOVED] = + g_signal_new ("removed", G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + 0, NULL, NULL, + g_cclosure_marshal_VOID__BOXED, + G_TYPE_NONE, 1, EMPATHY_TYPE_CAMERA); + g_type_class_add_private (object_class, sizeof (EmpathyCameraMonitorPrivate)); } |