2 * Dialog box for RTP player preferences
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
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.
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.
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.
31 #include "rtp_player_prefs.h"
32 #include <epan/prefs.h>
33 #include "prefs_dlg.h"
35 #define RTP_PLAYER_MAX_VISIBLE_KEY "max_visible"
36 #define RTP_PLAYER_TABLE_ROWS 6
38 static char max_visible_str[128] = "";
41 rtp_player_prefs_show(void)
43 GtkWidget *main_tb, *main_vb;
44 GtkWidget *rtp_player_max_visible_te;
45 GtkTooltips *tooltips = gtk_tooltips_new();
48 /* Main vertical box */
49 main_vb = gtk_vbox_new(FALSE, 7);
50 gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
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);
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);
70 /* Show 'em what we got */
71 gtk_widget_show_all(main_vb);
77 rtp_player_prefs_fetch(GtkWidget *w _U_)
79 GtkWidget *rtp_player_max_visible_te;
81 rtp_player_max_visible_te = (GtkWidget *)g_object_get_data(G_OBJECT(w), RTP_PLAYER_MAX_VISIBLE_KEY);
83 prefs.rtp_player_max_visible = strtol(gtk_entry_get_text(
84 GTK_ENTRY(rtp_player_max_visible_te)), NULL, 10);
86 /* Test for a minimum sane max channels */
88 if (prefs.rtp_player_max_visible < 1 || prefs.rtp_player_max_visible > 10)
89 prefs.rtp_player_max_visible = RTP_PLAYER_DEFAULT_VISIBLE;
93 rtp_player_prefs_apply(GtkWidget *w _U_)
98 rtp_player_prefs_destroy(GtkWidget *w _U_)