Pass icon size as unsigned int.

SVN revision: 35490
This commit is contained in:
Sebastian Dransfeld 2008-08-14 20:48:41 +00:00
parent e52e71e475
commit bfb18778e2
6 changed files with 44 additions and 19 deletions

View File

@ -3,7 +3,7 @@
#define LOOPS 1000 #define LOOPS 1000
#define THEME "Tango" #define THEME "Tango"
#define SIZE "16x16" #define SIZE 16
#define ADDRESS_BOOK_NEW "address-book-new" #define ADDRESS_BOOK_NEW "address-book-new"
#define APPLICATION_EXIT "application-exit" #define APPLICATION_EXIT "application-exit"

View File

@ -8,8 +8,8 @@
#define PATH_MAX 4096 #define PATH_MAX 4096
#endif #endif
#define SIZE "128x128" #define SIZE 128
#define THEME "Tango" #define THEME "Human"
#define FREE(x) do { free(x); x = NULL; } while (0); #define FREE(x) do { free(x); x = NULL; } while (0);
static void ef_icon_theme_themes_find(const char *search_dir, static void ef_icon_theme_themes_find(const char *search_dir,
@ -262,6 +262,7 @@ const char *icons[] =
"accessories-text-editor", "accessories-text-editor",
"help-browser", "help-browser",
"multimedia-volume-control", "multimedia-volume-control",
#if 0
"preferences-desktop-accessibility", "preferences-desktop-accessibility",
"preferences-desktop-font", "preferences-desktop-font",
"preferences-desktop-keyboard", "preferences-desktop-keyboard",
@ -416,6 +417,7 @@ const char *icons[] =
"weather-showers-scattered", "weather-showers-scattered",
"weather-snow", "weather-snow",
"weather-storm", "weather-storm",
#endif
NULL NULL
}; };
@ -449,6 +451,7 @@ ef_cb_efreet_icon_match(void)
ef_icons_find(theme, themes, icon_hash); ef_icons_find(theme, themes, icon_hash);
ecore_list_destroy(themes); ecore_list_destroy(themes);
double start = ecore_time_get();
for (i = 0; icons[i] != NULL; i++) for (i = 0; icons[i] != NULL; i++)
{ {
char *path, *s; char *path, *s;
@ -457,11 +460,13 @@ ef_cb_efreet_icon_match(void)
if (!path) if (!path)
{ {
#if 0
if (ecore_hash_get(icon_hash, icons[i])) if (ecore_hash_get(icon_hash, icons[i]))
{ {
printf("NOT FOUND %s\n", icons[i]); printf("NOT FOUND %s\n", icons[i]);
ret = 0; ret = 0;
} }
#endif
continue; continue;
} }
@ -477,8 +482,32 @@ ef_cb_efreet_icon_match(void)
} }
free(path); free(path);
} }
printf("Time: %f\n", (ecore_time_get() - start));
ecore_hash_destroy(icon_hash); ecore_hash_destroy(icon_hash);
start = ecore_time_get();
for (i = 0; icons[i] != NULL; i++)
{
char *path, *s;
path = efreet_icon_path_find(THEME, icons[i], SIZE);
if (!path) continue;
s = strrchr(path, '.');
if (s) *s = '\0';
s = strrchr(path, '/');
if (s) s++;
if (s && strcmp(s, icons[i]))
{
printf("Name mismatch name (%s) vs ef (%s)\n", icons[i], s);
ret = 0;
}
free(path);
}
printf("Time: %f\n", (ecore_time_get() - start));
return ret; return ret;
} }

View File

@ -50,7 +50,7 @@ EAPI const char *efreet_mime_special_type_get(const char *file);
EAPI const char *efreet_mime_fallback_type_get(const char *file); EAPI const char *efreet_mime_fallback_type_get(const char *file);
EAPI char *efreet_mime_type_icon_get(const char *mime, const char *theme, EAPI char *efreet_mime_type_icon_get(const char *mime, const char *theme,
const char *size); unsigned int size);
/** /**
* @} * @}

View File

@ -331,25 +331,23 @@ efreet_icon_find_theme_check(const char *theme_name)
* @brief Retrives the path to the given icon. * @brief Retrives the path to the given icon.
*/ */
EAPI char * EAPI char *
efreet_icon_path_find(const char *theme_name, const char *icon, const char *size) efreet_icon_path_find(const char *theme_name, const char *icon, unsigned int size)
{ {
char *value = NULL; char *value = NULL;
Efreet_Icon_Theme *theme; Efreet_Icon_Theme *theme;
unsigned int real_size;
theme = efreet_icon_find_theme_check(theme_name); theme = efreet_icon_find_theme_check(theme_name);
real_size = atoi(size);
#ifdef SLOPPY_SPEC #ifdef SLOPPY_SPEC
{ {
char *tmp; char *tmp;
tmp = efreet_icon_remove_extension(icon); tmp = efreet_icon_remove_extension(icon);
value = efreet_icon_find_helper(theme, tmp, real_size); value = efreet_icon_find_helper(theme, tmp, size);
FREE(tmp); FREE(tmp);
} }
#else #else
value = efreet_icon_find_helper(theme, icon, real_size); value = efreet_icon_find_helper(theme, icon, size);
#endif #endif
/* we didn't find the icon in the theme or in the inherited directories /* we didn't find the icon in the theme or in the inherited directories
@ -374,15 +372,13 @@ efreet_icon_path_find(const char *theme_name, const char *icon, const char *size
*/ */
EAPI char * EAPI char *
efreet_icon_list_find(const char *theme_name, Ecore_List *icons, efreet_icon_list_find(const char *theme_name, Ecore_List *icons,
const char *size) unsigned int size)
{ {
const char *icon = NULL; const char *icon = NULL;
char *value = NULL; char *value = NULL;
Efreet_Icon_Theme *theme; Efreet_Icon_Theme *theme;
unsigned int real_size;
theme = efreet_icon_find_theme_check(theme_name); theme = efreet_icon_find_theme_check(theme_name);
real_size = atoi(size);
ecore_list_first_goto(icons); ecore_list_first_goto(icons);
#ifdef SLOPPY_SPEC #ifdef SLOPPY_SPEC
@ -395,11 +391,11 @@ efreet_icon_list_find(const char *theme_name, Ecore_List *icons,
while ((icon = ecore_list_next(icons))) while ((icon = ecore_list_next(icons)))
ecore_list_append(tmps, efreet_icon_remove_extension(icon)); ecore_list_append(tmps, efreet_icon_remove_extension(icon));
value = efreet_icon_list_find_helper(theme, tmps, real_size); value = efreet_icon_list_find_helper(theme, tmps, size);
ecore_list_destroy(tmps); ecore_list_destroy(tmps);
} }
#else #else
value = efreet_icon_list_find_helper(theme, icons, real_size); value = efreet_icon_list_find_helper(theme, icons, size);
#endif #endif
/* we didn't find the icons in the theme or in the inherited directories /* we didn't find the icons in the theme or in the inherited directories
@ -429,7 +425,7 @@ efreet_icon_list_find(const char *theme_name, Ecore_List *icons,
* @brief Retrieves all of the information about the given icon. * @brief Retrieves all of the information about the given icon.
*/ */
EAPI Efreet_Icon * EAPI Efreet_Icon *
efreet_icon_find(const char *theme_name, const char *icon, const char *size) efreet_icon_find(const char *theme_name, const char *icon, unsigned int size)
{ {
char *path; char *path;

View File

@ -166,13 +166,13 @@ EAPI Ecore_List *efreet_icon_theme_list_get(void);
EAPI Efreet_Icon_Theme *efreet_icon_theme_find(const char *theme_name); EAPI Efreet_Icon_Theme *efreet_icon_theme_find(const char *theme_name);
EAPI Efreet_Icon *efreet_icon_find(const char *theme_name, EAPI Efreet_Icon *efreet_icon_find(const char *theme_name,
const char *icon, const char *icon,
const char *size); unsigned int size);
EAPI char *efreet_icon_list_find(const char *theme_name, EAPI char *efreet_icon_list_find(const char *theme_name,
Ecore_List *icons, Ecore_List *icons,
const char *size); unsigned int size);
EAPI char *efreet_icon_path_find(const char *theme_name, EAPI char *efreet_icon_path_find(const char *theme_name,
const char *icon, const char *icon,
const char *size); unsigned int size);
EAPI void efreet_icon_free(Efreet_Icon *icon); EAPI void efreet_icon_free(Efreet_Icon *icon);
/** /**

View File

@ -175,7 +175,7 @@ efreet_mime_type_get(const char *file)
* @brief Retreive the mime type icon for a file * @brief Retreive the mime type icon for a file
*/ */
EAPI char * EAPI char *
efreet_mime_type_icon_get(const char *mime, const char *theme, const char *size) efreet_mime_type_icon_get(const char *mime, const char *theme, unsigned int size)
{ {
char *icon = NULL; char *icon = NULL;
Ecore_List *icons = NULL; Ecore_List *icons = NULL;