[atk/docs-fixes: 44/56] Implement propert ctor for AtkSocket



commit 1237dc0cf6fbdba996840db863dcdaf56f34bdbc
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Jun 26 16:59:26 2018 +0100

    Implement propert ctor for AtkSocket
    
    GObject constructors should only ever call g_object_new().
    
    Setting the properties for AtkSocket should be deferred to the instance
    initialization code.

 atk/atksocket.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/atk/atksocket.c b/atk/atksocket.c
index 2517b52..c8e03f7 100644
--- a/atk/atksocket.c
+++ b/atk/atksocket.c
@@ -62,7 +62,12 @@ G_DEFINE_TYPE_WITH_CODE (AtkSocket, atk_socket, ATK_TYPE_OBJECT,
 static void
 atk_socket_init (AtkSocket* obj)
 {
+  AtkObject *accessible = ATK_OBJECT (obj);
+
   obj->embedded_plug_id = NULL;
+
+  accessible->role = ATK_ROLE_FILLER;
+  accessible->layer = ATK_LAYER_WIDGET;
 }
 
 static void
@@ -86,22 +91,22 @@ atk_socket_finalize (GObject *_obj)
   G_OBJECT_CLASS (atk_socket_parent_class)->finalize (_obj);
 }
 
-static void atk_component_interface_init (AtkComponentIface *iface)
+static void
+atk_component_interface_init (AtkComponentIface *iface)
 {
 }
 
+/**
+ * atk_socket_new:
+ *
+ * Creates a new #AtkSocket.
+ *
+ * Returns: (transfer full): the newly created #AtkSocket instance
+ */
 AtkObject*
 atk_socket_new (void)
 {
-  AtkObject* accessible;
-  
-  accessible = g_object_new (ATK_TYPE_SOCKET, NULL);
-  g_return_val_if_fail (accessible != NULL, NULL);
-
-  accessible->role = ATK_ROLE_FILLER;
-  accessible->layer = ATK_LAYER_WIDGET;
-  
-  return accessible;
+  return g_object_new (ATK_TYPE_SOCKET, NULL);
 }
 
 /**


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