comparison src/xs_fileinfo.c @ 430:d787dae8c043

Bugfixes.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 01 Jan 2007 08:09:04 +0000
parents faf12767a6f1
children 1d55247ad0cc
comparison
equal deleted inserted replaced
429:a991d1fe7e94 430:d787dae8c043
133 133
134 /* Get subtune information */ 134 /* Get subtune information */
135 tmpItem = gtk_menu_get_active(GTK_MENU(data)); 135 tmpItem = gtk_menu_get_active(GTK_MENU(data));
136 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem); 136 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
137 137
138 if (xs_fileinfostil) 138 if (xs_fileinfostil && tmpIndex <= xs_fileinfostil->nsubTunes)
139 tmpNode = xs_fileinfostil->subTunes[tmpIndex]; 139 tmpNode = xs_fileinfostil->subTunes[tmpIndex];
140 else 140 else
141 tmpNode = NULL; 141 tmpNode = NULL;
142 142
143 if (tmpNode) { 143 if (tmpNode) {
164 164
165 void xs_fileinfo(gchar * pcFilename) 165 void xs_fileinfo(gchar * pcFilename)
166 { 166 {
167 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu; 167 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu;
168 t_xs_tuneinfo *tmpInfo; 168 t_xs_tuneinfo *tmpInfo;
169 t_xs_stil_subnode *tmpNode;
170 gint n; 169 gint n;
171 170
172 /* Current implementation leaves old fileinfo window untouched if 171 /* Current implementation leaves old fileinfo window untouched if
173 * no information can be found for the new file. Hmm... 172 * no information can be found for the new file. Hmm...
174 */ 173 */
221 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu); 220 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu);
222 221
223 /* Other menu items */ 222 /* Other menu items */
224 for (n = 1; n <= tmpInfo->nsubTunes; n++) { 223 for (n = 1; n <= tmpInfo->nsubTunes; n++) {
225 gchar tmpStr[64]; 224 gchar tmpStr[64];
226 if (xs_fileinfostil) { 225 if (xs_fileinfostil && n <= xs_fileinfostil->nsubTunes) {
226 t_xs_stil_subnode *tmpNode = xs_fileinfostil->subTunes[n];
227
227 g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i: "), n); 228 g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i: "), n);
228 229
229 tmpNode = xs_fileinfostil->subTunes[n]; 230 if (tmpNode) {
230 231 if (tmpNode->pName)
231 if (tmpNode && tmpNode->pName) 232 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName);
232 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName); 233 else if (tmpNode->pInfo)
233 else if (tmpNode && tmpNode->pInfo) 234 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo);
234 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo); 235 } else
235 else
236 xs_pnstrcat(tmpStr, sizeof(tmpStr), "---"); 236 xs_pnstrcat(tmpStr, sizeof(tmpStr), "---");
237 } else { 237 } else {
238 g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i"), n); 238 g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i"), n);
239 } 239 }
240 240