File: bonobo-ui-xml.h

package info (click to toggle)
bonobo 1.0.22-2.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,412 kB
  • ctags: 5,445
  • sloc: ansic: 51,714; sh: 7,733; makefile: 1,425; yacc: 318; xml: 266; sed: 16
file content (126 lines) | stat: -rw-r--r-- 4,342 bytes parent folder | download | duplicates (2)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * bonobo-ui-xml.h: A module for merging, overlaying and de-merging XML 
 *
 * Author:
 *	Michael Meeks (michael@helixcode.com)
 *
 * Copyright 2000 Helix Code, Inc.
 */
#ifndef _BONOBO_UI_XML_H_
#define _BONOBO_UI_XML_H_

#include <gtk/gtkobject.h>
#include <bonobo/bonobo-ui-node.h>
#include <bonobo/bonobo-ui-engine.h>

#define BONOBO_UI_XML_TYPE        (bonobo_ui_xml_get_type ())
#define BONOBO_UI_XML(o)          (GTK_CHECK_CAST ((o), BONOBO_UI_XML_TYPE, BonoboUIXml))
#define BONOBO_UI_XML_CLASS(k)    (GTK_CHECK_CLASS_CAST((k), BONOBO_UI_XML_TYPE, BonoboUIXmlClass))
#define BONOBO_IS_UI_XML(o)       (GTK_CHECK_TYPE ((o), BONOBO_UI_XML_TYPE))
#define BONOBO_IS_UI_XML_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BONOBO_UI_XML_TYPE))

typedef struct _BonoboUIXml BonoboUIXml;

typedef struct {
	gpointer id;
	gboolean dirty;
	GSList  *overridden;
} BonoboUIXmlData;

typedef gboolean         (*BonoboUIXmlCompareFn)   (gpointer         id_a,
						    gpointer         id_b);
typedef BonoboUIXmlData *(*BonoboUIXmlDataNewFn)   (void);
typedef void             (*BonoboUIXmlDataFreeFn)  (BonoboUIXmlData *data);
typedef void             (*BonoboUIXmlDumpFn)      (BonoboUIXml      *tree,
						    BonoboUINode     *node);
typedef void             (*BonoboUIXmlAddNode)     (BonoboUINode     *parent,
						    BonoboUINode     *child,
						    gpointer          user_data);
typedef void             (*BonoboUIXmlWatchFn)     (BonoboUIXml      *xml,
						    const char       *path,
						    BonoboUINode     *opt_node,
						    gpointer          user_data);

struct _BonoboUIXml {
	GtkObject              object;

	BonoboUIXmlCompareFn   compare;
	BonoboUIXmlDataNewFn   data_new;
	BonoboUIXmlDataFreeFn  data_free;
	BonoboUIXmlDumpFn      dump;
	BonoboUIXmlAddNode     add_node;
	BonoboUIXmlWatchFn     watch;
	gpointer               user_data;

	BonoboUINode          *root;

	GSList                *watches;
};

typedef struct {
	GtkObjectClass         object_klass;

	void                 (*override)          (BonoboUINode *new_node,
						   BonoboUINode *old_node);
	void                 (*replace_override)  (BonoboUINode *new_node,
						   BonoboUINode *old_node);
	void                 (*reinstate)         (BonoboUINode *node);
	void                 (*rename)            (BonoboUINode *node);
	void                 (*remove)            (BonoboUINode *node);

	gpointer               dummy;
} BonoboUIXmlClass;

GtkType          bonobo_ui_xml_get_type          (void);

BonoboUIXml     *bonobo_ui_xml_new               (BonoboUIXmlCompareFn  compare,
						  BonoboUIXmlDataNewFn  data_new,
						  BonoboUIXmlDataFreeFn data_free,
						  BonoboUIXmlDumpFn     dump,
						  BonoboUIXmlAddNode    add_node,
						  gpointer              user_data);

/* Nominaly BonoboUIXmlData * */
gpointer         bonobo_ui_xml_get_data          (BonoboUIXml  *tree,
						  BonoboUINode *node);

void             bonobo_ui_xml_set_dirty         (BonoboUIXml  *tree,
						  BonoboUINode *node);

void             bonobo_ui_xml_clean             (BonoboUIXml  *tree,
						  BonoboUINode *node);

BonoboUINode    *bonobo_ui_xml_get_path          (BonoboUIXml  *tree,
						  const char   *path);
BonoboUINode    *bonobo_ui_xml_get_path_wildcard (BonoboUIXml  *tree,
						  const char   *path,
						  gboolean     *wildcard);

char            *bonobo_ui_xml_make_path         (BonoboUINode *node);
char            *bonobo_ui_xml_get_parent_path   (const char   *path);

BonoboUIError    bonobo_ui_xml_merge             (BonoboUIXml  *tree,
						  const char   *path,
						  BonoboUINode *nodes,
						  gpointer      id);

BonoboUIError    bonobo_ui_xml_rm                (BonoboUIXml  *tree,
						  const char   *path,
						  gpointer      id);

void             bonobo_ui_xml_dump              (BonoboUIXml  *tree,
						  BonoboUINode *node,
						  const char   *msg);

void             bonobo_ui_xml_set_watch_fn      (BonoboUIXml  *tree,
						  BonoboUIXmlWatchFn watch);

void             bonobo_ui_xml_add_watch         (BonoboUIXml  *tree,
						  const char   *path,
						  gpointer      user_data);

void             bonobo_ui_xml_remove_watch_by_data (BonoboUIXml  *tree,
						     gpointer      user_data);

#endif /* _BONOBO_UI_XML_H_ */