aboutsummaryrefslogtreecommitdiff
path: root/src/fs/main_window_view_toggles.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/main_window_view_toggles.c')
-rw-r--r--src/fs/main_window_view_toggles.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/fs/main_window_view_toggles.c b/src/fs/main_window_view_toggles.c
new file mode 100644
index 00000000..0cdea23a
--- /dev/null
+++ b/src/fs/main_window_view_toggles.c
@@ -0,0 +1,90 @@
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#include "gnunet-fs-gtk.h"
29
30
31/**
32 * Toggle the visibility of a widget based on the checkeness
33 * of a menu item.
34 *
35 * @param toggled_widget name of widget to toggle
36 * @param toggle_menu name of menu entry
37 */
38static void
39toggle_view (const char *toggled_widget,
40 const char *toggle_menu)
41{
42 GtkCheckMenuItem *mi;
43 GtkWidget *widget;
44
45 widget = GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object (toggled_widget));
46 mi = GTK_CHECK_MENU_ITEM (GNUNET_FS_GTK_get_main_window_object (toggle_menu));
47 if (gtk_check_menu_item_get_active (mi))
48 gtk_widget_show (widget);
49 else
50 gtk_widget_hide (widget);
51}
52
53
54/**
55 * Preview view is toggled.
56 */
57void
58GNUNET_GTK_main_menu_view_preview_toggled_cb (GtkWidget * dummy,
59 gpointer data)
60{
61 toggle_view ("GNUNET_GTK_main_window_preview_image",
62 "GNUNET_GTK_main_menu_view_preview");
63}
64
65
66/**
67 * Neighbour view is toggled.
68 */
69void
70GNUNET_GTK_main_menu_view_neighbours_toggled_cb (GtkWidget * dummy,
71 gpointer data)
72{
73 toggle_view ("GNUNET_GTK_main_window_peerinfo_treeview",
74 "GNUNET_GTK_main_menu_view_neighbours");
75}
76
77
78/**
79 * Metadata view is toggled.
80 */
81void
82GNUNET_GTK_main_menu_view_metadata_toggled_cb (GtkWidget * dummy,
83 gpointer data)
84{
85 toggle_view ("GNUNET_GTK_main_window_metadata_treeview",
86 "GNUNET_GTK_main_menu_view_metadata");
87}
88
89
90/* end of main_window_view_toggles.c */