diff options
Diffstat (limited to 'src/setup/gnunet-setup-namestore-plugins.c')
-rw-r--r-- | src/setup/gnunet-setup-namestore-plugins.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/setup/gnunet-setup-namestore-plugins.c b/src/setup/gnunet-setup-namestore-plugins.c new file mode 100644 index 00000000..74be3658 --- /dev/null +++ b/src/setup/gnunet-setup-namestore-plugins.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2012 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-namestore-plugins.c | ||
23 | * @brief (de)sensitize namestore plugin buttons based on plugin availability | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "gnunet-setup.h" | ||
27 | |||
28 | /** | ||
29 | * Test if the given plugin exists and change the sensitivity | ||
30 | * of the widget accordingly. | ||
31 | * | ||
32 | * @param widget widget to update | ||
33 | * @param name name of the plugin to check | ||
34 | */ | ||
35 | static void | ||
36 | test_plugin (GtkWidget * widget, const char *name) | ||
37 | { | ||
38 | if (GNUNET_YES == GNUNET_PLUGIN_test (name)) | ||
39 | { | ||
40 | gtk_widget_set_sensitive (widget, TRUE); | ||
41 | } | ||
42 | else | ||
43 | { | ||
44 | gtk_widget_set_sensitive (widget, FALSE); | ||
45 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | void | ||
51 | GNUNET_setup_namestore_sqlite_radiobutton_realize_cb (GtkWidget * widget, | ||
52 | gpointer user_data) | ||
53 | { | ||
54 | test_plugin (widget, "libgnunet_plugin_namestore_sqlite"); | ||
55 | } | ||
56 | |||
57 | |||
58 | void | ||
59 | GNUNET_setup_namestore_postgres_radiobutton_realize_cb (GtkWidget * widget, | ||
60 | gpointer user_data) | ||
61 | { | ||
62 | test_plugin (widget, "libgnunet_plugin_namestore_postgres"); | ||
63 | } | ||
64 | |||
65 | |||
66 | |||
67 | /* end of gnunet-setup-namestore-plugins.c */ | ||