1305
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
1 /* gtk.c - functions to build and display GTK windows
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
2 * Copyright (C) 2000-2007 Jason Jordan <shnutils@freeshell.org>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
3 *
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
7 * (at your option) any later version.
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
8 *
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
12 * GNU General Public License for more details.
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
13 *
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
15 * along with this program; if not, write to the Free Software
|
2835
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1305
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
17 */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
18
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
19 /*
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
20 * $Id: gtk.c,v 1.27 2007/03/29 00:40:40 jason Exp $
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
21 */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
22
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
23 #include <stdlib.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
24 #include <glib.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
25 #include "shorten.h"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
26
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
27 #undef XMMS_SHN_LOAD_TEXTFILES
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
28 #ifdef HAVE_DIRENT_H
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
29 # include <sys/types.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
30 # include <dirent.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
31 # ifdef HAVE_OPENDIR
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
32 # ifdef HAVE_READDIR
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
33 # ifdef HAVE_CLOSEDIR
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
34 # define XMMS_SHN_LOAD_TEXTFILES 1
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
35 # endif
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
36 # endif
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
37 # endif
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
38 #endif
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
39
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
40 static GtkWidget *shn_configurewin = NULL,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
41 *about_box,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
42 *vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
43 *options_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
44 *miscellaneous_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
45 *seektables_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
46 *bbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
47 *notebook,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
48 *output_frame,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
49 *output_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
50 *output_label,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
51 *output_error_stderr,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
52 *output_error_window,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
53 *output_error_devnull,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
54 *misc_frame,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
55 *misc_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
56 *swap_bytes_toggle,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
57 *verbose_toggle,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
58 *textfile_toggle,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
59 *textfile_extensions_entry,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
60 *textfile_extensions_label,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
61 *textfile_extensions_hbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
62 *path_frame,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
63 *path_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
64 *path_label,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
65 *path_entry,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
66 *path_entry_hbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
67 *path_browse,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
68 *relative_path_label,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
69 *relative_path_entry,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
70 *relative_path_entry_hbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
71 *ok,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
72 *cancel,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
73 *apply;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
74
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
75 void shn_display_about(void)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
76 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
77 if (about_box != NULL)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
78 {
|
2192
|
79 gtk_window_present(GTK_WINDOW(about_box));
|
1305
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
80 return;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
81 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
82
|
1677
|
83 about_box = audacious_info_dialog(
|
1305
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
84 (gchar *) "About " PACKAGE,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
85 (gchar *) PACKAGE " version " VERSION "\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
86 "Copyright (C) 2000-2007 Jason Jordan <shnutils@freeshell.org>\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
87 "Portions Copyright (C) 1992-1995 Tony Robinson\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
88 "\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
89 "shorten utilities pages:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
90 "\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
91 "http://www.etree.org/shnutils/\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
92 "http://shnutils.freeshell.org/",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
93 (gchar *) "Cool",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
94 FALSE, NULL, NULL);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
95 g_signal_connect_swapped(GTK_OBJECT(about_box), "destroy",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
96 gtk_widget_destroyed, &about_box);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
97 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
98
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
99 void shn_configurewin_save(void)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
100 {
|
2523
|
101 mcs_handle_t *cfg;
|
1305
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
102 gchar *filename;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
103
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
104 shn_cfg.error_output_method = ERROR_OUTPUT_DEVNULL;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
105 if (GTK_TOGGLE_BUTTON(output_error_stderr)->active)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
106 shn_cfg.error_output_method = ERROR_OUTPUT_STDERR;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
107 else if (GTK_TOGGLE_BUTTON(output_error_window)->active)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
108 shn_cfg.error_output_method = ERROR_OUTPUT_WINDOW;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
109
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
110 g_free(shn_cfg.seek_tables_path);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
111 shn_cfg.seek_tables_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(path_entry)));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
112
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
113 g_free(shn_cfg.relative_seek_tables_path);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
114 shn_cfg.relative_seek_tables_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(relative_path_entry)));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
115
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
116 shn_cfg.verbose = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(verbose_toggle));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
117
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
118 shn_cfg.swap_bytes = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(swap_bytes_toggle));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
119
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
120 shn_cfg.load_textfiles = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(textfile_toggle));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
121
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
122 g_free(shn_cfg.textfile_extensions);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
123 shn_cfg.textfile_extensions = g_strdup(gtk_entry_get_text(GTK_ENTRY(textfile_extensions_entry)));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
124
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
125 filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL);
|
2124
|
126 cfg = aud_cfg_db_open();
|
|
127 aud_cfg_db_set_int(cfg, XMMS_SHN_VERSION_TAG, shn_cfg.error_output_method_config_name, shn_cfg.error_output_method);
|
|
128 aud_cfg_db_set_bool(cfg, XMMS_SHN_VERSION_TAG, shn_cfg.verbose_config_name, shn_cfg.verbose);
|
|
129 aud_cfg_db_set_string(cfg, XMMS_SHN_VERSION_TAG, shn_cfg.seek_tables_path_config_name, shn_cfg.seek_tables_path);
|
|
130 aud_cfg_db_set_string(cfg, XMMS_SHN_VERSION_TAG, shn_cfg.relative_seek_tables_path_config_name, shn_cfg.relative_seek_tables_path);
|
|
131 aud_cfg_db_set_bool(cfg, XMMS_SHN_VERSION_TAG, shn_cfg.swap_bytes_config_name, shn_cfg.swap_bytes);
|
|
132 aud_cfg_db_set_bool(cfg, XMMS_SHN_VERSION_TAG, shn_cfg.load_textfiles_config_name, shn_cfg.load_textfiles);
|
|
133 aud_cfg_db_set_string(cfg, XMMS_SHN_VERSION_TAG, shn_cfg.textfile_extensions_config_name, shn_cfg.textfile_extensions);
|
1305
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
134
|
2124
|
135 aud_cfg_db_close(cfg);
|
1305
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
136 g_free(filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
137 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
138
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
139 void shn_configurewin_apply()
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
140 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
141 shn_configurewin_save();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
142 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
143
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
144 void shn_configurewin_ok(void)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
145 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
146 shn_configurewin_save();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
147 gtk_widget_destroy(shn_configurewin);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
148 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
149
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
150 void shn_display_configure(void)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
151 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
152 if (shn_configurewin != NULL)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
153 {
|
2192
|
154 gtk_window_present(GTK_WINDOW(shn_configurewin));
|
1305
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
155 return;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
156 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
157
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
158 shn_configurewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
159 gtk_signal_connect(GTK_OBJECT(shn_configurewin), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &shn_configurewin);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
160 gtk_window_set_title(GTK_WINDOW(shn_configurewin), (gchar *)"SHN Player Configuration");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
161 gtk_window_set_policy(GTK_WINDOW(shn_configurewin), FALSE, FALSE, FALSE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
162 gtk_container_border_width(GTK_CONTAINER(shn_configurewin), 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
163
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
164 vbox = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
165 gtk_container_add(GTK_CONTAINER(shn_configurewin), vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
166
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
167 notebook = gtk_notebook_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
168
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
169 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
170
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
171 options_vbox = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
172 gtk_container_set_border_width(GTK_CONTAINER(options_vbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
173
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
174 seektables_vbox = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
175 gtk_container_set_border_width(GTK_CONTAINER(seektables_vbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
176
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
177 miscellaneous_vbox = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
178 gtk_container_set_border_width(GTK_CONTAINER(miscellaneous_vbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
179
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
180 /* begin error output box */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
181
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
182 output_frame = gtk_frame_new((gchar *)" Error display options ");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
183 gtk_container_set_border_width(GTK_CONTAINER(output_frame), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
184
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
185 output_vbox = gtk_vbox_new(FALSE, 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
186 gtk_container_set_border_width(GTK_CONTAINER(output_vbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
187 gtk_container_add(GTK_CONTAINER(output_frame), output_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
188
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
189 output_label = gtk_label_new((gchar *)"When an error occurs, display it to:");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
190 gtk_misc_set_alignment(GTK_MISC(output_label), 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
191 gtk_label_set_justify(GTK_LABEL(output_label), GTK_JUSTIFY_LEFT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
192 gtk_box_pack_start(GTK_BOX(output_vbox), output_label, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
193 gtk_widget_show(output_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
194
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
195 output_error_window = gtk_radio_button_new_with_label(NULL, (gchar *)"a window");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
196 if (shn_cfg.error_output_method == ERROR_OUTPUT_WINDOW)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
197 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(output_error_window), TRUE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
198 gtk_box_pack_start(GTK_BOX(output_vbox), output_error_window, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
199 gtk_widget_show(output_error_window);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
200
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
201 output_error_stderr = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(output_error_window)), (gchar *)"stderr");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
202 if (shn_cfg.error_output_method == ERROR_OUTPUT_STDERR)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
203 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(output_error_stderr), TRUE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
204 gtk_box_pack_start(GTK_BOX(output_vbox), output_error_stderr, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
205 gtk_widget_show(output_error_stderr);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
206
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
207 output_error_devnull = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(output_error_window)), (gchar *)"/dev/null");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
208 if (shn_cfg.error_output_method == ERROR_OUTPUT_DEVNULL)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
209 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(output_error_devnull), TRUE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
210 gtk_box_pack_start(GTK_BOX(output_vbox), output_error_devnull, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
211 gtk_widget_show(output_error_devnull);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
212
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
213 gtk_widget_show(output_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
214 gtk_widget_show(output_frame);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
215
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
216 /* end error output box */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
217
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
218 /* begin misc box */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
219
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
220 misc_frame = gtk_frame_new((gchar *)" Miscellaneous options ");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
221 gtk_container_set_border_width(GTK_CONTAINER(misc_frame), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
222
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
223 misc_vbox = gtk_vbox_new(FALSE, 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
224 gtk_container_set_border_width(GTK_CONTAINER(misc_vbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
225 gtk_container_add(GTK_CONTAINER(misc_frame), misc_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
226
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
227 swap_bytes_toggle = gtk_check_button_new_with_label((gchar *)"Swap audio bytes (toggle if all you hear is static)");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
228 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(swap_bytes_toggle), shn_cfg.swap_bytes);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
229 gtk_box_pack_start(GTK_BOX(misc_vbox), swap_bytes_toggle, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
230 gtk_widget_show(swap_bytes_toggle);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
231
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
232 verbose_toggle = gtk_check_button_new_with_label((gchar *)"Display debug info to stderr");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
233 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(verbose_toggle), shn_cfg.verbose);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
234 gtk_box_pack_start(GTK_BOX(misc_vbox), verbose_toggle, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
235 gtk_widget_show(verbose_toggle);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
236
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
237 textfile_toggle = gtk_check_button_new_with_label((gchar *)"Load text files in file information box");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
238 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(textfile_toggle), shn_cfg.load_textfiles);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
239 gtk_box_pack_start(GTK_BOX(misc_vbox), textfile_toggle, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
240 gtk_widget_show(textfile_toggle);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
241
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
242 textfile_extensions_hbox = gtk_hbox_new(FALSE, 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
243 gtk_container_set_border_width(GTK_CONTAINER(textfile_extensions_hbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
244 gtk_box_pack_start(GTK_BOX(misc_vbox), textfile_extensions_hbox, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
245
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
246 textfile_extensions_label = gtk_label_new((gchar *)" Text file extensions:");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
247 gtk_misc_set_alignment(GTK_MISC(textfile_extensions_label), 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
248 gtk_label_set_justify(GTK_LABEL(textfile_extensions_label), GTK_JUSTIFY_LEFT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
249 gtk_box_pack_start(GTK_BOX(textfile_extensions_hbox), textfile_extensions_label, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
250 gtk_widget_show(textfile_extensions_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
251
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
252 textfile_extensions_entry = gtk_entry_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
253 gtk_entry_set_text(GTK_ENTRY(textfile_extensions_entry), shn_cfg.textfile_extensions);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
254 gtk_box_pack_start(GTK_BOX(textfile_extensions_hbox), textfile_extensions_entry, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
255 gtk_widget_show(textfile_extensions_entry);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
256
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
257 gtk_widget_show(textfile_extensions_hbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
258 gtk_widget_show(misc_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
259 gtk_widget_show(misc_frame);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
260
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
261 /* end misc box */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
262
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
263 /* begin seek table path box */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
264
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
265 path_frame = gtk_frame_new((gchar *)" Alternate seek table file locations ");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
266 gtk_container_set_border_width(GTK_CONTAINER(path_frame), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
267
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
268 path_vbox = gtk_vbox_new(FALSE, 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
269 gtk_container_set_border_width(GTK_CONTAINER(path_vbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
270 gtk_container_add(GTK_CONTAINER(path_frame), path_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
271
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
272 relative_path_label = gtk_label_new((gchar *)"Relative seek table path:");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
273 gtk_misc_set_alignment(GTK_MISC(relative_path_label), 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
274 gtk_label_set_justify(GTK_LABEL(relative_path_label), GTK_JUSTIFY_LEFT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
275 gtk_box_pack_start(GTK_BOX(path_vbox), relative_path_label, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
276 gtk_widget_show(relative_path_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
277
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
278 relative_path_entry_hbox = gtk_hbox_new(FALSE, 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
279 gtk_container_set_border_width(GTK_CONTAINER(relative_path_entry_hbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
280 gtk_box_pack_start(GTK_BOX(path_vbox), relative_path_entry_hbox, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
281
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
282 relative_path_entry = gtk_entry_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
283 gtk_entry_set_text(GTK_ENTRY(relative_path_entry), shn_cfg.relative_seek_tables_path);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
284 gtk_box_pack_start(GTK_BOX(relative_path_entry_hbox), relative_path_entry, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
285 gtk_widget_show(relative_path_entry);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
286
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
287 path_label = gtk_label_new((gchar *)"\nAbsolute seek table path:");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
288 gtk_misc_set_alignment(GTK_MISC(path_label), 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
289 gtk_label_set_justify(GTK_LABEL(path_label), GTK_JUSTIFY_LEFT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
290 gtk_box_pack_start(GTK_BOX(path_vbox), path_label, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
291 gtk_widget_show(path_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
292
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
293 path_entry_hbox = gtk_hbox_new(FALSE, 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
294 gtk_container_set_border_width(GTK_CONTAINER(path_entry_hbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
295 gtk_box_pack_start(GTK_BOX(path_vbox), path_entry_hbox, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
296
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
297 path_entry = gtk_entry_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
298 gtk_entry_set_text(GTK_ENTRY(path_entry), shn_cfg.seek_tables_path);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
299 gtk_box_pack_start(GTK_BOX(path_entry_hbox), path_entry, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
300 gtk_widget_show(path_entry);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
301
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
302 #if 0
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
303 path_browse = gtk_button_new_with_label("Browse");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
304 gtk_signal_connect(GTK_OBJECT(path_browse), "clicked", GTK_SIGNAL_FUNC(path_browse_cb), NULL);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
305 gtk_box_pack_start(GTK_BOX(path_entry_hbox), path_browse, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
306 gtk_widget_show(path_browse);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
307 #endif
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
308
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
309 gtk_widget_show(relative_path_entry_hbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
310 gtk_widget_show(path_entry_hbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
311 gtk_widget_show(path_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
312 gtk_widget_show(path_frame);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
313
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
314 /* end seek table path box */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
315
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
316 gtk_box_pack_start(GTK_BOX(options_vbox), output_frame, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
317 gtk_box_pack_start(GTK_BOX(seektables_vbox), path_frame, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
318 gtk_box_pack_start(GTK_BOX(miscellaneous_vbox), misc_frame, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
319
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
320 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), options_vbox, gtk_label_new((gchar *)"Error Display"));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
321 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), seektables_vbox, gtk_label_new((gchar *)"Seek Tables"));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
322 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), miscellaneous_vbox, gtk_label_new((gchar *)"Miscellaneous"));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
323
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
324 bbox = gtk_hbutton_box_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
325 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
326 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
327 gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
328
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
329 ok = gtk_button_new_with_label((gchar *)"OK");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
330 gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(shn_configurewin_ok), NULL);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
331 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
332 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
333 gtk_widget_show(ok);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
334 gtk_widget_grab_default(ok);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
335
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
336 cancel = gtk_button_new_with_label((gchar *)"Cancel");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
337 gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(shn_configurewin));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
338 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
339 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
340 gtk_widget_show(cancel);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
341
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
342 apply = gtk_button_new_with_label((gchar *)"Apply");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
343 gtk_signal_connect_object(GTK_OBJECT(apply), "clicked", GTK_SIGNAL_FUNC(shn_configurewin_apply), NULL);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
344 GTK_WIDGET_SET_FLAGS(apply, GTK_CAN_DEFAULT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
345 gtk_box_pack_start(GTK_BOX(bbox), apply, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
346 gtk_widget_show(apply);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
347
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
348 gtk_widget_show(bbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
349 gtk_widget_show(options_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
350 gtk_widget_show(seektables_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
351 gtk_widget_show(miscellaneous_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
352 gtk_widget_show(notebook);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
353 gtk_widget_show(vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
354 gtk_widget_show(shn_configurewin);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
355 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
356
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
357 void shn_message_box(char *message)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
358 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
359 GtkWidget *mbox_win,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
360 *mbox_vbox1,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
361 *mbox_vbox2,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
362 *mbox_frame,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
363 *mbox_label,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
364 *mbox_bbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
365 *mbox_ok;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
366
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
367 mbox_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
368 gtk_signal_connect(GTK_OBJECT(mbox_win), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &mbox_win);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
369 gtk_window_set_title(GTK_WINDOW(mbox_win), (gchar *)"Shorten file information");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
370 gtk_window_set_policy(GTK_WINDOW(mbox_win), FALSE, FALSE, FALSE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
371 gtk_container_border_width(GTK_CONTAINER(mbox_win), 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
372
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
373 mbox_vbox1 = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
374 gtk_container_add(GTK_CONTAINER(mbox_win), mbox_vbox1);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
375
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
376 mbox_frame = gtk_frame_new((gchar *)" " PACKAGE " error ");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
377 gtk_container_set_border_width(GTK_CONTAINER(mbox_frame), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
378 gtk_box_pack_start(GTK_BOX(mbox_vbox1), mbox_frame, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
379
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
380 mbox_vbox2 = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
381 gtk_container_set_border_width(GTK_CONTAINER(mbox_vbox2), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
382 gtk_container_add(GTK_CONTAINER(mbox_frame), mbox_vbox2);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
383
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
384 mbox_label = gtk_label_new((gchar *)message);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
385 gtk_misc_set_alignment(GTK_MISC(mbox_label), 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
386 gtk_label_set_justify(GTK_LABEL(mbox_label), GTK_JUSTIFY_LEFT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
387 gtk_box_pack_start(GTK_BOX(mbox_vbox2), mbox_label, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
388 gtk_widget_show(mbox_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
389
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
390 mbox_bbox = gtk_hbutton_box_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
391 gtk_button_box_set_layout(GTK_BUTTON_BOX(mbox_bbox), GTK_BUTTONBOX_SPREAD);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
392 gtk_button_box_set_spacing(GTK_BUTTON_BOX(mbox_bbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
393 gtk_box_pack_start(GTK_BOX(mbox_vbox2), mbox_bbox, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
394
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
395 mbox_ok = gtk_button_new_with_label((gchar *)"OK");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
396 gtk_signal_connect_object(GTK_OBJECT(mbox_ok), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(mbox_win));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
397 GTK_WIDGET_SET_FLAGS(mbox_ok, GTK_CAN_DEFAULT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
398 gtk_box_pack_start(GTK_BOX(mbox_bbox), mbox_ok, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
399 gtk_widget_show(mbox_ok);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
400 gtk_widget_grab_default(mbox_ok);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
401
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
402 gtk_widget_show(mbox_bbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
403 gtk_widget_show(mbox_vbox2);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
404 gtk_widget_show(mbox_frame);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
405 gtk_widget_show(mbox_vbox1);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
406 gtk_widget_show(mbox_win);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
407 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
408
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
409 void load_shntextfile(char *filename,int num,GtkWidget *shntxt_notebook)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
410 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
411 FILE *f;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
412 char buffer[1024],*shortfilename;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
413 int nchars;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
414 GtkWidget *shntxt_frame,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
415 *shntxt_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
416 *shntxt_vbox_inner,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
417 // *shntxt_text,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
418 // *shntxt_table,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
419 // *shntxt_vscrollbar,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
420 *shntxt_filename_hbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
421 *shntxt_filename_entry,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
422 *shntxt_filename_label;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
423
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
424 shn_debug("Loading text file '%s'",filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
425
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
426 if ((shortfilename = strrchr(filename,'/')))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
427 shortfilename++;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
428 else
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
429 shortfilename = filename;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
430
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
431 shntxt_vbox = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
432
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
433 shn_snprintf(buffer,1024," %s ",shortfilename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
434
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
435 shntxt_frame = gtk_frame_new((gchar *)buffer);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
436 gtk_container_set_border_width(GTK_CONTAINER(shntxt_frame), 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
437 gtk_box_pack_start(GTK_BOX(shntxt_vbox), shntxt_frame, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
438
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
439 shntxt_vbox_inner = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
440 gtk_container_set_border_width(GTK_CONTAINER(shntxt_vbox_inner), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
441 gtk_container_add(GTK_CONTAINER(shntxt_frame), shntxt_vbox_inner);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
442
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
443 /* begin filename */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
444 shntxt_filename_hbox = gtk_hbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
445 gtk_box_pack_start(GTK_BOX(shntxt_vbox_inner), shntxt_filename_hbox, FALSE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
446
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
447 shntxt_filename_label = gtk_label_new((gchar *)"Filename:");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
448 gtk_box_pack_start(GTK_BOX(shntxt_filename_hbox), shntxt_filename_label, FALSE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
449 shntxt_filename_entry = gtk_entry_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
450 gtk_editable_set_editable(GTK_EDITABLE(shntxt_filename_entry), FALSE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
451 gtk_box_pack_start(GTK_BOX(shntxt_filename_hbox), shntxt_filename_entry, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
452
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
453 gtk_entry_set_text(GTK_ENTRY(shntxt_filename_entry), filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
454 gtk_editable_set_position(GTK_EDITABLE(shntxt_filename_entry), -1);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
455 /* end filename */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
456
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
457 #if 0
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
458 shntxt_text = gtk_text_new(NULL,NULL);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
459
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
460 shntxt_table = gtk_table_new(2,2,FALSE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
461 gtk_container_add(GTK_CONTAINER(shntxt_vbox_inner), shntxt_table);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
462
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
463 shntxt_vscrollbar = gtk_vscrollbar_new(GTK_TEXT(shntxt_text)->vadj);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
464
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
465 gtk_text_set_editable(GTK_TEXT(shntxt_text),FALSE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
466 gtk_text_set_word_wrap(GTK_TEXT(shntxt_text),TRUE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
467
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
468 gtk_table_attach(GTK_TABLE(shntxt_table),shntxt_text, 0, 1, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
469 gtk_table_attach(GTK_TABLE(shntxt_table),shntxt_vscrollbar, 1, 2, 0, 1, GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
470
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
471 gtk_widget_show(shntxt_vscrollbar);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
472 gtk_widget_show(shntxt_text);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
473 gtk_widget_show(shntxt_table);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
474 #endif
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
475 gtk_widget_show(shntxt_frame);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
476 gtk_widget_show(shntxt_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
477 gtk_widget_show(shntxt_vbox_inner);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
478 gtk_widget_show(shntxt_filename_hbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
479 gtk_widget_show(shntxt_filename_entry);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
480 gtk_widget_show(shntxt_filename_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
481
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
482 if ((f = fopen(filename,"rb")))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
483 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
484 nchars = fread(buffer,1,1024,f);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
485 while (nchars > 0)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
486 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
487 // gtk_text_insert(GTK_TEXT(shntxt_text),NULL,NULL,NULL,buffer,nchars);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
488 nchars = fread(buffer,1,1024,f);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
489 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
490 fclose(f);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
491 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
492 else
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
493 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
494 shn_snprintf(buffer,1024,"error loading file: '%s'",filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
495 // gtk_text_insert(GTK_TEXT(shntxt_text),NULL,NULL,NULL,buffer,strlen(buffer));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
496 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
497
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
498 shn_snprintf(buffer,1024,"Text file %d",num);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
499
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
500 gtk_notebook_append_page(GTK_NOTEBOOK(shntxt_notebook), shntxt_vbox, gtk_label_new((gchar *)buffer));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
501 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
502
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
503 void scan_for_textfiles(GtkWidget *this_notebook,char *dirname,int *filenum)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
504 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
505 char *ext,*textfile_exts,buffer[2048];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
506 gchar *exts;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
507 DIR *dp;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
508 struct dirent *entry;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
509
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
510 shn_debug("Searching for text files in directory '%s'",dirname);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
511
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
512 if (NULL == (dp = opendir(dirname)))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
513 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
514 shn_debug("Could not open directory '%s'",dirname);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
515 return;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
516 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
517
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
518 while ((entry = readdir(dp)))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
519 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
520 exts = g_strdup(shn_cfg.textfile_extensions);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
521
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
522 if ((ext = strrchr(entry->d_name,'.')))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
523 ext++;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
524 else
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
525 ext = "";
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
526
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
527 textfile_exts = strtok(exts,",");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
528 while (textfile_exts)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
529 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
530 if ((0 == strcmp(textfile_exts,ext)) || (0 == strcmp(textfile_exts,"")))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
531 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
532 shn_snprintf(buffer,2048,"%s/%s",dirname,entry->d_name);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
533
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
534 load_shntextfile(buffer,*filenum,this_notebook);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
535 *filenum = *filenum + 1;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
536 break;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
537 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
538
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
539 textfile_exts = strtok(NULL,",");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
540 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
541
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
542 g_free(exts);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
543 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
544
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
545 closedir(dp);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
546 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
547
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
548 void load_shntextfiles(GtkWidget *this_notebook,char *filename)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
549 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
550 #ifdef XMMS_SHN_LOAD_TEXTFILES
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
551 char *basedir,*uponedir;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
552 int filenum = 1;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
553
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
554 basedir = shn_get_base_directory(filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
555
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
556 if (NULL == (uponedir = malloc((strlen(basedir) + 5) * sizeof(char))))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
557 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
558 shn_debug("Could not allocate memory for search directories");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
559 return;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
560 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
561
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
562 shn_snprintf(uponedir,strlen(basedir) + 4,"%s/..",basedir);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
563
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
564 scan_for_textfiles(this_notebook,basedir,&filenum);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
565 scan_for_textfiles(this_notebook,uponedir,&filenum);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
566
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
567 free(basedir);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
568 free(uponedir);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
569 #else
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
570 shn_debug("Text file support is disabled on your platform because the\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
571 "appropriate functions were not found. Please email me with\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
572 "the specifics of your platform, and I will try to support it.");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
573 #endif
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
574 }
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
575
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
576
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
577 void shn_display_info(shn_file *tmp_file)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
578 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
579 char props[BUF_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
580 char details[BUF_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
581 char props_label[BUF_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
582 char details_label[BUF_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
583 char misalignment[8];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
584 char seektable_revision[8];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
585 char id3v2_info[32];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
586 GtkWidget *info_win,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
587 *info_notebook,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
588 *props_hbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
589 *props_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
590 *props_vbox_inner,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
591 *props_frame,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
592 *props_label_left,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
593 *props_label_right,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
594 *props_filename_hbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
595 *props_filename_label,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
596 *props_filename_entry,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
597 *details_hbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
598 *details_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
599 *details_vbox_inner,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
600 *details_frame,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
601 *details_label_left,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
602 *details_label_right,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
603 *details_filename_hbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
604 *details_filename_label,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
605 *details_filename_entry,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
606 *main_vbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
607 *info_bbox,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
608 *info_ok;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
609
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
610 shn_snprintf(props_label,BUF_SIZE," Properties for %s ",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
611 strrchr(tmp_file->wave_header.filename,'/') ?
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
612 strrchr(tmp_file->wave_header.filename,'/') + 1 :
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
613 tmp_file->wave_header.filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
614
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
615 shn_snprintf(details_label,BUF_SIZE," Details for %s ",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
616 strrchr(tmp_file->wave_header.filename,'/') ?
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
617 strrchr(tmp_file->wave_header.filename,'/') + 1 :
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
618 tmp_file->wave_header.filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
619
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
620 shn_snprintf(misalignment,8,"%d",tmp_file->wave_header.data_size % CD_BLOCK_SIZE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
621
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
622 if (NO_SEEK_TABLE != tmp_file->seek_header.version)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
623 shn_snprintf(seektable_revision,8,"%d",tmp_file->seek_header.version);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
624
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
625 shn_snprintf(id3v2_info,32,"yes (%ld bytes)",tmp_file->wave_header.id3v2_tag_size);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
626
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
627 shn_snprintf(props,BUF_SIZE,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
628 "%s\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
629 "%s\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
630 "%s\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
631 "%0.4f\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
632 "\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
633 "%s\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
634 "%s\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
635 "%s bytes\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
636 "%s\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
637 "\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
638 "%s\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
639 "%s\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
640 "\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
641 "%s",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
642 tmp_file->wave_header.m_ss,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
643 (tmp_file->vars.seek_table_entries == NO_SEEK_TABLE)?"no":"yes",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
644 (tmp_file->seek_header.version == NO_SEEK_TABLE)?"n/a":seektable_revision,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
645 (double)tmp_file->wave_header.actual_size/(double)tmp_file->wave_header.total_size,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
646 (PROB_NOT_CD(tmp_file->wave_header))?"no":"yes",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
647 (PROB_NOT_CD(tmp_file->wave_header))?"n/a":((PROB_BAD_BOUND(tmp_file->wave_header))?"no":"yes"),
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
648 (PROB_NOT_CD(tmp_file->wave_header))?"n/a":misalignment,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
649 (PROB_NOT_CD(tmp_file->wave_header))?"n/a":((PROB_TOO_SHORT(tmp_file->wave_header))?"no":"yes"),
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
650 (PROB_HDR_NOT_CANONICAL(tmp_file->wave_header))?"yes":"no",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
651 (PROB_EXTRA_CHUNKS(tmp_file->wave_header))?"yes":"no",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
652 (tmp_file->wave_header.file_has_id3v2_tag)?id3v2_info:"no"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
653 );
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
654
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
655 shn_snprintf(details,BUF_SIZE,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
656 "\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
657 "0x%04x (%s)\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
658 "%hu\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
659 "%hu\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
660 "%lu\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
661 "%lu\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
662 "%lu bytes/sec\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
663 "%hu\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
664 "%d bytes\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
665 "%lu bytes\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
666 "%lu bytes\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
667 "%lu bytes\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
668 "%lu bytes",
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
669 tmp_file->wave_header.wave_format,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
670 shn_format_to_str(tmp_file->wave_header.wave_format),
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
671 tmp_file->wave_header.channels,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
672 tmp_file->wave_header.bits_per_sample,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
673 tmp_file->wave_header.samples_per_sec,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
674 tmp_file->wave_header.avg_bytes_per_sec,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
675 tmp_file->wave_header.rate,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
676 tmp_file->wave_header.block_align,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
677 tmp_file->wave_header.header_size,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
678 tmp_file->wave_header.data_size,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
679 tmp_file->wave_header.chunk_size,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
680 tmp_file->wave_header.total_size,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
681 tmp_file->wave_header.actual_size
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
682 );
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
683
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
684 info_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
685 gtk_signal_connect(GTK_OBJECT(info_win), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &info_win);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
686 gtk_window_set_title(GTK_WINDOW(info_win), (gchar *)"Shorten file information");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
687 gtk_window_set_policy(GTK_WINDOW(info_win), FALSE, FALSE, FALSE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
688 gtk_container_border_width(GTK_CONTAINER(info_win), 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
689
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
690 main_vbox = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
691 gtk_container_add(GTK_CONTAINER(info_win), main_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
692
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
693 info_notebook = gtk_notebook_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
694 gtk_container_add(GTK_CONTAINER(main_vbox), info_notebook);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
695
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
696 /* begin properties page */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
697
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
698 props_vbox = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
699
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
700 props_frame = gtk_frame_new((gchar *)props_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
701 gtk_container_set_border_width(GTK_CONTAINER(props_frame), 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
702 gtk_box_pack_start(GTK_BOX(props_vbox), props_frame, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
703
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
704 props_vbox_inner = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
705 gtk_container_set_border_width(GTK_CONTAINER(props_vbox_inner), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
706 gtk_container_add(GTK_CONTAINER(props_frame), props_vbox_inner);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
707
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
708 /* begin filename */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
709 props_filename_hbox = gtk_hbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
710 gtk_box_pack_start(GTK_BOX(props_vbox_inner), props_filename_hbox, FALSE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
711
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
712 props_filename_label = gtk_label_new((gchar *)"Filename:");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
713 gtk_box_pack_start(GTK_BOX(props_filename_hbox), props_filename_label, FALSE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
714 props_filename_entry = gtk_entry_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
715 gtk_editable_set_editable(GTK_EDITABLE(props_filename_entry), FALSE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
716 gtk_box_pack_start(GTK_BOX(props_filename_hbox), props_filename_entry, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
717
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
718 gtk_entry_set_text(GTK_ENTRY(props_filename_entry), tmp_file->wave_header.filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
719 gtk_editable_set_position(GTK_EDITABLE(props_filename_entry), -1);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
720 /* end filename */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
721
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
722 props_hbox = gtk_hbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
723 gtk_box_pack_start(GTK_BOX(props_vbox_inner), props_hbox, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
724
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
725 props_label_left = gtk_label_new((gchar *)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
726 "Length:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
727 "Seekable:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
728 "Seek table revision:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
729 "Compression ratio:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
730 "CD-quality properties:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
731 " CD-quality:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
732 " Cut on sector boundary:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
733 " Sector misalignment:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
734 " Long enough to be burned:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
735 "WAVE properties:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
736 " Non-canonical header:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
737 " Extra RIFF chunks:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
738 "Possible problems:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
739 " File contains ID3v2 tag:"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
740 );
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
741
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
742 props_label_right = gtk_label_new((gchar *)props);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
743
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
744 gtk_misc_set_alignment(GTK_MISC(props_label_left), 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
745 gtk_label_set_justify(GTK_LABEL(props_label_left), GTK_JUSTIFY_LEFT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
746 gtk_box_pack_start(GTK_BOX(props_hbox), props_label_left, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
747 gtk_widget_show(props_label_left);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
748
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
749 gtk_misc_set_alignment(GTK_MISC(props_label_right), 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
750 gtk_label_set_justify(GTK_LABEL(props_label_right), GTK_JUSTIFY_LEFT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
751 gtk_box_pack_start(GTK_BOX(props_hbox), props_label_right, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
752 gtk_widget_show(props_label_right);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
753
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
754 /* end properties page */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
755
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
756 /* begin details page */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
757
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
758 details_vbox = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
759
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
760 details_frame = gtk_frame_new((gchar *)details_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
761 gtk_container_set_border_width(GTK_CONTAINER(details_frame), 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
762 gtk_box_pack_start(GTK_BOX(details_vbox), details_frame, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
763
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
764 details_vbox_inner = gtk_vbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
765 gtk_container_set_border_width(GTK_CONTAINER(details_vbox_inner), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
766 gtk_container_add(GTK_CONTAINER(details_frame), details_vbox_inner);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
767
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
768 /* begin filename */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
769 details_filename_hbox = gtk_hbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
770 gtk_box_pack_start(GTK_BOX(details_vbox_inner), details_filename_hbox, FALSE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
771
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
772 details_filename_label = gtk_label_new((gchar *)"Filename:");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
773 gtk_box_pack_start(GTK_BOX(details_filename_hbox), details_filename_label, FALSE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
774 details_filename_entry = gtk_entry_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
775 gtk_editable_set_editable(GTK_EDITABLE(details_filename_entry), FALSE);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
776 gtk_box_pack_start(GTK_BOX(details_filename_hbox), details_filename_entry, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
777
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
778 gtk_entry_set_text(GTK_ENTRY(details_filename_entry), tmp_file->wave_header.filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
779 gtk_editable_set_position(GTK_EDITABLE(details_filename_entry), -1);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
780 /* end filename */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
781
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
782 details_hbox = gtk_hbox_new(FALSE, 10);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
783 gtk_box_pack_start(GTK_BOX(details_vbox_inner), details_hbox, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
784
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
785 details_label_left = gtk_label_new((gchar *)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
786 "\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
787 "WAVE format:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
788 "Channels:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
789 "Bits per sample:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
790 "Samples per second:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
791 "Average bytes per second:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
792 "Rate (calculated):\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
793 "Block align:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
794 "Header size:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
795 "WAVE data size:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
796 "Chunk size:\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
797 "Total size (chunk size + 8):\n"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
798 "Actual file size:"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
799 );
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
800
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
801 details_label_right = gtk_label_new((gchar *)details);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
802
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
803 gtk_misc_set_alignment(GTK_MISC(details_label_left), 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
804 gtk_label_set_justify(GTK_LABEL(details_label_left), GTK_JUSTIFY_LEFT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
805 gtk_box_pack_start(GTK_BOX(details_hbox), details_label_left, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
806 gtk_widget_show(details_label_left);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
807
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
808 gtk_misc_set_alignment(GTK_MISC(details_label_right), 0, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
809 gtk_label_set_justify(GTK_LABEL(details_label_right), GTK_JUSTIFY_LEFT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
810 gtk_box_pack_start(GTK_BOX(details_hbox), details_label_right, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
811 gtk_widget_show(details_label_right);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
812
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
813 /* end details page */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
814
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
815 info_bbox = gtk_hbutton_box_new();
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
816 gtk_button_box_set_layout(GTK_BUTTON_BOX(info_bbox), GTK_BUTTONBOX_SPREAD);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
817 gtk_button_box_set_spacing(GTK_BUTTON_BOX(info_bbox), 5);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
818 gtk_box_pack_start(GTK_BOX(main_vbox), info_bbox, FALSE, FALSE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
819
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
820 info_ok = gtk_button_new_with_label((gchar *)"OK");
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
821 gtk_signal_connect_object(GTK_OBJECT(info_ok), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(info_win));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
822 GTK_WIDGET_SET_FLAGS(info_ok, GTK_CAN_DEFAULT);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
823 gtk_box_pack_start(GTK_BOX(info_bbox), info_ok, TRUE, TRUE, 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
824 gtk_widget_show(info_ok);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
825 gtk_widget_grab_default(info_ok);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
826
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
827 gtk_notebook_append_page(GTK_NOTEBOOK(info_notebook), props_vbox, gtk_label_new((gchar *)"Properties"));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
828 gtk_notebook_append_page(GTK_NOTEBOOK(info_notebook), details_vbox, gtk_label_new((gchar *)"Details"));
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
829
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
830 gtk_widget_show(props_frame);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
831 gtk_widget_show(props_hbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
832 gtk_widget_show(props_vbox_inner);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
833 gtk_widget_show(props_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
834 gtk_widget_show(props_filename_hbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
835 gtk_widget_show(props_filename_entry);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
836 gtk_widget_show(props_filename_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
837 gtk_widget_show(details_frame);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
838 gtk_widget_show(details_hbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
839 gtk_widget_show(details_vbox_inner);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
840 gtk_widget_show(details_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
841 gtk_widget_show(details_filename_hbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
842 gtk_widget_show(details_filename_entry);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
843 gtk_widget_show(details_filename_label);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
844
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
845 /* begin any text files pages */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
846
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
847 if (shn_cfg.load_textfiles)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
848 load_shntextfiles(info_notebook,tmp_file->wave_header.filename);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
849
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
850 /* end any text files pages */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
851
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
852 gtk_notebook_set_page(GTK_NOTEBOOK(info_notebook), 0);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
853
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
854 gtk_widget_show(info_notebook);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
855 gtk_widget_show(main_vbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
856 gtk_widget_show(info_bbox);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
857 gtk_widget_show(info_win);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
858 }
|