struct _control {
Evas_Object *obj;
char *part;
+ int loc;
};
struct _priv {
ctl->obj = btn;
ctl->part = strdup(buf);
+ ctl->loc = loc;
p->list = eina_list_append(p->list, ctl);
p->cb.data = data;
}
+static struct _control *_get_control_loc(Eina_List *list, int loc)
+{
+ Eina_List *l;
+ struct _control *ctl;
+
+ EINA_LIST_FOREACH(list, l, ctl) {
+ if (ctl->loc == loc)
+ break;
+
+ ctl = NULL;
+ }
+
+ return ctl;
+}
+
static void _focus(void *handle, int loc, bool foc)
{
struct _priv *p;
}
p = handle;
- ctl = eina_list_nth(p->list, loc);
+ ctl = _get_control_loc(p->list, loc);
if (ctl && ctl->obj)
elm_object_focus_set(ctl->obj, foc);
}
p = handle;
- ctl = eina_list_nth(p->list, loc);
+ ctl = _get_control_loc(p->list, loc);
if (ctl && ctl->obj)
elm_object_signal_emit(ctl->obj, signal, "");
p = handle;
- ctl = eina_list_nth(p->list, loc);
+ ctl = _get_control_loc(p->list, loc);
if (!ctl)
return NULL;
#define STYLE_VIEWER_BTN "viewer_btn"
#define PART_VIEWER_BTN "control_btn"
-#define PLAY_BTN_LOC 1
#define VIEWER_TIMEOUT 3.0
#define VIEWER_SEPARATOR "/ "
#define VIDEO_COPYRIGHT "Unknown"
+#define BTN_LOC_PREV 0
+#define BTN_LOC_PLAY 2
+#define BTN_LOC_NEXT 4
+
enum {
VIEWER_MOVIE,
VIEWER_PHOTO,
static struct _btn_info btn_movie[] = {
{
.name = SRC_BTN_PREV,
- .loc = 1,
+ .loc = BTN_LOC_PREV,
},
{
.name = SRC_BTN_PLAY,
- .loc = 2,
+ .loc = BTN_LOC_PLAY,
},
{
.name = SRC_BTN_NEXT,
- .loc = 3,
+ .loc = BTN_LOC_NEXT,
},
};
static struct _btn_info btn_photo[] = {
{
.name = SRC_BTN_GALLERY_PREV,
- .loc = 0,
+ .loc = BTN_LOC_PREV,
},
{
.name = SRC_BTN_GALLERY_NEXT,
- .loc = 4,
+ .loc = BTN_LOC_NEXT,
},
};
static struct _btn_info btn_video[] = {
{
.name = SRC_BTN_GALLERY_PREV,
- .loc = 0,
+ .loc = BTN_LOC_PREV,
},
{
.name = SRC_BTN_PLAY,
- .loc = 2,
+ .loc = BTN_LOC_PLAY,
},
{
.name = SRC_BTN_GALLERY_NEXT,
- .loc = 4,
+ .loc = BTN_LOC_NEXT,
},
};
{
.btns = btn_movie,
.btn_count = 3,
- .focus_loc = 1,
+ .focus_loc = BTN_LOC_PLAY,
.callback = _callback_movie,
},
{
.btns = btn_photo,
.btn_count = 2,
- .focus_loc = 1,
+ .focus_loc = BTN_LOC_NEXT,
.callback = _callback_photo,
},
{
.btns = btn_video,
.btn_count = 3,
- .focus_loc = 2,
+ .focus_loc = BTN_LOC_NEXT,
.callback = _callback_video,
},
};
switch (priv->playlist.dir) {
case DIR_PREV:
- loc = 0;
+ loc = BTN_LOC_PREV;
break;
case DIR_NEXT:
- loc = info->btn_count - 1;
+ loc = BTN_LOC_NEXT;
break;
case DIR_NONE:
default:
loc = info->focus_loc;
if (id == VIEWER_MOVIE) {
ctl->ops->signal(ctl->handle,
- PLAY_BTN_LOC, SIG_SET_PAUSE);
+ BTN_LOC_PLAY, SIG_SET_PAUSE);
}
break;
}
struct controller *ctl;
ctl = priv->viewer.ctl[priv->viewer.cur];
- ctl->ops->signal(ctl->handle, 0, SIG_SET_UNFOCUS);
+ ctl->ops->signal(ctl->handle, BTN_LOC_PREV, SIG_SET_UNFOCUS);
_viewer_hide(priv);
struct controller *ctl;
ctl = priv->viewer.ctl[priv->viewer.cur];
- ctl->ops->signal(ctl->handle, ctl->ops->get_count(ctl->handle) - 1,
- SIG_SET_UNFOCUS);
+ ctl->ops->signal(ctl->handle, BTN_LOC_NEXT, SIG_SET_UNFOCUS);
_viewer_hide(priv);
}
ctl = priv->viewer.ctl[priv->viewer.cur];
- ctl->ops->signal(ctl->handle, PLAY_BTN_LOC, SIG_SET_PAUSE);
- ctl->ops->focus(ctl->handle, PLAY_BTN_LOC, true);
+ ctl->ops->signal(ctl->handle, BTN_LOC_PLAY, SIG_SET_PAUSE);
+ ctl->ops->focus(ctl->handle, BTN_LOC_PLAY, true);
}
static void _player_pause(struct _priv *priv)
}
ctl = priv->viewer.ctl[priv->viewer.cur];
- ctl->ops->signal(ctl->handle, PLAY_BTN_LOC, SIG_SET_PLAY);
- ctl->ops->focus(ctl->handle, PLAY_BTN_LOC, true);
+ ctl->ops->signal(ctl->handle, BTN_LOC_PLAY, SIG_SET_PLAY);
+ ctl->ops->focus(ctl->handle, BTN_LOC_PLAY, true);
}
static void _player_stop(struct _priv *priv)
playermgr_stop(priv->player);
ctl = priv->viewer.ctl[priv->viewer.cur];
- ctl->ops->signal(ctl->handle, PLAY_BTN_LOC, SIG_SET_PLAY);
+ ctl->ops->signal(ctl->handle, BTN_LOC_PLAY, SIG_SET_PLAY);
}
static void _player_complete_cb(void *data)