summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÁlvaro Peña <alvaropg@gmail.com>2014-04-15 20:46:09 +0200
committerÁlvaro Peña <alvaropg@gmail.com>2014-04-15 20:46:09 +0200
commit345ab80c5d49d3d297bdde44129de82af5276964 (patch)
tree47fb12cd33a4dc9cb1ebc273c668a3e20e349926
parent47770be52227c39d7a8ef0962c34e5a0f57b3846 (diff)
downloadlibgfbgraph-345ab80c5d49d3d297bdde44129de82af5276964.tar.gz
Node: A useful function to set the ID of a node.
-rw-r--r--gfbgraph/gfbgraph-node.c19
-rw-r--r--gfbgraph/gfbgraph-node.h2
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,