From 345ab80c5d49d3d297bdde44129de82af5276964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Pe=C3=B1a?= Date: Tue, 15 Apr 2014 20:46:09 +0200 Subject: 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(+) 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 @@ -373,6 +373,25 @@ gfbgraph_node_get_updated_time (GFBGraphNode *node) return node->priv->updated_time; } +/** + * 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. 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, -- cgit v1.2.1