Commit d6eec53b authored by Ludovic Fauvet's avatar Ludovic Fauvet

Hide next/prev buttons when action unavailable

parent 241b1c93
......@@ -187,6 +187,11 @@ collections {
rel1 {relative: 0.33 0.4;}
rel2 {relative: 0.43 1.0;}
}
description {
state: "hidden" 0.0;
inherit: "default" 0.0;
visible: 0;
}
}
part {
name: "play_button";
......@@ -205,6 +210,11 @@ collections {
rel1 {relative: 0.57 0.4;}
rel2 {relative: 0.67 1.0;}
}
description {
state: "hidden" 0.0;
inherit: "default" 0.0;
visible: 0;
}
}
part {
name: "repeat_button";
......@@ -215,5 +225,36 @@ collections {
rel2 {relative: 1.0 1.0;}
}
}
programs {
program {
name: "previous_button,hide";
signal: "previous_button,hide";
source: "";
action: STATE_SET "hidden" 0.0;
target: "previous_button";
}
program {
name: "previous_button,show";
signal: "previous_button,show";
source: "";
action: STATE_SET "default" 0.0;
target: "previous_button";
}
program {
name: "next_button,hide";
signal: "next_button,hide";
source: "";
action: STATE_SET "hidden" 0.0;
target: "next_button";
}
program {
name: "next_button,show";
signal: "next_button,show";
source: "";
action: STATE_SET "default" 0.0;
target: "next_button";
}
}
}
}
\ No newline at end of file
......@@ -151,6 +151,7 @@ collections
name: "swallow.previous";
type: SWALLOW;
description {
state: "default" 0.0;
aspect: 0.9 0.9;
aspect_preference: VERTICAL;
color: 255 0 0 255; // transparent grey
......@@ -163,6 +164,11 @@ collections
to: "swallow.play";
}
}
description {
state: "hidden" 0.0;
inherit: "default" 0.0;
visible: 0;
}
}
part {
name: "swallow.play";
......@@ -199,7 +205,43 @@ collections
to_y: "hub_button";
}
}
description {
state: "hidden" 0.0;
inherit: "default" 0.0;
visible: 0;
}
}
} //parts
}
programs {
program {
name: "swallow.previous,hide";
signal: "swallow.previous,hide";
source: "";
action: STATE_SET "hidden" 0.0;
target: "swallow.previous";
}
program {
name: "swallow.previous,show";
signal: "swallow.previous,show";
source: "";
action: STATE_SET "default" 0.0;
target: "swallow.previous";
}
program {
name: "swallow.next,hide";
signal: "swallow.next,hide";
source: "";
action: STATE_SET "hidden" 0.0;
target: "swallow.next";
}
program {
name: "swallow.next,show";
signal: "swallow.next,show";
source: "";
action: STATE_SET "default" 0.0;
target: "swallow.next";
}
}
}
}
......@@ -326,6 +326,26 @@ media_list_set_prev(media_list *p_ml)
}
}
bool
media_list_has_next(media_list *p_ml)
{
if (p_ml->i_repeat != REPEAT_NONE)
return true;
if (media_list_get_pos(p_ml) + 1 >= media_list_get_count(p_ml))
return false;
return true;
}
bool
media_list_has_prev(media_list *p_ml)
{
if (p_ml->i_repeat != REPEAT_NONE)
return true;
if (media_list_get_pos(p_ml) <= 0)
return false;
return true;
}
media_item *
media_list_get_item(media_list *p_ml)
{
......
......@@ -84,6 +84,12 @@ media_list_set_next(media_list *p_ml);
bool
media_list_set_prev(media_list *p_ml);
bool
media_list_has_next(media_list *p_ml);
bool
media_list_has_prev(media_list *p_ml);
media_item *
media_list_get_item(media_list *p_ml);
......
......@@ -897,6 +897,18 @@ playback_service_list_set_prev(playback_service *p_ps)
media_list_set_prev(p_ps->p_ml);
}
bool
playback_service_has_next(playback_service *p_ps)
{
return media_list_has_next(p_ps->p_ml);
}
bool
playback_service_has_prev(playback_service *p_ps)
{
return media_list_has_prev(p_ps->p_ml);
}
media_item *
playback_service_list_get_item(playback_service *p_ps)
{
......
......@@ -163,6 +163,12 @@ playback_service_list_set_next(playback_service *p_ps);
void
playback_service_list_set_prev(playback_service *p_ps);
bool
playback_service_has_next(playback_service *p_ps);
bool
playback_service_has_prev(playback_service *p_ps);
media_item *
playback_service_list_get_item(playback_service *p_ps);
......
......@@ -504,6 +504,34 @@ update_player_play_pause(audio_player* mpd)
evas_object_show(mpd->fs_play_pause_img);
}
static void
update_player_next_prev(audio_player* mpd)
{
Evas_Object *edje = elm_layout_edje_get(mpd->layout);
Evas_Object *fs_edje = elm_layout_edje_get(mpd->fs_layout);
if (playback_service_has_next(mpd->p_ps))
{
edje_object_signal_emit(edje, "swallow.next,show", "");
edje_object_signal_emit(fs_edje, "next_button,show", "");
}
else
{
edje_object_signal_emit(edje, "swallow.next,hide", "");
edje_object_signal_emit(fs_edje, "next_button,hide", "");
}
if (playback_service_has_prev(mpd->p_ps))
{
edje_object_signal_emit(edje, "swallow.previous,show", "");
edje_object_signal_emit(fs_edje, "previous_button,show", "");
}
else
{
edje_object_signal_emit(edje, "swallow.previous,hide", "");
edje_object_signal_emit(fs_edje, "previous_button,hide", "");
}
}
static void
update_player_title_display(audio_player* mpd, const char *title)
{
......@@ -579,6 +607,9 @@ update_player_display(audio_player* mpd)
/* Change the play/pause button img */
update_player_play_pause(mpd);
/* Update the next / previous buttons */
update_player_next_prev(mpd);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment