aboutsummaryrefslogtreecommitdiff
path: root/src/setup/gnunet-setup-options.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/setup/gnunet-setup-options.h')
-rw-r--r--src/setup/gnunet-setup-options.h161
1 files changed, 161 insertions, 0 deletions
diff --git a/src/setup/gnunet-setup-options.h b/src/setup/gnunet-setup-options.h
new file mode 100644
index 00000000..25cd6507
--- /dev/null
+++ b/src/setup/gnunet-setup-options.h
@@ -0,0 +1,161 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file src/gnunet-setup-options.h
23 * @brief configuration details
24 * @author Christian Grothoff
25 */
26#ifndef GNUNET_SETUP_OPTIONS_H
27#define GNUNET_SETUP_OPTIONS_H
28
29#include "gnunet-setup.h"
30
31
32/**
33 * Function to setup the value on load.
34 *
35 * @param cls closure
36 * @param section section with the value
37 * @param option option name
38 * @param value value as a string
39 * @param widget widget to initialize
40 * @param cfg configuration handle
41 * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
42 */
43typedef int (*GNUNET_SETUP_LoadFunction)(const void *cls,
44 const char *section,
45 const char *option,
46 const char *value,
47 GObject *widget,
48 const struct GNUNET_CONFIGURATION_Handle *cfg);
49
50
51/**
52 * Modify the configuration to contain the right value for
53 * the option based on the state of the widget.
54 *
55 * @param cls closure
56 * @param section section with the value
57 * @param option option name
58 * @param widget widget to initialize
59 * @param cfg configuration handle to update
60 * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
61 */
62typedef int (*GNUNET_SETUP_SaveFunction)(const void *cls,
63 const char *section,
64 const char *option,
65 GObject *widget,
66 struct GNUNET_CONFIGURATION_Handle *cfg);
67
68
69/**
70 * Structs of this type specify under which conditions the values of
71 * a particular option impact the visibility (or sensitivity) of some
72 * other widget.
73 */
74struct GNUNET_SETUP_VisibilitySpecification
75{
76 /**
77 * Which widget should be changed?
78 */
79 const char *widget_name;
80
81 /**
82 * If the option value matchis this regex, the widget should be
83 * shown. If NULL, the "hide_value" controls visibility.
84 */
85 const char *show_value;
86
87 /**
88 * If the option value matchis this regex, the widget should be
89 * hidden. If NULL, the "show_value" controls visibility.
90 */
91 const char *hide_value;
92
93};
94
95
96/**
97 * Structs of this type define how widgets relate to GNUnet options
98 * and control visibility and special actions.
99 */
100struct GNUNET_SETUP_OptionSpecification
101{
102 /**
103 * Name of the GTK widget in Glade.
104 */
105 const char *widget_name;
106
107 /**
108 * Name of the signal the widget emits if its state changes.
109 */
110 const char *change_signal;
111
112 /**
113 * Section in the configuration
114 */
115 const char *section;
116
117 /**
118 * Name of the configuration option.
119 */
120 const char *option;
121
122 /**
123 * Help text to display for this option.
124 */
125 const char *help_text;
126
127 /**
128 * Help URL to link to for this option.
129 */
130 const char *help_url;
131
132 /**
133 * Function to call to initialize the widget from the configuration.
134 */
135 GNUNET_SETUP_LoadFunction load_function;
136
137 /**
138 * Function to call set the configuration from the widget.
139 */
140 GNUNET_SETUP_SaveFunction save_function;
141
142 /**
143 * Closure for 'validation_function'.
144 */
145 const void *load_save_cls;
146
147 /**
148 * Visibility changes to apply if this option changes (NULL, or
149 * NULL-terminated).
150 */
151 const struct GNUNET_SETUP_VisibilitySpecification *visibility;
152
153};
154
155
156/**
157 * Option specification data.
158 */
159extern const struct GNUNET_SETUP_OptionSpecification option_specifications[];
160
161#endif