diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-27 18:43:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-27 18:43:00 +0000 |
commit | 951de471769f8f6c6b319654a0be2b70d95d73b9 (patch) | |
tree | 27993825288cf4dc2480cd21423708b22570b22c | |
parent | 74fee53c1a7a9bfee87713347645698aae28267b (diff) | |
download | gnunet-gtk-951de471769f8f6c6b319654a0be2b70d95d73b9.tar.gz gnunet-gtk-951de471769f8f6c6b319654a0be2b70d95d73b9.zip |
-nicer plugin template
-rw-r--r-- | src/namestore/plugin_gtk_namestore_template.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/namestore/plugin_gtk_namestore_template.c b/src/namestore/plugin_gtk_namestore_template.c index 1f477d09..962c97ca 100644 --- a/src/namestore/plugin_gtk_namestore_template.c +++ b/src/namestore/plugin_gtk_namestore_template.c | |||
@@ -19,8 +19,8 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file namestore/plugin_gtk_namestore_a.c | 22 | * @file namestore/plugin_gtk_namestore_template.c |
23 | * @brief namestore plugin for editing A records | 23 | * @brief namestore plugin for editing TEMPLATE records |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "gnunet_gtk.h" | 26 | #include "gnunet_gtk.h" |
@@ -28,6 +28,22 @@ | |||
28 | 28 | ||
29 | 29 | ||
30 | /** | 30 | /** |
31 | * The user has edited FOO. Enable/disable 'save' | ||
32 | * button depending on the validity of the value. | ||
33 | * | ||
34 | * @param entry editing widget | ||
35 | * @param user_data the plugin environment | ||
36 | */ | ||
37 | void | ||
38 | FOO_changed_cb (GtkEditable *entry, | ||
39 | gpointer user_data) | ||
40 | { | ||
41 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data; | ||
42 | |||
43 | env->check_validity (env->cls); | ||
44 | } | ||
45 | |||
46 | /** | ||
31 | * Function that will be called to initialize the builder's | 47 | * Function that will be called to initialize the builder's |
32 | * widgets from the existing record (if there is one). | 48 | * widgets from the existing record (if there is one). |
33 | * The `n_value` is the existing value of the record as a string. | 49 | * The `n_value` is the existing value of the record as a string. |
@@ -37,7 +53,7 @@ | |||
37 | * @param builder the edit dialog's builder | 53 | * @param builder the edit dialog's builder |
38 | */ | 54 | */ |
39 | static void | 55 | static void |
40 | a_load (void *cls, | 56 | template_load (void *cls, |
41 | gchar *n_value, | 57 | gchar *n_value, |
42 | GtkBuilder *builder) | 58 | GtkBuilder *builder) |
43 | { | 59 | { |
@@ -54,7 +70,7 @@ a_load (void *cls, | |||
54 | * @return record value as a string, as specified in the dialog | 70 | * @return record value as a string, as specified in the dialog |
55 | */ | 71 | */ |
56 | static gchar * | 72 | static gchar * |
57 | a_store (void *cls, | 73 | template_store (void *cls, |
58 | GtkBuilder *builder) | 74 | GtkBuilder *builder) |
59 | { | 75 | { |
60 | GNUNET_break (0); | 76 | GNUNET_break (0); |
@@ -74,7 +90,7 @@ a_store (void *cls, | |||
74 | * @return #GNUNET_OK if there is a valid record value in the dialog | 90 | * @return #GNUNET_OK if there is a valid record value in the dialog |
75 | */ | 91 | */ |
76 | static int | 92 | static int |
77 | a_validate (void *cls, | 93 | template_validate (void *cls, |
78 | GtkBuilder *builder) | 94 | GtkBuilder *builder) |
79 | { | 95 | { |
80 | GNUNET_break (0); | 96 | GNUNET_break (0); |
@@ -89,15 +105,15 @@ a_validate (void *cls, | |||
89 | * @return NULL on error, otherwise the plugin context | 105 | * @return NULL on error, otherwise the plugin context |
90 | */ | 106 | */ |
91 | void * | 107 | void * |
92 | libgnunet_plugin_gtk_namestore_a_init (void *cls) | 108 | libgnunet_plugin_gtk_namestore_template_init (void *cls) |
93 | { | 109 | { |
94 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls; | 110 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls; |
95 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; | 111 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; |
96 | 112 | ||
97 | plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions); | 113 | plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions); |
98 | plugin->cls = env; | 114 | plugin->cls = env; |
99 | plugin->dialog_glade_filename = "gnunet_namestore_edit_a.glade"; | 115 | plugin->dialog_glade_filename = "gnunet_namestore_edit_template.glade"; |
100 | plugin->dialog_widget_name = "edit_a_dialog"; | 116 | plugin->dialog_widget_name = "edit_template_dialog"; |
101 | plugin->load = &a_load; | 117 | plugin->load = &a_load; |
102 | plugin->store = &a_store; | 118 | plugin->store = &a_store; |
103 | plugin->validate = &a_validate; | 119 | plugin->validate = &a_validate; |
@@ -112,7 +128,7 @@ libgnunet_plugin_gtk_namestore_a_init (void *cls) | |||
112 | * @return always NULL | 128 | * @return always NULL |
113 | */ | 129 | */ |
114 | void * | 130 | void * |
115 | libgnunet_plugin_gtk_namestore_aaaa_done (void *cls) | 131 | libgnunet_plugin_gtk_namestore_template_done (void *cls) |
116 | { | 132 | { |
117 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin = cls; | 133 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin = cls; |
118 | 134 | ||
@@ -120,4 +136,4 @@ libgnunet_plugin_gtk_namestore_aaaa_done (void *cls) | |||
120 | return NULL; | 136 | return NULL; |
121 | } | 137 | } |
122 | 138 | ||
123 | /* end of plugin_gtk_namestore_a.c */ | 139 | /* end of plugin_gtk_namestore_template.c */ |