{
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;
efreet_shutdown(void)
{
if (--_efreet_init_count != 0)
- return _efreet_init_count;
+ return _efreet_init_count;
efreet_menu_shutdown();
efreet_desktop_shutdown();
_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;
}
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;
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];
-
- 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));
+ 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));
}
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);
_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())
{
/* 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;
}
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);
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);
efreet_ini_boolean_set(ini, "Hidden", desktop->hidden);
if (desktop->x) eina_hash_foreach(desktop->x, efreet_desktop_x_fields_save,
- ini);
+ ini);
}
/**
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));
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;
}
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;
}
* 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;
if (file)
{
exec = efreet_desktop_command_append_single(exec, &size,
- &len, file, *p);
+ &len, file, *p);
file_added = 1;
}
break;
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;
}
#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';
/* 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;
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);
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));
-
- eina_hash_del(desktop->x, key, NULL);
- eina_hash_add(desktop->x, key, eina_stringshare_add(data));
-
- return EINA_TRUE;
+ 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));
+
+ return EINA_TRUE;
}
EAPI const char *
efreet_desktop_x_field_get(Efreet_Desktop *desktop, const char *key)
{
- const char *ret;
-
- if (!desktop || strncmp(key, "X-", 2))
- return NULL;
-
- if (!desktop->x)
- return NULL;
-
- ret = eina_hash_find(desktop->x, key);
- if (!ret)
- return NULL;
-
- return eina_stringshare_add(ret);
+ const char *ret;
+
+ if (!desktop || strncmp(key, "X-", 2))
+ return NULL;
+
+ if (!desktop->x)
+ return NULL;
+
+ ret = eina_hash_find(desktop->x, key);
+ if (!ret)
+ return NULL;
+
+ 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->x)
- return EINA_FALSE;
-
- return eina_hash_del(desktop->x, key, NULL);
+ if (!desktop || strncmp(key, "X-", 2))
+ return EINA_FALSE;
+
+ if (!desktop->x)
+ return EINA_FALSE;
+
+ return eina_hash_del(desktop->x, key, 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);
}
/**
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();
}
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
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;
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);
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
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;
}
}
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);
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;
}
_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;
}
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);
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,
_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);
{
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
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;
}
prepend = eina_list_append(prepend, app_dir);
- free(dir);
+ free(dir);
}
parent->app_dirs = eina_list_merge(prepend, parent->app_dirs);
/* 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);
*/
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;
{
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)
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;
}
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);
*/
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;
continue;
}
- eina_hash_del(cache, buf2, NULL);
+ eina_hash_del(cache, buf2, NULL);
eina_hash_add(cache, buf2, desktop);
}
}
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();
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;
int i;
if (ecore_file_can_exec(file))
- return "application/x-executable";
+ return "application/x-executable";
if (!(f = fopen(file, "r"))) return NULL;
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));
{
eina_hash_del(wild, &(ext[2]), NULL);
eina_hash_add(wild, &(ext[2]),
- (void*)eina_stringshare_add(mimetype));
+ (void*)eina_stringshare_add(mimetype));
}
else
{
entry->value = NULL;
mime->entries = eina_list_append(mime->entries, entry);
- }
+ }
switch(*ptr)
{
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);
}
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'",
_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;
}
/* 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 */
/* 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")))
{
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)
ret = dir;
break;
}
- free(dir);
+ free(dir);
}
EINA_LIST_FREE(dirs, dir)
- if (ret != dir) free(dir);
+ if (ret != dir) free(dir);
return ret;
}
ud = search.result;
if (ud)
- {
- efreet_desktop_ref(ud->desktop);
- return ud->desktop;
- }
+ {
+ efreet_desktop_ref(ud->desktop);
+ return ud->desktop;
+ }
return NULL;
}
EAPI Eina_List *
efreet_util_desktop_categories_list(void)
{
- Eina_Iterator *it;
- Eina_List *list = NULL;
-
- it = eina_hash_iterator_key_new(desktops_by_category);
- if (it)
- {
+ Eina_Iterator *it;
+ Eina_List *list = NULL;
+
+ 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;
}
/**
}
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)
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;
}
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;
}
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;
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;
}
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;
}
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;
}
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;
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;
}
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;
}
static void
efreet_util_desktops_by_category_add(Efreet_Desktop *desktop)
{
- Eina_List *l;
- const char *category;
-
- if (!desktop->categories) return;
-
- EINA_LIST_FOREACH(desktop->categories, l, category)
- {
+ Eina_List *l;
+ const char *category;
+
+ if (!desktop->categories) return;
+
+ 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;
-
- if (!desktop->categories) return;
-
- EINA_LIST_FOREACH(desktop->categories, l, category)
- {
+ Eina_List *l;
+ const char *category;
+
+ if (!desktop->categories) return;
+
+ 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
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;
}
/**
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);
}
/**
buf_size = end - start + 1;
if (buf_size <= 1)
{
- ERR("zero length key");
+ ERR("zero length key");
goto efreet_error;
}
if (!start)
{
- ERR("missing value for attribute!");
+ ERR("missing value for attribute!");
goto efreet_error;
}
buf_size = end - start + 1;
if (buf_size <= 1)
{
- ERR("zero length value");
+ ERR("zero length value");
goto efreet_error;
}
(*data) += 2;
if ((int)strlen(tag) > *size)
{
- ERR("wrong end tag");
+ ERR("wrong end tag");
error = 1;
return 1;
}