Formatting

SVN revision: 45865
This commit is contained in:
Sebastian Dransfeld 2010-02-04 09:12:35 +00:00
parent 82d51bffd7
commit 0423e1ea99
11 changed files with 346 additions and 346 deletions

View File

@ -38,42 +38,42 @@ efreet_init(void)
{
printf("Efreet could create a general log domain.\n");
goto shutdown_eina;
goto shutdown_eina;
}
if (!efreet_base_init())
goto unregister_log_domain;
goto unregister_log_domain;
if (!efreet_xml_init())
goto shutdown_efreet_base;
goto shutdown_efreet_base;
if (!efreet_icon_init())
goto shutdown_efreet_xml;
goto shutdown_efreet_xml;
if (!efreet_ini_init())
goto shutdown_efreet_icon;
goto shutdown_efreet_icon;
if (!efreet_desktop_init())
goto shutdown_efreet_ini;
goto shutdown_efreet_ini;
if (!efreet_menu_init())
goto shutdown_efreet_desktop;
goto shutdown_efreet_desktop;
return _efreet_init_count;
shutdown_efreet_desktop:
shutdown_efreet_desktop:
efreet_desktop_shutdown();
shutdown_efreet_ini:
shutdown_efreet_ini:
efreet_ini_shutdown();
shutdown_efreet_icon:
shutdown_efreet_icon:
efreet_icon_shutdown();
shutdown_efreet_xml:
shutdown_efreet_xml:
efreet_xml_shutdown();
shutdown_efreet_base:
shutdown_efreet_base:
efreet_base_shutdown();
unregister_log_domain:
unregister_log_domain:
eina_log_domain_unregister(_efreet_log_domain_global);
shutdown_eina:
shutdown_eina:
eina_shutdown();
return --_efreet_init_count;
@ -89,7 +89,7 @@ EAPI int
efreet_shutdown(void)
{
if (--_efreet_init_count != 0)
return _efreet_init_count;
return _efreet_init_count;
efreet_menu_shutdown();
efreet_desktop_shutdown();

View File

@ -47,8 +47,8 @@ efreet_base_init(void)
_efreet_base_log_dom = eina_log_domain_register("Efreet_base", EFREET_DEFAULT_LOG_COLOR);
if (_efreet_base_log_dom < 0)
{
ERROR("Efreet: Could not create a log domain for efreet_base.\n");
return 0;
ERROR("Efreet: Could not create a log domain for efreet_base.\n");
return 0;
}
return 1;
}
@ -243,7 +243,7 @@ efreet_dirs_get(const char *key, const char *fallback)
p = strchr(s, EFREET_PATH_SEP);
}
if (!eina_list_search_unsorted(dirs, EINA_COMPARE_CB(strcmp), s))
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(s));
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(s));
FREE(tmp);
return dirs;

View File

@ -15,47 +15,47 @@ static Eina_Hash *icon_cache = NULL;
static void
path_free(const char *path)
{
if (path == NON_EXISTING) return;
eina_stringshare_del(path);
if (path == NON_EXISTING) return;
eina_stringshare_del(path);
}
static void
icon_cache_add(void)
{
if (icon_cache) return;
icon_cache = eina_hash_string_superfast_new(EINA_FREE_CB(path_free));
if (icon_cache) return;
icon_cache = eina_hash_string_superfast_new(EINA_FREE_CB(path_free));
}
void
efreet_cache_clear(void)
{
if (!icon_cache) return;
IF_FREE_HASH(icon_cache);
icon_cache = NULL;
if (!icon_cache) return;
IF_FREE_HASH(icon_cache);
icon_cache = NULL;
}
const char *
efreet_icon_hash_get(const char *theme_name, const char *icon, int size)
{
const char *file;
char buf[4096];
const char *file;
char buf[4096];
if (!icon_cache) return NULL;
snprintf(buf, sizeof(buf), "%s/::/%s/::/%i", theme_name, icon, size);
file = eina_hash_find(icon_cache, buf);
return file;
if (!icon_cache) return NULL;
snprintf(buf, sizeof(buf), "%s/::/%s/::/%i", theme_name, icon, size);
file = eina_hash_find(icon_cache, buf);
return file;
}
void
efreet_icon_hash_put(const char *theme_name, const char *icon, int size, const char *file)
{
char buf[4096];
char buf[4096];
icon_cache_add();
if (!icon_cache) return;
snprintf(buf, sizeof(buf), "%s/::/%s/::/%i", theme_name, icon, size);
if (file == NON_EXISTING)
eina_hash_add(icon_cache, buf, (void *)NON_EXISTING);
else if (file)
eina_hash_add(icon_cache, buf, (void *)eina_stringshare_add(file));
icon_cache_add();
if (!icon_cache) return;
snprintf(buf, sizeof(buf), "%s/::/%s/::/%i", theme_name, icon, size);
if (file == NON_EXISTING)
eina_hash_add(icon_cache, buf, (void *)NON_EXISTING);
else if (file)
eina_hash_add(icon_cache, buf, (void *)eina_stringshare_add(file));
}

View File

@ -87,13 +87,13 @@ static int efreet_desktop_generic_fields_parse(Efreet_Desktop *desktop,
static void efreet_desktop_generic_fields_save(Efreet_Desktop *desktop,
Efreet_Ini *ini);
static Eina_Bool efreet_desktop_x_fields_parse(const Eina_Hash *hash,
const void *key,
void *data,
void *fdata);
const void *key,
void *data,
void *fdata);
static Eina_Bool efreet_desktop_x_fields_save(const Eina_Hash *hash,
const void *key,
void *value,
void *fdata);
const void *key,
void *value,
void *fdata);
static int efreet_desktop_environment_check(Efreet_Ini *ini);
static char *efreet_string_append(char *dest, int *size,
int *len, const char *src);
@ -144,8 +144,8 @@ efreet_desktop_init(void)
_efreet_desktop_log_dom = eina_log_domain_register("Efreet_desktop", EFREET_DEFAULT_LOG_COLOR);
if (_efreet_desktop_log_dom < 0)
{
ERROR("Efreet: Could not create a log domain for Efreet_desktop");
return 0;
ERROR("Efreet: Could not create a log domain for Efreet_desktop");
return 0;
}
if (!ecore_file_init())
{
@ -206,7 +206,7 @@ efreet_desktop_cache_check(Efreet_Desktop *desktop)
/* have we modified this file since we last read it in? */
if ((desktop->cache_flush != cache_flush) ||
(ecore_file_mod_time(desktop->orig_path) != desktop->load_time))
return 0;
return 0;
return 1;
}
@ -370,7 +370,7 @@ efreet_desktop_read(Efreet_Desktop *desktop)
if (!error && !efreet_desktop_environment_check(ini)) error = 1;
if (!error && !efreet_desktop_generic_fields_parse(desktop, ini)) error = 1;
if (!error)
eina_hash_foreach(ini->section, efreet_desktop_x_fields_parse, desktop);
eina_hash_foreach(ini->section, efreet_desktop_x_fields_parse, desktop);
efreet_ini_free(ini);
@ -528,7 +528,7 @@ efreet_desktop_free(Efreet_Desktop *desktop)
if (desktop->ref > 0) return;
if (desktop->cached && efreet_desktop_cache)
eina_hash_del(efreet_desktop_cache, desktop->orig_path, NULL);
eina_hash_del(efreet_desktop_cache, desktop->orig_path, NULL);
IF_FREE(desktop->orig_path);
@ -1037,7 +1037,7 @@ efreet_desktop_generic_fields_save(Efreet_Desktop *desktop, Efreet_Ini *ini)
efreet_ini_boolean_set(ini, "Hidden", desktop->hidden);
if (desktop->x) eina_hash_foreach(desktop->x, efreet_desktop_x_fields_save,
ini);
ini);
}
/**
@ -1056,7 +1056,7 @@ efreet_desktop_x_fields_parse(const Eina_Hash *hash __UNUSED__, const void *key,
if (strncmp(key, "X-", 2)) return EINA_TRUE;
if (!desktop->x)
desktop->x = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
desktop->x = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
eina_hash_del(desktop->x, key, NULL);
eina_hash_add(desktop->x, key, (void *)eina_stringshare_add(value));
@ -1095,30 +1095,30 @@ efreet_desktop_environment_check(Efreet_Ini *ini)
char *val;
if (!desktop_environment)
return 1;
return 1;
list = efreet_desktop_string_list_parse(efreet_ini_string_get(ini, "OnlyShowIn"));
if (list)
{
EINA_LIST_FREE(list, val)
{
if (!strcmp(val, desktop_environment))
found = 1;
eina_stringshare_del(val);
EINA_LIST_FREE(list, val)
{
if (!strcmp(val, desktop_environment))
found = 1;
eina_stringshare_del(val);
}
return found;
}
list = efreet_desktop_string_list_parse(efreet_ini_string_get(ini, "NotShowIn"));
list = efreet_desktop_string_list_parse(efreet_ini_string_get(ini, "NotShowIn"));
EINA_LIST_FREE(list, val)
{
if (!strcmp(val, desktop_environment))
found = 1;
eina_stringshare_del(val);
}
{
if (!strcmp(val, desktop_environment))
found = 1;
eina_stringshare_del(val);
}
return !found;
return !found;
}
@ -1283,12 +1283,12 @@ efreet_desktop_command_flags_get(Efreet_Desktop *desktop)
p = strchr(p, '%');
}
#ifdef SLOPPY_SPEC
/* NON-SPEC!!! this is to work around LOTS of 'broken' .desktop files that
* do not specify %U/%u, %F/F etc. etc. at all. just a command. this is
* unlikely to be fixed in distributions etc. in the long run as gnome/kde
* seem to have workarounds too so no one notices.
*/
if (!flags) flags |= EFREET_DESKTOP_EXEC_FLAG_FULLPATH;
/* NON-SPEC!!! this is to work around LOTS of 'broken' .desktop files that
* do not specify %U/%u, %F/F etc. etc. at all. just a command. this is
* unlikely to be fixed in distributions etc. in the long run as gnome/kde
* seem to have workarounds too so no one notices.
*/
if (!flags) flags |= EFREET_DESKTOP_EXEC_FLAG_FULLPATH;
#endif
return flags;
@ -1340,12 +1340,12 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
* will run once, removing any file field codes */
l = command->files;
do
{
{
const char *p;
int len = 0;
int size = PATH_MAX;
int file_added = 0;
Efreet_Desktop_Command_File *file = eina_list_data_get(l);
Efreet_Desktop_Command_File *file = eina_list_data_get(l);
exec = malloc(size);
p = command->desktop->exec;
@ -1372,7 +1372,7 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
if (file)
{
exec = efreet_desktop_command_append_single(exec, &size,
&len, file, *p);
&len, file, *p);
file_added = 1;
}
break;
@ -1383,26 +1383,26 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
if (file)
{
exec = efreet_desktop_command_append_multiple(exec, &size,
&len, command, *p);
&len, command, *p);
file_added = 1;
}
break;
case 'i':
exec = efreet_desktop_command_append_icon(exec, &size, &len,
command->desktop);
command->desktop);
break;
case 'c':
exec = efreet_desktop_command_append_quoted(exec, &size, &len,
command->desktop->name);
command->desktop->name);
break;
case 'k':
exec = efreet_desktop_command_append_quoted(exec, &size, &len,
command->desktop->orig_path);
command->desktop->orig_path);
break;
case 'v':
case 'm':
WRN("[Efreet]: Deprecated conversion char: '%c' in file '%s'",
*p, command->desktop->orig_path);
*p, command->desktop->orig_path);
break;
case '%':
exec[len++] = *p;
@ -1419,30 +1419,30 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
}
#ifdef SLOPPY_SPEC
/* NON-SPEC!!! this is to work around LOTS of 'broken' .desktop files that
* do not specify %U/%u, %F/F etc. etc. at all. just a command. this is
* unlikely to be fixed in distributions etc. in the long run as gnome/kde
* seem to have workarounds too so no one notices.
*/
if ((file) && (!file_added))
{
WRN("Efreet_desktop: %s\n"
" command: %s\n"
" has no file path/uri spec info for executing this app WITH a\n"
" file/uri as a parameter. This is unlikely to be the intent.\n"
" please check the .desktop file and fix it by adding a %%U or %%F\n"
" or something appropriate.",
command->desktop->orig_path, command->desktop->exec);
/* NON-SPEC!!! this is to work around LOTS of 'broken' .desktop files that
* do not specify %U/%u, %F/F etc. etc. at all. just a command. this is
* unlikely to be fixed in distributions etc. in the long run as gnome/kde
* seem to have workarounds too so no one notices.
*/
if ((file) && (!file_added))
{
WRN("Efreet_desktop: %s\n"
" command: %s\n"
" has no file path/uri spec info for executing this app WITH a\n"
" file/uri as a parameter. This is unlikely to be the intent.\n"
" please check the .desktop file and fix it by adding a %%U or %%F\n"
" or something appropriate.",
command->desktop->orig_path, command->desktop->exec);
if (len >= size - 1)
{
size = len + 1024;
exec = realloc(exec, size);
}
exec[len++] = ' ';
exec = efreet_desktop_command_append_multiple(exec, &size,
&len, command, 'F');
file_added = 1;
}
{
size = len + 1024;
exec = realloc(exec, size);
}
exec[len++] = ' ';
exec = efreet_desktop_command_append_multiple(exec, &size,
&len, command, 'F');
file_added = 1;
}
#endif
exec[len++] = '\0';
@ -1451,7 +1451,7 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
/* If no file was added, then the Exec field doesn't contain any file
* fields (fFuUdDnN). We only want to run the app once in this case. */
if (!file_added) break;
}
}
while ((l = eina_list_next(l)) != NULL);
return execs;
@ -1636,7 +1636,7 @@ efreet_desktop_command_file_process(Efreet_Desktop_Command *command, const char
f->command = command;
/* handle uris */
if(!strncmp(file, "http://", 7) || !strncmp(file, "ftp://", 6))
if (!strncmp(file, "http://", 7) || !strncmp(file, "ftp://", 6))
{
uri = file;
base = ecore_file_file_get(file);
@ -1840,44 +1840,44 @@ efreet_desktop_command_path_absolute(const char *path)
EAPI Eina_Bool
efreet_desktop_x_field_set(Efreet_Desktop *desktop, const char *key, const char *data)
{
if (!desktop || strncmp(key, "X-", 2))
return EINA_FALSE;
if (!desktop || strncmp(key, "X-", 2))
return EINA_FALSE;
if (!desktop->x)
desktop->x = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
if (!desktop->x)
desktop->x = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
eina_hash_del(desktop->x, key, NULL);
eina_hash_add(desktop->x, key, eina_stringshare_add(data));
eina_hash_del(desktop->x, key, NULL);
eina_hash_add(desktop->x, key, eina_stringshare_add(data));
return EINA_TRUE;
return EINA_TRUE;
}
EAPI const char *
efreet_desktop_x_field_get(Efreet_Desktop *desktop, const char *key)
{
const char *ret;
const char *ret;
if (!desktop || strncmp(key, "X-", 2))
return NULL;
if (!desktop || strncmp(key, "X-", 2))
return NULL;
if (!desktop->x)
return NULL;
if (!desktop->x)
return NULL;
ret = eina_hash_find(desktop->x, key);
if (!ret)
return NULL;
ret = eina_hash_find(desktop->x, key);
if (!ret)
return NULL;
return eina_stringshare_add(ret);
return eina_stringshare_add(ret);
}
EAPI Eina_Bool
efreet_desktop_x_field_del(Efreet_Desktop *desktop, const char *key)
{
if (!desktop || strncmp(key, "X-", 2))
return EINA_FALSE;
if (!desktop || strncmp(key, "X-", 2))
return EINA_FALSE;
if (!desktop->x)
return EINA_FALSE;
if (!desktop->x)
return EINA_FALSE;
return eina_hash_del(desktop->x, key, NULL);
return eina_hash_del(desktop->x, key, NULL);
}

View File

@ -97,10 +97,10 @@ static Efreet_Icon_Theme *fake_null = NULL;
static void
_efreet_icon_cache_list_destroy(Eina_List *list)
{
Efreet_Icon_Cache *cache;
Efreet_Icon_Cache *cache;
EINA_LIST_FREE(list, cache)
efreet_icon_cache_free(cache);
EINA_LIST_FREE(list, cache)
efreet_icon_cache_free(cache);
}
/**
@ -151,11 +151,11 @@ efreet_icon_shutdown(void)
IF_FREE_HASH(efreet_icon_cache);
if (fake_null)
{
efreet_icon_theme_free(fake_null);
fake_null = NULL;
}
if (fake_null)
{
efreet_icon_theme_free(fake_null);
fake_null = NULL;
}
ecore_shutdown();
}
@ -224,8 +224,8 @@ efreet_icon_extra_list_get(void)
static Eina_Bool
_hash_keys(Eina_Hash *hash __UNUSED__, const void *key, void *list)
{
*(Eina_List**)list = eina_list_append(*(Eina_List**)list, key);
return EINA_TRUE;
*(Eina_List**)list = eina_list_append(*(Eina_List**)list, key);
return EINA_TRUE;
}
/**
* @return Returns a list of Efreet_Icon structs for all the non-hidden icon
@ -342,17 +342,17 @@ efreet_icon_find_theme_check(const char *theme_name)
if ((fake_null) && (!theme_name)) return fake_null;
theme = efreet_icon_theme_new();
theme->fake = 1;
if (theme_name)
{
theme->name.internal = eina_stringshare_add(theme_name);
eina_hash_del(efreet_icon_themes, (void *)theme->name.internal, NULL);
eina_hash_add(efreet_icon_themes, (void *)theme->name.internal, theme);
}
else
{
theme->name.internal = NULL;
fake_null = theme;
}
if (theme_name)
{
theme->name.internal = eina_stringshare_add(theme_name);
eina_hash_del(efreet_icon_themes, (void *)theme->name.internal, NULL);
eina_hash_add(efreet_icon_themes, (void *)theme->name.internal, theme);
}
else
{
theme->name.internal = NULL;
fake_null = theme;
}
}
return theme;
@ -374,8 +374,8 @@ efreet_icon_path_find(const char *theme_name, const char *icon, unsigned int siz
if ((cached = efreet_icon_hash_get(theme_name, icon, size)) != NULL)
{
if (cached == NON_EXISTING) return NULL;
return strdup(cached);
if (cached == NON_EXISTING) return NULL;
return strdup(cached);
}
theme = efreet_icon_find_theme_check(theme_name);
@ -433,7 +433,7 @@ efreet_icon_list_find(const char *theme_name, Eina_List *icons,
tmps = eina_list_append(tmps, efreet_icon_remove_extension(icon));
value = efreet_icon_list_find_helper(theme, tmps, size);
EINA_LIST_FREE(tmps, data)
EINA_LIST_FREE(tmps, data)
free(data);
}
#else
@ -830,7 +830,7 @@ efreet_icon_fallback_icon(const char *icon_name)
icon = efreet_icon_fallback_dir_scan(dir, icon_name);
if (icon)
{
efreet_icon_cache_add(efreet_icon_find_theme_check(NULL), icon_name, 0, icon);
efreet_icon_cache_add(efreet_icon_find_theme_check(NULL), icon_name, 0, icon);
return icon;
}
}
@ -1554,9 +1554,9 @@ efreet_icon_cache_flush(Efreet_Icon_Theme *theme, Eina_List *list)
while (eina_list_count(list) > 100)
{
Efreet_Icon_Cache *cache;
Eina_List *last;
Eina_List *last;
last = eina_list_last(list);
last = eina_list_last(list);
cache = eina_list_data_get(last);
efreet_icon_cache_free(cache);
list = eina_list_remove_list(list, last);
@ -1593,19 +1593,19 @@ efreet_icon_cache_check(Efreet_Icon_Theme *theme, const char *icon, unsigned int
if (!cache->path)
{
list = eina_list_promote_list(list, eina_list_data_find_list(list, cache));
eina_hash_modify(efreet_icon_cache, theme, list);
eina_hash_modify(efreet_icon_cache, theme, list);
return NON_EXISTING;
}
else if (!stat(cache->path, &st) && st.st_mtime == cache->lasttime)
{
list = eina_list_promote_list(list, eina_list_data_find_list(list, cache));
eina_hash_modify(efreet_icon_cache, theme, list);
eina_hash_modify(efreet_icon_cache, theme, list);
return strdup(cache->path);
}
efreet_icon_cache_free(cache);
list = eina_list_remove(list, cache);
if (list != NULL) eina_hash_modify(efreet_icon_cache, theme, list);
else eina_hash_del(efreet_icon_cache, theme, NULL);
list = eina_list_remove(list, cache);
if (list != NULL) eina_hash_modify(efreet_icon_cache, theme, list);
else eina_hash_del(efreet_icon_cache, theme, NULL);
}
return NULL;
}

View File

@ -56,8 +56,8 @@ efreet_ini_init(void)
_efreet_ini_log_dom = eina_log_domain_register("Efreet_init", EFREET_DEFAULT_LOG_COLOR);
if (_efreet_ini_log_dom < 0)
{
ERROR("Efreet: Could not create a log domain for efreet_init");
return 0;
ERROR("Efreet: Could not create a log domain for efreet_init");
return 0;
}
return 1;
}
@ -342,7 +342,7 @@ efreet_ini_section_add(Efreet_Ini *ini, const char *section)
if (!ini || !section) return;
if (!ini->data)
ini->data = eina_hash_string_small_new(EINA_FREE_CB(eina_hash_free));
ini->data = eina_hash_string_small_new(EINA_FREE_CB(eina_hash_free));
if (eina_hash_find(ini->data, section)) return;
hash = eina_hash_string_small_new(free);

View File

@ -266,16 +266,17 @@ static int efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal,
int legacy);
static int efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal);
static int efreet_menu_directory_dir_scan(const char *path,
const char *relative_path,
Eina_Hash *cache);
const char *relative_path,
Eina_Hash *cache);
static Efreet_Desktop *efreet_menu_directory_get(Efreet_Menu_Internal *internal,
const char *path);
static void efreet_menu_process_filters(Efreet_Menu_Internal *internal,
unsigned int only_unallocated);
static Eina_List * efreet_menu_process_app_pool(Eina_List *pool, Eina_List *applications,
Eina_Hash *matches,
Efreet_Menu_Filter *filter,
unsigned int only_unallocated);
static Eina_List * efreet_menu_process_app_pool(Eina_List *pool,
Eina_List *applications,
Eina_Hash *matches,
Efreet_Menu_Filter *filter,
unsigned int only_unallocated);
static int efreet_menu_filter_matches(Efreet_Menu_Filter_Op *op,
Efreet_Menu_Desktop *md);
static int efreet_menu_filter_or_matches(Efreet_Menu_Filter_Op *op,
@ -463,14 +464,14 @@ efreet_menu_init(void)
_efreet_menu_log_dom = eina_log_domain_register("Efreet_menu", EFREET_DEFAULT_LOG_COLOR);
if (_efreet_menu_log_dom < 0)
{
ERROR("Efreet: Could not create a log domain for Efreet_menu");
return 0;
ERROR("Efreet: Could not create a log domain for Efreet_menu");
return 0;
}
if (!efreet_xml_init())
{
ERROR("Efreet: Could not init xml module");
ERROR("Efreet: Could not init xml module");
eina_log_domain_unregister(_efreet_menu_log_dom);
return 0;
return 0;
}
efreet_menu_handle_cbs = eina_hash_string_superfast_new(NULL);
@ -482,7 +483,7 @@ efreet_menu_init(void)
{
efreet_xml_shutdown();
eina_log_domain_unregister(_efreet_menu_log_dom);
return 0;
return 0;
}
/* set Menu into it's own so we can check the XML is valid before trying
@ -490,41 +491,41 @@ efreet_menu_init(void)
efreet_tag_menu = eina_stringshare_add(menu_cbs[0].key);
for (i = 0; menu_cbs[i].key != NULL; i++)
{
eina_hash_del(efreet_menu_handle_cbs,
menu_cbs[i].key,
NULL);
eina_hash_add(efreet_menu_handle_cbs,
menu_cbs[i].key,
menu_cbs[i].cb);
}
{
eina_hash_del(efreet_menu_handle_cbs,
menu_cbs[i].key,
NULL);
eina_hash_add(efreet_menu_handle_cbs,
menu_cbs[i].key,
menu_cbs[i].cb);
}
for (i = 0; filter_cbs[i].key != NULL; i++)
{
eina_hash_del(efreet_menu_filter_cbs,
filter_cbs[i].key,
NULL);
eina_hash_add(efreet_menu_filter_cbs,
filter_cbs[i].key,
filter_cbs[i].cb);
}
{
eina_hash_del(efreet_menu_filter_cbs,
filter_cbs[i].key,
NULL);
eina_hash_add(efreet_menu_filter_cbs,
filter_cbs[i].key,
filter_cbs[i].cb);
}
for (i = 0; move_cbs[i].key != NULL; i++)
{
eina_hash_del(efreet_menu_move_cbs,
move_cbs[i].key,
NULL);
eina_hash_add(efreet_menu_move_cbs,
move_cbs[i].key,
move_cbs[i].cb);
}
{
eina_hash_del(efreet_menu_move_cbs,
move_cbs[i].key,
NULL);
eina_hash_add(efreet_menu_move_cbs,
move_cbs[i].key,
move_cbs[i].cb);
}
for (i = 0; layout_cbs[i].key != NULL; i++)
{
eina_hash_del(efreet_menu_layout_cbs,
layout_cbs[i].key,
NULL);
eina_hash_add(efreet_menu_layout_cbs,
layout_cbs[i].key,
layout_cbs[i].cb);
}
{
eina_hash_del(efreet_menu_layout_cbs,
layout_cbs[i].key,
NULL);
eina_hash_add(efreet_menu_layout_cbs,
layout_cbs[i].key,
layout_cbs[i].cb);
}
return 1;
}
@ -1216,7 +1217,7 @@ efreet_menu_handle_default_app_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xm
prepend = eina_list_append(prepend, app_dir);
free(dir);
free(dir);
}
parent->app_dirs = eina_list_merge(prepend, parent->app_dirs);
@ -1673,10 +1674,10 @@ efreet_menu_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *pat
/* don't merge the same path twice */
if (eina_hash_find(efreet_merged_menus, realpath))
{
{
FREE(realpath);
return 1;
}
}
eina_hash_add(efreet_merged_menus, realpath, (void *)1);
@ -2791,9 +2792,8 @@ efreet_menu_process_filters(Efreet_Menu_Internal *internal, unsigned int only_un
*/
static Eina_List *
efreet_menu_process_app_pool(Eina_List *pool, Eina_List *applications,
Eina_Hash *matches,
Efreet_Menu_Filter *filter,
unsigned int only_unallocated)
Eina_Hash *matches, Efreet_Menu_Filter *filter,
unsigned int only_unallocated)
{
Efreet_Menu_Desktop *md;
Eina_List *l;
@ -3021,7 +3021,7 @@ efreet_menu_concatenate(Efreet_Menu_Internal *dest, Efreet_Menu_Internal *src)
{
efreet_menu_create_app_dirs_list(dest);
dest->app_dirs = eina_list_merge(src->app_dirs, dest->app_dirs);
src->app_dirs = NULL;
src->app_dirs = NULL;
}
if (src->directory_dirs)
@ -3399,10 +3399,10 @@ efreet_menu_app_dirs_process(Efreet_Menu_Internal *internal)
Eina_List *l;
EINA_LIST_FREE(internal->app_pool, md)
efreet_menu_desktop_free(md);
efreet_menu_desktop_free(md);
EINA_LIST_FOREACH(internal->app_dirs, l, app_dir)
efreet_menu_app_dir_scan(internal, app_dir->path, app_dir->prefix, app_dir->legacy);
efreet_menu_app_dir_scan(internal, app_dir->path, app_dir->prefix, app_dir->legacy);
return 1;
}
@ -3481,7 +3481,7 @@ efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal)
if (internal->directory_dirs)
{
internal->directory_cache =
eina_hash_string_superfast_new(EINA_FREE_CB(efreet_desktop_free));
eina_hash_string_superfast_new(EINA_FREE_CB(efreet_desktop_free));
EINA_LIST_REVERSE_FOREACH(internal->directory_dirs, l, path)
efreet_menu_directory_dir_scan(path, NULL, internal->directory_cache);
@ -3514,7 +3514,7 @@ efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal)
*/
static int
efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
Eina_Hash *cache)
Eina_Hash *cache)
{
Efreet_Desktop *desktop;
DIR *files;
@ -3549,7 +3549,7 @@ efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
continue;
}
eina_hash_del(cache, buf2, NULL);
eina_hash_del(cache, buf2, NULL);
eina_hash_add(cache, buf2, desktop);
}
}

View File

@ -219,8 +219,8 @@ efreet_mime_init(void)
if (_efreet_mime_log_dom < 0)
{
ERROR("Efreet: Could not create a log domain for Efreet_mime.");
goto shutdown_efreet;
ERROR("Efreet: Could not create a log domain for Efreet_mime.");
goto shutdown_efreet;
}
efreet_mime_endianess = efreet_mime_endian_check();
@ -234,13 +234,13 @@ efreet_mime_init(void)
return _efreet_mime_init_count;
unregister_log_domain:
unregister_log_domain:
eina_log_domain_unregister(_efreet_mime_log_dom);
shutdown_efreet:
shutdown_efreet:
efreet_shutdown();
shutdown_ecore_file:
shutdown_ecore_file:
ecore_file_shutdown();
shutdown_ecore:
shutdown_ecore:
ecore_shutdown();
return --_efreet_mime_init_count;
@ -769,7 +769,7 @@ efreet_mime_fallback_check(const char *file)
int i;
if (ecore_file_can_exec(file))
return "application/x-executable";
return "application/x-executable";
if (!(f = fopen(file, "r"))) return NULL;
@ -864,7 +864,7 @@ efreet_mime_mime_types_load(const char *file)
strncpy(ext, pp, (p - pp));
ext[p - pp] = 0;
eina_hash_del(wild, ext, NULL);
eina_hash_del(wild, ext, NULL);
eina_hash_add(wild, ext, (void*)eina_stringshare_add(mimetype));
}
while ((*p != '\n') && (*p != 0));
@ -924,7 +924,7 @@ efreet_mime_shared_mimeinfo_globs_load(const char *file)
{
eina_hash_del(wild, &(ext[2]), NULL);
eina_hash_add(wild, &(ext[2]),
(void*)eina_stringshare_add(mimetype));
(void*)eina_stringshare_add(mimetype));
}
else
{
@ -1103,7 +1103,7 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
entry->value = NULL;
mime->entries = eina_list_append(mime->entries, entry);
}
}
switch(*ptr)
{
@ -1136,9 +1136,9 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
ptr++;
entry->word_size = atoi(ptr);
if ((entry->word_size != 0) && (((entry->word_size != 1)
&& (entry->word_size != 2)
&& (entry->word_size != 4))
|| (entry->value_len % entry->word_size)))
&& (entry->word_size != 2)
&& (entry->word_size != 4))
|| (entry->value_len % entry->word_size)))
{
/* Invalid, Destroy */
FREE(entry->value);
@ -1583,7 +1583,7 @@ efreet_mime_icons_debug(void)
}
DBG("mime-icon entry: '%s' last used: %s",
entry->mime, ctime(&entry->timestamp));
entry->mime, ctime(&entry->timestamp));
EINA_INLIST_FOREACH(entry->list, n)
DBG("\tsize: %3u theme: '%s' icon: '%s'",

View File

@ -42,10 +42,10 @@ efreet_trash_init(void)
_efreet_trash_log_dom = eina_log_domain_register("Efreet_trash", EFREET_DEFAULT_LOG_COLOR);
if (_efreet_trash_log_dom < 0)
{
ERROR("Efreet: Could not create a log domain for Efreet_trash");
ERROR("Efreet: Could not create a log domain for Efreet_trash");
eina_shutdown();
return --_efreet_trash_init_count;
}
}
return _efreet_trash_init_count;
}
@ -126,7 +126,7 @@ efreet_trash_delete_uri(Efreet_Uri *uri, int force_delete)
/* search for a free filename */
while (ecore_file_exists(dest))
snprintf(dest, sizeof(dest), "%s/files/%s$%d",
efreet_trash_dir_get(), fname, i++);
efreet_trash_dir_get(), fname, i++);
fname = ecore_file_file_get(dest);
/* move file to trash dir */
@ -150,7 +150,7 @@ efreet_trash_delete_uri(Efreet_Uri *uri, int force_delete)
/* create info file */
snprintf(dest, sizeof(dest), "%s/info/%s.trashinfo",
efreet_trash_dir_get(), fname);
efreet_trash_dir_get(), fname);
if ((f = fopen(dest, "w")))
{

View File

@ -126,11 +126,11 @@ efreet_util_init(void)
if (init++) return init;
_efreet_utils_log_dom = eina_log_domain_register("Efreet_util",EFREET_DEFAULT_LOG_COLOR);
if(_efreet_utils_log_dom < 0)
{
ERROR("Efreet: Could not create a log domain for efreet_util");
return 0;
}
if (_efreet_utils_log_dom < 0)
{
ERROR("Efreet: Could not create a log domain for efreet_util");
return 0;
}
if (!EFREET_EVENT_DESKTOP_LIST_CHANGE)
EFREET_EVENT_DESKTOP_LIST_CHANGE = ecore_event_type_new();
if (!EFREET_EVENT_DESKTOP_CHANGE)
@ -220,11 +220,11 @@ efreet_util_path_in_default(const char *section, const char *path)
ret = dir;
break;
}
free(dir);
free(dir);
}
EINA_LIST_FREE(dirs, dir)
if (ret != dir) free(dir);
if (ret != dir) free(dir);
return ret;
}
@ -307,10 +307,10 @@ efreet_util_desktop_wm_class_find(const char *wmname, const char *wmclass)
ud = search.result;
if (ud)
{
efreet_desktop_ref(ud->desktop);
return ud->desktop;
}
{
efreet_desktop_ref(ud->desktop);
return ud->desktop;
}
return NULL;
}
@ -522,17 +522,17 @@ _hash_keys(Eina_Hash *hash __UNUSED__, const void *key, void *fdata)
EAPI Eina_List *
efreet_util_desktop_categories_list(void)
{
Eina_Iterator *it;
Eina_List *list = NULL;
Eina_Iterator *it;
Eina_List *list = NULL;
it = eina_hash_iterator_key_new(desktops_by_category);
if (it)
{
it = eina_hash_iterator_key_new(desktops_by_category);
if (it)
{
eina_iterator_foreach(it, EINA_EACH(_hash_keys), &list);
eina_iterator_free(it);
}
}
return list;
return list;
}
/**
@ -677,12 +677,12 @@ efreet_util_cache_add(const char *path, const char *file_id, int priority, int e
}
if (!eina_hash_find(file_id_by_desktop_path, desktop->orig_path))
{
eina_hash_add(file_id_by_desktop_path,
desktop->orig_path,
(void *)eina_stringshare_add(file_id));
{
eina_hash_add(file_id_by_desktop_path,
desktop->orig_path,
(void *)eina_stringshare_add(file_id));
}
}
ud = eina_hash_find(desktop_by_file_id, file_id);
if (!ud)
@ -855,9 +855,9 @@ efreet_util_cache_search_mime(__UNUSED__ const Eina_Hash *hash, void *value, voi
if (!ud->desktop->mime_types) return EINA_TRUE;
EINA_LIST_FOREACH(ud->desktop->mime_types, l, mime)
if (search->what == mime)
if (search->what == mime)
{
efreet_desktop_ref(ud->desktop);
efreet_desktop_ref(ud->desktop);
search->list = eina_list_append(search->list, ud->desktop);
break;
}
@ -876,15 +876,15 @@ efreet_util_cache_search_wm_class(__UNUSED__ const Eina_Hash *hash, void *value,
if (!ud->desktop) return EINA_TRUE;
if (!ud->desktop->startup_wm_class) return EINA_TRUE;
if ((search->what2) && (!strcmp(ud->desktop->startup_wm_class, search->what2)))
{
search->result = ud;
return EINA_FALSE;
}
{
search->result = ud;
return EINA_FALSE;
}
else if ((search->what1) && (!strcmp(ud->desktop->startup_wm_class, search->what1)))
{
search->result = ud;
return EINA_FALSE;
}
{
search->result = ud;
return EINA_FALSE;
}
return EINA_TRUE;
}
@ -904,17 +904,17 @@ efreet_util_cache_search_exec(__UNUSED__ const Eina_Hash *hash, void *value, voi
if (!exec) return EINA_TRUE;
if (!strcmp(exec, search->what1))
{
free(exec);
search->result = ud;
return EINA_FALSE;
free(exec);
search->result = ud;
return EINA_FALSE;
}
file = ecore_file_file_get(exec);
if (file && !strcmp(file, search->what1))
{
free(exec);
search->result = ud;
return EINA_FALSE;
free(exec);
search->result = ud;
return EINA_FALSE;
}
free(exec);
return EINA_TRUE;
@ -931,10 +931,10 @@ efreet_util_cache_search_name(__UNUSED__ const Eina_Hash *hash, void *value, voi
if (!ud->desktop->name) return EINA_TRUE;
if (!strcmp(ud->desktop->name, search->what1))
{
search->result = ud;
return EINA_FALSE;
}
{
search->result = ud;
return EINA_FALSE;
}
return EINA_TRUE;
}
@ -949,10 +949,10 @@ efreet_util_cache_search_generic_name(__UNUSED__ const Eina_Hash *hash, void *va
if (!ud->desktop->generic_name) return EINA_TRUE;
if (!strcmp(ud->desktop->generic_name, search->what1))
{
search->result = ud;
return EINA_FALSE;
}
{
search->result = ud;
return EINA_FALSE;
}
return EINA_TRUE;
}
@ -967,10 +967,10 @@ efreet_util_cache_search_name_glob(__UNUSED__ const Eina_Hash *hash, void *value
if (!ud->desktop) return EINA_TRUE;
if (efreet_util_glob_match(ud->desktop->name, search->what))
{
efreet_desktop_ref(ud->desktop);
search->list = eina_list_append(search->list, ud->desktop);
}
{
efreet_desktop_ref(ud->desktop);
search->list = eina_list_append(search->list, ud->desktop);
}
return EINA_TRUE;
}
@ -988,10 +988,10 @@ efreet_util_cache_search_exec_glob(__UNUSED__ const Eina_Hash *hash, void *value
exec = ecore_file_app_exe_get(ud->desktop->exec);
if (!exec) return EINA_TRUE;
if (efreet_util_glob_match(exec, search->what))
{
efreet_desktop_ref(ud->desktop);
search->list = eina_list_append(search->list, ud->desktop);
if (efreet_util_glob_match(exec, search->what))
{
efreet_desktop_ref(ud->desktop);
search->list = eina_list_append(search->list, ud->desktop);
}
free(exec);
return EINA_TRUE;
@ -1007,10 +1007,10 @@ efreet_util_cache_search_generic_name_glob(__UNUSED__ const Eina_Hash *hash, voi
ud = value;
if (efreet_util_glob_match(ud->desktop->generic_name, search->what))
{
efreet_desktop_ref(ud->desktop);
search->list = eina_list_append(search->list, ud->desktop);
}
{
efreet_desktop_ref(ud->desktop);
search->list = eina_list_append(search->list, ud->desktop);
}
return EINA_TRUE;
}
@ -1024,10 +1024,10 @@ efreet_util_cache_search_comment_glob(__UNUSED__ const Eina_Hash *hash, void *va
ud = value;
if (efreet_util_glob_match(ud->desktop->comment, search->what))
{
efreet_desktop_ref(ud->desktop);
search->list = eina_list_append(search->list, ud->desktop);
}
{
efreet_desktop_ref(ud->desktop);
search->list = eina_list_append(search->list, ud->desktop);
}
return EINA_TRUE;
}
@ -1172,46 +1172,46 @@ efreet_util_menus_find_helper(Eina_List *menus, const char *config_dir)
static void
efreet_util_desktops_by_category_add(Efreet_Desktop *desktop)
{
Eina_List *l;
const char *category;
Eina_List *l;
const char *category;
if (!desktop->categories) return;
if (!desktop->categories) return;
EINA_LIST_FOREACH(desktop->categories, l, category)
{
EINA_LIST_FOREACH(desktop->categories, l, category)
{
Eina_List *list;
int newlist = 0;
list = eina_hash_find(desktops_by_category, category);
if (!list) newlist = 1;
if (!eina_list_data_find(list, desktop))
list = eina_list_append(list, desktop);
list = eina_list_append(list, desktop);
if (newlist)
eina_hash_add(desktops_by_category, category, list);
eina_hash_add(desktops_by_category, category, list);
else
eina_hash_modify(desktops_by_category, category, list);
}
eina_hash_modify(desktops_by_category, category, list);
}
}
static void
efreet_util_desktops_by_category_remove(Efreet_Desktop *desktop)
{
Eina_List *l;
const char *category;
Eina_List *l;
const char *category;
if (!desktop->categories) return;
if (!desktop->categories) return;
EINA_LIST_FOREACH(desktop->categories, l, category)
{
EINA_LIST_FOREACH(desktop->categories, l, category)
{
Eina_List *list;
list = eina_hash_find(desktops_by_category, category);
if (!list) continue;
if (eina_list_data_find(list, desktop))
list = eina_list_remove(list, desktop);
list = eina_list_remove(list, desktop);
if (!list)
eina_hash_del(desktops_by_category, category, list);
eina_hash_del(desktops_by_category, category, list);
else
eina_hash_modify(desktops_by_category, category, list);
}
eina_hash_modify(desktops_by_category, category, list);
}
}
static void

View File

@ -55,16 +55,16 @@ static int _efreet_xml_log_dom = -1;
int
efreet_xml_init(void)
{
_efreet_xml_init_count++;
if (_efreet_xml_init_count > 1) return _efreet_xml_init_count;
_efreet_xml_log_dom = eina_log_domain_register("Efreet_xml", EFREET_DEFAULT_LOG_COLOR);
if (_efreet_xml_log_dom < 0)
{
_efreet_xml_init_count++;
if (_efreet_xml_init_count > 1) return _efreet_xml_init_count;
_efreet_xml_log_dom = eina_log_domain_register("Efreet_xml", EFREET_DEFAULT_LOG_COLOR);
if (_efreet_xml_log_dom < 0)
{
_efreet_xml_init_count--;
ERROR("Efreet: Could not create a log domain for Efreet_xml.");
return _efreet_xml_init_count;
}
return _efreet_xml_init_count;
ERROR("Efreet: Could not create a log domain for Efreet_xml.");
return _efreet_xml_init_count;
}
return _efreet_xml_init_count;
}
/**
@ -75,9 +75,9 @@ efreet_xml_init(void)
void
efreet_xml_shutdown(void)
{
_efreet_xml_init_count--;
if (_efreet_xml_init_count > 0) return;
eina_log_domain_unregister(_efreet_xml_log_dom);
_efreet_xml_init_count--;
if (_efreet_xml_init_count > 0) return;
eina_log_domain_unregister(_efreet_xml_log_dom);
}
/**
@ -366,7 +366,7 @@ efreet_xml_attributes_parse(char **data, int *size,
buf_size = end - start + 1;
if (buf_size <= 1)
{
ERR("zero length key");
ERR("zero length key");
goto efreet_error;
}
@ -390,7 +390,7 @@ efreet_xml_attributes_parse(char **data, int *size,
if (!start)
{
ERR("missing value for attribute!");
ERR("missing value for attribute!");
goto efreet_error;
}
@ -440,7 +440,7 @@ efreet_xml_attributes_parse(char **data, int *size,
buf_size = end - start + 1;
if (buf_size <= 1)
{
ERR("zero length value");
ERR("zero length value");
goto efreet_error;
}
@ -565,7 +565,7 @@ efreet_xml_tag_close(char **data, int *size, const char *tag)
(*data) += 2;
if ((int)strlen(tag) > *size)
{
ERR("wrong end tag");
ERR("wrong end tag");
error = 1;
return 1;
}