move statusbar related code from main.c into it's own main_statusbar.c
[obnox/wireshark/wip.git] / gtk / rtp_player_prefs.c
1 /* rtp_player_prefs.c
2  * Dialog box for RTP player preferences
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifdef HAVE_CONFIG_H
26 #include "config.h"
27 #endif
28
29 #include <gtk/gtk.h>
30 #include <stdlib.h>
31 #include "rtp_player_prefs.h"
32 #include <epan/prefs.h>
33 #include "prefs_dlg.h"
34
35 #define RTP_PLAYER_MAX_VISIBLE_KEY   "max_visible"
36 #define RTP_PLAYER_TABLE_ROWS 6
37
38 static char max_visible_str[128] = "";
39
40 GtkWidget*
41 rtp_player_prefs_show(void)
42 {
43         GtkWidget   *main_tb, *main_vb;
44         GtkWidget   *rtp_player_max_visible_te;
45         GtkTooltips *tooltips = gtk_tooltips_new();
46         int pos = 0;
47
48         /* Main vertical box */
49         main_vb = gtk_vbox_new(FALSE, 7);
50         gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
51
52         /* Main table */
53         main_tb = gtk_table_new(RTP_PLAYER_TABLE_ROWS, 1, FALSE);
54         gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
55         gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
56         gtk_table_set_col_spacings(GTK_TABLE(main_tb), 15);
57         gtk_widget_show(main_tb);
58         g_object_set_data(G_OBJECT(main_tb), E_TOOLTIPS_KEY, tooltips);
59
60         /* Max visable channels in RTP Player */
61         rtp_player_max_visible_te = create_preference_entry(main_tb, pos++,
62             "Max visible channels in RTP Player:", 
63             "Determines maximum height of RTP Player window.", max_visible_str);
64         g_snprintf(max_visible_str, 128, "%d", prefs.rtp_player_max_visible);
65         gtk_entry_set_text(GTK_ENTRY(rtp_player_max_visible_te), max_visible_str);
66         gtk_tooltips_set_tip(tooltips, rtp_player_max_visible_te,
67             "Maximum height of RTP Player window is defined here.", NULL);
68         g_object_set_data(G_OBJECT(main_vb), RTP_PLAYER_MAX_VISIBLE_KEY, rtp_player_max_visible_te);
69
70         /* Show 'em what we got */
71         gtk_widget_show_all(main_vb);
72
73         return main_vb;
74 }
75
76 void
77 rtp_player_prefs_fetch(GtkWidget *w _U_)
78 {
79         GtkWidget *rtp_player_max_visible_te;
80
81         rtp_player_max_visible_te = (GtkWidget *)g_object_get_data(G_OBJECT(w), RTP_PLAYER_MAX_VISIBLE_KEY);
82
83         prefs.rtp_player_max_visible = strtol(gtk_entry_get_text(
84                 GTK_ENTRY(rtp_player_max_visible_te)), NULL, 10);
85
86         /* Test for a minimum sane max channels */
87
88         if (prefs.rtp_player_max_visible < 1 || prefs.rtp_player_max_visible > 10)
89                 prefs.rtp_player_max_visible = RTP_PLAYER_DEFAULT_VISIBLE;
90 }
91
92 void
93 rtp_player_prefs_apply(GtkWidget *w _U_)
94 {
95 }
96
97 void
98 rtp_player_prefs_destroy(GtkWidget *w _U_)
99 {
100 }
101