}
program {
name: "emit,signal";
- action: SIGNAL_EMIT SIG_BTN_CALLBACK "prev";
+ action: SIGNAL_EMIT SIG_BTN_CALLBACK SRC_BTN_PREV;
}
program {
name: "focused";
programs {
program {
name: "emit,signal";
- action: SIGNAL_EMIT SIG_BTN_CALLBACK "rew";
+ action: SIGNAL_EMIT SIG_BTN_CALLBACK SRC_BTN_REW;
}
}
}
programs {
program {
name: "emit,signal";
- action: SIGNAL_EMIT SIG_BTN_CALLBACK "ff";
+ action: SIGNAL_EMIT SIG_BTN_CALLBACK SRC_BTN_FF;
}
}
}
programs {
program {
name: "emit,signal";
- action: SIGNAL_EMIT SIG_BTN_CALLBACK "next";
+ action: SIGNAL_EMIT SIG_BTN_CALLBACK SRC_BTN_NEXT;
}
}
}
programs {
program {
name: "emit,signal";
- action: SIGNAL_EMIT SIG_BTN_CALLBACK "prev";
+ action: SIGNAL_EMIT SIG_BTN_CALLBACK SRC_BTN_PHOTO_PREV;
}
}
}
programs {
program {
name: "emit,signal";
- action: SIGNAL_EMIT SIG_BTN_CALLBACK "next";
+ action: SIGNAL_EMIT SIG_BTN_CALLBACK SRC_BTN_PHOTO_NEXT;
}
}
}
}
program {
name: "emit,signal";
- action: SIGNAL_EMIT SIG_BTN_CALLBACK "play";
+ action: SIGNAL_EMIT SIG_BTN_CALLBACK SRC_BTN_PLAY;
}
program {
name: "focused";
VIEWER_MAX
};
+enum {
+ DIR_NONE,
+ DIR_PREV,
+ DIR_NEXT
+};
+
struct _viewer {
struct controller *ctl[VIEWER_MAX];
int cur;
static struct _btn_info btn_movie[] = {
{
- .name = "prev",
+ .name = SRC_BTN_PREV,
.loc = 0,
},
{
- .name = "rew",
+ .name = SRC_BTN_REW,
.loc = 1,
},
{
- .name = "play",
+ .name = SRC_BTN_PLAY,
.loc = 2,
},
{
- .name = "ff",
+ .name = SRC_BTN_FF,
.loc = 3,
},
{
- .name = "next",
+ .name = SRC_BTN_NEXT,
.loc = 4,
},
};
static struct _btn_info btn_photo[] = {
{
- .name = "prev_photo",
+ .name = SRC_BTN_PHOTO_PREV,
.loc = 0,
},
{
- .name = "next_photo",
+ .name = SRC_BTN_PHOTO_NEXT,
.loc = 4,
},
};
static struct _btn_info btn_video[] = {
{
- .name = "prev",
+ .name = SRC_BTN_PREV,
.loc = 0,
},
{
- .name = "rew",
+ .name = SRC_BTN_REW,
.loc = 1,
},
{
- .name = "play",
+ .name = SRC_BTN_PLAY,
.loc = 2,
},
{
- .name = "ff",
+ .name = SRC_BTN_FF,
.loc = 3,
},
{
- .name = "next",
+ .name = SRC_BTN_NEXT,
.loc = 4,
},
};
struct _btn_info *btns;
int btn_count;
int focus_loc;
+ void (*callback)(void *, const char *);
};
+static void _callback_movie(void *data, const char *ev);
+static void _callback_photo(void *data, const char *ev);
+static void _callback_video(void *data, const char *ev);
+
static struct _viewer_info viewer_info[] = {
{
.btns = btn_movie,
.btn_count = 5,
.focus_loc = 2,
+ .callback = _callback_movie,
},
{
.btns = btn_photo,
.btn_count = 2,
.focus_loc = 1,
+ .callback = _callback_photo,
},
{
.btns = btn_video,
.btn_count = 5,
.focus_loc = 4,
+ .callback = _callback_video,
},
};
elm_object_part_content_set(priv->base, PART_VIEWER_FAVORITE, img);
}
-static bool _viewer_show(struct _priv *priv, int cur)
+static bool _viewer_show(struct _priv *priv, int cur, int foc)
{
struct _viewer_info *info;
struct controller *ctl;
int id;
+ int loc;
app_media *am;
app_media_info *mi;
priv->viewer.cur = id;
ctl->ops->show(ctl->handle);
- ctl->ops->focus(ctl->handle, info->focus_loc, true);
+
+ switch (foc) {
+ case DIR_PREV:
+ loc = 0;
+ break;
+ case DIR_NEXT:
+ loc = info->btn_count - 1;
+ break;
+ case DIR_NONE:
+ default:
+ loc = info->focus_loc;
+ break;
+ }
+ ctl->ops->focus(ctl->handle, loc, true);
_draw_title_bar(priv, id, mi);
_draw_time_info(priv, id, mi);
STYLE_VIEWER_BTN, PART_VIEWER_BTN);
}
+ ctl->ops->add_callback(ctl->handle, info->callback, priv);
+
priv->viewer.ctl[id] = ctl;
return true;
}
}
+static bool _viewer_prev(struct _priv *priv)
+{
+ int total;
+ bool r;
+
+ _viewer_hide(priv);
+
+ total = eina_list_count(priv->playlist.list);
+
+ if (priv->playlist.cur == 0)
+ priv->playlist.cur = total - 1;
+ else
+ priv->playlist.cur--;
+
+ r = _viewer_show(priv, priv->playlist.cur, DIR_PREV);
+
+ return r;
+}
+
+static bool _viewer_next(struct _priv *priv)
+{
+ int total;
+ bool r;
+
+ _viewer_hide(priv);
+
+ total = eina_list_count(priv->playlist.list);
+
+ if (priv->playlist.cur == total - 1)
+ priv->playlist.cur = 0;
+ else
+ priv->playlist.cur++;
+
+ r = _viewer_show(priv, priv->playlist.cur, DIR_NEXT);
+
+ return r;
+}
+
static bool _ui_init(struct _priv *priv)
{
bool r;
return false;
}
+static void _callback_movie(void *data, const char *ev)
+{
+}
+
+static void _callback_photo(void *data, const char *ev)
+{
+ struct _priv *priv;
+
+ if (!data || !ev)
+ return;
+
+ priv = data;
+
+ if (!strcmp(ev, SRC_BTN_PHOTO_PREV)) {
+ _viewer_prev(priv);
+ } else if (!strcmp(ev, SRC_BTN_PHOTO_NEXT)) {
+ _viewer_next(priv);
+ }
+}
+
+static void _callback_video(void *data, const char *ev)
+{
+ struct _priv *priv;
+
+ if (!data || !ev)
+ return;
+
+ priv = data;
+
+ if (!strcmp(ev, SRC_BTN_PREV)) {
+ _viewer_prev(priv);
+ } else if (!strcmp(ev, SRC_BTN_NEXT)) {
+ _viewer_next(priv);
+ }
+}
+
static Evas_Object *_create(Evas_Object *win, void *data)
{
struct _priv *priv;
priv = view_data;
/* FIXME: test code */
- _viewer_show(priv, 1);
+ _viewer_show(priv, priv->playlist.cur, DIR_NONE);
evas_object_show(priv->base);
}