]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
libvaladoc: Add wrapper for "agedge" of graphviz
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 7 Feb 2021 10:02:02 +0000 (11:02 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 27 Feb 2021 19:16:31 +0000 (20:16 +0100)
libvaladoc/charts/simplechartfactory.vala
libvaladoc/gvc-compat.c

index ddacbf0f46e1d4539526a589620c2ffe4cc4207d..9588be3802f137ad9a3c88a5536d16b997485332 100644 (file)
@@ -23,6 +23,9 @@
 [CCode (cname = "valadoc_compat_gvc_graph_new")]
 extern Gvc.Graph valadoc_gvc_graph_new (string name);
 
+[CCode (cname = "valadoc_compat_gvc_graph_create_edge")]
+extern Gvc.Edge valadoc_gvc_graph_create_edge (Gvc.Graph graph, Gvc.Node from, Gvc.Node to);
+
 public class Valadoc.Charts.SimpleFactory : Charts.Factory {
        protected virtual Gvc.Node configure_type (Gvc.Node node, Api.Node item) {
                node.safe_set ("shape", "box", "");
@@ -75,7 +78,7 @@ public class Valadoc.Charts.SimpleFactory : Charts.Factory {
        }
 
        public override Gvc.Edge add_children (Gvc.Graph graph, Gvc.Node parent, Gvc.Node child) {
-               var edge = graph.create_edge (parent, child);
+               var edge = valadoc_gvc_graph_create_edge (graph, parent, child);
                edge.safe_set ("dir", "back", "");
                return edge;
        }
index 962f74965eb040c0f8778164e5d94514641a62d9..5846334632ebdbc2c088e4929ca2781ebe575fa6 100644 (file)
@@ -33,6 +33,9 @@ valadoc_compat_gvc_graph_create_node (Agraph_t* graph, const char *name);
 Agraph_t*
 valadoc_compat_gvc_graph_new (const char *name);
 
+Agedge_t*
+valadoc_compat_gvc_graph_create_edge (Agraph_t* graph, Agnode_t* from, Agnode_t* to);
+
 void
 valadoc_compat_gvc_init (void)
 {
@@ -60,3 +63,13 @@ valadoc_compat_gvc_graph_new (const char *name)
        return agopen ((char*) name, AGDIGRAPH);
 #endif
 }
+
+Agedge_t*
+valadoc_compat_gvc_graph_create_edge (Agraph_t* graph, Agnode_t* from, Agnode_t* to)
+{
+#ifdef WITH_CGRAPH
+       return agedge (graph, from, to, NULL, TRUE);
+#else
+       return agedge (graph, from, to);
+#endif
+}