Ask the user to specify a position to seek the current song to. Definition at line 361 of file gui_input.c. 00362 { 00363 char *str, *t; 00364 int total = 0, split = 0, digit = 0, value, relative = 0; 00365 00366 str = gui_input_askstring(_("Jump to position"), curseek, 00367 gui_input_cursong_seek_validator); 00368 if (str == NULL) 00369 return; 00370 00371 for (t = str; *t != '\0'; t++) { 00372 switch (*t) { 00373 case ':': 00374 /* 00375 * Only allow two :'s, not without a prepending 00376 * digit. :'s must be interleaved with two 00377 * digits. 00378 */ 00379 g_assert(split <= 1 && digit != 0); 00380 g_assert(split == 0 || digit == 2); 00381 split++; 00382 digit = 0; 00383 break; 00384 case '+': 00385 /* Must be at the beginning */ 00386 g_assert(t == str); 00387 relative = 1; 00388 break; 00389 case '-': 00390 /* Must be at the beginning */ 00391 g_assert(t == str); 00392 relative = -1; 00393 break; 00394 default: 00395 /* Regular digit */ 00396 value = g_ascii_digit_value(*t); 00397 g_assert(value != -1); 00398 g_assert(split == 0 || digit != 0 || value <= 5); 00399 00400 total *= (digit == 0) ? 6 : 10; 00401 total += value; 00402 digit++; 00403 } 00404 } 00405 00406 /* Not enough trailing digits */ 00407 if (split > 0 && digit != 2) 00408 goto bad; 00409 00410 if (relative != 0) { 00411 total *= relative; 00412 if (total == 0) 00413 goto bad; 00414 } 00415 playq_cursong_seek(total, relative); 00416 00417 /* Show the string the next time as well */ 00418 g_free(curseek); 00419 curseek = str; 00420 return; 00421 00422 bad: gui_msgbar_warn(_("Bad time format.")); 00423 g_free(str); 00424 }
Here is the call graph for this function:
![]() |
1.6.3