aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-conversation-gtk_visibility.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk_visibility.c')
-rw-r--r--src/conversation/gnunet-conversation-gtk_visibility.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/conversation/gnunet-conversation-gtk_visibility.c b/src/conversation/gnunet-conversation-gtk_visibility.c
new file mode 100644
index 00000000..c9245af3
--- /dev/null
+++ b/src/conversation/gnunet-conversation-gtk_visibility.c
@@ -0,0 +1,82 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010-2014 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 3, 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/conversation/gnunet-conversation-gtk_visibility.c
23 * @brief show or hide widgets based on view options
24 * @author Christian Grothoff
25 */
26#include "gnunet-conversation-gtk.h"
27
28
29/**
30 * Toggle the visibility of a widget based on the checkeness
31 * of a menu item.
32 *
33 * @param toggled_widget name of widget to toggle
34 * @param toggle_menu name of menu entry
35 */
36static void
37toggle_view (const char *toggled_widget,
38 const char *toggle_menu)
39{
40 GtkCheckMenuItem *mi;
41 GtkWidget *widget;
42
43 widget = GTK_WIDGET (GCG_get_main_window_object (toggled_widget));
44 mi = GTK_CHECK_MENU_ITEM (GCG_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 * Log view is toggled.
54 *
55 * @param dummy widget triggering the event
56 * @param data main window builder (unused)
57 */
58void
59gnunet_conversation_gtk_view_log_checkmenuitem_toggled_cb (GtkWidget * dummy,
60 gpointer data)
61{
62 toggle_view ("gnunet_conversation_gtk_log_frame",
63 "gnunet_conversation_gtk_view_log_checkmenuitem");
64}
65
66
67/**
68 * History view is toggled.
69 *
70 * @param dummy widget triggering the event
71 * @param data main window builder (unused)
72 */
73void
74gnunet_conversation_gtk_view_history_checkmenuitem_toggled_cb (GtkWidget * dummy,
75 gpointer data)
76{
77 toggle_view ("gnunet_conversation_gtk_history_frame",
78 "gnunet_conversation_gtk_view_history_checkmenuitem");
79}
80
81
82/* end of gnunet-conversation-gtk_visibility.c */