aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-27 15:48:59 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-27 15:48:59 +0000
commit857a1f35e7355f508d375131e4d403f518be66ad (patch)
tree2171ab83b0b4b5b5b06cddd6181ed9789a8b4076
parent4f77275379d32aa75671d2ab7128e8670ef0bede (diff)
downloadgnunet-gtk-857a1f35e7355f508d375131e4d403f518be66ad.tar.gz
gnunet-gtk-857a1f35e7355f508d375131e4d403f518be66ad.zip
-defining plugin API for gnunet-namestore-gtk
-rw-r--r--src/include/Makefile.am3
-rw-r--r--src/include/gnunet_gtk_namestore_plugin.h108
2 files changed, 110 insertions, 1 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 97136fcc..e193ec8d 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -3,4 +3,5 @@ SUBDIRS = .
3gnunetgtkincludedir = $(includedir)/gnunet-gtk 3gnunetgtkincludedir = $(includedir)/gnunet-gtk
4 4
5gnunetgtkinclude_HEADERS = \ 5gnunetgtkinclude_HEADERS = \
6 gnunet_gtk.h 6 gnunet_gtk.h \
7 gnunet_gtk_namestore_plugin.h
diff --git a/src/include/gnunet_gtk_namestore_plugin.h b/src/include/gnunet_gtk_namestore_plugin.h
new file mode 100644
index 00000000..28b47ba5
--- /dev/null
+++ b/src/include/gnunet_gtk_namestore_plugin.h
@@ -0,0 +1,108 @@
1/*
2 This file is part of GNUnet
3 (C) 2012, 2013 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 3, 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/include/gnunet_gtk_namestore_plugin.h
23 * @author Christian Grothoff
24 * @brief API for plugins for the GNS record editor
25 */
26#ifndef GNUNET_GTK_NAMESTORE_PLUGIN_H
27#define GNUNET_GTK_NAMESTORE_PLUGIN_H
28
29#include "gnunet_gtk.h"
30#include <gnunet/gnunet_namestore_service.h>
31#include <gnunet/gnunet_dnsparser_lib.h>
32
33
34/**
35 * Context for edit operations.
36 */
37struct GNUNET_GTK_NAMESTORE_PluginEnvironment
38{
39 /**
40 * Closure to pass to @e check_validity.
41 */
42 void *cls;
43
44 /**
45 * Function that should be called by the plugin whenever values in
46 * the dialog were edited. It will check the validity of the dialog
47 * and update the "save" button accordingly.
48 */
49 void (*check_validity)(void *cls);
50
51};
52
53
54/**
55 * Each plugin is required to return a pointer to a struct of this
56 * type as the return value from its entry point.
57 */
58struct GNUNET_GTK_NAMESTORE_PluginFunctions
59{
60
61 /**
62 * Closure for all of the callbacks. Will typically contain
63 * the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`.
64 */
65 void *cls;
66
67 /**
68 * This must be set to the name of the ".glade" file containing the
69 * dialog.
70 */
71 const char *dialog_glade_filename;
72
73 /**
74 * This must be set to the name of the dialog widget in the ".glade"
75 * file.
76 */
77 const char *dialog_widget_name;
78
79 /**
80 * Function that will be called to initialize the builder's
81 * widgets from the existing record (if there is one).
82 * The `n_value` is the existing value of the record as a string.
83 */
84 void (*load)(void *cls,
85 gchar *n_value);
86
87 /**
88 * Function that will be called to retrieve the final value of the
89 * record (in string format) once the dialog is being closed.
90 */
91 gchar *(*store)(void *cls,
92 GtkBuilder *builder);
93
94 /**
95 * Function to call to validate the state of the dialog. Should
96 * return #GNUNET_OK if the information in the dialog is valid, and
97 * #GNUNET_SYSERR if some fields contain invalid values. The
98 * function should highlight fields with invalid inputs for the
99 * user.
100 */
101 int (*validate)(void *cls,
102 GtkBuilder *builder);
103
104
105};
106
107
108#endif