forked from enlightenment/efl
Frre up ram. Re organised a little to make freeing ram easier.
SVN revision: 26012
This commit is contained in:
parent
05cd95e44d
commit
fb74f26347
|
@ -75,10 +75,7 @@ ecore_desktop_icon_find(const char *icon, const char *icon_size, const char *ico
|
||||||
|
|
||||||
dir = _ecore_desktop_icon_find0(icn, icon_size, icon_theme);
|
dir = _ecore_desktop_icon_find0(icn, icon_size, icon_theme);
|
||||||
if (dir)
|
if (dir)
|
||||||
{
|
break;
|
||||||
// dir = strdup(dir);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ecore_list_destroy(icons);
|
ecore_list_destroy(icons);
|
||||||
|
|
||||||
|
@ -124,7 +121,7 @@ _ecore_desktop_icon_find0(const char *icon, const char *icon_size, const char *i
|
||||||
|
|
||||||
char icn[PATH_MAX], path[PATH_MAX];
|
char icn[PATH_MAX], path[PATH_MAX];
|
||||||
char *theme_path;
|
char *theme_path;
|
||||||
const char *found;
|
char *found = NULL;
|
||||||
|
|
||||||
if ((icon == NULL) || (icon[0] == '\0'))
|
if ((icon == NULL) || (icon[0] == '\0'))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -180,7 +177,7 @@ _ecore_desktop_icon_find0(const char *icon, const char *icon_size, const char *i
|
||||||
int wanted_size;
|
int wanted_size;
|
||||||
int minimal_size = INT_MAX;
|
int minimal_size = INT_MAX;
|
||||||
int i;
|
int i;
|
||||||
const char *closest = NULL;
|
char *closest = NULL;
|
||||||
char *directory;
|
char *directory;
|
||||||
|
|
||||||
wanted_size = atoi(icon_size);
|
wanted_size = atoi(icon_size);
|
||||||
|
@ -309,12 +306,8 @@ _ecore_desktop_icon_find0(const char *icon, const char *icon_size, const char *i
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
if (match) /* If there is a match in sizes, return the icon. */
|
if (match) /* If there is a match in sizes, return the icon. */
|
||||||
{
|
break;
|
||||||
ecore_list_destroy(directory_paths);
|
else if (result_size < minimal_size) /* While we are here, figure out our next fallback strategy. */
|
||||||
free(theme_path);
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
if (result_size < minimal_size) /* While we are here, figure out our next fallback strategy. */
|
|
||||||
{
|
{
|
||||||
minimal_size =
|
minimal_size =
|
||||||
result_size;
|
result_size;
|
||||||
|
@ -322,79 +315,70 @@ _ecore_desktop_icon_find0(const char *icon, const char *icon_size, const char *i
|
||||||
closest = found;
|
closest = found;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
free(found);
|
{
|
||||||
|
free(found);
|
||||||
|
found = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} /* if (size) */
|
||||||
}
|
} /* if (sub_group) */
|
||||||
|
if (found)
|
||||||
|
break;
|
||||||
} /* while ((directory = ecore_list_next(directory_paths)) != NULL) */
|
} /* while ((directory = ecore_list_next(directory_paths)) != NULL) */
|
||||||
|
|
||||||
/* Fall back strategy #1, look for closest size in this theme. */
|
if (!found)
|
||||||
if (closest)
|
{
|
||||||
{
|
/* Fall back strategy #1, look for closest size in this theme. */
|
||||||
ecore_list_destroy(directory_paths);
|
found = closest;
|
||||||
free(theme_path);
|
|
||||||
return closest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fall back strategy #2, Try again with the parent theme. */
|
/* Fall back strategy #2, Try again with the parent theme. */
|
||||||
if ((inherits) && (inherits[0] != '\0')
|
if ((!found) && (inherits) && (inherits[0] != '\0')
|
||||||
&& (strcmp(icon_theme, "hicolor") != 0))
|
&& (strcmp(icon_theme, "hicolor") != 0))
|
||||||
{
|
{
|
||||||
found =
|
found = (char *)
|
||||||
_ecore_desktop_icon_find0(icon, icon_size,
|
_ecore_desktop_icon_find0(icon, icon_size,
|
||||||
inherits);
|
inherits);
|
||||||
if (found != NULL)
|
}
|
||||||
{
|
|
||||||
ecore_list_destroy(directory_paths);
|
|
||||||
free(theme_path);
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fall back strategy #3, Try the default hicolor theme. */
|
/* Fall back strategy #3, Try the default hicolor theme. */
|
||||||
if ((!((inherits) && (inherits[0] != '\0')))
|
if ((!found) && (!((inherits) && (inherits[0] != '\0')))
|
||||||
&& (strcmp(icon_theme, "hicolor") != 0))
|
&& (strcmp(icon_theme, "hicolor") != 0))
|
||||||
{
|
{
|
||||||
found =
|
found = (char *)
|
||||||
_ecore_desktop_icon_find0(icon, icon_size,
|
_ecore_desktop_icon_find0(icon, icon_size,
|
||||||
"hicolor");
|
"hicolor");
|
||||||
if (found != NULL)
|
}
|
||||||
{
|
|
||||||
ecore_list_destroy(directory_paths);
|
|
||||||
free(theme_path);
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fall back strategy #4, Just search in the base of the icon directories. */
|
if (!found)
|
||||||
for (i = 0; ext[i] != NULL; i++)
|
{
|
||||||
{
|
/* Fall back strategy #4, Just search in the base of the icon directories. */
|
||||||
snprintf(path, PATH_MAX, "%s%s", icon, ext[i]);
|
for (i = 0; ext[i] != NULL; i++)
|
||||||
|
{
|
||||||
|
snprintf(path, PATH_MAX, "%s%s", icon, ext[i]);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("FDO icon = %s\n", path);
|
printf("FDO icon = %s\n", path);
|
||||||
#endif
|
#endif
|
||||||
found =
|
found =
|
||||||
ecore_desktop_paths_file_find
|
ecore_desktop_paths_file_find
|
||||||
(ecore_desktop_paths_icons, path, 0, NULL,
|
(ecore_desktop_paths_icons, path, 0, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
if (found)
|
if (found)
|
||||||
{
|
break;
|
||||||
ecore_list_destroy(directory_paths);
|
}
|
||||||
free(theme_path);
|
}
|
||||||
return found;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
ecore_list_destroy(directory_paths);
|
ecore_list_destroy(directory_paths);
|
||||||
}
|
} /* if (directory_paths) */
|
||||||
}
|
} /* if (directories) */
|
||||||
}
|
} /* if (icon_group) */
|
||||||
}
|
ecore_hash_destroy(theme);
|
||||||
|
} /* */
|
||||||
free(theme_path);
|
free(theme_path);
|
||||||
}
|
} /* if (theme_path) */
|
||||||
|
|
||||||
return NULL;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue