TizenRefApp-7001 Newly added image displayed in wallpaper preview mode 15/86515/1
authorDmytro Dragan <dm.dragan@samsung.com>
Thu, 1 Sep 2016 13:52:42 +0000 (16:52 +0300)
committerDmytro Dragan <dm.dragan@samsung.com>
Thu, 1 Sep 2016 13:52:42 +0000 (16:52 +0300)
Change-Id: I28a4da1924b3a84b7d88d5f0ad6164231b790d80
Signed-off-by: Dmytro Dragan <dm.dragan@samsung.com>
src/wallpaper-ui-service-main.c

index f6f8fd1..75abcf8 100644 (file)
@@ -596,17 +596,32 @@ static void _wallpaper_db_update_cb(media_content_error_e error, int pid,
 
        last_image = _get_last_image_from_db();
        WALLPAPERUI_DBG("last_image == %s", last_image);
+       if ((last_image == NULL && strstr(ad->last_preview_img_path, "no_gallery_bg.png") == NULL)
+               || (last_image != NULL && strcmp(last_image, ad->last_preview_img_path) != 0)) {
+           //if last image was changed
+           Thumbnail *item = NULL;
+
+           Elm_Object_Item *object_item = elm_gengrid_first_item_get(ad->gengrid);
+
+           while (object_item) {
+               item = (Thumbnail *)elm_object_item_data_get(object_item);
+
+               if (item && item->type == WALLPAPER_TYPE_GALLERY) {
+                   free(item->path);
+                   if (last_image != NULL) {
+                       item->path = strdup(last_image);
+                   } else {
+                       item->path = wallpaper_ui_service_get_icon_path("no_gallery_bg.png");
+                   }
+                   elm_gengrid_item_update(item->item);
+                   break;
+               }
+               object_item = elm_gengrid_item_next_get(object_item);
+           }
 
-       if (last_image != NULL) {
-               elm_image_file_set(ad->preview_image, last_image, NULL);
-               free(last_image);
-               last_image = NULL;
-       } else {
-           char *iconPath = wallpaper_ui_service_get_icon_path("no_gallery_bg.png");
-               elm_image_file_set(ad->preview_image, iconPath, NULL);
-               free(iconPath);
        }
-       evas_object_show(ad->preview_image);
+
+    free(last_image);
 
        WALLPAPERUI_TRACE_END;
 }