Mercurial > hg > xmms-sid
annotate src/xs_fileinfo.c @ 301:a2b4a19f564a
hmm.. LUW() was missing.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 25 Dec 2004 20:49:04 +0000 |
parents | 4279cc6a3412 |
children | dd201740a720 |
rev | line source |
---|---|
222 | 1 /* |
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) | |
3 | |
4 File information window | |
5 | |
6 Written by Matti "ccr" Hamalainen <ccr@tnsp.org> | |
7 | |
8 This program is free software; you can redistribute it and/or modify | |
9 it under the terms of the GNU General Public License as published by | |
10 the Free Software Foundation; either version 2 of the License, or | |
11 (at your option) any later version. | |
12 | |
13 This program is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with this program; if not, write to the Free Software | |
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
21 */ | |
22 #include <gdk/gdkkeysyms.h> | |
23 #include <gtk/gtk.h> | |
24 | |
290
b6bcd62394f3
Include correct headers, typecast returnvalue to gint
Matti Hamalainen <ccr@tnsp.org>
parents:
282
diff
changeset
|
25 #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
|
26 #include "xs_support.h" |
222 | 27 #include "xs_stil.h" |
28 #include "xs_config.h" | |
29 #include "xs_interface.h" | |
30 #include "xs_glade.h" | |
31 | |
32 static GtkWidget *xs_fileinfowin = NULL; | |
230 | 33 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
|
34 XS_MUTEX(xs_fileinfowin); |
222 | 35 |
296
4279cc6a3412
No need for variadic macros here.
Matti Hamalainen <ccr@tnsp.org>
parents:
290
diff
changeset
|
36 #define LUW(x) lookup_widget(xs_fileinfowin, x) |
222 | 37 |
38 | |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
39 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
|
40 { |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
41 gboolean isEnabled; |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
42 GtkAdjustment *tmpAdj; |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
43 |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
44 XS_MUTEX_LOCK(xs_status); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
45 XS_MUTEX_LOCK(xs_fileinfowin); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
46 |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
47 /* Check if control window exists, we are currently playing and have a tune */ |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
48 if (xs_fileinfowin) |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
49 { |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
50 if (xs_status.tuneInfo && xs_status.isPlaying && (xs_status.tuneInfo->nsubTunes > 1)) |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
51 { |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
52 tmpAdj = gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj"))); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
53 |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
54 tmpAdj->value = xs_status.currSong; |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
55 tmpAdj->lower = 1; |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
56 tmpAdj->upper = xs_status.tuneInfo->nsubTunes; |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
57 XS_MUTEX_UNLOCK(xs_status); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
58 XS_MUTEX_UNLOCK(xs_fileinfowin); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
59 gtk_adjustment_value_changed(tmpAdj); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
60 XS_MUTEX_LOCK(xs_status); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
61 XS_MUTEX_LOCK(xs_fileinfowin); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
62 isEnabled = TRUE; |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
63 } else |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
64 isEnabled = FALSE; |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
65 |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
66 /* Enable or disable subtune-control in fileinfo window */ |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
67 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_prev"), isEnabled); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
68 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_adj"), isEnabled); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
69 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_next"), isEnabled); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
70 } |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
71 |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
72 XS_MUTEX_UNLOCK(xs_status); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
73 XS_MUTEX_UNLOCK(xs_fileinfowin); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
74 } |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
75 |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
76 |
230 | 77 void xs_fileinfo_setsong(void) |
78 { | |
234
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
79 gint n; |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
80 |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
81 XS_MUTEX_LOCK(xs_status); |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
82 XS_MUTEX_LOCK(xs_fileinfowin); |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
83 |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
84 if (xs_status.tuneInfo && xs_status.isPlaying) |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
85 { |
301 | 86 n = (gint) gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))->value; |
234
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
87 if ((n >= 1) && (n <= xs_status.tuneInfo->nsubTunes)) |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
88 xs_status.currSong = n; |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
89 } |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
90 |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
91 XS_MUTEX_UNLOCK(xs_fileinfowin); |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
92 XS_MUTEX_UNLOCK(xs_status); |
230 | 93 } |
94 | |
95 | |
222 | 96 void xs_fileinfo_ok(void) |
97 { | |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
98 XS_MUTEX_LOCK(xs_fileinfowin); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
99 if (xs_fileinfowin) |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
100 { |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
101 gtk_widget_destroy(xs_fileinfowin); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
102 xs_fileinfowin = NULL; |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
103 } |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
104 XS_MUTEX_UNLOCK(xs_fileinfowin); |
222 | 105 } |
106 | |
107 | |
282
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
108 gboolean xs_fileinfo_delete(GtkWidget *widget, GdkEvent *event, gpointer user_data) |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
109 { |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
110 XSDEBUG("delete_event\n"); |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
111 xs_fileinfo_ok(); |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
112 return FALSE; |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
113 } |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
114 |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
115 |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
116 |
222 | 117 void xs_fileinfo_subtune(GtkWidget *widget, void *data) |
118 { | |
119 t_xs_stil_subnode *tmpNode; | |
120 GtkWidget *tmpItem, *tmpText; | |
121 gint tmpIndex; | |
122 gchar *subName, *subAuthor; | |
123 | |
124 /* Freeze text-widget and delete the old text */ | |
125 tmpText = LUW("fileinfo_sub_info"); | |
126 gtk_text_freeze(GTK_TEXT(tmpText)); | |
127 gtk_text_set_point(GTK_TEXT(tmpText), 0); | |
128 gtk_text_forward_delete(GTK_TEXT(tmpText), | |
129 gtk_text_get_length(GTK_TEXT(tmpText))); | |
130 | |
131 if (xs_fileinfostil) | |
132 { | |
133 /* Get subtune number */ | |
134 tmpItem = gtk_menu_get_active(GTK_MENU(data)); | |
135 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem); | |
136 | |
137 /* Get subtune information */ | |
138 tmpNode = &xs_fileinfostil->subTune[tmpIndex]; | |
139 subName = tmpNode->pName; | |
140 subAuthor = tmpNode->pAuthor; | |
141 | |
142 /* Put in the new text, if available */ | |
143 if (tmpNode->pInfo) | |
144 { | |
145 gtk_text_insert (GTK_TEXT (tmpText), NULL, NULL, NULL, | |
146 tmpNode->pInfo, strlen(tmpNode->pInfo)); | |
147 } | |
148 } else { | |
149 /* We don't have any information */ | |
150 subName = NULL; | |
151 subAuthor = NULL; | |
152 } | |
153 | |
154 /* Get and set subtune information */ | |
155 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? subName : ""); | |
156 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : ""); | |
157 | |
158 /* Un-freeze the widget */ | |
159 gtk_text_thaw(GTK_TEXT(tmpText)); | |
160 } | |
161 | |
162 | |
163 void xs_fileinfo(gchar *pcFilename) | |
164 { | |
165 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu; | |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
166 t_xs_tuneinfo *tmpInfo; |
222 | 167 t_xs_stil_subnode *tmpNode; |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
168 gchar tmpStr[64]; |
222 | 169 gint n; |
170 | |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
171 /* Current implementation leaves old fileinfo window untouched if |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
172 * no information can be found for the new file. Hmm... |
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 |
222 | 175 /* Get new tune information */ |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
176 XS_MUTEX_LOCK(xs_fileinfowin); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
177 XS_MUTEX_LOCK(xs_status); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
178 if ((tmpInfo = xs_status.sidPlayer->plrGetSIDInfo(pcFilename)) == NULL) |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
179 { |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
180 XS_MUTEX_UNLOCK(xs_fileinfowin); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
181 XS_MUTEX_UNLOCK(xs_status); |
222 | 182 return; |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
183 } |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
184 XS_MUTEX_UNLOCK(xs_status); |
222 | 185 |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
186 xs_fileinfostil = xs_stil_get(pcFilename); |
222 | 187 |
188 /* Check if there already is an open fileinfo window */ | |
189 if (xs_fileinfowin) | |
190 { | |
191 /* Raise old window */ | |
192 gdk_window_raise(xs_fileinfowin->window); | |
193 | |
194 /* Delete items */ | |
195 tmpOptionMenu = LUW("fileinfo_sub_tune"); | |
196 gtk_widget_destroy(GTK_OPTION_MENU(tmpOptionMenu)->menu); | |
197 GTK_OPTION_MENU(tmpOptionMenu)->menu = gtk_menu_new(); | |
198 } else { | |
199 /* If not, create a new one */ | |
200 xs_fileinfowin = create_xs_fileinfowin(); | |
201 | |
202 /* Connect additional signals */ | |
203 gtk_signal_connect(GTK_OBJECT( | |
204 gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))), | |
205 "value_changed", GTK_SIGNAL_FUNC (xs_fileinfo_setsong), NULL); | |
206 } | |
207 | |
208 | |
209 /* Set the generic song information */ | |
210 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_filename")), pcFilename); | |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
211 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_songname")), tmpInfo->sidName); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
212 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), tmpInfo->sidComposer); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
213 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), tmpInfo->sidCopyright); |
222 | 214 |
215 | |
216 /* Main tune - the pseudo tune */ | |
217 tmpOptionMenu = LUW("fileinfo_sub_tune"); | |
218 tmpMenu = GTK_OPTION_MENU(tmpOptionMenu)->menu; | |
219 | |
220 tmpMenuItem = gtk_menu_item_new_with_label ("General info"); | |
221 gtk_widget_show (tmpMenuItem); | |
222 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); | |
223 gtk_signal_connect (GTK_OBJECT (tmpMenuItem), "activate", | |
224 GTK_SIGNAL_FUNC (xs_fileinfo_subtune), tmpMenu); | |
225 | |
226 /* Other menu items */ | |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
227 for (n = 1; n <= tmpInfo->nsubTunes; n++) |
222 | 228 { |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
229 |
222 | 230 if (xs_fileinfostil) |
231 { | |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
232 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: ", n); |
222 | 233 tmpNode = &xs_fileinfostil->subTune[n]; |
234 if (tmpNode->pName) | |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
235 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName); |
222 | 236 else |
237 if (tmpNode->pInfo) | |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
238 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo); |
222 | 239 else |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
240 xs_pnstrcat(tmpStr, sizeof(tmpStr), "---"); |
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
241 } else { |
222 | 242 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
|
243 } |
222 | 244 |
245 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr); | |
246 gtk_widget_show (tmpMenuItem); | |
247 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); | |
248 | |
249 gtk_signal_connect (GTK_OBJECT(tmpMenuItem), "activate", | |
250 GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu); | |
251 } | |
252 | |
253 /* Set the subtune information */ | |
254 xs_fileinfo_subtune(NULL, tmpMenu); | |
255 | |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
256 /* Free temporary tuneinfo */ |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
257 xs_tuneinfo_free(tmpInfo); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
258 |
222 | 259 /* Show the window */ |
260 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
|
261 |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
262 XS_MUTEX_UNLOCK(xs_fileinfowin); |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
263 |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
264 xs_fileinfo_update(); |
222 | 265 } |
266 |