diff options
Diffstat (limited to 'src/main_window_view_toggles.c')
-rw-r--r-- | src/main_window_view_toggles.c | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/main_window_view_toggles.c b/src/main_window_view_toggles.c new file mode 100644 index 00000000..59c74553 --- /dev/null +++ b/src/main_window_view_toggles.c | |||
@@ -0,0 +1,99 @@ | |||
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/main_window_view_toggles.c | ||
23 | * @author Christian Grothoff | ||
24 | * | ||
25 | * This file contains callbacks for the 'view' menu that toggle views. | ||
26 | */ | ||
27 | #include "common.h" | ||
28 | |||
29 | |||
30 | /** | ||
31 | * Toggle the visibility of a widget based on the checkeness | ||
32 | * of a menu item. | ||
33 | * | ||
34 | * @param toggled_widget name of widget to toggle | ||
35 | * @param toggle_menu name of menu entry | ||
36 | */ | ||
37 | static void | ||
38 | toggle_view (const char *toggled_widget, | ||
39 | const char *toggle_menu) | ||
40 | { | ||
41 | GtkCheckMenuItem *mi; | ||
42 | GtkWidget *widget; | ||
43 | |||
44 | widget = GTK_WIDGET (GNUNET_GTK_get_main_window_object (toggled_widget)); | ||
45 | mi = GTK_CHECK_MENU_ITEM (GNUNET_GTK_get_main_window_object (toggle_menu)); | ||
46 | if (gtk_check_menu_item_get_active (mi)) | ||
47 | gtk_widget_show (widget); | ||
48 | else | ||
49 | gtk_widget_hide (widget); | ||
50 | } | ||
51 | |||
52 | |||
53 | /** | ||
54 | * Preview view is toggled. | ||
55 | */ | ||
56 | void | ||
57 | GNUNET_GTK_main_menu_view_preview_toggled_cb (GtkWidget * dummy, | ||
58 | gpointer data) | ||
59 | { | ||
60 | toggle_view ("GNUNET_GTK_main_window_preview_image", | ||
61 | "GNUNET_GTK_main_menu_view_preview"); | ||
62 | } | ||
63 | |||
64 | |||
65 | /** | ||
66 | * Neighbour view is toggled. | ||
67 | */ | ||
68 | void | ||
69 | GNUNET_GTK_main_menu_view_neighbours_toggled_cb (GtkWidget * dummy, | ||
70 | gpointer data) | ||
71 | { | ||
72 | toggle_view ("GNUNET_GTK_main_window_peerinfo_treeview", | ||
73 | "GNUNET_GTK_main_menu_view_neighbours"); | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * Statistics view is toggled. | ||
78 | */ | ||
79 | void | ||
80 | GNUNET_GTK_main_menu_view_statistics_toggled_cb (GtkWidget * dummy, | ||
81 | gpointer data) | ||
82 | { | ||
83 | toggle_view ("GNUNET_GTK_statistics_notebook", | ||
84 | "GNUNET_GTK_main_menu_view_statistics"); | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * Metadata view is toggled. | ||
89 | */ | ||
90 | void | ||
91 | GNUNET_GTK_main_menu_view_metadata_toggled_cb (GtkWidget * dummy, | ||
92 | gpointer data) | ||
93 | { | ||
94 | toggle_view ("GNUNET_GTK_main_window_metadata_treeview", | ||
95 | "GNUNET_GTK_main_menu_view_metadata"); | ||
96 | } | ||
97 | |||
98 | |||
99 | /* end of main_window_view_toggles.c */ | ||