Functions | |
void | emphasis_player_info_set (Emphasis_Player_Gui *player, Emphasis_Song *song, char *msg) |
Set the message in th textblock. | |
void | emphasis_player_progress_set (Emphasis_Player_Gui *player, float elapsed_time, int total_time) |
Set the progress bar to elapsed_time/total_time. | |
void | emphasis_player_toggle_play (Emphasis_Player_Gui *player) |
Set the image of btn_play to play if mpd is playing or to pause if mpd is stopped. | |
void | emphasis_player_toggle_random (Emphasis_Player_Gui *player, int value) |
Set the random checkbox state to value (1 is ticked). | |
void | emphasis_player_toggle_repeat (Emphasis_Player_Gui *player, int value) |
Set the repeat checkbox state to value (1 is ticked). | |
void | emphasis_player_vol_slider_set (Emphasis_Player_Gui *player, int value) |
Set the volume slider to the value position. |
void emphasis_player_info_set | ( | Emphasis_Player_Gui * | player, | |
Emphasis_Song * | song, | |||
char * | msg | |||
) |
Set the message in th textblock.
player | A Emphasis_Player_Gui | |
song | The current playing song | |
msg | Additional, if song != NULL or the message displayed |
00361 { 00362 char *info_label; 00363 char *info_textblock; 00364 00365 char *title, *artist, *album; 00366 title = artist = album = NULL; 00367 00368 if (song) 00369 { 00370 char **table[] = {&(song->artist), &(song->title), &(song->album), NULL}; 00371 emphasis_unknow_if_null(table); 00372 00373 artist = etk_strescape(song->artist); 00374 title = etk_strescape(song->title) ; 00375 album = etk_strescape(song->album) ; 00376 00377 /* TEMP */ 00378 /* don'd remove textblocks' spaces, it's a hack (utf8) */ 00379 if (!msg) 00380 { 00381 asprintf(&info_label, 00382 "<left_margin=10>" 00383 "<b><font_size=16>%s</font_size></b>" 00384 "<br><br>" 00385 "<font_size=11><i>by</i></font_size> " 00386 "<font_size=13>%s</font_size> " 00387 "<font_size=11><i>in</i></font_size> " 00388 "<font_size=13>%s</font_size>" 00389 "</left_margin>", 00390 title, artist, album); 00391 asprintf(&info_textblock, 00392 "<b><font size=16>%s </font></b>" 00393 "\n\n" 00394 "<font size=11><i>by</i></font> " 00395 "<font size=13>%s </font>\n" 00396 "<font size=11><i>in</i></font> " 00397 "<font size=13>%s </font> ", 00398 title, artist, album); 00399 } 00400 else 00401 { 00402 asprintf(&info_label, 00403 "<left_margin=10>" 00404 "<b><font_size=16>%s</font_size></b>" 00405 "<br><br>" 00406 "<font_size=11><i>by</i></font_size> " 00407 "<font_size=13>%s</font_size> " 00408 "<font_size=11><i>in</i></font_size> " 00409 "<font_size=13>%s</font_size>" 00410 "<font_size=11> (%s)</font_size>" 00411 "</left_margin>", 00412 title, artist, album, msg); 00413 asprintf(&info_textblock, 00414 "<b><font size=16>%s </font></b>\n" 00415 "<font size=10> (%s)</font>\n" 00416 "<font size=11><i>by</i></font> " 00417 "<font size=13>%s </font>\n" 00418 "<font size=11><i>in</i></font> " 00419 "<font size=13>%s </font>", 00420 title, msg, artist, album); 00421 } 00422 00423 etk_label_set(ETK_LABEL(player->full.info), info_label); 00424 etk_textblock_text_set(ETK_TEXT_VIEW(player->small.info)->textblock, 00425 info_textblock, 00426 ETK_TRUE); 00427 free(info_label); 00428 free(info_textblock); 00429 free(artist); 00430 free(title); 00431 free(album); 00432 } 00433 else 00434 { 00435 if (msg) 00436 { 00437 asprintf(&info_label, "%s", msg); 00438 asprintf(&info_textblock, "%s", msg); 00439 00440 etk_label_set(ETK_LABEL(player->full.info), info_label); 00441 etk_textblock_text_set(ETK_TEXT_VIEW(player->small.info)->textblock, 00442 info_textblock, ETK_TRUE); 00443 00444 free(info_label); 00445 free(info_textblock); 00446 00447 } 00448 } 00449 00450 etk_textblock_cursor_visible_set 00451 (etk_text_view_textblock_get(ETK_TEXT_VIEW(player->small.info)), ETK_FALSE); 00452 }
void emphasis_player_progress_set | ( | Emphasis_Player_Gui * | player, | |
float | elapsed_time, | |||
int | total_time | |||
) |
Set the progress bar to elapsed_time/total_time.
elapsed_time | The time elapsed | |
total_time | The lenght of the song | |
gui | A Emphasis_Gui |
00464 { 00465 char *time; 00466 00467 etk_progress_bar_fraction_set(ETK_PROGRESS_BAR(player->full.progress), 00468 (elapsed_time / total_time)); 00469 etk_progress_bar_fraction_set(ETK_PROGRESS_BAR(player->small.progress), 00470 (elapsed_time / total_time)); 00471 00472 asprintf(&time, "%d:%02d / %d:%02d", (int) elapsed_time / 60, 00473 (int) elapsed_time % 60, 00474 total_time / 60, 00475 total_time % 60); 00476 00477 etk_label_set(ETK_LABEL(player->full.time) , time); 00478 // etk_label_set(ETK_LABEL(player->small.time), time); 00479 etk_progress_bar_text_set(ETK_PROGRESS_BAR(player->small.progress), time); 00480 00481 free(time); 00482 }
void emphasis_player_toggle_play | ( | Emphasis_Player_Gui * | player | ) |
Set the image of btn_play to play if mpd is playing or to pause if mpd is stopped.
player | A Emphasis_Player_Gui |
00490 { 00491 /* TODO : respect enhance file */ 00492 if (mpc_assert_status(MPD_PLAYER_PLAY)) 00493 { 00494 etk_button_set_from_stock(ETK_BUTTON(player->full.play), 00495 ETK_STOCK_MEDIA_PLAYBACK_PAUSE); 00496 etk_button_label_set(ETK_BUTTON(player->full.play), NULL); 00497 00498 etk_button_set_from_stock(ETK_BUTTON(player->small.play), 00499 ETK_STOCK_MEDIA_PLAYBACK_PAUSE); 00500 etk_button_label_set(ETK_BUTTON(player->small.play), NULL); 00501 } 00502 else 00503 { 00504 if (mpc_assert_status(MPD_PLAYER_PAUSE) 00505 || mpc_assert_status(MPD_PLAYER_STOP)) 00506 { 00507 etk_button_set_from_stock(ETK_BUTTON(player->full.play), 00508 ETK_STOCK_MEDIA_PLAYBACK_START); 00509 etk_button_label_set(ETK_BUTTON(player->full.play), NULL); 00510 00511 etk_button_set_from_stock(ETK_BUTTON(player->small.play), 00512 ETK_STOCK_MEDIA_PLAYBACK_START); 00513 etk_button_label_set(ETK_BUTTON(player->small.play), NULL); 00514 } 00515 } 00516 }
void emphasis_player_toggle_random | ( | Emphasis_Player_Gui * | player, | |
int | value | |||
) |
Set the random checkbox state to value (1 is ticked).
value | A boolean | |
gui | A Emphasis_Gui |
00526 { 00527 etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(player->full.random) , value); 00528 etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(player->small.random), value); 00529 }
void emphasis_player_toggle_repeat | ( | Emphasis_Player_Gui * | player, | |
int | value | |||
) |
Set the repeat checkbox state to value (1 is ticked).
value | A boolean | |
gui | A Emphasis_Gui |
00539 { 00540 etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(player->full.repeat) , value); 00541 etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(player->small.repeat), value); 00542 }
void emphasis_player_vol_slider_set | ( | Emphasis_Player_Gui * | player, | |
int | value | |||
) |
Set the volume slider to the value position.
value | A vol value in percent | |
gui | A Emphasis_Gui |
00560 { 00561 etk_range_value_set(ETK_RANGE(player->full.sound_slider) , (double) value); 00562 etk_range_value_set(ETK_RANGE(player->small.sound_slider), (double) value); 00563 }