annotate src/xs_fileinfo.c @ 473:f1a997715ef5

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Jan 2007 07:21:05 +0000
parents 1d55247ad0cc
children 1775b3f16cd9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 File information window
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
324
dd201740a720 Changed copyright text.
Matti Hamalainen <ccr@tnsp.org>
parents: 301
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
422
d2e6682d3ef8 Copyright year update
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP)
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 (at your option) any later version.
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 GNU General Public License for more details.
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
412
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 399
diff changeset
19 You should have received a copy of the GNU General Public License along
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 399
diff changeset
20 with this program; if not, write to the Free Software Foundation, Inc.,
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 399
diff changeset
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #include <gdk/gdkkeysyms.h>
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 #include <gtk/gtk.h>
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25
290
b6bcd62394f3 Include correct headers, typecast returnvalue to gint
Matti Hamalainen <ccr@tnsp.org>
parents: 282
diff changeset
26 #include "xs_fileinfo.h"
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
27 #include "xs_support.h"
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 #include "xs_stil.h"
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 #include "xs_config.h"
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 #include "xs_interface.h"
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #include "xs_glade.h"
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32
462
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
33
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
34 static t_xs_stildb *xs_stildb_db = NULL;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
35 XS_MUTEX(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
36
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
37 static GtkWidget *xs_fileinfowin = NULL;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
38 static t_xs_stil_node *xs_fileinfostil = NULL;
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
39 XS_MUTEX(xs_fileinfowin);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
296
4279cc6a3412 No need for variadic macros here.
Matti Hamalainen <ccr@tnsp.org>
parents: 290
diff changeset
41 #define LUW(x) lookup_widget(xs_fileinfowin, x)
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43
462
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
44 /* STIL-database handling
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
45 */
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
46 gint xs_stil_init(void)
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
47 {
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
48 XS_MUTEX_LOCK(xs_cfg);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
49
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
50 if (!xs_cfg.stilDBPath) {
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
51 XS_MUTEX_UNLOCK(xs_cfg);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
52 return -1;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
53 }
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
54
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
55 XS_MUTEX_LOCK(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
56
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
57 /* Check if already initialized */
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
58 if (xs_stildb_db)
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
59 xs_stildb_free(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
60
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
61 /* Allocate database */
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
62 xs_stildb_db = (t_xs_stildb *) g_malloc0(sizeof(t_xs_stildb));
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
63 if (!xs_stildb_db) {
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
64 XS_MUTEX_UNLOCK(xs_cfg);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
65 XS_MUTEX_UNLOCK(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
66 return -2;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
67 }
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
68
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
69 /* Read the database */
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
70 if (xs_stildb_read(xs_stildb_db, xs_cfg.stilDBPath) != 0) {
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
71 xs_stildb_free(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
72 xs_stildb_db = NULL;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
73 XS_MUTEX_UNLOCK(xs_cfg);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
74 XS_MUTEX_UNLOCK(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
75 return -3;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
76 }
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
77
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
78 /* Create index */
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
79 if (xs_stildb_index(xs_stildb_db) != 0) {
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
80 xs_stildb_free(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
81 xs_stildb_db = NULL;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
82 XS_MUTEX_UNLOCK(xs_cfg);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
83 XS_MUTEX_UNLOCK(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
84 return -4;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
85 }
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
86
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
87 XS_MUTEX_UNLOCK(xs_cfg);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
88 XS_MUTEX_UNLOCK(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
89 return 0;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
90 }
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
91
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
92
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
93 void xs_stil_close(void)
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
94 {
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
95 XS_MUTEX_LOCK(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
96 xs_stildb_free(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
97 xs_stildb_db = NULL;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
98 XS_MUTEX_UNLOCK(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
99 }
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
100
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
101
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
102 t_xs_stil_node *xs_stil_get(gchar *pcFilename)
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
103 {
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
104 t_xs_stil_node *pResult;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
105 gchar *tmpFilename;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
106
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
107 XS_MUTEX_LOCK(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
108 XS_MUTEX_LOCK(xs_cfg);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
109
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
110 if (xs_cfg.stilDBEnable && xs_stildb_db) {
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
111 if (xs_cfg.hvscPath) {
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
112 /* Remove postfixed directory separator from HVSC-path */
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
113 tmpFilename = xs_strrchr(xs_cfg.hvscPath, '/');
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
114 if (tmpFilename && (tmpFilename[1] == 0))
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
115 tmpFilename[0] = 0;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
116
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
117 /* Remove HVSC location-prefix from filename */
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
118 tmpFilename = strstr(pcFilename, xs_cfg.hvscPath);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
119 if (tmpFilename)
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
120 tmpFilename += strlen(xs_cfg.hvscPath);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
121 else
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
122 tmpFilename = pcFilename;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
123 } else
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
124 tmpFilename = pcFilename;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
125
473
f1a997715ef5 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
126 XSDEBUG("xs_stil_get('%s') = '%s'\n", pcFilename, tmpFilename);
462
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
127
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
128 pResult = xs_stildb_get_node(xs_stildb_db, tmpFilename);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
129 } else
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
130 pResult = NULL;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
131
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
132 XS_MUTEX_UNLOCK(xs_stildb_db);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
133 XS_MUTEX_UNLOCK(xs_cfg);
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
134
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
135 return pResult;
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
136 }
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
137
1d55247ad0cc Moved again. :D
Matti Hamalainen <ccr@tnsp.org>
parents: 430
diff changeset
138
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
139 void xs_fileinfo_update(void)
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
140 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
141 gboolean isEnabled;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
142 GtkAdjustment *tmpAdj;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
143
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
144 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
145 XS_MUTEX_LOCK(xs_fileinfowin);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
146
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
147 /* Check if control window exists, we are currently playing and have a tune */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
148 if (xs_fileinfowin) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
149 if (xs_status.tuneInfo && xs_status.isPlaying && (xs_status.tuneInfo->nsubTunes > 1)) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
150 tmpAdj = gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")));
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
151
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
152 tmpAdj->value = xs_status.currSong;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
153 tmpAdj->lower = 1;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
154 tmpAdj->upper = xs_status.tuneInfo->nsubTunes;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
155 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
156 XS_MUTEX_UNLOCK(xs_fileinfowin);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
157 gtk_adjustment_value_changed(tmpAdj);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
158 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
159 XS_MUTEX_LOCK(xs_fileinfowin);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
160 isEnabled = TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
161 } else
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
162 isEnabled = FALSE;
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
163
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
164 /* Enable or disable subtune-control in fileinfo window */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
165 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_prev"), isEnabled);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
166 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_adj"), isEnabled);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
167 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_next"), isEnabled);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
168 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
169
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
170 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
171 XS_MUTEX_UNLOCK(xs_fileinfowin);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
172 }
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
173
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
174
424
faf12767a6f1 Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
175 static void xs_fileinfo_setsong(void)
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 222
diff changeset
176 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
177 gint n;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
178
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
179 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
180 XS_MUTEX_LOCK(xs_fileinfowin);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
181
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
182 if (xs_status.tuneInfo && xs_status.isPlaying) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
183 n = (gint) gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))->value;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
184 if ((n >= 1) && (n <= xs_status.tuneInfo->nsubTunes))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
185 xs_status.currSong = n;
234
6f9764fbd693 Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
186 }
6f9764fbd693 Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
187
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
188 XS_MUTEX_UNLOCK(xs_fileinfowin);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
189 XS_MUTEX_UNLOCK(xs_status);
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 222
diff changeset
190 }
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 222
diff changeset
191
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 222
diff changeset
192
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193 void xs_fileinfo_ok(void)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
195 XS_MUTEX_LOCK(xs_fileinfowin);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
196 if (xs_fileinfowin) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
197 gtk_widget_destroy(xs_fileinfowin);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
198 xs_fileinfowin = NULL;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
199 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
200 XS_MUTEX_UNLOCK(xs_fileinfowin);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
204 gboolean xs_fileinfo_delete(GtkWidget * widget, GdkEvent * event, gpointer user_data)
282
0d2d379a83c0 Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
205 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
206 (void) widget;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
207 (void) event;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
208 (void) user_data;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
209
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
210 XSDEBUG("delete_event\n");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
211 xs_fileinfo_ok();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
212 return FALSE;
282
0d2d379a83c0 Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
213 }
0d2d379a83c0 Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
214
0d2d379a83c0 Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
215
0d2d379a83c0 Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
216
424
faf12767a6f1 Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
217 static void xs_fileinfo_subtune(GtkWidget * widget, void *data)
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
219 t_xs_stil_subnode *tmpNode;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
220 GtkWidget *tmpItem, *tmpText;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
221 gint tmpIndex;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
222 gchar *subName, *subAuthor;
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
224 (void) widget;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
225 (void) data;
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
227 /* Freeze text-widget and delete the old text */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
228 tmpText = LUW("fileinfo_sub_info");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
229 gtk_text_freeze(GTK_TEXT(tmpText));
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
230 gtk_text_set_point(GTK_TEXT(tmpText), 0);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
231 gtk_text_forward_delete(GTK_TEXT(tmpText), gtk_text_get_length(GTK_TEXT(tmpText)));
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
233 /* Get subtune information */
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
234 tmpItem = gtk_menu_get_active(GTK_MENU(data));
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
235 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236
430
d787dae8c043 Bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 424
diff changeset
237 if (xs_fileinfostil && tmpIndex <= xs_fileinfostil->nsubTunes)
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
238 tmpNode = xs_fileinfostil->subTunes[tmpIndex];
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
239 else
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
240 tmpNode = NULL;
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
241
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
242 if (tmpNode) {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
243 subName = tmpNode->pName;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
244 subAuthor = tmpNode->pAuthor;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
245
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
246 if (tmpNode->pInfo) {
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
247 gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL,
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
248 tmpNode->pInfo, strlen(tmpNode->pInfo));
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 } else {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
251 subName = NULL;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
252 subAuthor = NULL;
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
255 /* Get and set subtune information */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
256 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? subName : "");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
257 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : "");
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
259 /* Un-freeze the widget */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
260 gtk_text_thaw(GTK_TEXT(tmpText));
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
264 void xs_fileinfo(gchar * pcFilename)
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
266 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
267 t_xs_tuneinfo *tmpInfo;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
268 gint n;
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
270 /* Current implementation leaves old fileinfo window untouched if
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
271 * no information can be found for the new file. Hmm...
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
272 */
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
273
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
274 /* Get new tune information */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
275 XS_MUTEX_LOCK(xs_fileinfowin);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
276 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
277 if ((tmpInfo = xs_status.sidPlayer->plrGetSIDInfo(pcFilename)) == NULL) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
278 XS_MUTEX_UNLOCK(xs_fileinfowin);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
279 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
280 return;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
281 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
282 XS_MUTEX_UNLOCK(xs_status);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
284 xs_fileinfostil = xs_stil_get(pcFilename);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
286 /* Check if there already is an open fileinfo window */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
287 if (xs_fileinfowin) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
288 /* Raise old window */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
289 gdk_window_raise(xs_fileinfowin->window);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
291 /* Delete items */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
292 tmpOptionMenu = LUW("fileinfo_sub_tune");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
293 gtk_widget_destroy(GTK_OPTION_MENU(tmpOptionMenu)->menu);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
294 GTK_OPTION_MENU(tmpOptionMenu)->menu = gtk_menu_new();
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 } else {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
296 /* If not, create a new one */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
297 xs_fileinfowin = create_xs_fileinfowin();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
298
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
299 /* Connect additional signals */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
300 gtk_signal_connect(GTK_OBJECT(gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))),
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
301 "value_changed", GTK_SIGNAL_FUNC(xs_fileinfo_setsong), NULL);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
305 /* Set the generic song information */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
306 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_filename")), pcFilename);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
307 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_songname")), tmpInfo->sidName);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
308 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), tmpInfo->sidComposer);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
309 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), tmpInfo->sidCopyright);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
312 /* Main tune - the pseudo tune */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
313 tmpOptionMenu = LUW("fileinfo_sub_tune");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
314 tmpMenu = GTK_OPTION_MENU(tmpOptionMenu)->menu;
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315
424
faf12767a6f1 Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
316 tmpMenuItem = gtk_menu_item_new_with_label(_("General info"));
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
317 gtk_widget_show(tmpMenuItem);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
318 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
319 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
321 /* Other menu items */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
322 for (n = 1; n <= tmpInfo->nsubTunes; n++) {
424
faf12767a6f1 Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
323 gchar tmpStr[64];
473
f1a997715ef5 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
324 if (xs_fileinfostil && n <= xs_fileinfostil->nsubTunes && xs_fileinfostil->subTunes[n]) {
430
d787dae8c043 Bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 424
diff changeset
325 t_xs_stil_subnode *tmpNode = xs_fileinfostil->subTunes[n];
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
326
430
d787dae8c043 Bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 424
diff changeset
327 g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i: "), n);
d787dae8c043 Bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 424
diff changeset
328
473
f1a997715ef5 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
329 if (tmpNode->pName)
f1a997715ef5 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
330 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName);
f1a997715ef5 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
331 else if (tmpNode->pTitle)
f1a997715ef5 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
332 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pTitle);
f1a997715ef5 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
333 else if (tmpNode->pInfo)
f1a997715ef5 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
334 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo);
f1a997715ef5 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
335 else
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
336 xs_pnstrcat(tmpStr, sizeof(tmpStr), "---");
239
7833df935239 Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents: 234
diff changeset
337 } else {
424
faf12767a6f1 Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
338 g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i"), n);
239
7833df935239 Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents: 234
diff changeset
339 }
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
340
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
341 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
342 gtk_widget_show(tmpMenuItem);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
343 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
345 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
348 /* Set the subtune information */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
349 xs_fileinfo_subtune(NULL, tmpMenu);
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
351 /* Free temporary tuneinfo */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
352 xs_tuneinfo_free(tmpInfo);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
353
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
354 /* Show the window */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
355 gtk_widget_show(xs_fileinfowin);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
356
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
357 XS_MUTEX_UNLOCK(xs_fileinfowin);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
358
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
359 xs_fileinfo_update();
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 }