summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2021-09-13 23:06:18 +0200
committerBoris Faure <billiob@gmail.com>2021-09-13 23:06:18 +0200
commit8eec8afcc241f620c29d92cbeb0b3a1e37542bbf (patch)
tree91966264208264a9b84a97d1f8cba77e04fcd4b9
parent1fe7f2ea8009879ac124b41822651589a00ab954 (diff)
options_background: use extn api
-rw-r--r--src/bin/options_background.c54
1 files changed, 23 insertions, 31 deletions
diff --git a/src/bin/options_background.c b/src/bin/options_background.c
index 9deaa81..541f580 100644
--- a/src/bin/options_background.c
+++ b/src/bin/options_background.c
@@ -180,14 +180,11 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part)
180 180
181 if (item->path) 181 if (item->path)
182 { 182 {
183 int i;
184 Media_Type type; 183 Media_Type type;
185 for (i = 0; extn_edj[i]; i++) 184 size_t len = strlen(item->path);
186 { 185 if (extn_matches(item->path, len, extn_edj))
187 if (eina_str_has_extension(item->path, extn_edj[i])) 186 return media_add(obj, item->path, config,
188 return media_add(obj, item->path, config, 187 MEDIA_BG, MEDIA_TYPE_EDJE);
189 MEDIA_BG, MEDIA_TYPE_EDJE);
190 }
191 type = media_src_type_get(item->path); 188 type = media_src_type_get(item->path);
192 return media_add(obj, item->path, config, MEDIA_THUMB, type); 189 return media_add(obj, item->path, config, MEDIA_THUMB, type);
193 } 190 }
@@ -277,11 +274,8 @@ _rec_read_directorys(Background_Ctx *ctx, Eina_List *list,
277{ 274{
278 Eina_List *childs = ecore_file_ls(root_path); 275 Eina_List *childs = ecore_file_ls(root_path);
279 char *file_name, path[PATH_MAX]; 276 char *file_name, path[PATH_MAX];
280 int i, j;
281 Background_Item *item; 277 Background_Item *item;
282 const char **extns[5] = 278 const char **extns[5] = { extn_img, extn_scale, extn_edj, extn_mov, NULL };
283 { extn_img, extn_scale, extn_edj, extn_mov, NULL };
284 const char **ex;
285 Insert_Gen_Grid_Item_Notify *notify; 279 Insert_Gen_Grid_Item_Notify *notify;
286 280
287 281
@@ -291,33 +285,31 @@ _rec_read_directorys(Background_Ctx *ctx, Eina_List *list,
291 snprintf(path, PATH_MAX, "%s/%s", root_path, file_name); 285 snprintf(path, PATH_MAX, "%s/%s", root_path, file_name);
292 if ((!ecore_file_is_dir(path)) && (file_name[0] != '.')) 286 if ((!ecore_file_is_dir(path)) && (file_name[0] != '.'))
293 { 287 {
288 int i;
289 size_t len = strlen(file_name);
294 //file is found, search for correct file endings ! 290 //file is found, search for correct file endings !
295 for (j = 0; extns[j]; j++) 291 for (i = 0; extns[i]; i++)
296 { 292 {
297 ex = extns[j]; 293 if (extn_matches(file_name, len, extns[i]))
298 for (i = 0; ex[i]; i++)
299 { 294 {
300 if (eina_str_has_extension(file_name, ex[i])) 295 //File is found and valid
296 item = calloc(1, sizeof(Background_Item));
297 if (item)
301 { 298 {
302 //File is found and valid 299 item->path = eina_stringshare_add(path);
303 item = calloc(1, sizeof(Background_Item)); 300 list = eina_list_append(list, item);
304 if (item) 301 notify = calloc(1,
302 sizeof(Insert_Gen_Grid_Item_Notify));
303 if (notify)
305 { 304 {
306 item->path = eina_stringshare_add(path); 305 //insert item to gengrid
307 list = eina_list_append(list, item); 306 notify->class = class;
308 notify = calloc(1, 307 notify->item = item;
309 sizeof(Insert_Gen_Grid_Item_Notify)); 308 //ecore_thread_feedback(th, notify);
310 if (notify) 309 _insert_gengrid_item(ctx, notify);
311 {
312 //insert item to gengrid
313 notify->class = class;
314 notify->item = item;
315 //ecore_thread_feedback(th, notify);
316 _insert_gengrid_item(ctx, notify);
317 }
318 } 310 }
319 break;
320 } 311 }
312 break;
321 } 313 }
322 } 314 }
323 } 315 }