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