Mercurial > hg > xmms-sid
diff 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 |
line wrap: on
line diff
--- a/src/xs_fileinfo.c Tue May 30 04:50:04 2006 +0000 +++ b/src/xs_fileinfo.c Wed May 31 10:02:00 2006 +0000 @@ -131,22 +131,24 @@ gtk_text_set_point(GTK_TEXT(tmpText), 0); gtk_text_forward_delete(GTK_TEXT(tmpText), gtk_text_get_length(GTK_TEXT(tmpText))); - if (xs_fileinfostil) { - /* Get subtune number */ - tmpItem = gtk_menu_get_active(GTK_MENU(data)); - tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem); + /* Get subtune information */ + tmpItem = gtk_menu_get_active(GTK_MENU(data)); + tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem); - /* Get subtune information */ - tmpNode = &xs_fileinfostil->subTunes[tmpIndex]; + if (xs_fileinfostil) + tmpNode = xs_fileinfostil->subTunes[tmpIndex]; + else + tmpNode = NULL; + + if (tmpNode) { subName = tmpNode->pName; subAuthor = tmpNode->pAuthor; - /* Put in the new text, if available */ if (tmpNode->pInfo) { - gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL, tmpNode->pInfo, strlen(tmpNode->pInfo)); + gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL, + tmpNode->pInfo, strlen(tmpNode->pInfo)); } } else { - /* We don't have any information */ subName = NULL; subAuthor = NULL; } @@ -223,10 +225,12 @@ for (n = 1; n <= tmpInfo->nsubTunes; n++) { if (xs_fileinfostil) { snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: ", n); - tmpNode = &xs_fileinfostil->subTunes[n]; - if (tmpNode->pName) + + tmpNode = xs_fileinfostil->subTunes[n]; + + if (tmpNode && tmpNode->pName) xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName); - else if (tmpNode->pInfo) + else if (tmpNode && tmpNode->pInfo) xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo); else xs_pnstrcat(tmpStr, sizeof(tmpStr), "---");