diff options
Diffstat (limited to 'src/namestore/plugin_gtk_namestore_pkey.c')
-rw-r--r-- | src/namestore/plugin_gtk_namestore_pkey.c | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/src/namestore/plugin_gtk_namestore_pkey.c b/src/namestore/plugin_gtk_namestore_pkey.c new file mode 100644 index 00000000..8b9e5c0a --- /dev/null +++ b/src/namestore/plugin_gtk_namestore_pkey.c | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * This file is part of GNUnet | ||
3 | * (C) 2009-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 namestore/plugin_gtk_namestore_pkey.c | ||
23 | * @brief namestore plugin for editing PKEY records | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "gnunet_gtk.h" | ||
27 | #include "gnunet_gtk_namestore_plugin.h" | ||
28 | |||
29 | |||
30 | /** | ||
31 | * Function that will be called to initialize the builder's | ||
32 | * widgets from the existing record (if there is one). | ||
33 | * The `n_value` is the existing value of the record as a string. | ||
34 | * | ||
35 | * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *` | ||
36 | * @param n_value the record as a string | ||
37 | * @param builder the edit dialog's builder | ||
38 | */ | ||
39 | static void | ||
40 | pkey_load (void *cls, | ||
41 | gchar *n_value, | ||
42 | GtkBuilder *builder) | ||
43 | { | ||
44 | GNUNET_break (0); | ||
45 | } | ||
46 | |||
47 | |||
48 | /** | ||
49 | * Function that will be called to retrieve the final value of the | ||
50 | * record (in string format) once the dialog is being closed. | ||
51 | * | ||
52 | * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *` | ||
53 | * @param builder the edit dialog's builder | ||
54 | * @return record value as a string, as specified in the dialog | ||
55 | */ | ||
56 | static gchar * | ||
57 | pkey_store (void *cls, | ||
58 | GtkBuilder *builder) | ||
59 | { | ||
60 | GNUNET_break (0); | ||
61 | return NULL; | ||
62 | } | ||
63 | |||
64 | |||
65 | /** | ||
66 | * Function to call to validate the state of the dialog. Should | ||
67 | * return #GNUNET_OK if the information in the dialog is valid, and | ||
68 | * #GNUNET_SYSERR if some fields contain invalid values. The | ||
69 | * function should highlight fields with invalid inputs for the | ||
70 | * user. | ||
71 | * | ||
72 | * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *` | ||
73 | * @param builder the edit dialog's builder | ||
74 | * @return #GNUNET_OK if there is a valid record value in the dialog | ||
75 | */ | ||
76 | static int | ||
77 | pkey_validate (void *cls, | ||
78 | GtkBuilder *builder) | ||
79 | { | ||
80 | GNUNET_break (0); | ||
81 | return GNUNET_OK; | ||
82 | } | ||
83 | |||
84 | |||
85 | /** | ||
86 | * Entry point for the plugin. | ||
87 | * | ||
88 | * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*" | ||
89 | * @return NULL on error, otherwise the plugin context | ||
90 | */ | ||
91 | void * | ||
92 | libgnunet_plugin_gtk_namestore_pkey_init (void *cls) | ||
93 | { | ||
94 | struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls; | ||
95 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; | ||
96 | |||
97 | plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions); | ||
98 | plugin->cls = env; | ||
99 | plugin->dialog_glade_filename = "gnunet_namestore_edit_pkey.glade"; | ||
100 | plugin->dialog_widget_name = "edit_pkey_dialog"; | ||
101 | plugin->load = &pkey_load; | ||
102 | plugin->store = &pkey_store; | ||
103 | plugin->validate = &pkey_validate; | ||
104 | return plugin; | ||
105 | } | ||
106 | |||
107 | |||
108 | /** | ||
109 | * Exit point from the plugin. | ||
110 | * | ||
111 | * @param cls the plugin context (as returned by "init") | ||
112 | * @return always NULL | ||
113 | */ | ||
114 | void * | ||
115 | libgnunet_plugin_gtk_namestore_pkey_done (void *cls) | ||
116 | { | ||
117 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin = cls; | ||
118 | |||
119 | GNUNET_free (plugin); | ||
120 | return NULL; | ||
121 | } | ||
122 | |||
123 | /* end of plugin_gtk_namestore_pkey.c */ | ||