forked from enlightenment/enlightenment
Maybe this is a bit saner. Maybe I should just give up and sleep.
SVN revision: 25901
This commit is contained in:
parent
6bace96662
commit
3e2608760e
110
src/bin/e_apps.c
110
src/bin/e_apps.c
|
@ -217,14 +217,12 @@ e_app_new(const char *path, int scan_subdirs)
|
||||||
if (a)
|
if (a)
|
||||||
{
|
{
|
||||||
if (stat(a->path, &st) >= 0)
|
if (stat(a->path, &st) >= 0)
|
||||||
{
|
|
||||||
if(st.st_mtime > a->mtime)
|
|
||||||
{
|
{
|
||||||
e_object_free(E_OBJECT(a));
|
|
||||||
a = NULL;
|
|
||||||
stated = 1;
|
stated = 1;
|
||||||
|
if (st.st_mtime > a->mtime)
|
||||||
|
e_app_fields_empty(a);
|
||||||
}
|
}
|
||||||
}
|
e_object_ref(E_OBJECT(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!a)
|
if (!a)
|
||||||
|
@ -233,61 +231,73 @@ e_app_new(const char *path, int scan_subdirs)
|
||||||
{
|
{
|
||||||
a = E_OBJECT_ALLOC(E_App, E_APP_TYPE, _e_app_free);
|
a = E_OBJECT_ALLOC(E_App, E_APP_TYPE, _e_app_free);
|
||||||
|
|
||||||
/* no image for now */
|
if (a)
|
||||||
a->image = NULL;
|
{
|
||||||
a->width = 0;
|
/* no image for now */
|
||||||
a->height = 0;
|
a->image = NULL;
|
||||||
/* record the path */
|
a->width = 0;
|
||||||
a->path = evas_stringshare_add(path);
|
a->height = 0;
|
||||||
|
/* record the path */
|
||||||
if (ecore_file_is_dir(a->path))
|
a->path = evas_stringshare_add(path);
|
||||||
{
|
}
|
||||||
snprintf(buf, sizeof(buf), "%s/.directory.eap", path);
|
}
|
||||||
if (ecore_file_exists(buf))
|
}
|
||||||
e_app_fields_fill(a, buf);
|
|
||||||
else
|
if ((a) && (a->path))
|
||||||
a->name = evas_stringshare_add(ecore_file_get_file(a->path));
|
{
|
||||||
if (scan_subdirs) e_app_subdir_scan(a, scan_subdirs);
|
if (ecore_file_is_dir(a->path))
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s/.directory.eap", path);
|
||||||
|
if (ecore_file_exists(buf))
|
||||||
|
e_app_fields_fill(a, buf);
|
||||||
|
else
|
||||||
|
a->name = evas_stringshare_add(ecore_file_get_file(a->path));
|
||||||
|
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. */
|
/* 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);
|
a->monitor = ecore_file_monitor_add(a->path, _e_app_cb_monitor, a);
|
||||||
}
|
}
|
||||||
else if (_e_app_is_eapp(path))
|
else if (_e_app_is_eapp(path))
|
||||||
{
|
{
|
||||||
e_app_fields_fill(a, path);
|
e_app_fields_fill(a, path);
|
||||||
|
|
||||||
/* no exe field.. not valid. drop it */
|
/* no exe field.. not valid. drop it */
|
||||||
// if (!_e_app_exe_valid_get(a->exe))
|
// if (!_e_app_exe_valid_get(a->exe))
|
||||||
// goto error;
|
// goto error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
else
|
/* Timestamp the cache, and no need to stat the file twice if the cache was stale. */
|
||||||
{
|
if ((stated) || (stat(a->path, &st) >= 0))
|
||||||
return NULL;
|
{
|
||||||
}
|
a->mtime = st.st_mtime;
|
||||||
/* Timestamp the cache, and no need to stat the file twice if the cache was stale. */
|
stated = 1;
|
||||||
if ((stated) || (stat(a->path, &st) >= 0))
|
}
|
||||||
{
|
|
||||||
a->mtime = st.st_mtime;
|
|
||||||
stated = 1;
|
|
||||||
}
|
|
||||||
#if ! NO_APP_LIST
|
#if ! NO_APP_LIST
|
||||||
_e_apps_list = evas_list_prepend(_e_apps_list, a);
|
_e_apps_list = evas_list_prepend(_e_apps_list, a);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
e_object_ref(E_OBJECT(a));
|
goto error;
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (a->monitor) ecore_file_monitor_del(a->monitor);
|
if (a)
|
||||||
if (a->path) evas_stringshare_del(a->path);
|
{
|
||||||
e_app_fields_empty(a);
|
if (a->monitor) ecore_file_monitor_del(a->monitor);
|
||||||
free(a);
|
if (a->path) evas_stringshare_del(a->path);
|
||||||
|
e_app_fields_empty(a);
|
||||||
|
free(a);
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue