diff options
Diffstat (limited to 'src/fs/fs_anonymity_spin_buttons.c')
-rw-r--r-- | src/fs/fs_anonymity_spin_buttons.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/fs/fs_anonymity_spin_buttons.c b/src/fs/fs_anonymity_spin_buttons.c new file mode 100644 index 00000000..fa4b4eeb --- /dev/null +++ b/src/fs/fs_anonymity_spin_buttons.c | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2005, 2006, 2010 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/fs_anonymtiy_spin_buttons.c | ||
23 | * @author Christian Grothoff | ||
24 | * | ||
25 | * This file contains callbacks to turn spin buttons red when the | ||
26 | * value reaches zero. | ||
27 | */ | ||
28 | #include "common.h" | ||
29 | |||
30 | |||
31 | /** | ||
32 | * Spin button is changed, update its colour. | ||
33 | */ | ||
34 | void | ||
35 | GNUNET_GTK_anonymity_spin_button_value_changed_cb (GtkWidget *w, | ||
36 | gpointer data) | ||
37 | { | ||
38 | GtkSpinButton *spin; | ||
39 | gint val; | ||
40 | GdkColor bcolor; | ||
41 | GdkColor fcolor; | ||
42 | |||
43 | spin = GTK_SPIN_BUTTON (w); | ||
44 | if (spin == NULL) | ||
45 | { | ||
46 | GNUNET_break (0); | ||
47 | return; | ||
48 | } | ||
49 | val = gtk_spin_button_get_value_as_int (spin); | ||
50 | if (val == 0) | ||
51 | { | ||
52 | if ((TRUE == gdk_color_parse ("red", | ||
53 | &bcolor)) && | ||
54 | (TRUE == gdk_colormap_alloc_color (gdk_colormap_get_system (), | ||
55 | &bcolor, FALSE, TRUE)) && | ||
56 | (TRUE == gdk_color_parse ("black", | ||
57 | &fcolor)) && | ||
58 | (TRUE == gdk_colormap_alloc_color (gdk_colormap_get_system (), | ||
59 | &fcolor, FALSE, TRUE))) | ||
60 | { | ||
61 | gtk_widget_modify_base (w, GTK_STATE_NORMAL, &bcolor); | ||
62 | gtk_widget_modify_text (w, GTK_STATE_NORMAL, &fcolor); | ||
63 | } | ||
64 | } | ||
65 | else | ||
66 | { | ||
67 | gtk_widget_modify_base (w, GTK_STATE_NORMAL, NULL); | ||
68 | gtk_widget_modify_text (w, GTK_STATE_NORMAL, NULL); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | |||
73 | /* end of fs_anonymtiy_spin_buttons.c */ | ||