comparison src/xs_fileinfo.c @ 392:b09d74eb71e6

Working on getting STIL and SLDB using completely dynamically allocated structures. Indentation cleanups, etc.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 31 May 2006 10:02:00 +0000
parents b1a858b8cb1a
children e25d23b07cd2
comparison
equal deleted inserted replaced
391:3cc7455360ad 392:b09d74eb71e6
129 tmpText = LUW("fileinfo_sub_info"); 129 tmpText = LUW("fileinfo_sub_info");
130 gtk_text_freeze(GTK_TEXT(tmpText)); 130 gtk_text_freeze(GTK_TEXT(tmpText));
131 gtk_text_set_point(GTK_TEXT(tmpText), 0); 131 gtk_text_set_point(GTK_TEXT(tmpText), 0);
132 gtk_text_forward_delete(GTK_TEXT(tmpText), gtk_text_get_length(GTK_TEXT(tmpText))); 132 gtk_text_forward_delete(GTK_TEXT(tmpText), gtk_text_get_length(GTK_TEXT(tmpText)));
133 133
134 if (xs_fileinfostil) { 134 /* Get subtune information */
135 /* Get subtune number */ 135 tmpItem = gtk_menu_get_active(GTK_MENU(data));
136 tmpItem = gtk_menu_get_active(GTK_MENU(data)); 136 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
137 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem); 137
138 138 if (xs_fileinfostil)
139 /* Get subtune information */ 139 tmpNode = xs_fileinfostil->subTunes[tmpIndex];
140 tmpNode = &xs_fileinfostil->subTunes[tmpIndex]; 140 else
141 tmpNode = NULL;
142
143 if (tmpNode) {
141 subName = tmpNode->pName; 144 subName = tmpNode->pName;
142 subAuthor = tmpNode->pAuthor; 145 subAuthor = tmpNode->pAuthor;
143 146
144 /* Put in the new text, if available */
145 if (tmpNode->pInfo) { 147 if (tmpNode->pInfo) {
146 gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL, tmpNode->pInfo, strlen(tmpNode->pInfo)); 148 gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL,
149 tmpNode->pInfo, strlen(tmpNode->pInfo));
147 } 150 }
148 } else { 151 } else {
149 /* We don't have any information */
150 subName = NULL; 152 subName = NULL;
151 subAuthor = NULL; 153 subAuthor = NULL;
152 } 154 }
153 155
154 /* Get and set subtune information */ 156 /* Get and set subtune information */
221 223
222 /* Other menu items */ 224 /* Other menu items */
223 for (n = 1; n <= tmpInfo->nsubTunes; n++) { 225 for (n = 1; n <= tmpInfo->nsubTunes; n++) {
224 if (xs_fileinfostil) { 226 if (xs_fileinfostil) {
225 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: ", n); 227 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: ", n);
226 tmpNode = &xs_fileinfostil->subTunes[n]; 228
227 if (tmpNode->pName) 229 tmpNode = xs_fileinfostil->subTunes[n];
230
231 if (tmpNode && tmpNode->pName)
228 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName); 232 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName);
229 else if (tmpNode->pInfo) 233 else if (tmpNode && tmpNode->pInfo)
230 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo); 234 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo);
231 else 235 else
232 xs_pnstrcat(tmpStr, sizeof(tmpStr), "---"); 236 xs_pnstrcat(tmpStr, sizeof(tmpStr), "---");
233 } else { 237 } else {
234 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n); 238 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n);