diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-08-15 18:29:59 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-08-15 20:03:28 +0800 |
commit | 624bbe7ac793e34aa9b0db0122b973eadd218770 (patch) | |
tree | 77953c647a5ddd309a42a8365e54b2afe87638e9 | |
parent | b01f42247694b992c91fefab5c70acdfa3770051 (diff) | |
download | gsoc2013-empathy-624bbe7ac793e34aa9b0db0122b973eadd218770.tar gsoc2013-empathy-624bbe7ac793e34aa9b0db0122b973eadd218770.tar.gz gsoc2013-empathy-624bbe7ac793e34aa9b0db0122b973eadd218770.tar.bz2 gsoc2013-empathy-624bbe7ac793e34aa9b0db0122b973eadd218770.tar.lz gsoc2013-empathy-624bbe7ac793e34aa9b0db0122b973eadd218770.tar.xz gsoc2013-empathy-624bbe7ac793e34aa9b0db0122b973eadd218770.tar.zst gsoc2013-empathy-624bbe7ac793e34aa9b0db0122b973eadd218770.zip |
CameraMonitor: add empathy_camera_monitor_new()
Which doesn't return a singleton but a new object.
-rw-r--r-- | libempathy/empathy-camera-monitor.c | 48 | ||||
-rw-r--r-- | libempathy/empathy-camera-monitor.h | 1 |
2 files changed, 23 insertions, 26 deletions
diff --git a/libempathy/empathy-camera-monitor.c b/libempathy/empathy-camera-monitor.c index da6b23492..3b5221eb8 100644 --- a/libempathy/empathy-camera-monitor.c +++ b/libempathy/empathy-camera-monitor.c @@ -201,30 +201,6 @@ empathy_camera_monitor_dispose (GObject *object) G_OBJECT_CLASS (empathy_camera_monitor_parent_class)->dispose (object); } -static GObject * -empathy_camera_monitor_constructor (GType type, - guint n_props, - GObjectConstructParam *props) -{ - GObject *retval; - - if (manager_singleton) - { - retval = g_object_ref (manager_singleton); - } - else - { - retval = - G_OBJECT_CLASS (empathy_camera_monitor_parent_class)-> - constructor (type, n_props, props); - - manager_singleton = EMPATHY_CAMERA_MONITOR (retval); - g_object_add_weak_pointer (retval, (gpointer) & manager_singleton); - } - - return retval; -} - static void empathy_camera_monitor_constructed (GObject *object) { @@ -241,7 +217,6 @@ empathy_camera_monitor_class_init (EmpathyCameraMonitorClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = empathy_camera_monitor_dispose; - object_class->constructor = empathy_camera_monitor_constructor; object_class->constructed = empathy_camera_monitor_constructed; object_class->get_property = empathy_camera_monitor_get_property; @@ -291,7 +266,28 @@ empathy_camera_monitor_init (EmpathyCameraMonitor *self) EmpathyCameraMonitor * empathy_camera_monitor_dup_singleton (void) { - return g_object_new (EMPATHY_TYPE_CAMERA_MONITOR, NULL); + GObject *retval; + + if (manager_singleton) + { + retval = g_object_ref (manager_singleton); + } + else + { + retval = g_object_new (EMPATHY_TYPE_CAMERA_MONITOR, NULL); + + manager_singleton = EMPATHY_CAMERA_MONITOR (retval); + g_object_add_weak_pointer (retval, (gpointer) &manager_singleton); + } + + return EMPATHY_CAMERA_MONITOR (retval); +} + +EmpathyCameraMonitor * +empathy_camera_monitor_new (void) +{ + return EMPATHY_CAMERA_MONITOR ( + g_object_new (EMPATHY_TYPE_CAMERA_MONITOR, NULL)); } gboolean empathy_camera_monitor_get_available (EmpathyCameraMonitor *self) diff --git a/libempathy/empathy-camera-monitor.h b/libempathy/empathy-camera-monitor.h index 2f26670dd..f627f7b58 100644 --- a/libempathy/empathy-camera-monitor.h +++ b/libempathy/empathy-camera-monitor.h @@ -59,6 +59,7 @@ GType empathy_camera_get_type (void) G_GNUC_CONST; GType empathy_camera_monitor_get_type (void) G_GNUC_CONST; EmpathyCameraMonitor *empathy_camera_monitor_dup_singleton (void); +EmpathyCameraMonitor *empathy_camera_monitor_new (void); gboolean empathy_camera_monitor_get_available (EmpathyCameraMonitor *self); |