#include "dEvian.h"
Go to the source code of this file.
Defines | |
#define | CACHE_SIZE() (dEvianM->conf->data_picture_cache_size + evas_list_count(dEvianM->devians) * dEvianM->conf->data_picture_cache_size) |
Functions | |
static int | _picture_list_local_add_dir (const char *dir, int recursive) |
static E_Popup * | _picture_list_local_popup_load_start (void) |
static void | _picture_list_local_popup_load_stop (E_Popup *popup) |
static Picture * | _picture_list_get_picture (Evas_List *pictures_list) |
Get a picture in a list. | |
static Picture * | _picture_cache_get_picture_unused (void) |
Get the first unused picture in cache. | |
static int | _picture_cache_add_picture (Picture *picture) |
Add a picture to the cache. | |
static int | _picture_cache_del_picture (Picture *picture) |
Removes a picture from the cache. | |
static int | _picture_cache_fill (void) |
Fills the cache. | |
static int | _picture_free (Picture *picture, int force, int force_now) |
Free a picture. | |
static void | _picture_local_thumb_cb (Evas_Object *obj, void *data) |
static Evas_Object * | _picture_thumb_get_evas (char *thumb) |
int | devian_data_picture_list_local_init (void) |
Initialise the list of local pictures wich we can display. | |
void | devian_data_picture_list_local_shutdown (void) |
Shutdown the list of local pictures. | |
void | devian_data_picture_list_local_regen (void) |
This function regenerate the list of local pictures. | |
int | devian_data_picture_list_net_init (void) |
void | devian_data_picture_list_net_shutdown (void) |
int | devian_data_picture_cache_init (void) |
Init picture cache. | |
void | devian_data_picture_cache_shutdown (void) |
Shutdown picture cache. | |
Picture * | devian_data_picture_cache_attach (Source_Picture *source, int edje_part) |
Attach a picture to a source. | |
void | devian_data_picture_cache_detach (Source_Picture *source, int part) |
Detach a picture of source. | |
char * | devian_data_picture_get_name_from_path (char *path, int len) |
Get the name of a picture. |
|
Definition at line 3 of file e_mod_data_picture.c. Referenced by _picture_cache_fill(). |
|
Add a picture to the cache.
Definition at line 626 of file e_mod_data_picture.c. References _picture_thumb_get_evas(), DDATAC, and dEvianM. Referenced by _picture_cache_fill(). 00627 { 00628 Picture_Cache *cache; 00629 int th_w, th_h; 00630 00631 cache = dEvianM->picture_cache; 00632 th_w = dEvianM->conf->data_picture_thumb_default_size; 00633 th_h = dEvianM->conf->data_picture_thumb_default_size; 00634 00635 /* (Load the picture) */ 00636 if (!picture->picture) 00637 picture->picture = _picture_thumb_get_evas(picture->thumb_path); 00638 00639 cache->pictures = evas_list_append(cache->pictures, picture); 00640 picture->cached = 1; 00641 00642 if (cache->pos == -1) 00643 cache->pos = evas_list_count(cache->pictures) - 1; 00644 00645 DDATAC(("ajout ok (%s), pos:%d", picture->picture_description->name, cache->pos)); 00646 00647 return 1; 00648 }
|
|
Removes a picture from the cache.
Definition at line 657 of file e_mod_data_picture.c. References _picture_cache_get_picture_unused(), DATA_PICTURE_LOCAL, DDATAC, devian_data_picture_cache_detach(), and dEvianM. Referenced by _picture_cache_fill(), _picture_free(), and devian_data_picture_cache_shutdown(). 00658 { 00659 Evas_List *l; 00660 Picture_Cache *cache; 00661 cache = dEvianM->picture_cache; 00662 00663 if (!picture) 00664 { 00665 picture = _picture_cache_get_picture_unused(); 00666 if (!picture) 00667 return 0; 00668 /* We have a picture to remove =) */ 00669 } 00670 00671 if (picture->source) 00672 { 00673 if(picture->source->picture0 == picture) 00674 devian_data_picture_cache_detach(picture->source, 0); 00675 else 00676 { 00677 if(picture->source->picture1 == picture) 00678 devian_data_picture_cache_detach(picture->source, 1); 00679 else 00680 { 00681 fprintf(stderr, "dEvian: SOURCE of a PICTURE doesnt reference the PICTURE !!!\n"); 00682 } 00683 } 00684 } 00685 00686 /* (Unload picture) */ 00687 if (picture->from == DATA_PICTURE_LOCAL) 00688 { 00689 if(picture->picture) 00690 evas_object_del(picture->picture); 00691 picture->picture = NULL; 00692 } 00693 00694 /* Only if picture is before cache->pos, decr cache->pos */ 00695 if (cache->pos != -1) 00696 { 00697 l = evas_list_nth_list(cache->pictures, cache->pos); 00698 if ( !evas_list_find(l, picture) ) 00699 { 00700 DDATAC(("retrait %s pos --", picture->picture_description->name)); 00701 cache->pos--; 00702 } 00703 } 00704 00705 cache->pictures = evas_list_remove(cache->pictures, picture); 00706 picture->cached = 0; 00707 00708 /* If the pictures pointed by cache->pos is no more valid, set 'no new pics to display' */ 00709 if (cache->pos != -1) 00710 { 00711 l = evas_list_nth_list(cache->pictures, cache->pos); 00712 if (!l) 00713 { 00714 DDATAC(("retrait %s was last, pos set to -1", picture->picture_description->name)); 00715 cache->pos = -1; 00716 } 00717 } 00718 00719 DDATAC(("retrait ok (%s), pos %d", picture->picture_description->name, cache->pos)); 00720 00721 return 1; 00722 }
|
|
Fills the cache. Fill the cache to CACHE_SIZE() if possible. If max is reached, try to remove unused old pictures and go again
Definition at line 731 of file e_mod_data_picture.c. References _picture_cache_add_picture(), _picture_cache_del_picture(), _picture_list_get_picture(), CACHE_SIZE, DDATAC, and dEvianM. Referenced by devian_data_picture_cache_attach(), and devian_data_picture_cache_init(). 00732 { 00733 Picture_Cache *cache; 00734 Picture *picture = NULL; 00735 int new; 00736 00737 cache = dEvianM->picture_cache; 00738 new = 0; 00739 00740 DDATAC(("fill begin")); 00741 00742 /* If cache is too big, reduce it */ 00743 while (evas_list_count(cache->pictures) > CACHE_SIZE()) 00744 { 00745 DDATAC(("cache too big, delete a pic")); 00746 if (!_picture_cache_del_picture(NULL)) 00747 { 00748 fprintf(stderr, "dEvian: !!! Cache too big but cant delete picture ... NEED TO BE FIXED !!!\n"); 00749 break; 00750 } 00751 } 00752 00753 /* Add pictures while we have one, and if max reached, we can del one*/ 00754 while ( (picture = _picture_list_get_picture(NULL)) ) 00755 { 00756 if ( evas_list_count(cache->pictures) == CACHE_SIZE() ) 00757 { 00758 if (!_picture_cache_del_picture(NULL)) 00759 break; 00760 } 00761 _picture_cache_add_picture(picture); 00762 picture = NULL; 00763 new++; 00764 } 00765 00766 DDATAC(("fill end")); 00767 00768 return new; 00769 }
|
|
Get the first unused picture in cache.
Definition at line 564 of file e_mod_data_picture.c. References dEvianM. Referenced by _picture_cache_del_picture(), and devian_data_picture_cache_attach(). 00565 { 00566 Picture *picture; 00567 Picture_Cache *cache; 00568 Evas_List *l, *was_first; 00569 int i = 0; 00570 00571 cache = dEvianM->picture_cache; 00572 00573 if (!evas_list_count(cache->pictures)) 00574 return NULL; 00575 if (!cache->pos) 00576 return NULL; 00577 00578 if (cache->pos == -1) 00579 { 00580 l = evas_list_nth_list(cache->pictures, 00581 rand()%evas_list_count(cache->pictures)); 00582 } 00583 else 00584 { 00585 i = rand()%cache->pos; 00586 l = evas_list_nth_list(cache->pictures, i); 00587 } 00588 00589 was_first = l; 00590 00591 do 00592 { 00593 picture = evas_list_data(l); 00594 /* Current picture ? */ 00595 if (!picture->source && !picture->delete) 00596 return picture; 00597 l = evas_list_next(l); 00598 00599 if (cache->pos == -1) 00600 { 00601 if (!l) 00602 l = cache->pictures; 00603 } 00604 else 00605 { 00606 i++; 00607 if (i == cache->pos) 00608 { 00609 i = 0; 00610 l = cache->pictures; 00611 } 00612 } 00613 00614 } while (l != was_first); 00615 00616 return NULL; 00617 }
|
|
Free a picture. Remove it from the cache, a list, and from memory Definition at line 776 of file e_mod_data_picture.c. References _picture_cache_del_picture(), DATA_PICTURE_LOCAL, DDATA, and dEvianM. Referenced by _picture_local_thumb_cb(), devian_data_picture_cache_detach(), devian_data_picture_list_local_regen(), and devian_data_picture_list_local_shutdown(). 00777 { 00778 DDATA(("Free picture %s beginf (%d %d)", picture->picture_description->name, force, force_now)); 00779 00780 if (picture->source) 00781 { 00782 if (!force) 00783 return 0; 00784 00785 /* If not now, only mark as delete, and picture will be deleted 00786 on next picture change */ 00787 if (!force_now) 00788 { 00789 //if (picture->cached) 00790 //_picture_cache_del_picture(picture); 00791 picture->delete = 1; 00792 return 1; 00793 } 00794 } 00795 00796 if (picture->cached) 00797 _picture_cache_del_picture(picture); 00798 00799 if (picture->picture) 00800 evas_object_del(picture->picture); 00801 00802 if (picture->path) 00803 evas_stringshare_del(picture->path); 00804 if (picture->thumb_path) 00805 E_FREE(picture->thumb_path); 00806 00807 if (picture->picture_description->name) 00808 evas_stringshare_del(picture->picture_description->name); 00809 if (picture->picture_description->author_name) 00810 E_FREE(picture->picture_description->author_name); 00811 if (picture->picture_description->where_from) 00812 E_FREE(picture->picture_description->where_from); 00813 if (picture->picture_description->date) 00814 E_FREE(picture->picture_description->date); 00815 if (picture->picture_description->comments) 00816 E_FREE(picture->picture_description->comments); 00817 E_FREE(picture->picture_description); 00818 00819 if (picture->from == DATA_PICTURE_LOCAL) 00820 { 00821 dEvianM->picture_list_local->pictures = 00822 evas_list_remove(dEvianM->picture_list_local->pictures, picture); 00823 } 00824 else 00825 { 00826 fprintf(stderr, "DEL FROM NET !!!!!!\n"); 00827 dEvianM->picture_list_net->pictures = 00828 evas_list_remove(dEvianM->picture_list_net->pictures, picture); 00829 } 00830 00831 DDATA(("Picture free ok (%p, %d in list)", picture, evas_list_count(dEvianM->picture_list_local->pictures))); 00832 00833 E_FREE(picture); 00834 00835 return 1; 00836 }
|
|
Get a picture in a list.
Definition at line 492 of file e_mod_data_picture.c. References DATA_PICTURE_BOTH, DATA_PICTURE_LOCAL, DATA_PICTURE_NET, and dEvianM. Referenced by _picture_cache_fill(). 00493 { 00494 Picture *picture; 00495 Evas_List *l, *was_first; 00496 00497 picture = NULL; 00498 00499 if (!pictures_list) 00500 { 00501 switch (dEvianM->conf->sources_picture_default_location) 00502 { 00503 case DATA_PICTURE_LOCAL: 00504 pictures_list = dEvianM->picture_list_local->pictures; 00505 break; 00506 case DATA_PICTURE_NET: 00507 pictures_list = dEvianM->picture_list_net->pictures; 00508 break; 00509 case DATA_PICTURE_BOTH: 00510 { 00511 /* Random between local and net. If one doesnt work, try the other one */ 00512 int i; 00513 00514 i = rand()%2; 00515 if (!i) 00516 picture = 00517 _picture_list_get_picture(dEvianM->picture_list_local->pictures); 00518 else 00519 picture = 00520 _picture_list_get_picture(dEvianM->picture_list_net->pictures); 00521 00522 if (!picture) 00523 { 00524 if (i) 00525 picture = 00526 _picture_list_get_picture(dEvianM->picture_list_local->pictures); 00527 else 00528 picture = 00529 _picture_list_get_picture(dEvianM->picture_list_net->pictures); 00530 } 00531 00532 return picture; 00533 } 00534 } 00535 } 00536 00537 if (!evas_list_count(pictures_list)) 00538 return NULL; 00539 00540 l = evas_list_nth_list( pictures_list, 00541 rand()%evas_list_count(pictures_list) ); 00542 was_first = l; 00543 00544 do 00545 { 00546 picture = evas_list_data(l); 00547 if (!picture->source && !picture->cached && !picture->delete) 00548 return picture; 00549 l = evas_list_next(l); 00550 if (!l) 00551 l = pictures_list; 00552 } while (l != was_first); 00553 00554 00555 return NULL; 00556 }
|
|
Definition at line 346 of file e_mod_data_picture.c. References _picture_local_thumb_cb(), DATA_PICTURE_INFOS_LEN, DATA_PICTURE_LOCAL, DDATA, devian_data_picture_get_name_from_path(), DEVIAN_MAX_PATH, and dEvianM. Referenced by devian_data_picture_list_local_init(). 00347 { 00348 Picture_List_Local *list; 00349 Picture *picture; 00350 Ecore_List *files; 00351 char *file, *ext; 00352 int th_w, th_h; 00353 char buf[DEVIAN_MAX_PATH]; 00354 char buf2[4096]; 00355 00356 list = dEvianM->picture_list_local; 00357 th_w = dEvianM->conf->data_picture_thumb_default_size; 00358 th_h = dEvianM->conf->data_picture_thumb_default_size; 00359 00360 if (!ecore_file_is_dir(dir)) 00361 { 00362 snprintf(buf2, sizeof(buf2), 00363 _( 00364 "<hilight>Directory %s doesnt exists.</hilight><br><br>" 00365 "To import pictures, you have to put them" 00366 "in the folder you set in main configuration panel<br><br>" 00367 "They can be jpeg, gif, png, edj<br>" 00368 "After import, if you can remove these files and the pictures still can<br>" 00369 "be viewed, but you wont be able to set them as wallpaper anymore<br><br>" 00370 ), 00371 dir 00372 ); 00373 e_module_dialog_show(_("dEvian Module Error"), buf2); 00374 return 0; 00375 } 00376 files = ecore_file_ls(dir); 00377 if (!strcmp(dEvianM->conf->sources_picture_data_import_dir, dir)) 00378 if(ecore_list_is_empty(files) || !files) 00379 { 00380 snprintf(buf2, sizeof(buf2), 00381 _( 00382 "<hilight>Directory %s is empty</hilight><br><br>" 00383 "To import pictures, you have to put them" 00384 "in this folder.<br>" 00385 "They can be jpeg, gif, png, edj<br>" 00386 "After import, if you can remove these files and the pictures still can<br>" 00387 "be viewed, but you wont be able to set them as wallpaper anymore<br><br>" 00388 ), 00389 dir 00390 ); 00391 e_module_dialog_show(_("dEvian Module Error"), buf2); 00392 return 0; 00393 } 00394 00395 DDATA(("Going to list %s", dir)); 00396 00397 while ((file = (char*)ecore_list_next(files)) != NULL) 00398 { 00399 snprintf(buf, DEVIAN_MAX_PATH, "%s/%s", dir, file); 00400 if (recursive && ecore_file_is_dir(buf)) 00401 { 00402 _picture_list_local_add_dir(buf, 1); 00403 continue; 00404 } 00405 00406 ext = strrchr(file, '.'); 00407 if (!ext) 00408 continue; 00409 if(strcasecmp(ext, ".edj") && 00410 strcasecmp(ext, ".jpg") && strcasecmp(ext, ".JPG") && 00411 strcasecmp(ext, ".jpeg") && strcasecmp(ext, ".JPEG") && 00412 strcasecmp(ext, ".gif") && strcasecmp(ext, ".GIF") && 00413 strcasecmp(ext, ".png") && strcasecmp(ext, ".PNG") 00414 ) 00415 continue; 00416 00417 DDATA(("File %s thumb ...", file)); 00418 snprintf(buf, DEVIAN_MAX_PATH, "%s/%s", dir, file); 00419 00420 picture = E_NEW(Picture, 1); 00421 picture->source = NULL; 00422 picture->path = (char *)evas_stringshare_add(buf); 00423 picture->thumb_path = e_thumb_file_get(picture->path); 00424 picture->picture = NULL; 00425 picture->picture_description = E_NEW(Picture_Infos, 1); 00426 picture->picture_description->name = 00427 devian_data_picture_get_name_from_path(picture->path, 00428 DATA_PICTURE_INFOS_LEN); 00429 picture->picture_description->author_name = NULL; 00430 picture->picture_description->where_from = NULL; 00431 picture->picture_description->date = NULL; 00432 picture->picture_description->comments = NULL; 00433 picture->delete = 0; 00434 picture->from = DATA_PICTURE_LOCAL; 00435 picture->thumbed = 0; 00436 picture->cached = 0; 00437 00438 DDATA(("Thumb %s of %s exists ?", picture->thumb_path, picture->path)); 00439 if ( e_thumb_exists(picture->path) ) 00440 { 00441 int w, h; 00442 e_thumb_geometry_get(picture->thumb_path, &w, &h, 1); 00443 DDATA(("THUMB %dx%d (wanted %dx%d)", w, h, th_w, th_h)); 00444 if ((th_w > w) && (th_h > h)) 00445 { 00446 /* Thumb exists, but regen to new size */ 00447 int i; 00448 i = ecore_file_unlink(picture->thumb_path); 00449 DDATA(("File %s thumb exists (%dx%d), but regen to %dx%d (del old %d)", 00450 file, w, h, th_w, th_h, i)); 00451 e_thumb_generate_begin(picture->path, th_w, th_h, 00452 dEvianM->container->bg_evas, 00453 &picture->picture, 00454 _picture_local_thumb_cb, 00455 picture); 00456 list->nb_pictures_waiting++; 00457 continue; 00458 } 00459 /* Thumb exists and good size */ 00460 DDATA(("File %s thumb exists and good size, add (%de)", file, 00461 evas_list_count(list->pictures))); 00462 picture->thumbed = 1; 00463 picture->original_w = w; 00464 picture->original_h = h; 00465 list->pictures = evas_list_append(list->pictures, picture); 00466 } 00467 else 00468 { 00469 /* Thumb doesnt exists so generate it */ 00470 DDATA(("File %s thumb doesnt exist, gen %dx%d", file, th_w, th_h)); 00471 e_thumb_generate_begin(picture->path, th_w, th_h, 00472 dEvianM->container->bg_evas, 00473 &picture->picture, 00474 _picture_local_thumb_cb, 00475 picture); 00476 list->nb_pictures_waiting++; 00477 continue; 00478 } 00479 } 00480 00481 DDATA(("End listing %s", dir)); 00482 00483 return 1; 00484 }
|
|
Definition at line 900 of file e_mod_data_picture.c. References devian_devian_edje_load(), dEvianM, and DMAIN. Referenced by devian_data_picture_list_local_init(). 00901 { 00902 E_Popup *popup; 00903 Evas_Object *obj; 00904 int x, y, w, h; 00905 00906 popup = e_popup_new(e_zone_current_get(dEvianM->container), 0, 0, 1, 1); 00907 if (!popup) 00908 return NULL; 00909 00910 e_popup_layer_set(popup, 255); 00911 obj = edje_object_add(popup->evas); 00912 if (!devian_devian_edje_load(obj, "devian/popup/load/local")) 00913 return NULL; 00914 00915 edje_object_part_text_set(obj, "text", "Loading pictures list ..."); 00916 00917 edje_object_size_min_calc(obj, &w, &h); 00918 evas_object_move(obj, 0, 0); 00919 evas_object_resize(obj, w, h); 00920 evas_object_show(obj); 00921 e_popup_edje_bg_object_set(popup, obj); 00922 x = (dEvianM->canvas_w - w) / 2; 00923 y = (dEvianM->canvas_h - h) / 2; 00924 e_popup_move_resize(popup, x, y, w, h); 00925 00926 DMAIN(("Popup pos %d %d, size %d x %d", x, y, w, h)); 00927 e_popup_show(popup); 00928 00929 return popup; 00930 }
|
|
Definition at line 932 of file e_mod_data_picture.c. Referenced by devian_data_picture_list_local_init().
|
|
Definition at line 838 of file e_mod_data_picture.c. References _picture_free(), DDATA, and dEvianM. Referenced by _picture_list_local_add_dir(). 00839 { 00840 Picture *picture; 00841 Picture_List_Local *list; 00842 00843 if (!dEvianM || !data) 00844 return; 00845 00846 list = dEvianM->picture_list_local; 00847 picture = data; 00848 00849 DDATA(("back from thumb generation of %s", picture->picture_description->name)); 00850 00851 if (ecore_file_exists(picture->thumb_path)) 00852 { 00853 e_thumb_geometry_get(picture->thumb_path, 00854 &picture->original_w, &picture->original_h, 00855 1); 00856 picture->thumbed = 1; 00857 DDATA(("thumb generated %dx%d", picture->original_w, picture->original_h)); 00858 list->pictures = evas_list_append(list->pictures, picture); 00859 list->nb_pictures_waiting--; 00860 00861 /* If the pic is loaded, remove it, we dont want it ! 00862 Moreover it does memleak */ 00863 if (picture->picture) 00864 { 00865 evas_object_del(picture->picture); 00866 picture->picture = NULL; 00867 } 00868 } 00869 else 00870 { 00871 _picture_free(picture, 1, 1); 00872 } 00873 }
|
|
Definition at line 875 of file e_mod_data_picture.c. References dEvianM. Referenced by _picture_cache_add_picture(). 00876 { 00877 Eet_File *ef; 00878 Evas_Object *im = NULL; 00879 Evas_Coord sw, sh; 00880 00881 ef = eet_open(thumb, EET_FILE_MODE_READ); 00882 if (!ef) 00883 { 00884 eet_close(ef); 00885 return NULL; 00886 } 00887 00888 im = e_icon_add(dEvianM->container->bg_evas); 00889 e_icon_file_key_set(im, thumb, "/thumbnail/data"); 00890 00891 e_icon_size_get(im, &sw, &sh); 00892 evas_object_resize(im, sw, sh); 00893 e_icon_fill_inside_set(im, 1); 00894 00895 eet_close(ef); 00896 00897 return im; 00898 }
|
|
Attach a picture to a source.
Definition at line 201 of file e_mod_data_picture.c. References _picture_cache_fill(), _picture_cache_get_picture_unused(), DDATAC, and dEvianM. Referenced by devian_source_picture_add(), and devian_source_picture_change(). 00203 { 00204 Picture_Cache *cache; 00205 Picture *picture; 00206 00207 cache = dEvianM->picture_cache; 00208 00209 /* If old pictures are still attached, abord */ 00210 if (!edje_part && source->picture0) 00211 return NULL; 00212 if (edje_part && source->picture1) 00213 return NULL; 00214 00215 /* Need to fill the cache ? */ 00216 if ( cache->pos == -1 ) 00217 _picture_cache_fill(); 00218 else 00219 if ( cache->pos > 00220 ( evas_list_count(cache->pictures) - 00221 (int)(evas_list_count(cache->pictures) / 4) ) ) 00222 _picture_cache_fill(); 00223 00224 /* Get the next picture and change next picture */ 00225 if (cache->pos != -1) 00226 { 00227 picture = evas_list_nth(cache->pictures, cache->pos); 00228 cache->pos++; 00229 if ( cache->pos > (evas_list_count(cache->pictures)-1) ) 00230 cache->pos = -1; // Overflow -> no more pictures avalaible ! 00231 } 00232 else 00233 { 00234 picture = _picture_cache_get_picture_unused(); 00235 if (!picture) 00236 return NULL; 00237 } 00238 00239 /* Attach the picture to the source */ 00240 picture->source = source; 00241 if (!edje_part) 00242 source->picture0 = picture; 00243 else 00244 source->picture1 = picture; 00245 cache->nb_attached++; 00246 00247 DDATAC(("attach ok (%s, %p), pos: %d", picture->picture_description->name, picture, cache->pos)); 00248 00249 return picture; 00250 }
|
|
Detach a picture of source.
Definition at line 258 of file e_mod_data_picture.c. References _picture_free(), DATA_PICTURE_LOCAL, DDATAC, and dEvianM. Referenced by _picture_cache_del_picture(), devian_source_detach(), and devian_source_picture_del(). 00259 { 00260 Picture_Cache *cache; 00261 Picture *picture = NULL; 00262 00263 cache = dEvianM->picture_cache; 00264 00265 if (!source) 00266 return; 00267 if (!part && (source->picture0)) 00268 { 00269 picture = source->picture0; 00270 } 00271 else 00272 { 00273 if (part && (source->picture1)) 00274 picture = source->picture1; 00275 else 00276 printf("BAD BAD BAD in cache detach\n"); 00277 } 00278 00279 if (!picture) 00280 return; 00281 00282 /* Detach source from picture */ 00283 picture->source = NULL; 00284 00285 /* Picture needs to be deleted ? */ 00286 if (picture->delete) 00287 { 00288 if (picture->from == DATA_PICTURE_LOCAL) 00289 _picture_free(picture, 1, 1); 00290 } 00291 00292 /* Detach picture from source */ 00293 if (!part && (source->picture0)) 00294 source->picture0 = NULL; 00295 else 00296 { 00297 if (part && (source->picture1)) 00298 source->picture1 = NULL; 00299 } 00300 00301 evas_object_hide(picture->picture); 00302 00303 cache->nb_attached--; 00304 00305 if (picture->picture_description) 00306 DDATAC(("detach ok (%s)", picture->picture_description->name)); 00307 else 00308 DDATAC(("detach ok (-null-)")); 00309 }
|
|
Init picture cache.
Definition at line 154 of file e_mod_data_picture.c. References _picture_cache_fill(), and dEvianM. Referenced by devian_devian_main_init(). 00155 { 00156 Picture_Cache *cache; 00157 00158 cache = E_NEW(Picture_Cache, 1); 00159 cache->pictures = NULL; 00160 cache->pos = -1; 00161 cache->nb_attached = 0; 00162 dEvianM->picture_cache = cache; 00163 00164 _picture_cache_fill(); 00165 00166 return 1; 00167 }
|
|
Shutdown picture cache.
Definition at line 172 of file e_mod_data_picture.c. References _picture_cache_del_picture(), and dEvianM. Referenced by devian_devian_main_shutdown(). 00173 { 00174 Picture_Cache *cache; 00175 Picture *picture; 00176 Evas_List *l; 00177 00178 cache = dEvianM->picture_cache; 00179 00180 if(!cache) 00181 return; 00182 00183 for(l = cache->pictures; l; l = evas_list_next(l)) 00184 { 00185 picture = evas_list_data(l); 00186 _picture_cache_del_picture(picture); 00187 } 00188 00189 evas_list_free(l); 00190 E_FREE(cache); 00191 cache = NULL; 00192 }
|
|
Get the name of a picture.
Definition at line 318 of file e_mod_data_picture.c. References DEVIAN_MAX_PATH. Referenced by _picture_list_local_add_dir(). 00319 { 00320 char name[DEVIAN_MAX_PATH]; 00321 int name_l; 00322 char *fichier; 00323 char *ext; 00324 int ext_l; 00325 00326 fichier = strrchr(path, '/') + 1; 00327 if(!fichier) 00328 return strdup(path); 00329 00330 ext = strrchr(path, '.'); 00331 if (!ext) 00332 return strdup(path); 00333 ext_l = strlen(ext); 00334 00335 name_l = strlen(fichier) - ext_l; 00336 00337 strncpy(name, fichier, name_l); 00338 name[name_l] = '\0'; 00339 00340 return (char *)evas_stringshare_add(name); 00341 }
|
|
Initialise the list of local pictures wich we can display. This function creates a list of pictures and generate thumbs for all pictures in pictures directories.
Definition at line 28 of file e_mod_data_picture.c. References _picture_list_local_add_dir(), _picture_list_local_popup_load_start(), _picture_list_local_popup_load_stop(), and dEvianM. Referenced by devian_data_picture_list_local_regen(), and devian_devian_main_init(). 00029 { 00030 E_Popup *popup; 00031 Picture_List_Local *list; 00032 00033 if (!dEvianM->picture_list_local) 00034 { 00035 list = E_NEW(Picture_List_Local, 1); 00036 list->pictures = NULL; 00037 list->nb_pictures_waiting = 0; 00038 dEvianM->picture_list_local = list; 00039 } 00040 else 00041 list = dEvianM->picture_list_local; 00042 00043 /* Load pictures */ 00044 popup = _picture_list_local_popup_load_start(); 00045 _picture_list_local_add_dir(e_module_dir_get(dEvianM->module), 0); 00046 _picture_list_local_add_dir(dEvianM->conf->sources_picture_data_import_dir, 00047 dEvianM->conf->sources_picture_data_import_recursive); 00048 _picture_list_local_popup_load_stop(popup); 00049 00050 if (dEvianM->conf->sources_picture_data_import_thumbs_warn && 00051 (list->nb_pictures_waiting > 2)) 00052 { 00053 char buf[4096]; 00054 dEvianM->conf->sources_picture_data_import_thumbs_warn = 0; 00055 snprintf(buf, sizeof(buf), 00056 _( 00057 "<hilight>Creating thumbs</hilight><br><br>" 00058 "%d pictures are being thumbed in a background task.<br>" 00059 "It can take a while, but after, loading will be faster :)<br><br>" 00060 "Each time wou will load pictures that haven't been loaded in devian before,<br>" 00061 "they will be thumbed" 00062 ), 00063 list->nb_pictures_waiting 00064 ); 00065 e_module_dialog_show(_("dEvian Module Information"), buf); 00066 return 0; 00067 } 00068 00069 return 0; 00070 }
|
|
This function regenerate the list of local pictures.
Definition at line 102 of file e_mod_data_picture.c. References _picture_free(), devian_data_picture_list_local_init(), and dEvianM. Referenced by _main_advanced_create_widgets(), and _main_basic_create_widgets(). 00103 { 00104 Picture_List_Local *list; 00105 Evas_List *l; 00106 Picture *picture; 00107 00108 list = dEvianM->picture_list_local; 00109 00110 if (!list) 00111 { 00112 devian_data_picture_list_local_init(); 00113 return; 00114 } 00115 00116 if (list->nb_pictures_waiting) 00117 { 00118 printf("WAIT ITS ALREADY RUNNING =)\n"); 00119 return; 00120 } 00121 00122 for (l=list->pictures; l; l=evas_list_next(l)) 00123 { 00124 picture = evas_list_data(l); 00125 _picture_free(picture, 1, 0); 00126 00127 /* 00128 { 00129 Evas_List *o; 00130 Picture *O; 00131 printf("\n"); 00132 for(o=list->pictures; o; o=evas_list_next(o)) 00133 { 00134 O = evas_list_data(o); 00135 printf("%s - ", O->picture_description->name); 00136 } 00137 printf("\n\n"); 00138 } 00139 */ 00140 00141 } 00142 //dEvianM->picture_list_local->pictures=l; 00143 00144 devian_data_picture_list_local_init(); 00145 }
|
|
Shutdown the list of local pictures. It deletes all pictures and free the list Definition at line 77 of file e_mod_data_picture.c. References _picture_free(), and dEvianM. Referenced by devian_devian_main_shutdown(). 00078 { 00079 Picture_List_Local *list; 00080 Evas_List *l; 00081 Picture *picture; 00082 00083 list = dEvianM->picture_list_local; 00084 00085 if (!list) 00086 return; 00087 00088 for (l=list->pictures; l; l=evas_list_next(l)) 00089 { 00090 picture = evas_list_data(l); 00091 _picture_free(picture, 1, 1); 00092 } 00093 00094 evas_list_free(l); 00095 E_FREE(list); 00096 dEvianM->picture_list_local=NULL; 00097 }
|
|
|
|
|