Files
breeze/src/screens/settings/settings_session.c
T

71 lines
2.5 KiB
C

#include "settings_session.h"
#include "app.h"
#include "app_settings.h"
#include "flint_locale.h"
#include "flint_ui.h"
#include "settings_ui.h"
#define SETTINGS_SESSION_SLIDER_ROW_H 52
int
settings_session_content_height(int content_w)
{
int label_w = content_w > 0 ? content_w : flint_px(240);
int height = flint_px(SETTINGS_SESSION_SLIDER_ROW_H) + flint_px(40);
height += settings_ui_toggle_row_height(locale_get("show_session_volume_control_label"),
label_w);
height += settings_ui_toggle_row_height(locale_get("show_session_return_button_label"),
label_w);
height += settings_ui_toggle_row_height(locale_get("play_in_background_label"),
label_w);
return height;
}
void
settings_session_draw(InbeApp *app, int x, int w, int *y)
{
int sound_volume;
int show_session_volume;
int show_session_return;
int play_in_background;
if(app == NULL || y == NULL)
return;
sound_volume = app->sound_volume;
if(settings_ui_commit_slider_row(app, 6, x, w, y,
flint_px(SETTINGS_SESSION_SLIDER_ROW_H),
locale_get("volume_label"),
SETTINGS_VOLUME_MIN, SETTINGS_VOLUME_MAX,
&sound_volume, "", 0)) {
app->sound_volume = sound_volume;
save_settings(app);
}
show_session_volume = app->show_session_volume_control;
if(settings_ui_commit_toggle_row(app, x, w, y,
locale_get("show_session_volume_control_label"),
&show_session_volume, 0)) {
app->show_session_volume_control = show_session_volume;
save_settings(app);
}
show_session_return = app->show_session_return_button;
if(settings_ui_commit_toggle_row(app, x, w, y,
locale_get("show_session_return_button_label"),
&show_session_return, 0)) {
app->show_session_return_button = show_session_return;
save_settings(app);
}
play_in_background = app->inbe.play_in_background;
if(settings_ui_commit_toggle_row(app, x, w, y,
locale_get("play_in_background_label"),
&play_in_background, 0)) {
app->inbe.play_in_background = play_in_background;
save_settings(app);
}
}