]> git.0d.be Git - empathy.git/commitdiff
CameraMonitor: add empathy_camera_monitor_new()
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Mon, 15 Aug 2011 10:29:59 +0000 (11:29 +0100)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Mon, 15 Aug 2011 12:03:28 +0000 (13:03 +0100)
Which doesn't return a singleton but a new object.

libempathy/empathy-camera-monitor.c
libempathy/empathy-camera-monitor.h

index da6b234926efa3020f9db98ff6bce371fe57d89a..3b5221eb8766713711047a272890d4eb329cdc46 100644 (file)
@@ -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)
index 2f26670dd758ff620fd1a23a2aeb49cb19dd0e95..f627f7b58a83216d7adf179f45813e1a971eda8b 100644 (file)
@@ -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);