aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_main-window-view-toggles.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_main-window-view-toggles.c')
-rw-r--r--src/fs/gnunet-fs-gtk_main-window-view-toggles.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/fs/gnunet-fs-gtk_main-window-view-toggles.c b/src/fs/gnunet-fs-gtk_main-window-view-toggles.c
new file mode 100644
index 00000000..367e30ae
--- /dev/null
+++ b/src/fs/gnunet-fs-gtk_main-window-view-toggles.c
@@ -0,0 +1,92 @@
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/gnunet-fs-gtk_main-window-view-toggles.c
23 * @author Christian Grothoff
24 * @brief This file contains callbacks for the 'view' menu that toggle views.
25 */
26#include "gnunet-fs-gtk_common.h"
27#include "gnunet-fs-gtk.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 */
37static void
38toggle_view (const char *toggled_widget, const char *toggle_menu)
39{
40 GtkCheckMenuItem *mi;
41 GtkWidget *widget;
42
43 widget = GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object (toggled_widget));
44 mi = GTK_CHECK_MENU_ITEM (GNUNET_FS_GTK_get_main_window_object (toggle_menu));
45 if (gtk_check_menu_item_get_active (mi))
46 gtk_widget_show (widget);
47 else
48 gtk_widget_hide (widget);
49}
50
51
52/**
53 * Preview view is toggled.
54 *
55 * @param dummy widget triggering the event
56 * @param gpointer main window builder (unused)
57 */
58void
59GNUNET_GTK_main_menu_view_preview_toggled_cb (GtkWidget * dummy, gpointer data)
60{
61 toggle_view ("GNUNET_GTK_main_window_preview_image",
62 "GNUNET_GTK_main_menu_view_preview");
63}
64
65
66/**
67 * Metadata view is toggled.
68 *
69 * @param dummy widget triggering the event
70 * @param gpointer main window builder (unused)
71 */
72void
73GNUNET_GTK_main_menu_view_metadata_toggled_cb (GtkWidget * dummy, gpointer data)
74{
75 toggle_view ("GNUNET_GTK_main_window_metadata_treeview",
76 "GNUNET_GTK_main_menu_view_metadata");
77}
78
79/**
80 * Preview view is toggled.
81 *
82 * @param dummy widget triggering the event
83 * @param gpointer main window builder (unused)
84 */
85void
86GNUNET_GTK_main_menu_view_search_toggled_cb (GtkWidget * dummy, gpointer data)
87{
88 toggle_view ("main_window_search_hbox",
89 "GNUNET_GTK_main_menu_search_preview");
90}
91
92/* end of gnunet-fs-gtk_main-window-view-toggles.c */