File: rendsystem-elements.c

package info (click to toggle)
entity 1.0.1-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,604 kB
  • ctags: 5,394
  • sloc: ansic: 64,242; sh: 7,377; makefile: 776; perl: 319
file content (62 lines) | stat: -rw-r--r-- 1,293 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <glib.h>
#include "entity.h"


static void
system_elements_render (ENode * node)
{
    GSList *list;
    GSList *tmp;
    ENode *root;
    ENode *dyna;

    /* This gets all the currently loaded elements */
    list = element_list ();

    tmp = list;
    while (tmp) {
	EBuf *element = tmp->data;

	enode_attrib_quiet (node, element->str, ebuf_new_with_true ());

	tmp = tmp->next;
    }

    g_slist_free (list);

    /* Now we look at dynaloaded elements, and see * what we can find there. */
    root = enode_root_node ();
    dyna = enode_child (root, "dynaloaders");

    if (dyna) {
	list = enode_children (dyna, "dynaload-element");

	tmp = list;
	while (tmp) {
	    ENode *n = tmp->data;
	    gchar *val;

	    val = enode_attrib_str (n, "tag", NULL);
	    if (val) {
		enode_attrib_quiet (node, val, ebuf_new_with_true ());
	    }

	    tmp = tmp->next;
	}

	g_slist_free (list);
    }
}

void
system_elements_renderer_register (void)
{
    Element *element;

    element = g_new0 (Element, 1);
    element->render_func = system_elements_render;
    element->tag = "system-elements";
    element->description =
	"A list of supported system elements.  Each supported element will be set as an attribute of this node, with a value of true.";
    element_register (element);
}