[libgfbgraph] Node: A useful function to set the ID of a node.



commit 345ab80c5d49d3d297bdde44129de82af5276964
Author: Álvaro Peña <alvaropg gmail com>
Date:   Tue Apr 15 20:46:09 2014 +0200

    Node: A useful function to set the ID of a node.

 gfbgraph/gfbgraph-node.c |   19 +++++++++++++++++++
 gfbgraph/gfbgraph-node.h |    2 ++
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/gfbgraph/gfbgraph-node.c b/gfbgraph/gfbgraph-node.c
index d45c4b4..9f7a28b 100644
--- a/gfbgraph/gfbgraph-node.c
+++ b/gfbgraph/gfbgraph-node.c
@@ -374,6 +374,25 @@ gfbgraph_node_get_updated_time (GFBGraphNode *node)
 }
 
 /**
+ * gfbgraph_node_set_id:
+ * @node: a #GFBGraphNode.
+ * @id: a const pointer to a #gchar.
+ *
+ * Sets the ID for a node. Just useful when a new node is created
+ * and the Graph API returns the ID of the new created node.
+ **/
+void
+gfbgraph_node_set_id (GFBGraphNode *node, const gchar *id)
+{
+        g_return_if_fail (GFBGRAPH_IS_NODE (node));
+        g_return_if_fail (id != NULL);
+
+        g_object_set (G_OBJECT (node),
+                      "id", id,
+                      NULL);
+}
+
+/**
  * gfbgraph_node_get_connection_nodes:
  * @node: a #GFBGraphNode object which retrieve the connected nodes.
  * @node_type: a #GFBGraphNode type #GType that determines the kind of nodes to retrieve.
diff --git a/gfbgraph/gfbgraph-node.h b/gfbgraph/gfbgraph-node.h
index 399468b..95da121 100644
--- a/gfbgraph/gfbgraph-node.h
+++ b/gfbgraph/gfbgraph-node.h
@@ -65,6 +65,8 @@ const gchar*   gfbgraph_node_get_link         (GFBGraphNode *node);
 const gchar*   gfbgraph_node_get_created_time (GFBGraphNode *node);
 const gchar*   gfbgraph_node_get_updated_time (GFBGraphNode *node);
 
+void           gfbgraph_node_set_id           (GFBGraphNode *node, const gchar *id);
+
 GList*         gfbgraph_node_get_connection_nodes              (GFBGraphNode         *node,
                                                                 GType                 node_type,
                                                                 GFBGraphAuthorizer   *authorizer,


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