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