diff options
Diffstat (limited to 'src/include/gnunet_gtk_namestore_plugin.h')
-rw-r--r-- | src/include/gnunet_gtk_namestore_plugin.h | 116 |
1 files changed, 110 insertions, 6 deletions
diff --git a/src/include/gnunet_gtk_namestore_plugin.h b/src/include/gnunet_gtk_namestore_plugin.h index c7a2d237..79ef4202 100644 --- a/src/include/gnunet_gtk_namestore_plugin.h +++ b/src/include/gnunet_gtk_namestore_plugin.h | |||
@@ -32,26 +32,125 @@ | |||
32 | 32 | ||
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Context for edit operations. | 35 | * Context for edit operations and environment for plugins. |
36 | * Typical plugins will only use the @e check_validity callback. | ||
36 | */ | 37 | */ |
37 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment | 38 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment |
38 | { | 39 | { |
39 | /** | ||
40 | * Closure to pass to @e check_validity. | ||
41 | */ | ||
42 | void *cls; | ||
43 | 40 | ||
44 | /** | 41 | /** |
45 | * Function that should be called by the plugin whenever values in | 42 | * Function that should be called by the plugin whenever values in |
46 | * the dialog were edited. It will check the validity of the dialog | 43 | * the dialog were edited. It will check the validity of the dialog |
47 | * and update the "save" button accordingly. | 44 | * and update the "save" button accordingly. |
48 | */ | 45 | */ |
49 | void (*check_validity)(void *cls); | 46 | void (*check_validity)(struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc); |
47 | |||
48 | /** | ||
49 | * Builder for the dialog. | ||
50 | */ | ||
51 | GtkBuilder *builder; | ||
52 | |||
53 | /** | ||
54 | * Main dialog window. | ||
55 | */ | ||
56 | GtkDialog *dialog; | ||
57 | |||
58 | /** | ||
59 | * Where in the tree view are we editing? | ||
60 | */ | ||
61 | struct RecordInfo *ri; | ||
62 | |||
63 | /** | ||
64 | * Name of the record. | ||
65 | */ | ||
66 | gchar *name; | ||
67 | |||
68 | /** | ||
69 | * Value of the record in string format. | ||
70 | */ | ||
71 | gchar *n_value; | ||
72 | |||
73 | /** | ||
74 | * Name of the zone into which the record should be placed. | ||
75 | */ | ||
76 | gchar *new_zone_option; | ||
77 | |||
78 | /** | ||
79 | * Ego of the zone into which the record should be placed. | ||
80 | */ | ||
81 | struct GNUNET_IDENTITY_Ego *ego; | ||
82 | |||
83 | /** | ||
84 | * List of all zones. | ||
85 | */ | ||
86 | GtkListStore *zone_liststore; | ||
87 | |||
88 | /** | ||
89 | * The plugin we used to edit the value. | ||
90 | */ | ||
91 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; | ||
92 | |||
93 | /** | ||
94 | * Name of the plugin library. | ||
95 | */ | ||
96 | char *liblow; | ||
97 | |||
98 | /** | ||
99 | * Expiration time value (absolute or relative). | ||
100 | */ | ||
101 | guint64 n_exp_time; | ||
102 | |||
103 | /** | ||
104 | * Offset of the record we are editing in the 'rd' list of 'ri'. | ||
105 | */ | ||
106 | unsigned int off; | ||
107 | |||
108 | /** | ||
109 | * Flag indicating if the old record was in the namestore. | ||
110 | */ | ||
111 | int old_record_in_namestore; | ||
112 | |||
113 | /** | ||
114 | * Type of the record. | ||
115 | */ | ||
116 | uint32_t record_type; | ||
117 | |||
118 | /** | ||
119 | * Is this record 'public'? | ||
120 | */ | ||
121 | gboolean n_public; | ||
122 | |||
123 | /** | ||
124 | * Is the expiration time relative? | ||
125 | */ | ||
126 | gboolean n_is_relative; | ||
127 | |||
128 | /** | ||
129 | * Is this record a shadow record? | ||
130 | */ | ||
131 | gboolean n_is_shadow; | ||
50 | 132 | ||
51 | }; | 133 | }; |
52 | 134 | ||
53 | 135 | ||
54 | /** | 136 | /** |
137 | * Symbol to give to the GtkBuilder for resolution. | ||
138 | */ | ||
139 | struct GNUNET_GTK_NAMESTORE_Symbol | ||
140 | { | ||
141 | /** | ||
142 | * Name of the symbol. | ||
143 | */ | ||
144 | const char *name; | ||
145 | |||
146 | /** | ||
147 | * Corresponding callback. | ||
148 | */ | ||
149 | GCallback cb; | ||
150 | }; | ||
151 | |||
152 | |||
153 | /** | ||
55 | * Each plugin is required to return a pointer to a struct of this | 154 | * Each plugin is required to return a pointer to a struct of this |
56 | * type as the return value from its entry point. | 155 | * type as the return value from its entry point. |
57 | */ | 156 | */ |
@@ -77,6 +176,11 @@ struct GNUNET_GTK_NAMESTORE_PluginFunctions | |||
77 | const char *dialog_widget_name; | 176 | const char *dialog_widget_name; |
78 | 177 | ||
79 | /** | 178 | /** |
179 | * NULL-terminated array of symbols to add to the gtk builder. | ||
180 | */ | ||
181 | const struct GNUNET_GTK_NAMESTORE_Symbol *symbols; | ||
182 | |||
183 | /** | ||
80 | * Function that will be called to initialize the builder's | 184 | * Function that will be called to initialize the builder's |
81 | * widgets from the existing record (if there is one). | 185 | * widgets from the existing record (if there is one). |
82 | * The `n_value` is the existing value of the record as a string. | 186 | * The `n_value` is the existing value of the record as a string. |