name: "elm/gengrid/item/album_item/default";
data.item: "selectraise" "on";
data.item: "texts" "elm.text.title";
- data.item: "contents" "elm.swallow.thumbnail elm.swallow.textbg";
+ data.item: "contents" "elm.swallow.thumbnail elm.swallow.icon elm.swallow.textbg";
data.item: "focus_highlight" "on";
parts {
part {
}
}
part {
+ name: PART_ELM_SWALLOW_ICON;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_ELM_SWALLOW_THUMBNAIL;
+ relative: 0.5 0.5;
+ }
+ rel2 {
+ to: PART_ELM_SWALLOW_THUMBNAIL;
+ relative: 0.5 0.5;
+ }
+ min: 128 128;
+ fixed: 1 1;
+ }
+ }
+ part {
name: "padding_favorite";
type: SPACER;
scale: 1;
return strdup(ai->name);
}
+static Evas_Object *_album_content_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ Evas_Object *eo;
+ struct album_info *ai;
+ struct color_data bg;
+
+ if (!data)
+ return NULL;
+
+ ai = data;
+
+ eo = NULL;
+ if (!strcmp(part, PART_ELM_SWALLOW_THUMBNAIL)) {
+ if (ai->album_art) {
+ eo = util_add_image(obj, ai->album_art);
+ if (!eo) {
+ _ERR("failed to create image object");
+ return NULL;
+ }
+ } else {
+ eo = evas_object_rectangle_add(obj);
+ if (!eo) {
+ _ERR("failed to create rectangle object");
+ return NULL;
+
+ }
+
+ app_contents_get_color(ai->name, &bg, NULL);
+ evas_object_color_set(eo, bg.r, bg.g, bg.b, bg.a);
+ }
+ } else if (!strcmp(part, PART_ELM_SWALLOW_ICON)) {
+ if (ai->album_art)
+ return NULL;
+
+ eo = util_add_image(obj, IMAGE_THUMBNAIL_SONG_ALBUM);
+ if (!eo) {
+ _ERR("failed to create image object");
+ return NULL;
+ }
+ } else if (!strcmp(part, PART_ELM_SWALLOW_TEXTBG)) {
+ eo = evas_object_rectangle_add(obj);
+ if (!eo) {
+ _ERR("failed to create rectangle object");
+ return NULL;
+ }
+
+ app_contents_get_color(ai->name, NULL, &bg);
+ evas_object_color_set(eo, bg.r, bg.g, bg.b, bg.a);
+ }
+
+ if (eo)
+ evas_object_show(eo);
+
+ return eo;
+}
+
static char *_artist_text_get(void *data, Evas_Object *obj, const char *part)
{
struct album_info *ai;
return strdup(ai->artist);
}
-static Evas_Object *_album_content_get(void *data, Evas_Object *obj,
+static Evas_Object *_artist_content_get(void *data, Evas_Object *obj,
const char *part)
{
Evas_Object *eo;
eo = NULL;
if (!strcmp(part, PART_ELM_SWALLOW_THUMBNAIL)) {
- eo = util_add_image(obj, ai->album_art);
+ if (ai->album_art) {
+ eo = util_add_image(obj, ai->album_art);
+ if (!eo) {
+ _ERR("failed to create image object");
+ return NULL;
+ }
+ } else {
+ eo = evas_object_rectangle_add(obj);
+ if (!eo) {
+ _ERR("failed to create rectangle object");
+ return NULL;
+
+ }
+
+ app_contents_get_color(ai->name, &bg, NULL);
+ evas_object_color_set(eo, bg.r, bg.g, bg.b, bg.a);
+ }
+ } else if (!strcmp(part, PART_ELM_SWALLOW_ICON)) {
+ if (ai->album_art)
+ return NULL;
+
+ eo = util_add_image(obj, IMAGE_THUMBNAIL_ARTIST);
if (!eo) {
_ERR("failed to create image object");
return NULL;
[E_MUSIC_ARTIST] = {
.item_style = STYLE_MUSIC_ARTIST,
.text_get = _artist_text_get,
- .content_get = _album_content_get
+ .content_get = _artist_content_get
},
[E_MUSIC_GENRE] = {
.item_style = STYLE_MUSIC_GENRE,
eo = NULL;
if (!strcmp(part, PART_ELM_SWALLOW_THUMBNAIL)) {
- eo = util_add_image(obj, ai->album_art);
+ if (ai->album_art) {
+ eo = util_add_image(obj, ai->album_art);
+ if (!eo) {
+ _ERR("failed to create image object");
+ return NULL;
+ }
+ } else {
+ eo = evas_object_rectangle_add(obj);
+ if (!eo) {
+ _ERR("failed to create rectangle object");
+ return NULL;
+
+ }
+
+ app_contents_get_color(ai->name, &bg, NULL);
+ evas_object_color_set(eo, bg.r, bg.g, bg.b, bg.a);
+ }
+ } else if (!strcmp(part, PART_ELM_SWALLOW_ICON)) {
+ if (ai->album_art)
+ return NULL;
+
+ eo = util_add_image(obj, IMAGE_THUMBNAIL_SONG_ALBUM);
if (!eo) {
_ERR("failed to create image object");
return NULL;