Maybe this is a bit saner. Maybe I should just give up and sleep.

SVN revision: 25901
This commit is contained in:
David Walter Seikel 2006-09-17 02:05:19 +00:00
parent 6bace96662
commit 3e2608760e
1 changed files with 60 additions and 50 deletions

View File

@ -218,13 +218,11 @@ e_app_new(const char *path, int scan_subdirs)
{
if (stat(a->path, &st) >= 0)
{
if(st.st_mtime > a->mtime)
{
e_object_free(E_OBJECT(a));
a = NULL;
stated = 1;
if (st.st_mtime > a->mtime)
e_app_fields_empty(a);
}
}
e_object_ref(E_OBJECT(a));
}
if (!a)
@ -233,13 +231,20 @@ e_app_new(const char *path, int scan_subdirs)
{
a = E_OBJECT_ALLOC(E_App, E_APP_TYPE, _e_app_free);
if (a)
{
/* no image for now */
a->image = NULL;
a->width = 0;
a->height = 0;
/* record the path */
a->path = evas_stringshare_add(path);
}
}
}
if ((a) && (a->path))
{
if (ecore_file_is_dir(a->path))
{
snprintf(buf, sizeof(buf), "%s/.directory.eap", path);
@ -247,10 +252,16 @@ e_app_new(const char *path, int scan_subdirs)
e_app_fields_fill(a, buf);
else
a->name = evas_stringshare_add(ecore_file_get_file(a->path));
if (scan_subdirs) e_app_subdir_scan(a, scan_subdirs);
if (scan_subdirs)
{
if (stated)
_e_app_subdir_rescan(a);
else
e_app_subdir_scan(a, scan_subdirs);
}
/* Don't monitor the all directory, all changes to that must go through e_app. */
if (strcmp(_e_apps_path_all, a->path) != 0)
if ((!stated) && (strcmp(_e_apps_path_all, a->path) != 0))
a->monitor = ecore_file_monitor_add(a->path, _e_app_cb_monitor, a);
}
else if (_e_app_is_eapp(path))
@ -263,11 +274,7 @@ e_app_new(const char *path, int scan_subdirs)
}
else
goto error;
}
else
{
return NULL;
}
/* Timestamp the cache, and no need to stat the file twice if the cache was stale. */
if ((stated) || (stat(a->path, &st) >= 0))
{
@ -279,15 +286,18 @@ e_app_new(const char *path, int scan_subdirs)
#endif
}
else
e_object_ref(E_OBJECT(a));
goto error;
return a;
error:
if (a)
{
if (a->monitor) ecore_file_monitor_del(a->monitor);
if (a->path) evas_stringshare_del(a->path);
e_app_fields_empty(a);
free(a);
}
return NULL;
}