Main Page | Data Structures | Directories | File List | Data Fields | Globals

e_mod_source_picture.h File Reference

Go to the source code of this file.

Data Structures

struct  _Source_Picture

Defines

#define SOURCE_PICTURE_TIMER_DEFAULT   20
#define SOURCE_PICTURE_TIMER_MIN   3
#define SOURCE_PICTURE_SET_BG_PURGE_DEFAULT   1

Functions

int devian_source_picture_add (dEvian *devian)
void devian_source_picture_del (Source_Picture *source)
int devian_source_picture_change (Source_Picture *source)
int devian_source_picture_set_bg (Source_Picture *source)
int devian_source_picture_viewer (Source_Picture *source)
int devian_source_picture_evas_object_get (dEvian *devian, Evas_Object **picture0, Evas_Object **picture1)
int devian_source_picture_original_size_get (Source_Picture *source, int part, int *w, int *h)
void devian_source_picture_dialog_infos (Source_Picture *source)
char * devian_source_picture_name_get (Source_Picture *source, int part)
void devian_source_picture_timer_change_set (Source_Picture *source, int active, int time)


Define Documentation

#define SOURCE_PICTURE_SET_BG_PURGE_DEFAULT   1
 

Definition at line 13 of file e_mod_source_picture.h.

Referenced by devian_config_main_new().

#define SOURCE_PICTURE_TIMER_DEFAULT   20
 

Definition at line 11 of file e_mod_source_picture.h.

Referenced by devian_config_devian_new().

#define SOURCE_PICTURE_TIMER_MIN   3
 

Definition at line 12 of file e_mod_source_picture.h.

Referenced by devian_source_picture_timer_change_set().


Function Documentation

int devian_source_picture_add dEvian *  devian  ) 
 

Definition at line 14 of file e_mod_source_picture.c.

References devian_data_picture_cache_attach(), devian_devian_set_name(), devian_source_picture_del(), devian_source_picture_timer_change_set(), DSOURCE, and SOURCE_PICTURE.

Referenced by devian_source_change().

00015 {
00016   Source_Picture *source;
00017 
00018   DSOURCE(("dEvian: Source picture creation START\n"));
00019 
00020   source = E_NEW(Source_Picture, 1);
00021   source->devian = devian;
00022   
00023   /* Set new name for devian */
00024   devian_devian_set_name(devian, SOURCE_PICTURE, NULL);
00025 
00026   /* Attach picture */
00027   if ( !devian_data_picture_cache_attach(source, 0) )
00028     {
00029       devian_source_picture_del(source);
00030       return 1;
00031     }
00032 
00033   /* Timer to change picture */
00034   if (devian->conf->picture_timer_active)
00035     devian_source_picture_timer_change_set(source, 1, 0);
00036 
00037   source->was_set_bg = NULL;
00038 
00039   devian->conf->source_type = SOURCE_PICTURE;
00040   devian->source = source;
00041 
00042   DSOURCE(("dEvian: Source picture creation OK\n"));
00043 
00044   return 0;
00045 }

int devian_source_picture_change Source_Picture *  source  ) 
 

Definition at line 75 of file e_mod_source_picture.c.

References devian_container_edje_part_change(), devian_container_edje_part_get(), devian_container_resize_auto(), and devian_data_picture_cache_attach().

Referenced by _cb_timer_picture_change(), and devian_source_refresh().

00076 {
00077   int old_part;
00078 
00079   old_part = devian_container_edje_part_get(source->devian);
00080 
00081   if (!devian_data_picture_cache_attach(source,
00082           !old_part))
00083     return 0;
00084 
00085   if(!devian_container_edje_part_change(source->devian))
00086       return 0;
00087 
00088   devian_container_resize_auto(source->devian);
00089             
00090   return 1;
00091 }

void devian_source_picture_del Source_Picture *  source  ) 
 

Definition at line 47 of file e_mod_source_picture.c.

References _was_set_bg_purge(), devian_data_picture_cache_detach(), dEvianM, DSOURCE, and SOURCE_NO.

Referenced by _devian_source_del(), and devian_source_picture_add().

00048 {
00049   devian_data_picture_cache_detach(source, 0);
00050   devian_data_picture_cache_detach(source, 1);
00051 
00052   if (source->timer)
00053     {
00054       ecore_timer_del(source->timer);
00055     }
00056 
00057   if (dEvianM->conf->sources_picture_set_bg_purge)
00058     _was_set_bg_purge(source, 0);
00059 
00060   source->devian->source = NULL;
00061   source->devian->conf->source_type = SOURCE_NO;
00062 
00063   E_FREE(source);
00064 
00065   DSOURCE(("dEvian: Source deleted\n"));
00066 
00067 }

void devian_source_picture_dialog_infos Source_Picture *  source  ) 
 

Definition at line 308 of file e_mod_source_picture.c.

References devian_container_edje_part_get(), devian_source_picture_name_get(), and dEvianM.

Referenced by devian_source_dialog_infos().

00309 {
00310   E_Dialog *dia;
00311   char buf[4096];
00312   char *path;
00313   int edje_part;
00314 
00315   edje_part = devian_container_edje_part_get(source->devian);
00316   if(!edje_part)
00317     path = source->picture0->path;
00318   else
00319     path = source->picture1->path;
00320 
00321   dia = e_dialog_new(dEvianM->container);
00322   if (!dia)
00323     return;
00324 
00325   snprintf( buf, 4096,
00326       "<hilight>Informations</hilight><br>"
00327       "Picture name : %s<br>"
00328       "Picture path : %s<br>"
00329       "<br>"
00330       "Total pictures in local list : %d",
00331       devian_source_picture_name_get(source, edje_part),
00332       path,
00333       evas_list_count(dEvianM->picture_list_local->pictures) );
00334   e_dialog_title_set(dia, "dEvian Module - Picture Informations");
00335   e_dialog_icon_set(dia, "enlightenment/e", 64);
00336   e_dialog_text_set(dia, buf);
00337   e_dialog_button_add(dia, _("Ok"), NULL, NULL, NULL);
00338   e_win_centered_set(dia->win, 1);
00339   e_dialog_show(dia);
00340 
00341 }

int devian_source_picture_evas_object_get dEvian *  devian,
Evas_Object **  picture0,
Evas_Object **  picture1
 

Definition at line 256 of file e_mod_source_picture.c.

Referenced by devian_source_evas_object_get().

00259 {
00260   Source_Picture *source;
00261 
00262   source = (Source_Picture *)devian->source;
00263 
00264   if ((!source->picture0) && (!source->picture1))
00265     return 0;
00266 
00267   if (source->picture0)
00268     *picture0 = source->picture0->picture;
00269   else
00270     *picture0 = NULL;
00271   if (source->picture1)
00272     *picture1 = source->picture1->picture;
00273   else
00274     *picture1 = NULL;
00275 
00276   return 1;
00277 }

char* devian_source_picture_name_get Source_Picture *  source,
int  part
 

Definition at line 343 of file e_mod_source_picture.c.

References devian_container_edje_part_get().

Referenced by devian_source_name_get(), and devian_source_picture_dialog_infos().

00344 {
00345   char *name;
00346   name = NULL;
00347 
00348   if (part == -1)
00349     {
00350       part = devian_container_edje_part_get(source->devian);
00351     }
00352 
00353   if (!part && source->picture0)
00354     name = source->picture0->picture_description->name;
00355   
00356   if (part && source->picture1)
00357     name = source->picture1->picture_description->name;
00358   
00359   return name;
00360 }

int devian_source_picture_original_size_get Source_Picture *  source,
int  part,
int *  w,
int *  h
 

Definition at line 279 of file e_mod_source_picture.c.

References devian_container_edje_part_get().

Referenced by devian_source_original_size_get().

00281 {
00282   if (!source)
00283     return 0;
00284 
00285   if (part == -1)
00286     {
00287       if ( (part = devian_container_edje_part_get(source->devian)) == -1 )
00288   return 0;
00289     }
00290 
00291   if (!part && source->picture0)
00292     {
00293       *w = source->picture0->original_w;
00294       *h = source->picture0->original_h;
00295       return 1;
00296     }
00297 
00298   if (part && source->picture1)
00299     {
00300       *w = source->picture1->original_w;
00301       *h = source->picture1->original_h;
00302       return 1;
00303     }
00304 
00305   return 0;
00306 }

int devian_source_picture_set_bg Source_Picture *  source  ) 
 

Definition at line 93 of file e_mod_source_picture.c.

References _was_set_bg_add(), _was_set_bg_purge(), devian_container_edje_part_get(), dEvianM, and DSOURCE.

Referenced by devian_source_set_bg().

00094 {
00095   E_Zone *zone;
00096   char *file = NULL;
00097   char *name;
00098   char buf[4096];
00099 
00100   zone = e_zone_current_get(dEvianM->container);
00101   if (!zone)
00102     return 0;
00103 
00104   if (!devian_container_edje_part_get(source->devian))
00105     {
00106       if (source->picture0)
00107   {
00108     file = source->picture0->path;
00109     name = source->picture0->picture_description->name;
00110   }
00111     }
00112   else
00113     {
00114       if (source->picture1)
00115   {
00116     file = source->picture1->path;
00117     name = source->picture1->picture_description->name;
00118   }
00119       else
00120   return 0;
00121     }
00122   if (!file)
00123     return 0;
00124 
00125   if (dEvianM->conf->sources_picture_set_bg_purge)
00126     _was_set_bg_purge(source, 1);
00127 
00128   if (!ecore_file_exists(file))
00129     {
00130       snprintf(buf, sizeof(buf),
00131                _(
00132                  "<hilight>File %s doesnt exists.</hilight><br><br>"
00133      "This file is in dEvian's picture list, but it seems you removed it from the disk<br>"
00134      "It cant be set as background, sorry."
00135                  ),
00136                file
00137                );
00138       e_module_dialog_show(_("dEvian Module Error"), buf);
00139       return 0;
00140     }
00141 
00142   if (!strstr(file, ".edj"))
00143     {
00144       if (ecore_file_app_installed("e17setroot"))
00145   {
00146     Ecore_Exe *exe;
00147     
00148     snprintf(buf, 4096, "e17setroot -s %s", file);
00149     DSOURCE(("Set background with %s", buf));
00150     exe = ecore_exe_run(buf, NULL);
00151     if (exe)
00152       {
00153         ecore_exe_free(exe);
00154         if (dEvianM->conf->sources_picture_set_bg_purge)
00155     _was_set_bg_add(source, name);
00156       }
00157   }
00158       else
00159   {
00160     snprintf(buf, sizeof(buf),
00161        _(
00162          "<hilight>e17setroot needed</hilight><br><br>"
00163          "%s is not an edje file !<br>"
00164          "dEvian need e17setroot util from e_utils package to set you're picture as background"
00165          "Please install it and try again"
00166          ),
00167        file
00168        );
00169     e_module_dialog_show(_("dEvian Module Error"), buf);
00170     return 0;
00171   }
00172     }
00173   else
00174     { 
00175       DSOURCE(("Set edje background %s", file));
00176 
00177       if ((zone->container->num == 0) && (zone->num == 0) &&
00178     (zone->desk_x_current == 0) && (zone->desk_y_current == 0))
00179   {
00180     e_lib_background_set(strdup(file));
00181   }
00182       else
00183   {
00184     e_lib_desktop_background_del(zone->container->num, zone->num, zone->desk_x_current, zone->desk_y_current);
00185     e_lib_desktop_background_add(zone->container->num, zone->num, zone->desk_x_current, zone->desk_y_current, strdup(file));
00186   }
00187     }
00188 
00189   return 1;
00190 }

void devian_source_picture_timer_change_set Source_Picture *  source,
int  active,
int  time
 

Definition at line 362 of file e_mod_source_picture.c.

References _cb_timer_picture_change(), devian_container_edje_part_change_set(), and SOURCE_PICTURE_TIMER_MIN.

Referenced by _devian_advanced_apply_data(), devian_source_picture_add(), and devian_source_timer_change_set().

00363 {
00364   if (time && (time < SOURCE_PICTURE_TIMER_MIN))
00365     return;
00366  
00367   source->devian->conf->picture_timer_active = active;
00368   if (!time)
00369     time = source->devian->conf->picture_timer_s;
00370   else
00371     source->devian->conf->picture_timer_s = time;
00372 
00373   if (!active)
00374     {
00375       if (source->timer)
00376   {
00377     devian_container_edje_part_change_set(source->devian, 0);
00378     ecore_timer_del(source->timer);
00379     source->timer = NULL;
00380   }
00381       return;
00382     }
00383 
00384   if (source->timer)
00385     ecore_timer_del(source->timer);
00386   source->timer = ecore_timer_add(time,
00387           _cb_timer_picture_change,
00388           source);
00389   devian_container_edje_part_change_set(source->devian, 1);
00390 }

int devian_source_picture_viewer Source_Picture *  source  ) 
 

Definition at line 192 of file e_mod_source_picture.c.

References devian_container_edje_part_get(), and DSOURCE.

Referenced by devian_source_viewer().

00193 {
00194   char *file;
00195   char buf[4096];
00196 
00197   if (!devian_container_edje_part_get(source->devian))
00198     {
00199       if (source->picture0)
00200   {
00201     file = source->picture0->path;
00202   }
00203       else
00204   return 0;
00205     }
00206   else
00207     {
00208       if (source->picture1)
00209   {
00210     file = source->picture1->path;
00211   }
00212       else
00213   return 0;
00214     }
00215   if (!file)
00216     return 0;
00217   if (!ecore_file_exists(file))
00218     {
00219       snprintf(buf, sizeof(buf),
00220                _(
00221                  "<hilight>File %s doesnt exists.</hilight><br><br>"
00222      "This file is in dEvian's picture list, but it seems you removed it from the disk<br>"
00223      "It cant be set opened in a viewer, sorry."
00224                  ),
00225                file
00226                );
00227       e_module_dialog_show(_("dEvian Module Error"), buf);
00228       return 0;
00229     }  
00230   
00231   if (ecore_file_app_installed("exhibit"))
00232     {
00233       Ecore_Exe *exe;
00234       
00235       snprintf(buf, 4096, "exhibit %s", file);
00236       DSOURCE(("Viewer: %s", buf));
00237       exe = ecore_exe_run(buf, NULL);
00238       if (exe)
00239   ecore_exe_free(exe);
00240     }
00241   else
00242     {
00243       snprintf(buf, sizeof(buf),
00244          _(
00245      "<hilight>exhibit not found !</hilight><br><br>"
00246      "Exhibit in an image viewer writen with Enlightenment Librairies. You can get it on E cvs"
00247      )
00248          );
00249       e_module_dialog_show(_("dEvian Module Error"), buf);
00250       return 0;
00251     }
00252 
00253   return 1;
00254 }


Generated on Fri Jan 6 02:26:26 2006 for dEvian by  doxygen 1.4.4