Mercurial > hg > xmms-sid
comparison src/xs_fileinfo.c @ 239:7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 21 Dec 2004 15:03:05 +0000 |
parents | 6f9764fbd693 |
children | 0d2d379a83c0 |
comparison
equal
deleted
inserted
replaced
238:5a390af358fc | 239:7833df935239 |
---|---|
154 void xs_fileinfo(gchar *pcFilename) | 154 void xs_fileinfo(gchar *pcFilename) |
155 { | 155 { |
156 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu; | 156 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu; |
157 t_xs_tuneinfo *tmpInfo; | 157 t_xs_tuneinfo *tmpInfo; |
158 t_xs_stil_subnode *tmpNode; | 158 t_xs_stil_subnode *tmpNode; |
159 gchar tmpStr[32], *tmpS; | 159 gchar tmpStr[64]; |
160 gint n; | 160 gint n; |
161 | 161 |
162 /* Current implementation leaves old fileinfo window untouched if | 162 /* Current implementation leaves old fileinfo window untouched if |
163 * no information can be found for the new file. Hmm... | 163 * no information can be found for the new file. Hmm... |
164 */ | 164 */ |
215 GTK_SIGNAL_FUNC (xs_fileinfo_subtune), tmpMenu); | 215 GTK_SIGNAL_FUNC (xs_fileinfo_subtune), tmpMenu); |
216 | 216 |
217 /* Other menu items */ | 217 /* Other menu items */ |
218 for (n = 1; n <= tmpInfo->nsubTunes; n++) | 218 for (n = 1; n <= tmpInfo->nsubTunes; n++) |
219 { | 219 { |
220 | |
220 if (xs_fileinfostil) | 221 if (xs_fileinfostil) |
221 { | 222 { |
223 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: ", n); | |
222 tmpNode = &xs_fileinfostil->subTune[n]; | 224 tmpNode = &xs_fileinfostil->subTune[n]; |
223 if (tmpNode->pName) | 225 if (tmpNode->pName) |
224 tmpS = tmpNode->pName; | 226 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName); |
225 else | 227 else |
226 if (tmpNode->pInfo) | 228 if (tmpNode->pInfo) |
227 tmpS = tmpNode->pInfo; | 229 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo); |
228 else | 230 else |
229 tmpS = "---"; | 231 xs_pnstrcat(tmpStr, sizeof(tmpStr), "---"); |
230 | 232 } else { |
231 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: %s", n, tmpS); | |
232 } else | |
233 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n); | 233 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n); |
234 } | |
234 | 235 |
235 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr); | 236 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr); |
236 gtk_widget_show (tmpMenuItem); | 237 gtk_widget_show (tmpMenuItem); |
237 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); | 238 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); |
238 | 239 |