forked from enlightenment/efl
* estickies,
* etk, * PROTO/exalt, * E-MODULES-EXTRA/diskio, * E-MODULES-EXTRA/drawer, * E-MODULES-EXTRA/penguins, * E-MODULES-EXTRA/slideshow, * E-MODULES-EXTRA/mail, * E-MODULES-EXTRA/forecasts, * E-MODULES-EXTRA/iiirk, * E-MODULES-EXTRA/places, * e, * ewl, * ecore, * elitaire, * entrance, * e_dbus, * efreet: Here we go, move from Ecore_List to Eina_List. NOTE: This patch is huge, I did test it a lot, and I hope nothing is broken. But if you think something change after this commit, please contact me ASAP. SVN revision: 39200
This commit is contained in:
parent
e31b5e961e
commit
6978e98dc6
|
@ -1,8 +1,6 @@
|
||||||
#ifndef _ECORE_DATA_H
|
#ifndef _ECORE_DATA_H
|
||||||
# define _ECORE_DATA_H
|
# define _ECORE_DATA_H
|
||||||
|
|
||||||
#include <Eina.h>
|
|
||||||
|
|
||||||
#ifdef EAPI
|
#ifdef EAPI
|
||||||
# undef EAPI
|
# undef EAPI
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,6 +30,8 @@
|
||||||
/* we need this for size_t */
|
/* we need this for size_t */
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include <Eina.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file Ecore_Data.h
|
* @file Ecore_Data.h
|
||||||
* @brief Contains threading, list, hash, debugging and tree functions.
|
* @brief Contains threading, list, hash, debugging and tree functions.
|
||||||
|
@ -300,7 +300,7 @@ extern "C" {
|
||||||
|
|
||||||
struct _ecore_path_group
|
struct _ecore_path_group
|
||||||
{
|
{
|
||||||
Ecore_List *paths;
|
Eina_List *paths;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -331,7 +331,7 @@ extern "C" {
|
||||||
/*
|
/*
|
||||||
* Get a list of all the available files in a path set
|
* Get a list of all the available files in a path set
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List * ecore_path_group_available_get(Ecore_Path_Group *group);
|
EAPI Eina_List * ecore_path_group_available_get(Ecore_Path_Group *group);
|
||||||
|
|
||||||
|
|
||||||
typedef struct _ecore_plugin Ecore_Plugin;
|
typedef struct _ecore_plugin Ecore_Plugin;
|
||||||
|
@ -355,7 +355,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
EAPI void *ecore_plugin_symbol_get(Ecore_Plugin * plugin, const char *symbol_name);
|
EAPI void *ecore_plugin_symbol_get(Ecore_Plugin * plugin, const char *symbol_name);
|
||||||
|
|
||||||
EAPI Ecore_List *ecore_plugin_available_get(Ecore_Path_Group *group);
|
EAPI Eina_List *ecore_plugin_available_get(Ecore_Path_Group *group);
|
||||||
|
|
||||||
|
|
||||||
typedef struct _ecore_heap Ecore_Sheap;
|
typedef struct _ecore_heap Ecore_Sheap;
|
||||||
|
|
|
@ -1635,11 +1635,10 @@ ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int a
|
||||||
Eina_List *
|
Eina_List *
|
||||||
ecore_getopt_list_free(Eina_List *list)
|
ecore_getopt_list_free(Eina_List *list)
|
||||||
{
|
{
|
||||||
while (list)
|
void *data;
|
||||||
{
|
|
||||||
free(list->data);
|
EINA_LIST_FREE(list, data)
|
||||||
list = eina_list_remove_list(list, list);
|
free(data);
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,12 @@ ecore_path_group_new(void)
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_path_group_del(Ecore_Path_Group *group)
|
ecore_path_group_del(Ecore_Path_Group *group)
|
||||||
{
|
{
|
||||||
|
char *path;
|
||||||
|
|
||||||
CHECK_PARAM_POINTER("group", group);
|
CHECK_PARAM_POINTER("group", group);
|
||||||
|
|
||||||
if (group->paths)
|
EINA_LIST_FREE(group->paths, path)
|
||||||
ecore_list_destroy(group->paths);
|
free(path);
|
||||||
|
|
||||||
free(group);
|
free(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,13 +66,7 @@ ecore_path_group_add(Ecore_Path_Group *group, const char *path)
|
||||||
CHECK_PARAM_POINTER("group", group);
|
CHECK_PARAM_POINTER("group", group);
|
||||||
CHECK_PARAM_POINTER("path", path);
|
CHECK_PARAM_POINTER("path", path);
|
||||||
|
|
||||||
if (!group->paths)
|
group->paths = eina_list_append(group->paths, strdup(path));
|
||||||
{
|
|
||||||
group->paths = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(group->paths, free);
|
|
||||||
}
|
|
||||||
|
|
||||||
ecore_list_append(group->paths, strdup(path));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,16 +89,16 @@ ecore_path_group_remove(Ecore_Path_Group *group, const char *path)
|
||||||
/*
|
/*
|
||||||
* Find the path in the list of available paths
|
* Find the path in the list of available paths
|
||||||
*/
|
*/
|
||||||
ecore_list_first_goto(group->paths);
|
found = eina_list_search_unsorted(group->paths, strcmp, path);
|
||||||
|
|
||||||
while ((found = ecore_list_current(group->paths)) && strcmp(found, path))
|
|
||||||
ecore_list_next(group->paths);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the path is found, remove and free it
|
* If the path is found, remove and free it
|
||||||
*/
|
*/
|
||||||
if (found)
|
if (found)
|
||||||
ecore_list_remove_destroy(group->paths);
|
{
|
||||||
|
group->paths = eina_list_remove(group->paths, found);
|
||||||
|
free(found);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,6 +112,7 @@ ecore_path_group_remove(Ecore_Path_Group *group, const char *path)
|
||||||
EAPI char *
|
EAPI char *
|
||||||
ecore_path_group_find(Ecore_Path_Group *group, const char *name)
|
ecore_path_group_find(Ecore_Path_Group *group, const char *name)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
int r;
|
int r;
|
||||||
char *p;
|
char *p;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -131,15 +127,13 @@ ecore_path_group_find(Ecore_Path_Group *group, const char *name)
|
||||||
/*
|
/*
|
||||||
* Search the paths of the path group for the specified file name
|
* Search the paths of the path group for the specified file name
|
||||||
*/
|
*/
|
||||||
ecore_list_first_goto(group->paths);
|
EINA_LIST_FOREACH(group->paths, l, p)
|
||||||
p = ecore_list_next(group->paths);
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
snprintf(path, PATH_MAX, "%s/%s", p, name);
|
snprintf(path, PATH_MAX, "%s/%s", p, name);
|
||||||
r = stat(path, &st);
|
r = stat(path, &st);
|
||||||
|
if ((r >= 0) && S_ISREG(st.st_mode))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
while (((r < 0) || !S_ISREG(st.st_mode)) &&
|
|
||||||
(p = ecore_list_next(group->paths)));
|
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
p = strdup(path);
|
p = strdup(path);
|
||||||
|
@ -154,20 +148,19 @@ ecore_path_group_find(Ecore_Path_Group *group, const char *name)
|
||||||
* identified by @p group_id. @c NULL otherwise.
|
* identified by @p group_id. @c NULL otherwise.
|
||||||
* @ingroup Ecore_Path_Group
|
* @ingroup Ecore_Path_Group
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
ecore_path_group_available_get(Ecore_Path_Group *group)
|
ecore_path_group_available_get(Ecore_Path_Group *group)
|
||||||
{
|
{
|
||||||
Ecore_List *avail = NULL;
|
Eina_List *avail = NULL;
|
||||||
|
Eina_List *l;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
CHECK_PARAM_POINTER_RETURN("group", group, NULL);
|
CHECK_PARAM_POINTER_RETURN("group", group, NULL);
|
||||||
|
|
||||||
if (!group->paths || ecore_list_empty_is(group->paths))
|
if (!group->paths || !eina_list_count(group->paths))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ecore_list_first_goto(group->paths);
|
EINA_LIST_FOREACH(group->paths, l, path)
|
||||||
|
|
||||||
while ((path = ecore_list_next(group->paths)) != NULL)
|
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -203,13 +196,11 @@ ecore_path_group_available_get(Ecore_Path_Group *group)
|
||||||
|
|
||||||
strncpy(n, d->d_name, l - 2);
|
strncpy(n, d->d_name, l - 2);
|
||||||
*/
|
*/
|
||||||
if (!avail)
|
/* avail = eina_list_append(avail, strdup(n));*/
|
||||||
avail = ecore_list_new();
|
avail = eina_list_append(avail, strdup(d->d_name));
|
||||||
|
|
||||||
/* ecore_list_append(avail, strdup(n));*/
|
|
||||||
ecore_list_append(avail, strdup(d->d_name));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return avail;
|
return avail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "ecore_private.h"
|
#include "ecore_private.h"
|
||||||
|
|
||||||
|
|
||||||
static Ecore_List *loaded_plugins = NULL;
|
static Eina_List *loaded_plugins = NULL;
|
||||||
|
|
||||||
static Eina_Bool _hash_keys(const Eina_Hash *hash,
|
static Eina_Bool _hash_keys(const Eina_Hash *hash,
|
||||||
const char *key,
|
const char *key,
|
||||||
|
@ -106,10 +106,8 @@ ecore_plugin_load(Ecore_Path_Group *group, const char *plugin_name, const char *
|
||||||
/*
|
/*
|
||||||
* Now add it to the list of the groups loaded plugins
|
* Now add it to the list of the groups loaded plugins
|
||||||
*/
|
*/
|
||||||
if (!loaded_plugins)
|
|
||||||
loaded_plugins = ecore_list_new();
|
|
||||||
|
|
||||||
ecore_list_append(loaded_plugins, plugin);
|
loaded_plugins = eina_list_append(loaded_plugins, plugin);
|
||||||
|
|
||||||
FREE(path);
|
FREE(path);
|
||||||
|
|
||||||
|
@ -129,14 +127,7 @@ ecore_plugin_unload(Ecore_Plugin *plugin)
|
||||||
if (!plugin->handle)
|
if (!plugin->handle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ecore_list_goto(loaded_plugins, plugin))
|
loaded_plugins = eina_list_remove(loaded_plugins, plugin);
|
||||||
ecore_list_remove(loaded_plugins);
|
|
||||||
|
|
||||||
if (ecore_list_empty_is(loaded_plugins))
|
|
||||||
{
|
|
||||||
ecore_list_destroy(loaded_plugins);
|
|
||||||
loaded_plugins = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
dlclose(plugin->handle);
|
dlclose(plugin->handle);
|
||||||
|
|
||||||
|
@ -173,23 +164,23 @@ ecore_plugin_symbol_get(Ecore_Plugin *plugin, const char *symbol_name)
|
||||||
* paths identified by @p group_id. @c NULL otherwise.
|
* paths identified by @p group_id. @c NULL otherwise.
|
||||||
* @ingroup Ecore_Plugin
|
* @ingroup Ecore_Plugin
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
ecore_plugin_available_get(Ecore_Path_Group *group)
|
ecore_plugin_available_get(Ecore_Path_Group *group)
|
||||||
{
|
{
|
||||||
Ecore_List *avail = NULL;
|
Eina_List *avail = NULL;
|
||||||
|
Eina_List *l;
|
||||||
Eina_Hash *plugins = NULL;
|
Eina_Hash *plugins = NULL;
|
||||||
Eina_Iterator *it = NULL;
|
Eina_Iterator *it = NULL;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
CHECK_PARAM_POINTER_RETURN("group", group, NULL);
|
CHECK_PARAM_POINTER_RETURN("group", group, NULL);
|
||||||
|
|
||||||
if (!group->paths || ecore_list_empty_is(group->paths))
|
if (!group->paths || !eina_list_count(group->paths))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ecore_list_first_goto(group->paths);
|
|
||||||
plugins = eina_hash_string_superfast_new(NULL);
|
plugins = eina_hash_string_superfast_new(NULL);
|
||||||
|
|
||||||
while ((path = ecore_list_next(group->paths)) != NULL)
|
EINA_LIST_FOREACH(group->paths, l, path)
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -239,14 +230,10 @@ ecore_plugin_available_get(Ecore_Path_Group *group)
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
avail = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(avail, free);
|
|
||||||
|
|
||||||
|
|
||||||
it = eina_hash_iterator_data_new(plugins);
|
it = eina_hash_iterator_data_new(plugins);
|
||||||
if (it)
|
if (it)
|
||||||
{
|
{
|
||||||
eina_iterator_foreach(it, EINA_EACH(_hash_keys), avail);
|
eina_iterator_foreach(it, EINA_EACH(_hash_keys), &avail);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +246,6 @@ ecore_plugin_available_get(Ecore_Path_Group *group)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_hash_keys(const Eina_Hash *hash __UNUSED__, const char *key, void *list)
|
_hash_keys(const Eina_Hash *hash __UNUSED__, const char *key, void *list)
|
||||||
{
|
{
|
||||||
ecore_list_append(list, strdup(key));
|
*(Eina_List **)list = eina_list_append(*(Eina_List **)list, key);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ EAPI int ECORE_CON_EVENT_SERVER_DEL = 0;
|
||||||
EAPI int ECORE_CON_EVENT_CLIENT_DATA = 0;
|
EAPI int ECORE_CON_EVENT_CLIENT_DATA = 0;
|
||||||
EAPI int ECORE_CON_EVENT_SERVER_DATA = 0;
|
EAPI int ECORE_CON_EVENT_SERVER_DATA = 0;
|
||||||
|
|
||||||
static Ecore_List *servers = NULL;
|
static Eina_List *servers = NULL;
|
||||||
static int init_count = 0;
|
static int init_count = 0;
|
||||||
|
|
||||||
#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
|
#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
|
||||||
|
@ -94,8 +94,6 @@ ecore_con_init(void)
|
||||||
ecore_con_dns_init();
|
ecore_con_dns_init();
|
||||||
ecore_con_info_init();
|
ecore_con_info_init();
|
||||||
|
|
||||||
servers = ecore_list_new();
|
|
||||||
|
|
||||||
return init_count;
|
return init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,10 +108,8 @@ ecore_con_shutdown(void)
|
||||||
{
|
{
|
||||||
if (--init_count != 0) return init_count;
|
if (--init_count != 0) return init_count;
|
||||||
|
|
||||||
while (!ecore_list_empty_is(servers))
|
while (servers)
|
||||||
_ecore_con_server_free(ecore_list_first_remove(servers));
|
_ecore_con_server_free(eina_list_data_get(servers));
|
||||||
ecore_list_destroy(servers);
|
|
||||||
servers = NULL;
|
|
||||||
|
|
||||||
ecore_con_info_shutdown();
|
ecore_con_info_shutdown();
|
||||||
ecore_con_dns_shutdown();
|
ecore_con_dns_shutdown();
|
||||||
|
@ -239,7 +235,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type, const char *name, int port,
|
||||||
socket_unix.sun_family = AF_UNIX;
|
socket_unix.sun_family = AF_UNIX;
|
||||||
if (type == ECORE_CON_LOCAL_ABSTRACT)
|
if (type == ECORE_CON_LOCAL_ABSTRACT)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
#ifdef HAVE_ABSTRACT_SOCKET
|
||||||
/* . is a placeholder */
|
/* . is a placeholder */
|
||||||
snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name);
|
snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name);
|
||||||
/* first char null indicates abstract namespace */
|
/* first char null indicates abstract namespace */
|
||||||
|
@ -285,7 +281,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type, const char *name, int port,
|
||||||
if (!ecore_con_info_udp_listen(svr, _ecore_con_cb_udp_listen, svr)) goto error;
|
if (!ecore_con_info_udp_listen(svr, _ecore_con_cb_udp_listen, svr)) goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_list_append(servers, svr);
|
servers = eina_list_append(servers, svr);
|
||||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
|
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
|
||||||
|
|
||||||
return svr;
|
return svr;
|
||||||
|
@ -463,7 +459,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type, const char *name, int port,
|
||||||
if (!ecore_con_info_udp_connect(svr, _ecore_con_cb_udp_connect, svr)) goto error;
|
if (!ecore_con_info_udp_connect(svr, _ecore_con_cb_udp_connect, svr)) goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_list_append(servers, svr);
|
servers = eina_list_append(servers, svr);
|
||||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
|
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
|
||||||
|
|
||||||
return svr;
|
return svr;
|
||||||
|
@ -494,6 +490,8 @@ ecore_con_server_del(Ecore_Con_Server *svr)
|
||||||
ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del");
|
ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (svr->delete_me) return NULL;
|
||||||
|
|
||||||
data = svr->data;
|
data = svr->data;
|
||||||
svr->data = NULL;
|
svr->data = NULL;
|
||||||
svr->delete_me = 1;
|
svr->delete_me = 1;
|
||||||
|
@ -508,7 +506,6 @@ ecore_con_server_del(Ecore_Con_Server *svr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ecore_con_server_free(svr);
|
_ecore_con_server_free(svr);
|
||||||
if (ecore_list_goto(servers, svr)) ecore_list_remove(servers);
|
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -886,12 +883,8 @@ _ecore_con_server_free(Ecore_Con_Server *svr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (svr->write_buf) free(svr->write_buf);
|
if (svr->write_buf) free(svr->write_buf);
|
||||||
while (svr->clients)
|
EINA_LIST_FREE(svr->clients, cl)
|
||||||
{
|
|
||||||
cl = eina_list_data_get(svr->clients);
|
|
||||||
svr->clients = eina_list_remove(svr->clients, cl);
|
|
||||||
_ecore_con_client_free(cl);
|
_ecore_con_client_free(cl);
|
||||||
}
|
|
||||||
if ((svr->created) && (svr->path) && (svr->ppid == getpid()))
|
if ((svr->created) && (svr->path) && (svr->ppid == getpid()))
|
||||||
unlink(svr->path);
|
unlink(svr->path);
|
||||||
if (svr->fd >= 0) close(svr->fd);
|
if (svr->fd >= 0) close(svr->fd);
|
||||||
|
@ -900,6 +893,7 @@ _ecore_con_server_free(Ecore_Con_Server *svr)
|
||||||
if (svr->path) free(svr->path);
|
if (svr->path) free(svr->path);
|
||||||
if (svr->ip) free(svr->ip);
|
if (svr->ip) free(svr->ip);
|
||||||
if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler);
|
if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler);
|
||||||
|
servers = eina_list_remove(servers, svr);
|
||||||
free(svr);
|
free(svr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1389,7 +1383,7 @@ static int
|
||||||
_ecore_con_svr_udp_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
_ecore_con_svr_udp_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
||||||
{
|
{
|
||||||
Ecore_Con_Server *svr;
|
Ecore_Con_Server *svr;
|
||||||
Ecore_Con_Client *cl;
|
Ecore_Con_Client *cl = NULL;
|
||||||
|
|
||||||
svr = data;
|
svr = data;
|
||||||
if (svr->dead) return 1;
|
if (svr->dead) return 1;
|
||||||
|
|
|
@ -198,9 +198,10 @@ ecore_con_info_get(Ecore_Con_Server *svr,
|
||||||
char service[NI_MAXSERV];
|
char service[NI_MAXSERV];
|
||||||
char hbuf[NI_MAXHOST];
|
char hbuf[NI_MAXHOST];
|
||||||
char sbuf[NI_MAXSERV];
|
char sbuf[NI_MAXSERV];
|
||||||
void *tosend;
|
void *tosend = NULL;
|
||||||
int tosend_len;
|
int tosend_len;
|
||||||
int canonname_len = 0;
|
int canonname_len = 0;
|
||||||
|
int err;
|
||||||
|
|
||||||
/* FIXME with EINA */
|
/* FIXME with EINA */
|
||||||
snprintf(service, NI_MAXSERV, "%i", svr->port);
|
snprintf(service, NI_MAXSERV, "%i", svr->port);
|
||||||
|
@ -210,12 +211,13 @@ ecore_con_info_get(Ecore_Con_Server *svr,
|
||||||
if (result->ai_canonname)
|
if (result->ai_canonname)
|
||||||
canonname_len = strlen(result->ai_canonname) + 1;
|
canonname_len = strlen(result->ai_canonname) + 1;
|
||||||
tosend_len = sizeof(Ecore_Con_Info) + result->ai_addrlen + canonname_len;
|
tosend_len = sizeof(Ecore_Con_Info) + result->ai_addrlen + canonname_len;
|
||||||
tosend = malloc(tosend_len);
|
|
||||||
|
if ((tosend = malloc(tosend_len)));
|
||||||
|
goto on_error;
|
||||||
|
memset(tosend, 0, tosend_len);
|
||||||
container = (Ecore_Con_Info *)tosend;
|
container = (Ecore_Con_Info *)tosend;
|
||||||
|
|
||||||
container->size = tosend_len;
|
container->size = tosend_len;
|
||||||
memset(container->ip, 0, sizeof(container->ip));
|
|
||||||
memset(container->service, 0, sizeof(container->service));
|
|
||||||
|
|
||||||
memcpy(&container->info, result, sizeof(struct addrinfo));
|
memcpy(&container->info, result, sizeof(struct addrinfo));
|
||||||
memcpy(tosend + sizeof(Ecore_Con_Info), result->ai_addr, result->ai_addrlen);
|
memcpy(tosend + sizeof(Ecore_Con_Info), result->ai_addr, result->ai_addrlen);
|
||||||
|
@ -228,13 +230,14 @@ ecore_con_info_get(Ecore_Con_Server *svr,
|
||||||
memcpy(container->ip, hbuf, sizeof(container->ip));
|
memcpy(container->ip, hbuf, sizeof(container->ip));
|
||||||
memcpy(container->service, sbuf, sizeof(container->service));
|
memcpy(container->service, sbuf, sizeof(container->service));
|
||||||
}
|
}
|
||||||
write(fd[1], tosend, tosend_len);
|
err = write(fd[1], tosend, tosend_len);
|
||||||
|
|
||||||
free(tosend);
|
free(tosend);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
write(fd[1], "", 1);
|
err = write(fd[1], "", 1);
|
||||||
|
|
||||||
|
on_error:
|
||||||
close(fd[1]);
|
close(fd[1]);
|
||||||
# ifdef __USE_ISOC99
|
# ifdef __USE_ISOC99
|
||||||
_Exit(0);
|
_Exit(0);
|
||||||
|
|
|
@ -80,7 +80,7 @@ static void _ecore_con_event_url_free(void *data __UNUSED__, void *ev);
|
||||||
static int _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match);
|
static int _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match);
|
||||||
|
|
||||||
static Ecore_Idler *_fd_idler_handler = NULL;
|
static Ecore_Idler *_fd_idler_handler = NULL;
|
||||||
static Ecore_List *_url_con_list = NULL;
|
static Eina_List *_url_con_list = NULL;
|
||||||
static CURLM *curlm = NULL;
|
static CURLM *curlm = NULL;
|
||||||
static fd_set _current_fd_set;
|
static fd_set _current_fd_set;
|
||||||
static int init_count = 0;
|
static int init_count = 0;
|
||||||
|
@ -129,6 +129,8 @@ EAPI int
|
||||||
ecore_con_url_init(void)
|
ecore_con_url_init(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
|
Ecore_Con_Url *url_con;
|
||||||
|
|
||||||
if (!ECORE_CON_EVENT_URL_DATA)
|
if (!ECORE_CON_EVENT_URL_DATA)
|
||||||
{
|
{
|
||||||
ECORE_CON_EVENT_URL_DATA = ecore_event_type_new();
|
ECORE_CON_EVENT_URL_DATA = ecore_event_type_new();
|
||||||
|
@ -136,27 +138,21 @@ ecore_con_url_init(void)
|
||||||
ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new();
|
ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_url_con_list)
|
|
||||||
{
|
|
||||||
_url_con_list = ecore_list_new();
|
|
||||||
if (!_url_con_list) return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!curlm)
|
if (!curlm)
|
||||||
{
|
{
|
||||||
FD_ZERO(&_current_fd_set);
|
FD_ZERO(&_current_fd_set);
|
||||||
if (curl_global_init(CURL_GLOBAL_NOTHING))
|
if (curl_global_init(CURL_GLOBAL_NOTHING))
|
||||||
{
|
{
|
||||||
ecore_list_destroy(_url_con_list);
|
EINA_LIST_FREE(_url_con_list, url_con)
|
||||||
_url_con_list = NULL;
|
ecore_con_url_destroy(url_con);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
curlm = curl_multi_init();
|
curlm = curl_multi_init();
|
||||||
if (!curlm)
|
if (!curlm)
|
||||||
{
|
{
|
||||||
ecore_list_destroy(_url_con_list);
|
EINA_LIST_FREE(_url_con_list, url_con)
|
||||||
_url_con_list = NULL;
|
ecore_con_url_destroy(url_con);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,24 +172,14 @@ EAPI int
|
||||||
ecore_con_url_shutdown(void)
|
ecore_con_url_shutdown(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
|
Ecore_Con_Url *url_con;
|
||||||
|
|
||||||
if (!init_count)
|
if (!init_count)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
init_count--;
|
init_count--;
|
||||||
if (_url_con_list)
|
EINA_LIST_FREE(_url_con_list, url_con)
|
||||||
{
|
|
||||||
if (!ecore_list_empty_is(_url_con_list))
|
|
||||||
{
|
|
||||||
Ecore_Con_Url *url_con;
|
|
||||||
while ((url_con = ecore_list_first(_url_con_list)))
|
|
||||||
{
|
|
||||||
ecore_con_url_destroy(url_con);
|
ecore_con_url_destroy(url_con);
|
||||||
}
|
|
||||||
}
|
|
||||||
ecore_list_destroy(_url_con_list);
|
|
||||||
_url_con_list = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (curlm)
|
if (curlm)
|
||||||
{
|
{
|
||||||
|
@ -286,8 +272,7 @@ ecore_con_url_destroy(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
if (url_con->active)
|
if (url_con->active)
|
||||||
{
|
{
|
||||||
if (ecore_list_find(_url_con_list, ecore_direct_compare, url_con) == url_con)
|
_url_con_list = eina_list_remove(_url_con_list, url_con);
|
||||||
ecore_list_remove(_url_con_list);
|
|
||||||
url_con->active = 0;
|
url_con->active = 0;
|
||||||
|
|
||||||
curl_multi_remove_handle(curlm, url_con->curl_easy);
|
curl_multi_remove_handle(curlm, url_con->curl_easy);
|
||||||
|
@ -615,14 +600,14 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, int use_epsv)
|
||||||
static int
|
static int
|
||||||
_ecore_con_url_suspend_fd_handler(void)
|
_ecore_con_url_suspend_fd_handler(void)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
Ecore_Con_Url *url_con;
|
Ecore_Con_Url *url_con;
|
||||||
int deleted = 0;
|
int deleted = 0;
|
||||||
|
|
||||||
if (!_url_con_list)
|
if (!_url_con_list)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ecore_list_first_goto(_url_con_list);
|
EINA_LIST_FOREACH(_url_con_list, l, url_con)
|
||||||
while ((url_con = ecore_list_current(_url_con_list)))
|
|
||||||
{
|
{
|
||||||
if (url_con->active && url_con->fd_handler)
|
if (url_con->active && url_con->fd_handler)
|
||||||
{
|
{
|
||||||
|
@ -630,7 +615,6 @@ _ecore_con_url_suspend_fd_handler(void)
|
||||||
url_con->fd_handler = NULL;
|
url_con->fd_handler = NULL;
|
||||||
deleted++;
|
deleted++;
|
||||||
}
|
}
|
||||||
ecore_list_next(_url_con_list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return deleted;
|
return deleted;
|
||||||
|
@ -639,25 +623,23 @@ _ecore_con_url_suspend_fd_handler(void)
|
||||||
static int
|
static int
|
||||||
_ecore_con_url_restart_fd_handler(void)
|
_ecore_con_url_restart_fd_handler(void)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
Ecore_Con_Url *url_con;
|
Ecore_Con_Url *url_con;
|
||||||
int activated = 0;
|
int activated = 0;
|
||||||
|
|
||||||
if (!_url_con_list)
|
if (!_url_con_list)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ecore_list_first_goto(_url_con_list);
|
EINA_LIST_FOREACH(_url_con_list, l, url_con)
|
||||||
while ((url_con = ecore_list_current(_url_con_list)))
|
|
||||||
{
|
{
|
||||||
if (url_con->fd_handler == NULL
|
if (url_con->fd_handler == NULL && url_con->fd != -1)
|
||||||
&& url_con->fd != -1)
|
|
||||||
{
|
{
|
||||||
url_con->fd_handler = ecore_main_fd_handler_add(url_con->fd,
|
url_con->fd_handler == ecore_main_fd_handler_add(url_con->fd,
|
||||||
url_con->flags,
|
url_con->flags,
|
||||||
_ecore_con_url_fd_handler,
|
_ecore_con_url_fd_handler,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
activated++;
|
activated++;
|
||||||
}
|
}
|
||||||
ecore_list_next(_url_con_list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return activated;
|
return activated;
|
||||||
|
@ -781,7 +763,7 @@ _ecore_con_url_perform(Ecore_Con_Url *url_con)
|
||||||
int still_running;
|
int still_running;
|
||||||
int completed_immediately = 0;
|
int completed_immediately = 0;
|
||||||
|
|
||||||
ecore_list_append(_url_con_list, url_con);
|
_url_con_list = eina_list_append(_url_con_list, url_con);
|
||||||
|
|
||||||
url_con->active = 1;
|
url_con->active = 1;
|
||||||
curl_multi_add_handle(curlm, url_con->curl_easy);
|
curl_multi_add_handle(curlm, url_con->curl_easy);
|
||||||
|
@ -874,7 +856,9 @@ _ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __
|
||||||
static int
|
static int
|
||||||
_ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match)
|
_ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
Ecore_Con_Url *url_con;
|
Ecore_Con_Url *url_con;
|
||||||
|
Ecore_Con_Event_Url_Complete *e;
|
||||||
CURLMsg *curlmsg;
|
CURLMsg *curlmsg;
|
||||||
int n_remaining;
|
int n_remaining;
|
||||||
int job_matched = 0;
|
int job_matched = 0;
|
||||||
|
@ -885,16 +869,13 @@ _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match)
|
||||||
if (curlmsg->msg != CURLMSG_DONE) continue;
|
if (curlmsg->msg != CURLMSG_DONE) continue;
|
||||||
|
|
||||||
/* find the job which is done */
|
/* find the job which is done */
|
||||||
ecore_list_first_goto(_url_con_list);
|
EINA_LIST_FOREACH(_url_con_list, l, url_con)
|
||||||
while ((url_con = ecore_list_current(_url_con_list)))
|
|
||||||
{
|
{
|
||||||
if (curlmsg->easy_handle == url_con->curl_easy)
|
if (curlmsg->easy_handle == url_con->curl_easy)
|
||||||
{
|
{
|
||||||
/* We have found the completed job in our job list */
|
if (url_con_to_match && (url_con == url_con_to_match))
|
||||||
if (url_con_to_match && (url_con == url_con_to_match)) {
|
|
||||||
job_matched = 1;
|
job_matched = 1;
|
||||||
}
|
if(url_con->fd != -1)
|
||||||
if (url_con->fd != -1)
|
|
||||||
{
|
{
|
||||||
FD_CLR(url_con->fd, &_current_fd_set);
|
FD_CLR(url_con->fd, &_current_fd_set);
|
||||||
if (url_con->fd_handler)
|
if (url_con->fd_handler)
|
||||||
|
@ -902,27 +883,22 @@ _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match)
|
||||||
url_con->fd = -1;
|
url_con->fd = -1;
|
||||||
url_con->fd_handler = NULL;
|
url_con->fd_handler = NULL;
|
||||||
}
|
}
|
||||||
ecore_list_remove(_url_con_list);
|
_url_con_list = eina_list_remove(_url_con_list, url_con);
|
||||||
url_con->active = 0;
|
url_con->active = 0;
|
||||||
{
|
|
||||||
Ecore_Con_Event_Url_Complete *e;
|
|
||||||
e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
|
e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
e->url_con = url_con;
|
e->url_con = url_con;
|
||||||
|
|
||||||
e->status = 0;
|
e->status = 0;
|
||||||
curl_easy_getinfo(curlmsg->easy_handle, CURLINFO_RESPONSE_CODE, &e->status);
|
curl_easy_getinfo(curlmsg->easy_handle, CURLINFO_RESPONSE_CODE, &e->status);
|
||||||
|
|
||||||
_url_complete_push_event(ECORE_CON_EVENT_URL_COMPLETE, e);
|
_url_complete_push_event(ECORE_CON_EVENT_URL_COMPLETE, e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
curl_multi_remove_handle(curlm, url_con->curl_easy);
|
curl_multi_remove_handle(curlm, url_con->curl_easy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ecore_list_next(_url_con_list);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return job_matched;
|
return job_matched;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,6 +364,7 @@ _ecore_config_ipc_ecore_exit(void **data)
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_ipc_shutdown();
|
ecore_ipc_shutdown();
|
||||||
|
ecore_shutdown();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ static int _ecore_evas_init_count = 0;
|
||||||
|
|
||||||
static int _ecore_evas_fps_debug = 0;
|
static int _ecore_evas_fps_debug = 0;
|
||||||
static char *ecore_evas_default_display = "0";
|
static char *ecore_evas_default_display = "0";
|
||||||
static Ecore_List *ecore_evas_input_devices = NULL;
|
static Eina_List *ecore_evas_input_devices = NULL;
|
||||||
static Ecore_Evas *ecore_evases = NULL;
|
static Ecore_Evas *ecore_evases = NULL;
|
||||||
static Ecore_Event_Handler *ecore_evas_event_handlers[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
|
static Ecore_Event_Handler *ecore_evas_event_handlers[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
|
||||||
static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
|
static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
|
||||||
|
@ -76,6 +76,7 @@ static void
|
||||||
_ecore_evas_fb_lose(void *data __UNUSED__)
|
_ecore_evas_fb_lose(void *data __UNUSED__)
|
||||||
{
|
{
|
||||||
Ecore_List2 *l;
|
Ecore_List2 *l;
|
||||||
|
Eina_List *ll;
|
||||||
Ecore_Fb_Input_Device *dev;
|
Ecore_Fb_Input_Device *dev;
|
||||||
|
|
||||||
for (l = (Ecore_List2 *)ecore_evases; l; l = l->next)
|
for (l = (Ecore_List2 *)ecore_evases; l; l = l->next)
|
||||||
|
@ -87,8 +88,7 @@ _ecore_evas_fb_lose(void *data __UNUSED__)
|
||||||
}
|
}
|
||||||
if (ecore_evas_input_devices)
|
if (ecore_evas_input_devices)
|
||||||
{
|
{
|
||||||
ecore_list_first_goto(ecore_evas_input_devices);
|
EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev)
|
||||||
while ((dev = ecore_list_next(ecore_evas_input_devices)))
|
|
||||||
ecore_fb_input_device_listen(dev, 0);
|
ecore_fb_input_device_listen(dev, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,7 @@ static void
|
||||||
_ecore_evas_fb_gain(void *data __UNUSED__)
|
_ecore_evas_fb_gain(void *data __UNUSED__)
|
||||||
{
|
{
|
||||||
Ecore_List2 *l;
|
Ecore_List2 *l;
|
||||||
|
Eina_List *l;
|
||||||
Ecore_Fb_Input_Device *dev;
|
Ecore_Fb_Input_Device *dev;
|
||||||
|
|
||||||
for (l = (Ecore_List2 *)ecore_evases; l; l = l->next)
|
for (l = (Ecore_List2 *)ecore_evases; l; l = l->next)
|
||||||
|
@ -112,8 +113,7 @@ _ecore_evas_fb_gain(void *data __UNUSED__)
|
||||||
}
|
}
|
||||||
if (ecore_evas_input_devices)
|
if (ecore_evas_input_devices)
|
||||||
{
|
{
|
||||||
ecore_list_first_goto(ecore_evas_input_devices);
|
EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev)
|
||||||
while ((dev = ecore_list_next(ecore_evas_input_devices)))
|
|
||||||
ecore_fb_input_device_listen(dev, 1);
|
ecore_fb_input_device_listen(dev, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,6 @@ _ecore_evas_fb_init(int w, int h)
|
||||||
input_dir = opendir("/dev/input/");
|
input_dir = opendir("/dev/input/");
|
||||||
if (!input_dir) return _ecore_evas_init_count;
|
if (!input_dir) return _ecore_evas_init_count;
|
||||||
|
|
||||||
ecore_evas_input_devices = ecore_list_new();
|
|
||||||
while ((input_entry = readdir(input_dir)))
|
while ((input_entry = readdir(input_dir)))
|
||||||
{
|
{
|
||||||
char device_path[256];
|
char device_path[256];
|
||||||
|
@ -295,7 +294,7 @@ _ecore_evas_fb_init(int w, int h)
|
||||||
{
|
{
|
||||||
ecore_fb_input_device_axis_size_set(device, w, h);
|
ecore_fb_input_device_axis_size_set(device, w, h);
|
||||||
ecore_fb_input_device_listen(device,1);
|
ecore_fb_input_device_listen(device,1);
|
||||||
ecore_list_append(ecore_evas_input_devices, device);
|
ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device);
|
||||||
if (!mouse_handled)
|
if (!mouse_handled)
|
||||||
{
|
{
|
||||||
ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
|
ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
|
||||||
|
@ -309,7 +308,7 @@ _ecore_evas_fb_init(int w, int h)
|
||||||
else if ((caps & ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS) && !(caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE))
|
else if ((caps & ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS) && !(caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE))
|
||||||
{
|
{
|
||||||
ecore_fb_input_device_listen(device,1);
|
ecore_fb_input_device_listen(device,1);
|
||||||
ecore_list_append(ecore_evas_input_devices, device);
|
ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device);
|
||||||
if (!keyboard_handled)
|
if (!keyboard_handled)
|
||||||
{
|
{
|
||||||
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_FB_EVENT_KEY_DOWN, _ecore_evas_event_key_down, NULL);
|
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_FB_EVENT_KEY_DOWN, _ecore_evas_event_key_down, NULL);
|
||||||
|
@ -480,6 +479,7 @@ _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int h
|
||||||
static void
|
static void
|
||||||
_ecore_evas_fullscreen_set(Ecore_Evas *ee, int on)
|
_ecore_evas_fullscreen_set(Ecore_Evas *ee, int on)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
int resized = 0;
|
int resized = 0;
|
||||||
|
|
||||||
if (((ee->prop.fullscreen) && (on)) ||
|
if (((ee->prop.fullscreen) && (on)) ||
|
||||||
|
@ -520,9 +520,8 @@ _ecore_evas_fullscreen_set(Ecore_Evas *ee, int on)
|
||||||
{
|
{
|
||||||
Ecore_Fb_Input_Device *dev;
|
Ecore_Fb_Input_Device *dev;
|
||||||
|
|
||||||
ecore_list_first_goto(ecore_evas_input_devices);
|
EINA_LIST_FOREACH(ecore_evas_input_devices, l, dev)
|
||||||
while ((dev = ecore_list_next(ecore_evas_input_devices)))
|
ecore_fb_input_device_axis_size_set(dev, ee->wn ee->h);
|
||||||
ecore_fb_input_device_axis_size_set(dev, ee->w, ee->h);
|
|
||||||
}
|
}
|
||||||
if (resized)
|
if (resized)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#define CLICK_THRESHOLD_DEFAULT 0.25
|
#define CLICK_THRESHOLD_DEFAULT 0.25
|
||||||
|
|
||||||
static Ecore_List *_ecore_fb_li_devices = NULL;
|
static Eina_List *_ecore_fb_li_devices = NULL;
|
||||||
|
|
||||||
static const char *_ecore_fb_li_kbd_syms[128 * 6] =
|
static const char *_ecore_fb_li_kbd_syms[128 * 6] =
|
||||||
{
|
{
|
||||||
|
@ -374,9 +374,6 @@ ecore_fb_input_device_open(const char *dev)
|
||||||
device = calloc(1, sizeof(Ecore_Fb_Input_Device));
|
device = calloc(1, sizeof(Ecore_Fb_Input_Device));
|
||||||
if(!device) return NULL;
|
if(!device) return NULL;
|
||||||
|
|
||||||
if(!_ecore_fb_li_devices)
|
|
||||||
_ecore_fb_li_devices = ecore_list_new();
|
|
||||||
|
|
||||||
if((fd = open(dev, O_RDONLY, O_NONBLOCK)) < 0)
|
if((fd = open(dev, O_RDONLY, O_NONBLOCK)) < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ecore_fb_li:device_open] %s %s", dev, strerror(errno));
|
fprintf(stderr, "[ecore_fb_li:device_open] %s %s", dev, strerror(errno));
|
||||||
|
@ -433,7 +430,7 @@ ecore_fb_input_device_open(const char *dev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ecore_list_append(_ecore_fb_li_devices, device);
|
_ecore_fb_li_devices = eina_list_append(_ecore_fb_li_devices, device);
|
||||||
return device;
|
return device;
|
||||||
|
|
||||||
error_caps:
|
error_caps:
|
||||||
|
@ -450,8 +447,7 @@ ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev)
|
||||||
/* close the fd */
|
/* close the fd */
|
||||||
close(dev->fd);
|
close(dev->fd);
|
||||||
/* remove the element from the list */
|
/* remove the element from the list */
|
||||||
if(ecore_list_goto(_ecore_fb_li_devices, dev))
|
_ecore_fb_li_devices = eina_list_remove(_ecore_fb_li_devices, dev);
|
||||||
ecore_list_remove(_ecore_fb_li_devices);
|
|
||||||
free(dev);
|
free(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ extern "C" {
|
||||||
EAPI int ecore_file_can_write (const char *file);
|
EAPI int ecore_file_can_write (const char *file);
|
||||||
EAPI int ecore_file_can_exec (const char *file);
|
EAPI int ecore_file_can_exec (const char *file);
|
||||||
EAPI char *ecore_file_readlink (const char *link);
|
EAPI char *ecore_file_readlink (const char *link);
|
||||||
EAPI Ecore_List *ecore_file_ls (const char *dir);
|
EAPI Eina_List *ecore_file_ls (const char *dir);
|
||||||
EAPI char *ecore_file_app_exe_get (const char *app);
|
EAPI char *ecore_file_app_exe_get (const char *app);
|
||||||
EAPI char *ecore_file_escape_name (const char *filename);
|
EAPI char *ecore_file_escape_name (const char *filename);
|
||||||
EAPI char *ecore_file_strip_ext (const char *file);
|
EAPI char *ecore_file_strip_ext (const char *file);
|
||||||
|
@ -100,7 +100,7 @@ extern "C" {
|
||||||
|
|
||||||
EAPI int ecore_file_path_dir_exists(const char *in_dir);
|
EAPI int ecore_file_path_dir_exists(const char *in_dir);
|
||||||
EAPI int ecore_file_app_installed(const char *exe);
|
EAPI int ecore_file_app_installed(const char *exe);
|
||||||
EAPI Ecore_List *ecore_file_app_list(void);
|
EAPI Eina_List *ecore_file_app_list(void);
|
||||||
|
|
||||||
EAPI int ecore_file_download(const char *url, const char *dst,
|
EAPI int ecore_file_download(const char *url, const char *dst,
|
||||||
void (*completion_cb)(void *data,
|
void (*completion_cb)(void *data,
|
||||||
|
|
|
@ -509,36 +509,32 @@ ecore_file_readlink(const char *link)
|
||||||
* For more information see the manual pages of strcoll and setlocale.
|
* For more information see the manual pages of strcoll and setlocale.
|
||||||
* The list will not contain the directory entries for '.' and '..'.
|
* The list will not contain the directory entries for '.' and '..'.
|
||||||
* @param dir The name of the directory to list
|
* @param dir The name of the directory to list
|
||||||
* @return Return an Ecore_List containing all the files in the directory;
|
* @return Return an Eina_List containing all the files in the directory;
|
||||||
* on failure it returns NULL.
|
* on failure it returns NULL.
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
ecore_file_ls(const char *dir)
|
ecore_file_ls(const char *dir)
|
||||||
{
|
{
|
||||||
char *f;
|
char *f;
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
Ecore_List *list;
|
Eina_List *list = NULL;
|
||||||
|
|
||||||
dirp = opendir(dir);
|
dirp = opendir(dir);
|
||||||
if (!dirp) return NULL;
|
if (!dirp) return NULL;
|
||||||
|
|
||||||
list = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(list, free);
|
|
||||||
|
|
||||||
while ((dp = readdir(dirp)))
|
while ((dp = readdir(dirp)))
|
||||||
{
|
{
|
||||||
if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, "..")))
|
if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, "..")))
|
||||||
{
|
{
|
||||||
f = strdup(dp->d_name);
|
f = strdup(dp->d_name);
|
||||||
ecore_list_append(list, f);
|
list = eina_list_append(list, f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
|
||||||
ecore_list_sort(list, ECORE_COMPARE_CB(strcoll), ECORE_SORT_MIN);
|
list = eina_list_sort(list, ECORE_SORT_MIN, ECORE_COMPARE_CB(strcoll));
|
||||||
|
|
||||||
ecore_list_first_goto(list);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ static void _ecore_file_download_abort(Ecore_File_Download_Job *job);
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
static Ecore_Event_Handler *_url_complete_handler = NULL;
|
static Ecore_Event_Handler *_url_complete_handler = NULL;
|
||||||
static Ecore_Event_Handler *_url_progress_download = NULL;
|
static Ecore_Event_Handler *_url_progress_download = NULL;
|
||||||
static Ecore_List *_job_list;
|
static Eina_List *_job_list;
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_file_download_init(void)
|
ecore_file_download_init(void)
|
||||||
|
@ -60,11 +60,6 @@ ecore_file_download_init(void)
|
||||||
_url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
|
_url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!_job_list)
|
|
||||||
{
|
|
||||||
_job_list = ecore_list_new();
|
|
||||||
if (!_job_list) return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
|
@ -84,9 +79,7 @@ ecore_file_download_shutdown(void)
|
||||||
ecore_event_handler_del(_url_progress_download);
|
ecore_event_handler_del(_url_progress_download);
|
||||||
_url_complete_handler = NULL;
|
_url_complete_handler = NULL;
|
||||||
_url_progress_download = NULL;
|
_url_progress_download = NULL;
|
||||||
if (_job_list)
|
ecore_file_download_abort_all();
|
||||||
ecore_list_destroy(_job_list);
|
|
||||||
_job_list = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ecore_con_url_shutdown();
|
return ecore_con_url_shutdown();
|
||||||
|
@ -98,16 +91,10 @@ ecore_file_download_shutdown(void)
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_file_download_abort_all(void)
|
ecore_file_download_abort_all(void)
|
||||||
{
|
{
|
||||||
if (!ecore_list_empty_is(_job_list))
|
|
||||||
{
|
|
||||||
Ecore_File_Download_Job *job;
|
Ecore_File_Download_Job *job;
|
||||||
|
|
||||||
while ((job = ecore_list_first_remove(_job_list)))
|
EINA_LIST_FREE(_job_list, job)
|
||||||
{
|
|
||||||
_ecore_file_download_abort(job);
|
_ecore_file_download_abort(job);
|
||||||
}
|
|
||||||
}
|
|
||||||
ecore_list_clear(_job_list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,10 +199,10 @@ _ecore_file_download_url_complete_cb(void *data, int type, void *event)
|
||||||
Ecore_Con_Event_Url_Complete *ev = event;
|
Ecore_Con_Event_Url_Complete *ev = event;
|
||||||
Ecore_File_Download_Job *job;
|
Ecore_File_Download_Job *job;
|
||||||
|
|
||||||
job = ecore_list_find(_job_list, _ecore_file_download_url_compare_job, ev->url_con);
|
job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con);
|
||||||
if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return 1;
|
if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return 1;
|
||||||
|
|
||||||
ecore_list_remove(_job_list);
|
_job_list = eina_list_remove(_job_list, job);
|
||||||
|
|
||||||
if (job->completion_cb)
|
if (job->completion_cb)
|
||||||
job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, !ev->status);
|
job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, !ev->status);
|
||||||
|
@ -233,7 +220,7 @@ _ecore_file_download_url_progress_cb(void *data, int type, void *event)
|
||||||
Ecore_Con_Event_Url_Progress *ev = event;
|
Ecore_Con_Event_Url_Progress *ev = event;
|
||||||
Ecore_File_Download_Job *job;
|
Ecore_File_Download_Job *job;
|
||||||
|
|
||||||
job = ecore_list_find(_job_list, _ecore_file_download_url_compare_job, ev->url_con);
|
job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con);
|
||||||
if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return 1;
|
if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return 1;
|
||||||
|
|
||||||
if (job->progress_cb)
|
if (job->progress_cb)
|
||||||
|
@ -241,7 +228,7 @@ _ecore_file_download_url_progress_cb(void *data, int type, void *event)
|
||||||
(long int) ev->down.total, (long int) ev->down.now,
|
(long int) ev->down.total, (long int) ev->down.now,
|
||||||
(long int) ev->up.total, (long int) ev->up.now) != 0)
|
(long int) ev->up.total, (long int) ev->up.now) != 0)
|
||||||
{
|
{
|
||||||
ecore_list_remove(_job_list);
|
_job_list = eina_list_remove(_job_list, job);
|
||||||
_ecore_file_download_abort(job);
|
_ecore_file_download_abort(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +272,7 @@ _ecore_file_download_curl(const char *url, const char *dst,
|
||||||
|
|
||||||
job->completion_cb = completion_cb;
|
job->completion_cb = completion_cb;
|
||||||
job->progress_cb = progress_cb;
|
job->progress_cb = progress_cb;
|
||||||
ecore_list_append(_job_list, job);
|
_job_list = eina_list_append(_job_list, job);
|
||||||
|
|
||||||
ecore_con_url_send(job->url_con, NULL, 0, NULL);
|
ecore_con_url_send(job->url_con, NULL, 0, NULL);
|
||||||
|
|
||||||
|
|
|
@ -117,29 +117,28 @@ ecore_file_monitor_poll_add(const char *path,
|
||||||
if (ecore_file_is_dir(em->path))
|
if (ecore_file_is_dir(em->path))
|
||||||
{
|
{
|
||||||
/* Check for subdirs */
|
/* Check for subdirs */
|
||||||
Ecore_List *files;
|
Eina_List *files;
|
||||||
char *file;
|
char *file;
|
||||||
|
|
||||||
files = ecore_file_ls(em->path);
|
files = ecore_file_ls(em->path);
|
||||||
if (files)
|
EINA_LIST_FREE(files, file)
|
||||||
{
|
|
||||||
while ((file = ecore_list_next(files)))
|
|
||||||
{
|
{
|
||||||
Ecore_File *f;
|
Ecore_File *f;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
f = calloc(1, sizeof(Ecore_File));
|
f = calloc(1, sizeof(Ecore_File));
|
||||||
if (!f)
|
if (!f)
|
||||||
|
{
|
||||||
|
free(file);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", em->path, file);
|
snprintf(buf, sizeof(buf), "%s/%s", em->path, file);
|
||||||
f->name = strdup(file);
|
f->name = file;
|
||||||
f->mtime = ecore_file_mod_time(buf);
|
f->mtime = ecore_file_mod_time(buf);
|
||||||
f->is_dir = ecore_file_is_dir(buf);
|
f->is_dir = ecore_file_is_dir(buf);
|
||||||
em->files = _ecore_list2_append(em->files, f);
|
em->files = _ecore_list2_append(em->files, f);
|
||||||
}
|
}
|
||||||
ecore_list_destroy(files);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -307,7 +306,8 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em)
|
||||||
/* Check for new files */
|
/* Check for new files */
|
||||||
if (ECORE_FILE_MONITOR_POLL(em)->mtime < mtime)
|
if (ECORE_FILE_MONITOR_POLL(em)->mtime < mtime)
|
||||||
{
|
{
|
||||||
Ecore_List *files;
|
Eina_List *files;
|
||||||
|
Eina_List *l;
|
||||||
char *file;
|
char *file;
|
||||||
|
|
||||||
/* Files have been added or removed */
|
/* Files have been added or removed */
|
||||||
|
@ -315,7 +315,7 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em)
|
||||||
if (files)
|
if (files)
|
||||||
{
|
{
|
||||||
/* Are we a directory? We should check first, rather than rely on null here*/
|
/* Are we a directory? We should check first, rather than rely on null here*/
|
||||||
while ((file = ecore_list_next(files)))
|
EINA_LIST_FOREACH(files, l, file)
|
||||||
{
|
{
|
||||||
Ecore_File *f;
|
Ecore_File *f;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
@ -331,7 +331,7 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em)
|
||||||
|
|
||||||
f->name = strdup(file);
|
f->name = strdup(file);
|
||||||
f->mtime = ecore_file_mod_time(buf);
|
f->mtime = ecore_file_mod_time(buf);
|
||||||
f->is_dir = ecore_file_is_dir(buf);
|
f->is_dir = ecore_file_mod_time(buf);
|
||||||
if (f->is_dir)
|
if (f->is_dir)
|
||||||
event = ECORE_FILE_EVENT_CREATED_DIRECTORY;
|
event = ECORE_FILE_EVENT_CREATED_DIRECTORY;
|
||||||
else
|
else
|
||||||
|
@ -339,7 +339,12 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em)
|
||||||
em->func(em->data, em, event, buf);
|
em->func(em->data, em, event, buf);
|
||||||
em->files = _ecore_list2_append(em->files, f);
|
em->files = _ecore_list2_append(em->files, f);
|
||||||
}
|
}
|
||||||
ecore_list_destroy(files);
|
while (files)
|
||||||
|
{
|
||||||
|
file = eina_list_data_get(files);
|
||||||
|
free(file);
|
||||||
|
files = eina_list_remove_list(files, files);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ecore_file_is_dir(em->path))
|
if (!ecore_file_is_dir(em->path))
|
||||||
|
|
|
@ -12,36 +12,35 @@
|
||||||
#include "ecore_file_private.h"
|
#include "ecore_file_private.h"
|
||||||
|
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
static Ecore_List *__ecore_file_path_bin = NULL;
|
static Eina_List *__ecore_file_path_bin = NULL;
|
||||||
|
|
||||||
static Ecore_List *_ecore_file_path_from_env(const char *env);
|
static Eina_List *_ecore_file_path_from_env(const char *env);
|
||||||
|
|
||||||
int
|
int
|
||||||
ecore_file_path_init(void)
|
ecore_file_path_init(void)
|
||||||
{
|
{
|
||||||
if (++init != 1) return init;
|
if (++init != 1) return init;
|
||||||
__ecore_file_path_bin = _ecore_file_path_from_env("PATH");
|
__ecore_file_path_bin = _ecore_file_path_from_env("PATH");
|
||||||
ecore_list_free_cb_set(__ecore_file_path_bin, free);
|
|
||||||
return init;
|
return init;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ecore_file_path_shutdown(void)
|
ecore_file_path_shutdown(void)
|
||||||
{
|
{
|
||||||
|
char *dir;
|
||||||
|
|
||||||
if (--init != 0) return init;
|
if (--init != 0) return init;
|
||||||
ecore_list_destroy(__ecore_file_path_bin);
|
EINA_LIST_FREE(__ecore_file_path_bin, dir)
|
||||||
__ecore_file_path_bin = NULL;
|
free(dir);
|
||||||
return init;
|
return init;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ecore_List *
|
Eina_List *
|
||||||
_ecore_file_path_from_env(const char *env)
|
_ecore_file_path_from_env(const char *env)
|
||||||
{
|
{
|
||||||
Ecore_List *path;
|
Eina_List *path = NULL;
|
||||||
char *env_path, *p, *last;
|
char *env_path, *p, *last;
|
||||||
|
|
||||||
path = ecore_list_new();
|
|
||||||
|
|
||||||
env_path = getenv(env);
|
env_path = getenv(env);
|
||||||
if (!env_path)
|
if (!env_path)
|
||||||
return path;
|
return path;
|
||||||
|
@ -56,12 +55,12 @@ _ecore_file_path_from_env(const char *env)
|
||||||
if (!*p)
|
if (!*p)
|
||||||
{
|
{
|
||||||
if (!ecore_file_path_dir_exists(last))
|
if (!ecore_file_path_dir_exists(last))
|
||||||
ecore_list_append(path, strdup(last));
|
path = eina_list_append(path, strdup(last));
|
||||||
last = p + 1;
|
last = p + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p > last)
|
if (p > last)
|
||||||
ecore_list_append(path, strdup(last));
|
path = eina_list_append(path, strdup(last));
|
||||||
|
|
||||||
free(env_path);
|
free(env_path);
|
||||||
return path;
|
return path;
|
||||||
|
@ -75,14 +74,16 @@ _ecore_file_path_from_env(const char *env)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_file_path_dir_exists(const char *in_dir)
|
ecore_file_path_dir_exists(const char *in_dir)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
||||||
if (!__ecore_file_path_bin) return 0;
|
if (!__ecore_file_path_bin) return 0;
|
||||||
ecore_list_first_goto(__ecore_file_path_bin);
|
EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
|
||||||
while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL)
|
|
||||||
{
|
{
|
||||||
if (!strcmp(dir, in_dir)) return 1;
|
if (strcmp(dir, in_dir))
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,50 +97,47 @@ ecore_file_path_dir_exists(const char *in_dir)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_file_app_installed(const char *exe)
|
ecore_file_app_installed(const char *exe)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *dir;
|
char *dir;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
if (!exe) return 0;
|
if (!exe) return 0;
|
||||||
if (ecore_file_can_exec(exe)) return 1;
|
if (ecore_file_can_exec(exe)) return 1;
|
||||||
|
|
||||||
ecore_list_first_goto(__ecore_file_path_bin);
|
EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
|
||||||
while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL)
|
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
|
snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
|
||||||
if (ecore_file_can_exec(buf)) return 1;
|
if (ecore_file_can_exec(buf))
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all the applications installed on the system
|
* Get a list of all the applications installed on the system
|
||||||
* @return An Ecore_List containing all the executable files in the system
|
* @return An Eina_List containing all the executable files in the system
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
ecore_file_app_list(void)
|
ecore_file_app_list(void)
|
||||||
{
|
{
|
||||||
Ecore_List *list, *files;
|
Eina_List *list = NULL;
|
||||||
|
Eina_List *files;
|
||||||
|
Eina_List *l;
|
||||||
char buf[PATH_MAX], *dir, *exe;
|
char buf[PATH_MAX], *dir, *exe;
|
||||||
|
|
||||||
list = ecore_list_new();
|
EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
|
||||||
if (!list) return NULL;
|
|
||||||
ecore_list_free_cb_set(list, free);
|
|
||||||
ecore_list_first_goto(__ecore_file_path_bin);
|
|
||||||
while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL)
|
|
||||||
{
|
{
|
||||||
files = ecore_file_ls(dir);
|
files = ecore_file_ls(dir);
|
||||||
if (files)
|
EINA_LIST_FREE(files, exe)
|
||||||
{
|
|
||||||
ecore_list_first_goto(files);
|
|
||||||
while ((exe = ecore_list_next(files)) != NULL)
|
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
|
snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
|
||||||
if ((ecore_file_can_exec(buf)) &&
|
if ((ecore_file_can_exec(buf)) &&
|
||||||
(!ecore_file_is_dir(buf)))
|
(!ecore_file_is_dir(buf)))
|
||||||
ecore_list_append(list, strdup(buf));
|
list = eina_list_append(list, strdup(buf));
|
||||||
}
|
free(exe);
|
||||||
ecore_list_destroy(files);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,8 +294,8 @@ extern "C" {
|
||||||
EAPI int ecore_imf_init(void);
|
EAPI int ecore_imf_init(void);
|
||||||
EAPI int ecore_imf_shutdown(void);
|
EAPI int ecore_imf_shutdown(void);
|
||||||
|
|
||||||
EAPI Ecore_List *ecore_imf_context_available_ids_get(void);
|
EAPI Eina_List *ecore_imf_context_available_ids_get(void);
|
||||||
EAPI Ecore_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type);
|
EAPI Eina_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type);
|
||||||
EAPI const char *ecore_imf_context_default_id_get(void);
|
EAPI const char *ecore_imf_context_default_id_get(void);
|
||||||
EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type);
|
EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type);
|
||||||
EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id);
|
EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id);
|
||||||
|
|
|
@ -24,20 +24,20 @@
|
||||||
/**
|
/**
|
||||||
* Get the list of the available Input Method Context ids.
|
* Get the list of the available Input Method Context ids.
|
||||||
*
|
*
|
||||||
* Note that the caller is responsible for freeing the Ecore_List
|
* Note that the caller is responsible for freeing the Eina_List
|
||||||
* when finished with it. There is no need to finish the list strings.
|
* when finished with it. There is no need to finish the list strings.
|
||||||
*
|
*
|
||||||
* @return Return an Ecore_List of strings;
|
* @return Return an EIna_List of strings;
|
||||||
* on failure it returns NULL.
|
* on failure it returns NULL.
|
||||||
* @ingroup Ecore_IMF_Context_Group
|
* @ingroup Ecore_IMF_Context_Group
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
ecore_imf_context_available_ids_get(void)
|
ecore_imf_context_available_ids_get(void)
|
||||||
{
|
{
|
||||||
return ecore_imf_module_context_ids_get();
|
return ecore_imf_module_context_ids_get();
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type)
|
ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type)
|
||||||
{
|
{
|
||||||
return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type);
|
return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type);
|
||||||
|
@ -85,7 +85,7 @@ EAPI const char *
|
||||||
ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
|
ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
|
||||||
{
|
{
|
||||||
const char *id;
|
const char *id;
|
||||||
Ecore_List *modules;
|
Eina_List *modules;
|
||||||
Ecore_IMF_Module *module;
|
Ecore_IMF_Module *module;
|
||||||
char *locale;
|
char *locale;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
@ -113,8 +113,7 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
|
||||||
|
|
||||||
id = NULL;
|
id = NULL;
|
||||||
|
|
||||||
ecore_list_first_goto(modules);
|
EINA_LIST_FREE(modules, module)
|
||||||
while ((module = ecore_list_next(modules)))
|
|
||||||
{
|
{
|
||||||
if (canvas_type &&
|
if (canvas_type &&
|
||||||
strcmp(module->info->canvas_type, canvas_type) == 0)
|
strcmp(module->info->canvas_type, canvas_type) == 0)
|
||||||
|
@ -135,7 +134,6 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
|
||||||
p = q ? q + 1 : NULL;
|
p = q ? q + 1 : NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ecore_list_destroy(modules);
|
|
||||||
|
|
||||||
free(locale);
|
free(locale);
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -66,33 +66,25 @@ ecore_imf_module_shutdown(void)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_hash_module_available_get(const Eina_Hash *hash, int *data, void *list)
|
_hash_module_available_get(const Eina_Hash *hash, int *data, void *list)
|
||||||
{
|
{
|
||||||
ecore_list_append(list, data);
|
*(Eina_List**)list = eina_list_append(*(Eina_List**)list, data);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ecore_List *
|
Eina_List *
|
||||||
ecore_imf_module_available_get(void)
|
ecore_imf_module_available_get(void)
|
||||||
{
|
{
|
||||||
Ecore_List *values;
|
Eina_List *values = NULL;
|
||||||
Eina_Iterator *it = NULL;
|
Eina_Iterator *it = NULL;
|
||||||
|
|
||||||
if (!modules) return NULL;
|
if (!modules) return NULL;
|
||||||
|
|
||||||
values = ecore_list_new();
|
|
||||||
if (!values) return NULL;
|
|
||||||
|
|
||||||
it = eina_hash_iterator_data_new(modules);
|
it = eina_hash_iterator_data_new(modules);
|
||||||
if (!it)
|
if (!it)
|
||||||
{
|
|
||||||
ecore_list_destroy(values);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
eina_iterator_foreach(it, EINA_EACH(_hash_module_available_get), values);
|
eina_iterator_foreach(it, EINA_EACH(_hash_module_available_get), &values);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
ecore_list_first_goto(values);
|
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,29 +120,23 @@ ecore_imf_module_context_create(const char *ctx_id)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_hash_ids_get(const Eina_Hash *hash, const char *key, void *list)
|
_hash_ids_get(const Eina_Hash *hash, const char *key, void *list)
|
||||||
{
|
{
|
||||||
ecore_list_append(list, key);
|
*(Eina_List**)list = eina_list_append(*(Eina_List**)list, key);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ecore_List *
|
Eina_List *
|
||||||
ecore_imf_module_context_ids_get(void)
|
ecore_imf_module_context_ids_get(void)
|
||||||
{
|
{
|
||||||
Ecore_List *l = NULL;
|
Eina_List *l = NULL;
|
||||||
Eina_Iterator *it = NULL;
|
Eina_Iterator *it = NULL;
|
||||||
|
|
||||||
if (!modules) return NULL;
|
if (!modules) return NULL;
|
||||||
|
|
||||||
l = ecore_list_new();
|
|
||||||
if (!l) return NULL;
|
|
||||||
|
|
||||||
it = eina_hash_iterator_key_new(modules);
|
it = eina_hash_iterator_key_new(modules);
|
||||||
if (!it)
|
if (!it)
|
||||||
{
|
|
||||||
ecore_list_destroy(l);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
eina_iterator_foreach(it, EINA_EACH(_hash_ids_get), l);
|
eina_iterator_foreach(it, EINA_EACH(_hash_ids_get), &l);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
|
@ -163,16 +149,16 @@ _hash_ids_by_canvas_type_get(const Eina_Hash *hash, void *data, void *fdata)
|
||||||
Ecore_IMF_Selector *selector = fdata;
|
Ecore_IMF_Selector *selector = fdata;
|
||||||
|
|
||||||
if (!strcmp(module->info->canvas_type, selector->toselect))
|
if (!strcmp(module->info->canvas_type, selector->toselect))
|
||||||
ecore_list_append(selector->selected, (void *)module->info->id);
|
selector->selected = eina_list_append(selector->selected, (void *)module->info->id);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ecore_List *
|
Eina_List *
|
||||||
ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type)
|
ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type)
|
||||||
{
|
{
|
||||||
Ecore_IMF_Selector selector;
|
Ecore_IMF_Selector selector;
|
||||||
Ecore_List *values;
|
Eina_List *values = NULL;
|
||||||
Eina_Iterator *it = NULL;
|
Eina_Iterator *it = NULL;
|
||||||
|
|
||||||
if (!modules) return NULL;
|
if (!modules) return NULL;
|
||||||
|
@ -180,30 +166,22 @@ ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type)
|
||||||
if (!canvas_type)
|
if (!canvas_type)
|
||||||
return ecore_imf_module_context_ids_get();
|
return ecore_imf_module_context_ids_get();
|
||||||
|
|
||||||
values = ecore_list_new();
|
|
||||||
if (!values) return NULL;
|
|
||||||
|
|
||||||
it = eina_hash_iterator_data_new(modules);
|
it = eina_hash_iterator_data_new(modules);
|
||||||
if (!it)
|
if (!it)
|
||||||
{
|
|
||||||
ecore_list_destroy(values);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
selector.toselect = canvas_type;
|
selector.toselect = canvas_type;
|
||||||
selector.selected = values;
|
selector.selected = values;
|
||||||
eina_iterator_foreach(it, EINA_EACH(_hash_ids_by_canvas_type_get), &selector);
|
eina_iterator_foreach(it, EINA_EACH(_hash_ids_by_canvas_type_get), &selector);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
ecore_list_first_goto(values);
|
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_imf_module_load_all(void)
|
_ecore_imf_module_load_all(void)
|
||||||
{
|
{
|
||||||
Ecore_List *avail;
|
Eina_List *avail;
|
||||||
char *filename;
|
char *filename;
|
||||||
Ecore_Plugin *plugin;
|
Ecore_Plugin *plugin;
|
||||||
const Ecore_IMF_Context_Info *info = NULL;
|
const Ecore_IMF_Context_Info *info = NULL;
|
||||||
|
@ -213,8 +191,7 @@ _ecore_imf_module_load_all(void)
|
||||||
avail = ecore_plugin_available_get(ecore_imf_modules_path);
|
avail = ecore_plugin_available_get(ecore_imf_modules_path);
|
||||||
if (!avail) return;
|
if (!avail) return;
|
||||||
|
|
||||||
ecore_list_first_goto(avail);
|
EINA_LIST_FREE(avail, filename)
|
||||||
while ((filename = ecore_list_next(avail)))
|
|
||||||
{
|
{
|
||||||
plugin = ecore_plugin_load(ecore_imf_modules_path, filename, NULL);
|
plugin = ecore_plugin_load(ecore_imf_modules_path, filename, NULL);
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
|
@ -255,8 +232,6 @@ _ecore_imf_module_load_all(void)
|
||||||
|
|
||||||
_ecore_imf_module_append(plugin, info, imf_module_create);
|
_ecore_imf_module_append(plugin, info, imf_module_create);
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_list_destroy(avail);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -267,7 +242,7 @@ _ecore_imf_module_append(Ecore_Plugin *plugin,
|
||||||
Ecore_IMF_Module *module;
|
Ecore_IMF_Module *module;
|
||||||
|
|
||||||
if (!modules)
|
if (!modules)
|
||||||
modules = eina_hash_string_superfast_new(_ecore_imf_module_free);
|
modules = eina_hash_string_superfast_new(EINA_FREE_CB(_ecore_imf_module_free));
|
||||||
|
|
||||||
module = malloc(sizeof(Ecore_IMF_Module));
|
module = malloc(sizeof(Ecore_IMF_Module));
|
||||||
module->plugin = plugin;
|
module->plugin = plugin;
|
||||||
|
|
|
@ -29,10 +29,10 @@ struct _Ecore_IMF_Module
|
||||||
|
|
||||||
void ecore_imf_module_init(void);
|
void ecore_imf_module_init(void);
|
||||||
void ecore_imf_module_shutdown(void);
|
void ecore_imf_module_shutdown(void);
|
||||||
Ecore_List *ecore_imf_module_available_get(void);
|
Eina_List *ecore_imf_module_available_get(void);
|
||||||
Ecore_IMF_Module *ecore_imf_module_get(const char *ctx_id);
|
Ecore_IMF_Module *ecore_imf_module_get(const char *ctx_id);
|
||||||
Ecore_IMF_Context *ecore_imf_module_context_create(const char *ctx_id);
|
Ecore_IMF_Context *ecore_imf_module_context_create(const char *ctx_id);
|
||||||
Ecore_List *ecore_imf_module_context_ids_get(void);
|
Eina_List *ecore_imf_module_context_ids_get(void);
|
||||||
Ecore_List *ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type);
|
Eina_List *ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -297,7 +297,7 @@ EAPI unsigned long long _ecore_ipc_swap_64(unsigned long long v);
|
||||||
EAPI void *ecore_ipc_server_del(Ecore_Ipc_Server *svr);
|
EAPI void *ecore_ipc_server_del(Ecore_Ipc_Server *svr);
|
||||||
EAPI void *ecore_ipc_server_data_get(Ecore_Ipc_Server *svr);
|
EAPI void *ecore_ipc_server_data_get(Ecore_Ipc_Server *svr);
|
||||||
EAPI int ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr);
|
EAPI int ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr);
|
||||||
EAPI Ecore_List *ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr);
|
EAPI Eina_List *ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr);
|
||||||
/* FIXME: this needs to become an ipc message */
|
/* FIXME: this needs to become an ipc message */
|
||||||
EAPI int ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, const void *data, int size);
|
EAPI int ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, const void *data, int size);
|
||||||
EAPI void ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients);
|
EAPI void ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients);
|
||||||
|
|
|
@ -241,7 +241,7 @@ EAPI int ECORE_IPC_EVENT_CLIENT_DATA = 0;
|
||||||
EAPI int ECORE_IPC_EVENT_SERVER_DATA = 0;
|
EAPI int ECORE_IPC_EVENT_SERVER_DATA = 0;
|
||||||
|
|
||||||
static int init_count = 0;
|
static int init_count = 0;
|
||||||
static Ecore_Ipc_Server *servers = NULL;
|
static Eina_List *servers = NULL;
|
||||||
static Ecore_Event_Handler *handler[6];
|
static Ecore_Event_Handler *handler[6];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -300,7 +300,7 @@ ecore_ipc_shutdown(void)
|
||||||
|
|
||||||
if (--init_count != 0) return init_count;
|
if (--init_count != 0) return init_count;
|
||||||
|
|
||||||
while (servers) ecore_ipc_server_del(servers);
|
while (servers) ecore_ipc_server_del(eina_list_data_get(servers));
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
ecore_event_handler_del(handler[i]);
|
ecore_event_handler_del(handler[i]);
|
||||||
|
@ -364,9 +364,7 @@ ecore_ipc_server_add(Ecore_Ipc_Type compl_type, const char *name, int port, cons
|
||||||
}
|
}
|
||||||
svr->max_buf_size = 32 * 1024;
|
svr->max_buf_size = 32 * 1024;
|
||||||
svr->data = (void *)data;
|
svr->data = (void *)data;
|
||||||
svr->client_list = ecore_list_new();
|
servers = eina_list_append(servers, svr);
|
||||||
ecore_list_init(svr->client_list);
|
|
||||||
servers = _ecore_list2_append(servers, svr);
|
|
||||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER);
|
ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER);
|
||||||
return svr;
|
return svr;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +420,7 @@ ecore_ipc_server_connect(Ecore_Ipc_Type compl_type, char *name, int port, const
|
||||||
}
|
}
|
||||||
svr->max_buf_size = -1;
|
svr->max_buf_size = -1;
|
||||||
svr->data = (void *)data;
|
svr->data = (void *)data;
|
||||||
servers = _ecore_list2_append(servers, svr);
|
servers = eina_list_append(servers, svr);
|
||||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER);
|
ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER);
|
||||||
return svr;
|
return svr;
|
||||||
}
|
}
|
||||||
|
@ -444,17 +442,21 @@ ecore_ipc_server_del(Ecore_Ipc_Server *svr)
|
||||||
"ecore_ipc_server_del");
|
"ecore_ipc_server_del");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (svr->delete_me) return NULL;
|
||||||
|
|
||||||
data = svr->data;
|
data = svr->data;
|
||||||
svr->data = NULL;
|
svr->data = NULL;
|
||||||
svr->delete_me = 1;
|
svr->delete_me = 1;
|
||||||
if (svr->event_count == 0)
|
if (svr->event_count == 0)
|
||||||
{
|
{
|
||||||
while (svr->clients)
|
Ecore_Ipc_Client *cl;
|
||||||
ecore_ipc_client_del((Ecore_Ipc_Client *)svr->clients);
|
|
||||||
|
EINA_LIST_FREE(svr->clients, cl)
|
||||||
|
ecore_ipc_client_del(cl);
|
||||||
ecore_con_server_del(svr->server);
|
ecore_con_server_del(svr->server);
|
||||||
servers = _ecore_list2_remove(servers, svr);
|
servers = eina_list_remove(servers, svr);
|
||||||
|
|
||||||
if (svr->buf) free(svr->buf);
|
if (svr->buf) free(svr->buf);
|
||||||
if (svr->client_list) ecore_list_destroy(svr->client_list);
|
|
||||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_NONE);
|
ECORE_MAGIC_SET(svr, ECORE_MAGIC_NONE);
|
||||||
free(svr);
|
free(svr);
|
||||||
}
|
}
|
||||||
|
@ -500,10 +502,10 @@ ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr)
|
||||||
/**
|
/**
|
||||||
* Retrieves the list of clients for this server.
|
* Retrieves the list of clients for this server.
|
||||||
* @param svr The given IPC server.
|
* @param svr The given IPC server.
|
||||||
* @return An Ecore_List with the clients.
|
* @return An Eina_List with the clients.
|
||||||
* @ingroup Ecore_IPC_Server_Group
|
* @ingroup Ecore_IPC_Server_Group
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr)
|
ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr)
|
||||||
{
|
{
|
||||||
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
|
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
|
||||||
|
@ -1000,7 +1002,7 @@ _ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void
|
||||||
Ecore_Con_Event_Client_Add *e;
|
Ecore_Con_Event_Client_Add *e;
|
||||||
|
|
||||||
e = ev;
|
e = ev;
|
||||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
|
if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
|
||||||
/* handling code here */
|
/* handling code here */
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Client *cl;
|
Ecore_Ipc_Client *cl;
|
||||||
|
@ -1014,7 +1016,7 @@ _ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void
|
||||||
cl->max_buf_size = 32 * 1024;
|
cl->max_buf_size = 32 * 1024;
|
||||||
ecore_con_client_data_set(cl->client, (void *)cl);
|
ecore_con_client_data_set(cl->client, (void *)cl);
|
||||||
svr->clients = _ecore_list2_append(svr->clients, cl);
|
svr->clients = _ecore_list2_append(svr->clients, cl);
|
||||||
ecore_list_append(svr->client_list, cl);
|
svr->client_list = eina_list_append(svr->client_list, cl);
|
||||||
if (!cl->delete_me)
|
if (!cl->delete_me)
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Event_Client_Add *e2;
|
Ecore_Ipc_Event_Client_Add *e2;
|
||||||
|
@ -1038,7 +1040,7 @@ _ecore_ipc_event_client_del(void *data __UNUSED__, int ev_type __UNUSED__, void
|
||||||
Ecore_Con_Event_Client_Del *e;
|
Ecore_Con_Event_Client_Del *e;
|
||||||
|
|
||||||
e = ev;
|
e = ev;
|
||||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
|
if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
|
||||||
/* handling code here */
|
/* handling code here */
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Client *cl;
|
Ecore_Ipc_Client *cl;
|
||||||
|
@ -1049,9 +1051,7 @@ _ecore_ipc_event_client_del(void *data __UNUSED__, int ev_type __UNUSED__, void
|
||||||
Ecore_Ipc_Server *svr;
|
Ecore_Ipc_Server *svr;
|
||||||
|
|
||||||
svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
|
svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
|
||||||
ecore_list_goto(svr->client_list, cl);
|
svr->client_list = eina_list_remove(svr->client_list, cl);
|
||||||
ecore_list_remove(svr->client_list);
|
|
||||||
ecore_list_first_goto(svr->client_list);
|
|
||||||
if (!cl->delete_me)
|
if (!cl->delete_me)
|
||||||
{
|
{
|
||||||
e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Del));
|
e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Del));
|
||||||
|
@ -1074,7 +1074,7 @@ _ecore_ipc_event_server_add(void *data __UNUSED__, int ev_type __UNUSED__, void
|
||||||
Ecore_Con_Event_Server_Add *e;
|
Ecore_Con_Event_Server_Add *e;
|
||||||
|
|
||||||
e = ev;
|
e = ev;
|
||||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(e->server))) return 1;
|
if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return 1;
|
||||||
/* handling code here */
|
/* handling code here */
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Server *svr;
|
Ecore_Ipc_Server *svr;
|
||||||
|
@ -1103,7 +1103,7 @@ _ecore_ipc_event_server_del(void *data __UNUSED__, int ev_type __UNUSED__, void
|
||||||
Ecore_Con_Event_Server_Del *e;
|
Ecore_Con_Event_Server_Del *e;
|
||||||
|
|
||||||
e = ev;
|
e = ev;
|
||||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(e->server))) return 1;
|
if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return 1;
|
||||||
/* handling code here */
|
/* handling code here */
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Server *svr;
|
Ecore_Ipc_Server *svr;
|
||||||
|
@ -1173,7 +1173,7 @@ _ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
||||||
Ecore_Con_Event_Client_Data *e;
|
Ecore_Con_Event_Client_Data *e;
|
||||||
|
|
||||||
e = ev;
|
e = ev;
|
||||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
|
if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
|
||||||
/* handling code here */
|
/* handling code here */
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Client *cl;
|
Ecore_Ipc_Client *cl;
|
||||||
|
@ -1365,7 +1365,7 @@ _ecore_ipc_event_server_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
||||||
Ecore_Con_Event_Server_Data *e;
|
Ecore_Con_Event_Server_Data *e;
|
||||||
|
|
||||||
e = ev;
|
e = ev;
|
||||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(e->server))) return 1;
|
if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return 1;
|
||||||
/* handling code here */
|
/* handling code here */
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Server *svr;
|
Ecore_Ipc_Server *svr;
|
||||||
|
|
|
@ -39,7 +39,6 @@ __attribute__ ((packed));
|
||||||
|
|
||||||
struct _Ecore_Ipc_Client
|
struct _Ecore_Ipc_Client
|
||||||
{
|
{
|
||||||
Ecore_List __list_data;
|
|
||||||
ECORE_MAGIC;
|
ECORE_MAGIC;
|
||||||
Ecore_Con_Client *client;
|
Ecore_Con_Client *client;
|
||||||
void *data;
|
void *data;
|
||||||
|
@ -57,11 +56,10 @@ struct _Ecore_Ipc_Client
|
||||||
|
|
||||||
struct _Ecore_Ipc_Server
|
struct _Ecore_Ipc_Server
|
||||||
{
|
{
|
||||||
Ecore_List __list_data;
|
|
||||||
ECORE_MAGIC;
|
ECORE_MAGIC;
|
||||||
Ecore_Con_Server *server;
|
Ecore_Con_Server *server;
|
||||||
Ecore_Ipc_Client *clients;
|
Eina_List *clients;
|
||||||
Ecore_List *client_list;
|
Eina_List *client_list;
|
||||||
void *data;
|
void *data;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
int buf_size;
|
int buf_size;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* but its code is commented.
|
* but its code is commented.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static Ecore_List *_ecore_xcb_cookies = NULL;
|
static Eina_List *_ecore_xcb_cookies = NULL;
|
||||||
static void *_ecore_xcb_reply = NULL;
|
static void *_ecore_xcb_reply = NULL;
|
||||||
|
|
||||||
typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data;
|
typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data;
|
||||||
|
@ -33,35 +33,22 @@ struct _Ecore_Xcb_Data
|
||||||
int
|
int
|
||||||
_ecore_x_reply_init ()
|
_ecore_x_reply_init ()
|
||||||
{
|
{
|
||||||
_ecore_xcb_cookies = ecore_list_new();
|
|
||||||
if (!_ecore_xcb_cookies)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!ecore_list_init(_ecore_xcb_cookies))
|
|
||||||
{
|
|
||||||
ecore_list_destroy(_ecore_xcb_cookies);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ecore_list_free_cb_set(_ecore_xcb_cookies, ECORE_FREE_CB(free)))
|
|
||||||
{
|
|
||||||
ecore_list_destroy(_ecore_xcb_cookies);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_ecore_x_reply_shutdown ()
|
_ecore_x_reply_shutdown ()
|
||||||
{
|
{
|
||||||
|
Ecore_Xcb_Data *data;
|
||||||
|
|
||||||
if (_ecore_xcb_reply)
|
if (_ecore_xcb_reply)
|
||||||
free(_ecore_xcb_reply);
|
free(_ecore_xcb_reply);
|
||||||
|
|
||||||
if (!_ecore_xcb_cookies)
|
if (!_ecore_xcb_cookies)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ecore_list_destroy(_ecore_xcb_cookies);
|
EINA_LIST_FREE(_ecore_xcb_cookies, data)
|
||||||
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -78,7 +65,8 @@ _ecore_xcb_cookie_cache (unsigned int cookie)
|
||||||
|
|
||||||
data->cookie = cookie;
|
data->cookie = cookie;
|
||||||
|
|
||||||
if (!ecore_list_append(_ecore_xcb_cookies, data))
|
_ecore_xcb_cookies = eina_list_append(_ecore_xcb_cookies, data);
|
||||||
|
if (!eina_list_data_find(_ecore_xcb_cookies, data))
|
||||||
{
|
{
|
||||||
free(data);
|
free(data);
|
||||||
return;
|
return;
|
||||||
|
@ -94,16 +82,14 @@ _ecore_xcb_cookie_get (void)
|
||||||
if (!_ecore_xcb_cookies)
|
if (!_ecore_xcb_cookies)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
data = ecore_list_first_remove(_ecore_xcb_cookies);
|
data = eina_list_data_get(_ecore_xcb_cookies);
|
||||||
if (data)
|
if (!data) return 0;
|
||||||
{
|
|
||||||
|
_ecore_xcb_cookies = eina_list_remove_list(_ecore_xcb_cookies, _ecore_xcb_cookies);
|
||||||
cookie = data->cookie;
|
cookie = data->cookie;
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
return cookie;
|
return cookie;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
static int
|
static int
|
||||||
timer(void *data __UNUSED__)
|
timer(void *data __UNUSED__)
|
||||||
{
|
{
|
||||||
Ecore_List *list;
|
Eina_List *list;
|
||||||
|
Eina_List *l;
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
double start;
|
double start;
|
||||||
|
|
||||||
|
@ -22,12 +23,12 @@ timer(void *data __UNUSED__)
|
||||||
list = efreet_util_desktop_mime_list("application/ogg");
|
list = efreet_util_desktop_mime_list("application/ogg");
|
||||||
if (list)
|
if (list)
|
||||||
{
|
{
|
||||||
ecore_list_first_goto(list);
|
EINA_LIST_FOREACH(list, l, desktop)
|
||||||
while ((desktop = ecore_list_next(list)))
|
|
||||||
{
|
{
|
||||||
printf("application/ogg: %s\n", desktop->name);
|
printf("application/ogg: %s\n", desktop->name);
|
||||||
}
|
}
|
||||||
ecore_list_destroy(list);
|
while (list)
|
||||||
|
list = eina_list_remove_list(list, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -153,7 +153,7 @@ ef_cb_efreet_cache_home(void)
|
||||||
int
|
int
|
||||||
ef_cb_efreet_data_dirs(void)
|
ef_cb_efreet_data_dirs(void)
|
||||||
{
|
{
|
||||||
Ecore_List *tmp;
|
Eina_List *tmp, *l;
|
||||||
int ret = 1, i;
|
int ret = 1, i;
|
||||||
char dirs[128], *val;
|
char dirs[128], *val;
|
||||||
char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
|
char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
|
||||||
|
@ -172,8 +172,7 @@ ef_cb_efreet_data_dirs(void)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
tmp = efreet_data_dirs_get();
|
tmp = efreet_data_dirs_get();
|
||||||
ecore_list_first_goto(tmp);
|
EINA_LIST_FOREACH(tmp, l, val)
|
||||||
while ((val = ecore_list_next(tmp)))
|
|
||||||
{
|
{
|
||||||
if (vals[i] == NULL)
|
if (vals[i] == NULL)
|
||||||
{
|
{
|
||||||
|
@ -199,14 +198,13 @@ ef_cb_efreet_data_dirs(void)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
tmp = efreet_data_dirs_get();
|
tmp = efreet_data_dirs_get();
|
||||||
if (ecore_list_count(tmp) != 2)
|
if (eina_list_count(tmp) != 2)
|
||||||
{
|
{
|
||||||
printf("efreet_data_dirs_get() nodes is differnet from expected default\n");
|
printf("efreet_data_dirs_get() nodes is differnet from expected default\n");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_list_first_goto(tmp);
|
EINA_LIST_FOREACH(tmp, l, val)
|
||||||
while ((val = ecore_list_next(tmp)))
|
|
||||||
{
|
{
|
||||||
if (def_vals[i] == NULL)
|
if (def_vals[i] == NULL)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +229,7 @@ ef_cb_efreet_data_dirs(void)
|
||||||
int
|
int
|
||||||
ef_cb_efreet_config_dirs(void)
|
ef_cb_efreet_config_dirs(void)
|
||||||
{
|
{
|
||||||
Ecore_List *tmp;
|
Eina_List *tmp, *l;
|
||||||
int ret = 1, i;
|
int ret = 1, i;
|
||||||
char dirs[128], *val;
|
char dirs[128], *val;
|
||||||
char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
|
char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
|
||||||
|
@ -251,8 +249,7 @@ ef_cb_efreet_config_dirs(void)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
tmp = efreet_config_dirs_get();
|
tmp = efreet_config_dirs_get();
|
||||||
ecore_list_first_goto(tmp);
|
EINA_LIST_FOREACH(tmp, l, val)
|
||||||
while ((val = ecore_list_next(tmp)))
|
|
||||||
{
|
{
|
||||||
if (vals[i] == NULL)
|
if (vals[i] == NULL)
|
||||||
{
|
{
|
||||||
|
@ -278,8 +275,7 @@ ef_cb_efreet_config_dirs(void)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
tmp = efreet_config_dirs_get();
|
tmp = efreet_config_dirs_get();
|
||||||
ecore_list_first_goto(tmp);
|
EINA_LIST_FOREACH(tmp, l, val)
|
||||||
while ((val = ecore_list_next(tmp)))
|
|
||||||
{
|
{
|
||||||
if (def_vals[i] == NULL)
|
if (def_vals[i] == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,7 @@ int
|
||||||
ef_cb_desktop_parse(void)
|
ef_cb_desktop_parse(void)
|
||||||
{
|
{
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
|
Eina_List *l;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
desktop = efreet_desktop_get(PACKAGE_DATA_DIR"/test/test.desktop");
|
desktop = efreet_desktop_get(PACKAGE_DATA_DIR"/test/test.desktop");
|
||||||
|
@ -48,8 +49,7 @@ ef_cb_desktop_parse(void)
|
||||||
const char *cat;
|
const char *cat;
|
||||||
int num_categories = 2, i = 0;
|
int num_categories = 2, i = 0;
|
||||||
|
|
||||||
ecore_list_first_goto(desktop->categories);
|
EINA_LIST_FOREACH(desktop->categories, l, cat)
|
||||||
while ((cat = ecore_list_next(desktop->categories)))
|
|
||||||
{
|
{
|
||||||
if (i >= num_categories)
|
if (i >= num_categories)
|
||||||
{
|
{
|
||||||
|
@ -141,10 +141,9 @@ ef_cb_desktop_save(void)
|
||||||
desktop->type = EFREET_DESKTOP_TYPE_APPLICATION;
|
desktop->type = EFREET_DESKTOP_TYPE_APPLICATION;
|
||||||
desktop->generic_name = strdup("Test Application");
|
desktop->generic_name = strdup("Test Application");
|
||||||
desktop->exec = strdup("efreet_test");
|
desktop->exec = strdup("efreet_test");
|
||||||
desktop->categories = ecore_list_new();
|
desktop->categories = NULL;
|
||||||
ecore_list_free_cb_set(desktop->categories, ECORE_FREE_CB(free));
|
desktop->categories = eina_list_append(desktop->categories, strdup("Test"));
|
||||||
ecore_list_append(desktop->categories, strdup("Test"));
|
desktop->categories = eina_list_append(desktop->categories, strdup("Enlightenment"));
|
||||||
ecore_list_append(desktop->categories, strdup("Enlightenment"));
|
|
||||||
printf("save test: %d\n", efreet_desktop_save(desktop));
|
printf("save test: %d\n", efreet_desktop_save(desktop));
|
||||||
unlink("/tmp/test.desktop");
|
unlink("/tmp/test.desktop");
|
||||||
efreet_desktop_free(desktop);
|
efreet_desktop_free(desktop);
|
||||||
|
@ -154,7 +153,7 @@ ef_cb_desktop_save(void)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Ecore_List *expected;
|
Eina_List *expected;
|
||||||
int error;
|
int error;
|
||||||
char type;
|
char type;
|
||||||
} Test_Info;
|
} Test_Info;
|
||||||
|
@ -163,7 +162,7 @@ int
|
||||||
ef_cb_desktop_command_get(void)
|
ef_cb_desktop_command_get(void)
|
||||||
{
|
{
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
Ecore_List *files, *expected;
|
Eina_List *files, *expected;
|
||||||
char olddir[PATH_MAX];
|
char olddir[PATH_MAX];
|
||||||
Test_Info *info;
|
Test_Info *info;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -177,14 +176,15 @@ ef_cb_desktop_command_get(void)
|
||||||
desktop->name = strdup("App Name");
|
desktop->name = strdup("App Name");
|
||||||
desktop->icon = strdup("icon.png");
|
desktop->icon = strdup("icon.png");
|
||||||
|
|
||||||
files = ecore_list_new();
|
files = NULL;
|
||||||
ecore_list_append(files, "/tmp/absolute_path");
|
files = eina_list_append(files, "/tmp/absolute_path");
|
||||||
ecore_list_append(files, "relative_path");
|
files = eina_list_append(files, "relative_path");
|
||||||
ecore_list_append(files, "file:///tmp/absolute_uri");
|
files = eina_list_append(files, "file:///tmp/absolute_uri");
|
||||||
ecore_list_append(files, "file:relative_uri");
|
files = eina_list_append(files, "file:relative_uri");
|
||||||
|
|
||||||
info = NEW(Test_Info, 1);
|
info = NEW(Test_Info, 1);
|
||||||
expected = ecore_list_new();
|
expected = NULL;
|
||||||
|
// FIXME: info->expected needs to be update.
|
||||||
info->expected = expected;
|
info->expected = expected;
|
||||||
info->error = 0;
|
info->error = 0;
|
||||||
|
|
||||||
|
@ -192,129 +192,131 @@ ef_cb_desktop_command_get(void)
|
||||||
info->type = 'f';
|
info->type = 'f';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %f");
|
desktop->exec = strdup("app %f");
|
||||||
ecore_list_append(expected, "app '/tmp/absolute_path'");
|
expected = eina_list_append(expected, "app '/tmp/absolute_path'");
|
||||||
ecore_list_append(expected, "app '/relative_path'");
|
expected = eina_list_append(expected, "app '/relative_path'");
|
||||||
ecore_list_append(expected, "app '/tmp/absolute_uri'");
|
expected = eina_list_append(expected, "app '/tmp/absolute_uri'");
|
||||||
ecore_list_append(expected, "app '/relative_uri'");
|
expected = eina_list_append(expected, "app '/relative_uri'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* test single uri */
|
/* test single uri */
|
||||||
info->type = 'u';
|
info->type = 'u';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %u");
|
desktop->exec = strdup("app %u");
|
||||||
ecore_list_append(expected, "app 'file:///tmp/absolute_path'");
|
expected = eina_list_append(expected, "app 'file:///tmp/absolute_path'");
|
||||||
ecore_list_append(expected, "app 'file:///relative_path'");
|
expected = eina_list_append(expected, "app 'file:///relative_path'");
|
||||||
ecore_list_append(expected, "app 'file:///tmp/absolute_uri'");
|
expected = eina_list_append(expected, "app 'file:///tmp/absolute_uri'");
|
||||||
ecore_list_append(expected, "app 'file:///relative_uri'");
|
expected = eina_list_append(expected, "app 'file:///relative_uri'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* test single dir */
|
/* test single dir */
|
||||||
info->type = 'd';
|
info->type = 'd';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %d");
|
desktop->exec = strdup("app %d");
|
||||||
ecore_list_append(expected, "app '/tmp'");
|
expected = eina_list_append(expected, "app '/tmp'");
|
||||||
ecore_list_append(expected, "app '/'");
|
expected = eina_list_append(expected, "app '/'");
|
||||||
ecore_list_append(expected, "app '/tmp'");
|
expected = eina_list_append(expected, "app '/tmp'");
|
||||||
ecore_list_append(expected, "app '/'");
|
expected = eina_list_append(expected, "app '/'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
|
|
||||||
/* test single names */
|
/* test single names */
|
||||||
info->type = 'n';
|
info->type = 'n';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %n");
|
desktop->exec = strdup("app %n");
|
||||||
ecore_list_append(expected, "app 'absolute_path'");
|
expected = eina_list_append(expected, "app 'absolute_path'");
|
||||||
ecore_list_append(expected, "app 'relative_path'");
|
expected = eina_list_append(expected, "app 'relative_path'");
|
||||||
ecore_list_append(expected, "app 'absolute_uri'");
|
expected = eina_list_append(expected, "app 'absolute_uri'");
|
||||||
ecore_list_append(expected, "app 'relative_uri'");
|
expected = eina_list_append(expected, "app 'relative_uri'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* test multiple fullpaths */
|
/* test multiple fullpaths */
|
||||||
info->type = 'F';
|
info->type = 'F';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %F");
|
desktop->exec = strdup("app %F");
|
||||||
ecore_list_append(expected, "app '/tmp/absolute_path' '/relative_path' '/tmp/absolute_uri' '/relative_uri'");
|
expected = eina_list_append(expected, "app '/tmp/absolute_path' '/relative_path' '/tmp/absolute_uri' '/relative_uri'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* test multiple URIs */
|
/* test multiple URIs */
|
||||||
info->type = 'U';
|
info->type = 'U';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %U");
|
desktop->exec = strdup("app %U");
|
||||||
ecore_list_append(expected, "app 'file:///tmp/absolute_path' 'file:///relative_path' 'file:///tmp/absolute_uri' 'file:///relative_uri'");
|
expected = eina_list_append(expected, "app 'file:///tmp/absolute_path' 'file:///relative_path' 'file:///tmp/absolute_uri' 'file:///relative_uri'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* test multiple dirs */
|
/* test multiple dirs */
|
||||||
info->type = 'D';
|
info->type = 'D';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %D");
|
desktop->exec = strdup("app %D");
|
||||||
ecore_list_append(expected, "app '/tmp' '/' '/tmp' '/'");
|
expected = eina_list_append(expected, "app '/tmp' '/' '/tmp' '/'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* test multiple names */
|
/* test multiple names */
|
||||||
info->type = 'N';
|
info->type = 'N';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %N");
|
desktop->exec = strdup("app %N");
|
||||||
ecore_list_append(expected, "app 'absolute_path' 'relative_path' 'absolute_uri' 'relative_uri'");
|
expected = eina_list_append(expected, "app 'absolute_path' 'relative_path' 'absolute_uri' 'relative_uri'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
efreet_desktop_command_get(desktop, files, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* test icon appending */
|
/* test icon appending */
|
||||||
info->type = 'i';
|
info->type = 'i';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %i");
|
desktop->exec = strdup("app %i");
|
||||||
ecore_list_append(expected, "app --icon 'icon.png'");
|
expected = eina_list_append(expected, "app --icon 'icon.png'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, NULL, _cb_command, info);
|
efreet_desktop_command_get(desktop, NULL, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* test app name */
|
/* test app name */
|
||||||
info->type = 'c';
|
info->type = 'c';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %c");
|
desktop->exec = strdup("app %c");
|
||||||
ecore_list_append(expected, "app 'App Name'");
|
expected = eina_list_append(expected, "app 'App Name'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, NULL, _cb_command, info);
|
efreet_desktop_command_get(desktop, NULL, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* test desktop path */
|
/* test desktop path */
|
||||||
info->type = 'k';
|
info->type = 'k';
|
||||||
IF_FREE(desktop->exec);
|
IF_FREE(desktop->exec);
|
||||||
desktop->exec = strdup("app %k");
|
desktop->exec = strdup("app %k");
|
||||||
ecore_list_append(expected, "app 'test.desktop'");
|
expected = eina_list_append(expected, "app 'test.desktop'");
|
||||||
|
|
||||||
ecore_list_first_goto(expected);
|
|
||||||
efreet_desktop_command_get(desktop, NULL, _cb_command, info);
|
efreet_desktop_command_get(desktop, NULL, _cb_command, info);
|
||||||
ecore_list_clear(expected);
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
efreet_desktop_free(desktop);
|
efreet_desktop_free(desktop);
|
||||||
ecore_list_destroy(files);
|
while (files)
|
||||||
ecore_list_destroy(expected);
|
files = eina_list_remove_list(files, expected);
|
||||||
|
while (expected)
|
||||||
|
expected = eina_list_remove_list(expected, expected);
|
||||||
|
|
||||||
ret = info->error > 0 ? 0 : 1;
|
ret = info->error > 0 ? 0 : 1;
|
||||||
free(info);
|
free(info);
|
||||||
|
@ -331,7 +333,8 @@ _cb_command(void *data, Efreet_Desktop *desktop __UNUSED__,
|
||||||
Test_Info *info = data;
|
Test_Info *info = data;
|
||||||
char *expected;
|
char *expected;
|
||||||
|
|
||||||
expected = ecore_list_next(info->expected);
|
expected = eina_list_data_get(info->expected);
|
||||||
|
info->expected = eina_list_demote_list(info->expected, info->expected);
|
||||||
if (!expected)
|
if (!expected)
|
||||||
{
|
{
|
||||||
printf(" ERROR: (%%%c) got \"%s\", expected nothing\n", info->type, exec);
|
printf(" ERROR: (%%%c) got \"%s\", expected nothing\n", info->type, exec);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
static Eina_Bool _hash_keys(Eina_Hash *hash, const char *key, void *list);
|
static Eina_Bool _hash_keys(Eina_Hash *hash, const char *key, void *list);
|
||||||
static void ef_icon_theme_themes_find(const char *search_dir,
|
static void ef_icon_theme_themes_find(const char *search_dir,
|
||||||
Eina_Hash *themes);
|
Eina_Hash *themes);
|
||||||
static void ef_icons_find(Efreet_Icon_Theme *theme, Ecore_List *themes,
|
static void ef_icons_find(Efreet_Icon_Theme *theme, Eina_List *themes,
|
||||||
Eina_Hash *icons);
|
Eina_Hash *icons);
|
||||||
static void ef_read_dir(const char *dir, Eina_Hash *icons);
|
static void ef_read_dir(const char *dir, Eina_Hash *icons);
|
||||||
|
|
||||||
|
@ -56,7 +56,9 @@ ef_cb_efreet_icon_theme(void)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_hash_keys(Eina_Hash *hash, const char *key, void *list)
|
_hash_keys(Eina_Hash *hash, const char *key, void *list)
|
||||||
{
|
{
|
||||||
ecore_list_append(list, key);
|
Eina_List **l = list;
|
||||||
|
|
||||||
|
*l = eina_list_append(*l, key);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,11 +66,12 @@ int
|
||||||
ef_cb_efreet_icon_theme_list(void)
|
ef_cb_efreet_icon_theme_list(void)
|
||||||
{
|
{
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
Ecore_List *themes;
|
Eina_List *themes;
|
||||||
|
Eina_List *icon_dirs;
|
||||||
|
Eina_List *l;
|
||||||
Eina_Hash *dirs;
|
Eina_Hash *dirs;
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
Efreet_Icon_Theme *theme;
|
Efreet_Icon_Theme *theme;
|
||||||
Ecore_List *icon_dirs;
|
|
||||||
const char *dir;
|
const char *dir;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
void *value;
|
void *value;
|
||||||
|
@ -76,10 +79,9 @@ ef_cb_efreet_icon_theme_list(void)
|
||||||
dirs = eina_hash_string_superfast_new(free);
|
dirs = eina_hash_string_superfast_new(free);
|
||||||
|
|
||||||
icon_dirs = efreet_data_dirs_get();
|
icon_dirs = efreet_data_dirs_get();
|
||||||
ecore_list_first_goto(icon_dirs);
|
|
||||||
|
|
||||||
ef_icon_theme_themes_find(efreet_icon_user_dir_get(), dirs);
|
ef_icon_theme_themes_find(efreet_icon_user_dir_get(), dirs);
|
||||||
while ((dir = ecore_list_next(icon_dirs)))
|
EINA_LIST_FOREACH(icon_dirs, l, dir)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s/icons", dir);
|
snprintf(buf, sizeof(buf), "%s/icons", dir);
|
||||||
ef_icon_theme_themes_find(buf, dirs);
|
ef_icon_theme_themes_find(buf, dirs);
|
||||||
|
@ -87,8 +89,7 @@ ef_cb_efreet_icon_theme_list(void)
|
||||||
ef_icon_theme_themes_find("/usr/share/pixmaps", dirs);
|
ef_icon_theme_themes_find("/usr/share/pixmaps", dirs);
|
||||||
|
|
||||||
themes = efreet_icon_theme_list_get();
|
themes = efreet_icon_theme_list_get();
|
||||||
ecore_list_first_goto(themes);
|
EINA_LIST_FOREACH(themes, l, theme)
|
||||||
while ((theme = ecore_list_next(themes)))
|
|
||||||
{
|
{
|
||||||
if ((eina_hash_find(dirs, theme->name.internal)))
|
if ((eina_hash_find(dirs, theme->name.internal)))
|
||||||
eina_hash_del(dirs, theme->name.internal, NULL);
|
eina_hash_del(dirs, theme->name.internal, NULL);
|
||||||
|
@ -99,26 +100,31 @@ ef_cb_efreet_icon_theme_list(void)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ecore_list_destroy(themes);
|
while (themes)
|
||||||
|
{
|
||||||
|
themes = eina_list_remove_list(themes, themes);
|
||||||
|
}
|
||||||
|
|
||||||
themes = ecore_list_new();
|
themes = NULL;
|
||||||
it = eina_hash_iterator_key_new(dirs);
|
it = eina_hash_iterator_key_new(dirs);
|
||||||
eina_iterator_foreach(it, EINA_EACH(_hash_keys), themes);
|
eina_iterator_foreach(it, EINA_EACH(_hash_keys), &themes);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
if (ecore_list_count(themes) > 0)
|
if (eina_list_count(themes) > 0)
|
||||||
{
|
{
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
||||||
printf("efreet_icon_theme_list_get() missed: ");
|
printf("efreet_icon_theme_list_get() missed: ");
|
||||||
ecore_list_first_goto(themes);
|
EINA_LIST_FOREACH(themes, l, dir)
|
||||||
while ((dir = ecore_list_next(themes)))
|
|
||||||
printf("%s ", dir);
|
printf("%s ", dir);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
ecore_list_destroy(themes);
|
while (themes)
|
||||||
|
{
|
||||||
|
themes = eina_list_remove_list(themes, themes);
|
||||||
|
}
|
||||||
eina_hash_free(dirs);
|
eina_hash_free(dirs);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -127,7 +133,7 @@ ef_cb_efreet_icon_theme_list(void)
|
||||||
static void
|
static void
|
||||||
ef_icon_theme_themes_find(const char *search_dir, Eina_Hash *themes)
|
ef_icon_theme_themes_find(const char *search_dir, Eina_Hash *themes)
|
||||||
{
|
{
|
||||||
Ecore_List *dirs;
|
Eina_List *dirs;
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
||||||
if (!search_dir || !themes) return;
|
if (!search_dir || !themes) return;
|
||||||
|
@ -135,10 +141,11 @@ ef_icon_theme_themes_find(const char *search_dir, Eina_Hash *themes)
|
||||||
dirs = ecore_file_ls(search_dir);
|
dirs = ecore_file_ls(search_dir);
|
||||||
if (!dirs) return;
|
if (!dirs) return;
|
||||||
|
|
||||||
while ((dir = ecore_list_first_remove(dirs)))
|
while ((dir = eina_list_data_get(dirs)))
|
||||||
{
|
{
|
||||||
char p[PATH_MAX];
|
char p[PATH_MAX];
|
||||||
|
|
||||||
|
dirs = eina_list_remove_list(dirs, dirs);
|
||||||
/* if we've already added the theme we're done */
|
/* if we've already added the theme we're done */
|
||||||
if (eina_hash_find(themes, dir))
|
if (eina_hash_find(themes, dir))
|
||||||
{
|
{
|
||||||
|
@ -170,7 +177,6 @@ ef_icon_theme_themes_find(const char *search_dir, Eina_Hash *themes)
|
||||||
}
|
}
|
||||||
free(dir);
|
free(dir);
|
||||||
}
|
}
|
||||||
ecore_list_destroy(dirs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *icons[] =
|
const char *icons[] =
|
||||||
|
@ -440,11 +446,11 @@ ef_cb_efreet_icon_match(void)
|
||||||
int i, ret = 1;
|
int i, ret = 1;
|
||||||
Eina_Hash *icon_hash;
|
Eina_Hash *icon_hash;
|
||||||
Efreet_Icon_Theme *theme;
|
Efreet_Icon_Theme *theme;
|
||||||
Ecore_List *themes;
|
Eina_List *themes;
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
themes = efreet_icon_theme_list_get();
|
themes = efreet_icon_theme_list_get();
|
||||||
ecore_list_first_goto(themes);
|
EINA_LIST_FOREACH(themes, l, theme)
|
||||||
while ((theme = ecore_list_next(themes)))
|
|
||||||
{
|
{
|
||||||
if (!strcmp(theme->name.internal, THEME))
|
if (!strcmp(theme->name.internal, THEME))
|
||||||
break;
|
break;
|
||||||
|
@ -453,14 +459,16 @@ ef_cb_efreet_icon_match(void)
|
||||||
if (!theme)
|
if (!theme)
|
||||||
{
|
{
|
||||||
printf("Theme not installed, SKIPPED.\n");
|
printf("Theme not installed, SKIPPED.\n");
|
||||||
ecore_list_destroy(themes);
|
while (themes)
|
||||||
|
themes = eina_list_remove_list(themes, themes);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
icon_hash = eina_hash_string_superfast_new(free);
|
icon_hash = eina_hash_string_superfast_new(free);
|
||||||
|
|
||||||
ef_icons_find(theme, themes, icon_hash);
|
ef_icons_find(theme, themes, icon_hash);
|
||||||
ecore_list_destroy(themes);
|
while (themes)
|
||||||
|
themes = eina_list_remove_list(themes, themes);
|
||||||
|
|
||||||
double start = ecore_time_get();
|
double start = ecore_time_get();
|
||||||
for (i = 0; icons[i] != NULL; i++)
|
for (i = 0; icons[i] != NULL; i++)
|
||||||
|
@ -527,67 +535,33 @@ ef_cb_efreet_icon_match(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ef_icons_find(Efreet_Icon_Theme *theme, Ecore_List *themes, Eina_Hash *icons)
|
ef_icons_find(Efreet_Icon_Theme *theme, Eina_List *themes, Eina_Hash *icons)
|
||||||
{
|
{
|
||||||
|
Eina_List *l, *ll;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
const char *theme_path;
|
||||||
|
|
||||||
if (!theme || !icons) return;
|
if (!theme || !icons) return;
|
||||||
|
|
||||||
if (theme->paths.count == 1)
|
EINA_LIST_FOREACH(theme->paths, l, theme_path)
|
||||||
{
|
{
|
||||||
Efreet_Icon_Theme_Directory *dir;
|
Efreet_Icon_Theme_Directory *dir;
|
||||||
|
|
||||||
ecore_list_first_goto(theme->directories);
|
EINA_LIST_FOREACH(theme->directories, ll, dir)
|
||||||
while ((dir = ecore_list_next(theme->directories)))
|
|
||||||
{
|
|
||||||
if (theme->paths.count > 1)
|
|
||||||
{
|
|
||||||
Ecore_List *list;
|
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
list = theme->paths.path;
|
|
||||||
ecore_list_first_goto(list);
|
|
||||||
while ((tmp = ecore_list_next(list)))
|
|
||||||
{
|
|
||||||
snprintf(path, sizeof(path), "%s/%s/", tmp, dir->name);
|
|
||||||
ef_read_dir(path, icons);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (theme->paths.count == 1)
|
|
||||||
{
|
|
||||||
snprintf(path, sizeof(path), "%s/%s/", (char *)theme->paths.path, dir->name);
|
|
||||||
ef_read_dir(path, icons);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (theme->paths.count > 1)
|
|
||||||
{
|
|
||||||
const char *theme_path;
|
|
||||||
|
|
||||||
ecore_list_first_goto(theme->paths.path);
|
|
||||||
while ((theme_path = ecore_list_next(theme->paths.path)))
|
|
||||||
{
|
|
||||||
Efreet_Icon_Theme_Directory *dir;
|
|
||||||
|
|
||||||
ecore_list_first_goto(theme->directories);
|
|
||||||
while ((dir = ecore_list_next(theme->directories)))
|
|
||||||
{
|
{
|
||||||
snprintf(path, sizeof(path), "%s/%s/", theme_path, dir->name);
|
snprintf(path, sizeof(path), "%s/%s/", theme_path, dir->name);
|
||||||
ef_read_dir(path, icons);
|
ef_read_dir(path, icons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (theme->inherits)
|
if (theme->inherits)
|
||||||
{
|
{
|
||||||
Efreet_Icon_Theme *parent_theme;
|
Efreet_Icon_Theme *parent_theme;
|
||||||
char *parent;
|
char *parent;
|
||||||
|
|
||||||
ecore_list_first_goto(theme->inherits);
|
EINA_LIST_FOREACH(theme->inherits, l, parent)
|
||||||
while ((parent = ecore_list_next(theme->inherits)))
|
|
||||||
{
|
{
|
||||||
ecore_list_first_goto(themes);
|
EINA_LIST_FOREACH(themes, ll, parent_theme)
|
||||||
while ((parent_theme = ecore_list_next(themes)))
|
|
||||||
{
|
{
|
||||||
if (!strcmp(parent_theme->name.internal, parent))
|
if (!strcmp(parent_theme->name.internal, parent))
|
||||||
ef_icons_find(parent_theme, themes, icons);
|
ef_icons_find(parent_theme, themes, icons);
|
||||||
|
@ -598,8 +572,7 @@ ef_icons_find(Efreet_Icon_Theme *theme, Ecore_List *themes, Eina_Hash *icons)
|
||||||
{
|
{
|
||||||
Efreet_Icon_Theme *parent_theme;
|
Efreet_Icon_Theme *parent_theme;
|
||||||
|
|
||||||
ecore_list_first_goto(themes);
|
EINA_LIST_FOREACH(themes, l, parent_theme)
|
||||||
while ((parent_theme = ecore_list_next(themes)))
|
|
||||||
{
|
{
|
||||||
if (!strcmp(parent_theme->name.internal, "hicolor"))
|
if (!strcmp(parent_theme->name.internal, "hicolor"))
|
||||||
ef_icons_find(parent_theme, themes, icons);
|
ef_icons_find(parent_theme, themes, icons);
|
||||||
|
@ -612,7 +585,7 @@ ef_icons_find(Efreet_Icon_Theme *theme, Ecore_List *themes, Eina_Hash *icons)
|
||||||
static void
|
static void
|
||||||
ef_read_dir(const char *dir, Eina_Hash *icons)
|
ef_read_dir(const char *dir, Eina_Hash *icons)
|
||||||
{
|
{
|
||||||
Ecore_List *files;
|
Eina_List *files;
|
||||||
char *file;
|
char *file;
|
||||||
|
|
||||||
if (!dir || !icons) return;
|
if (!dir || !icons) return;
|
||||||
|
@ -620,10 +593,11 @@ ef_read_dir(const char *dir, Eina_Hash *icons)
|
||||||
files = ecore_file_ls(dir);
|
files = ecore_file_ls(dir);
|
||||||
if (!files) return;
|
if (!files) return;
|
||||||
|
|
||||||
while ((file = ecore_list_first_remove(files)))
|
while ((file = eina_list_data_get(files)))
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
files = eina_list_remove_list(files, files);
|
||||||
p = strrchr(file, '.');
|
p = strrchr(file, '.');
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
{
|
||||||
|
@ -640,5 +614,4 @@ ef_read_dir(const char *dir, Eina_Hash *icons)
|
||||||
|
|
||||||
FREE(file);
|
FREE(file);
|
||||||
}
|
}
|
||||||
ecore_list_destroy(files);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,20 +8,20 @@
|
||||||
static void
|
static void
|
||||||
ef_menu_desktop_exec(Efreet_Menu *menu)
|
ef_menu_desktop_exec(Efreet_Menu *menu)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
if (menu->entries)
|
if (menu->entries)
|
||||||
{
|
{
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
|
|
||||||
ecore_list_first_goto(menu->entries);
|
EINA_LIST_FOREACH(menu->entries, l, desktop)
|
||||||
while ((desktop = ecore_list_next(menu->entries)))
|
|
||||||
efreet_desktop_exec(desktop, NULL);
|
efreet_desktop_exec(desktop, NULL);
|
||||||
}
|
}
|
||||||
if (menu->sub_menus)
|
if (menu->sub_menus)
|
||||||
{
|
{
|
||||||
Efreet_Menu *sub_menu;
|
Efreet_Menu *sub_menu;
|
||||||
|
|
||||||
ecore_list_first_goto(menu->sub_menus);
|
EINA_LIST_FOREACH(menu->sub_menus, l, sub_menu)
|
||||||
while ((sub_menu = ecore_list_next(menu->sub_menus)))
|
|
||||||
ef_menu_desktop_exec(sub_menu);
|
ef_menu_desktop_exec(sub_menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,7 @@ ef_cb_menu_edit(void)
|
||||||
efreet_menu_dump(menu, "");
|
efreet_menu_dump(menu, "");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
ecore_list_first_goto(menu->entries);
|
entry = eina_list_data_get(menu->entries);
|
||||||
entry = ecore_list_current(menu->entries);
|
|
||||||
if (desktop != entry->desktop)
|
if (desktop != entry->desktop)
|
||||||
{
|
{
|
||||||
efreet_menu_free(menu);
|
efreet_menu_free(menu);
|
||||||
|
@ -127,8 +126,7 @@ ef_cb_menu_edit(void)
|
||||||
efreet_menu_dump(menu, "");
|
efreet_menu_dump(menu, "");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
ecore_list_index_goto(menu->entries, 2);
|
entry = eina_list_nth(menu->entries, 2);
|
||||||
entry = ecore_list_current(menu->entries);
|
|
||||||
if (desktop != entry->desktop)
|
if (desktop != entry->desktop)
|
||||||
{
|
{
|
||||||
efreet_menu_free(menu);
|
efreet_menu_free(menu);
|
||||||
|
@ -141,8 +139,7 @@ ef_cb_menu_edit(void)
|
||||||
efreet_menu_dump(menu, "");
|
efreet_menu_dump(menu, "");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
ecore_list_last_goto(menu->entries);
|
entry = eina_list_data_get(eina_list_last(menu->entries));
|
||||||
entry = ecore_list_current(menu->entries);
|
|
||||||
if (desktop != entry->desktop)
|
if (desktop != entry->desktop)
|
||||||
{
|
{
|
||||||
efreet_menu_free(menu);
|
efreet_menu_free(menu);
|
||||||
|
|
|
@ -35,11 +35,11 @@ static void
|
||||||
dump(Efreet_Menu *menu, const char *path)
|
dump(Efreet_Menu *menu, const char *path)
|
||||||
{
|
{
|
||||||
Efreet_Menu *entry;
|
Efreet_Menu *entry;
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
if (!menu || !menu->entries) return;
|
if (!menu || !menu->entries) return;
|
||||||
|
|
||||||
ecore_list_first_goto(menu->entries);
|
EINA_LIST_FOREACH(menu->entries, l, entry)
|
||||||
while ((entry = ecore_list_next(menu->entries)))
|
|
||||||
{
|
{
|
||||||
if (entry->type == EFREET_MENU_ENTRY_DESKTOP)
|
if (entry->type == EFREET_MENU_ENTRY_DESKTOP)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,34 +77,34 @@ static Efreet_Test tests[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
static Ecore_List *environment = NULL;
|
static Eina_List *environment = NULL;
|
||||||
|
|
||||||
void
|
void
|
||||||
environment_store(void)
|
environment_store(void)
|
||||||
{
|
{
|
||||||
|
char *env;
|
||||||
char **e;
|
char **e;
|
||||||
|
|
||||||
if (environment)
|
while (environment)
|
||||||
ecore_list_clear(environment);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
environment = ecore_list_new();
|
env = eina_list_data_get(environment);
|
||||||
ecore_list_free_cb_set(environment, ECORE_FREE_CB(free));
|
free(env);
|
||||||
|
environment = eina_list_remove_list(environment, environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (e = environ; *e; e++)
|
for (e = environ; *e; e++)
|
||||||
ecore_list_append(environment, strdup(*e));
|
environment = eina_list_append(environment, strdup(*e));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
environment_restore(void)
|
environment_restore(void)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *e;
|
char *e;
|
||||||
if (!environment) return;
|
if (!environment) return;
|
||||||
|
|
||||||
*environ = NULL;
|
*environ = NULL;
|
||||||
ecore_list_first_goto(environment);
|
EINA_LIST_FOREACH(environment, l, e)
|
||||||
while ((e = ecore_list_next(environment)))
|
|
||||||
putenv(e);
|
putenv(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,13 +112,12 @@ int
|
||||||
main(int argc, char ** argv)
|
main(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int i, passed = 0, num_tests = 0;
|
int i, passed = 0, num_tests = 0;
|
||||||
Ecore_List *run = NULL;
|
Eina_List *run = NULL;
|
||||||
double total;
|
double total;
|
||||||
|
|
||||||
total = ecore_time_get();
|
total = ecore_time_get();
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
run = ecore_list_new();
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if ((!strcmp(argv[i], "-h")) ||
|
if ((!strcmp(argv[i], "-h")) ||
|
||||||
|
@ -130,7 +129,7 @@ main(int argc, char ** argv)
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ecore_list_append(run, argv[i]);
|
run = eina_list_append(run, argv[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +140,7 @@ main(int argc, char ** argv)
|
||||||
double start;
|
double start;
|
||||||
|
|
||||||
/* we've been given specific tests and it isn't in the list */
|
/* we've been given specific tests and it isn't in the list */
|
||||||
if (run && !ecore_list_find(run, ECORE_COMPARE_CB(strcasecmp),
|
if (run && !eina_list_search_unsorted(run, ECORE_COMPARE_CB(strcasecmp),
|
||||||
tests[i].name))
|
tests[i].name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -166,10 +165,15 @@ main(int argc, char ** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n-----------------\n");
|
printf("\n-----------------\n");
|
||||||
if (environment) ecore_list_destroy(environment);
|
while (environment)
|
||||||
|
{
|
||||||
|
free(eina_list_data_get(environment));
|
||||||
|
environment = eina_list_remove_list(environment, environment);
|
||||||
|
}
|
||||||
printf("Passed %d of %d tests.\n", passed, num_tests);
|
printf("Passed %d of %d tests.\n", passed, num_tests);
|
||||||
|
|
||||||
if (run) ecore_list_destroy(run);
|
while (run)
|
||||||
|
run = eina_list_remove_list(run, run);
|
||||||
|
|
||||||
printf("Total run: %.3f seconds\n", ecore_time_get() - total);
|
printf("Total run: %.3f seconds\n", ecore_time_get() - total);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -41,7 +41,7 @@ EAPI void efreet_trash_shutdown(void);
|
||||||
|
|
||||||
EAPI const char *efreet_trash_dir_get(void);
|
EAPI const char *efreet_trash_dir_get(void);
|
||||||
EAPI int efreet_trash_delete_uri(Efreet_Uri *uri, int force_delete);
|
EAPI int efreet_trash_delete_uri(Efreet_Uri *uri, int force_delete);
|
||||||
EAPI Ecore_List *efreet_trash_ls(void);
|
EAPI Eina_List *efreet_trash_ls(void);
|
||||||
EAPI int efreet_trash_is_empty(void);
|
EAPI int efreet_trash_is_empty(void);
|
||||||
EAPI int efreet_trash_empty_trash(void);
|
EAPI int efreet_trash_empty_trash(void);
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@ static const char *efreet_home_dir = NULL;
|
||||||
static const char *xdg_data_home = NULL;
|
static const char *xdg_data_home = NULL;
|
||||||
static const char *xdg_config_home = NULL;
|
static const char *xdg_config_home = NULL;
|
||||||
static const char *xdg_cache_home = NULL;
|
static const char *xdg_cache_home = NULL;
|
||||||
static Ecore_List *xdg_data_dirs = NULL;
|
static Eina_List *xdg_data_dirs = NULL;
|
||||||
static Ecore_List *xdg_config_dirs = NULL;
|
static Eina_List *xdg_config_dirs = NULL;
|
||||||
|
|
||||||
static const char *efreet_dir_get(const char *key, const char *fallback);
|
static const char *efreet_dir_get(const char *key, const char *fallback);
|
||||||
static Ecore_List *efreet_dirs_get(const char *key,
|
static Eina_List *efreet_dirs_get(const char *key,
|
||||||
const char *fallback);
|
const char *fallback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,15 +77,15 @@ efreet_data_home_get(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the Ecore_List of preference ordered extra data directories
|
* @return Returns the Eina_List of preference ordered extra data directories
|
||||||
* @brief Returns the Ecore_List of prefernece oredred extra data
|
* @brief Returns the Eina_List of prefernece oredred extra data
|
||||||
* directories
|
* directories
|
||||||
*
|
*
|
||||||
* @note The returned list is static inside Efreet. If you add/remove from the
|
* @note The returned list is static inside Efreet. If you add/remove from the
|
||||||
* list then the next call to efreet_data_dirs_get() will return your
|
* list then the next call to efreet_data_dirs_get() will return your
|
||||||
* modified values. DO NOT free this list.
|
* modified values. DO NOT free this list.
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_data_dirs_get(void)
|
efreet_data_dirs_get(void)
|
||||||
{
|
{
|
||||||
if (xdg_data_dirs) return xdg_data_dirs;
|
if (xdg_data_dirs) return xdg_data_dirs;
|
||||||
|
@ -107,15 +107,15 @@ efreet_config_home_get(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the Ecore_List of preference ordered extra config directories
|
* @return Returns the Eina_List of preference ordered extra config directories
|
||||||
* @brief Returns the Ecore_List of prefernece oredred extra config
|
* @brief Returns the Eina_List of prefernece oredred extra config
|
||||||
* directories
|
* directories
|
||||||
*
|
*
|
||||||
* @note The returned list is static inside Efreet. If you add/remove from the
|
* @note The returned list is static inside Efreet. If you add/remove from the
|
||||||
* list then the next call to efreet_config_dirs_get() will return your
|
* list then the next call to efreet_config_dirs_get() will return your
|
||||||
* modified values. DO NOT free this list.
|
* modified values. DO NOT free this list.
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_config_dirs_get(void)
|
efreet_config_dirs_get(void)
|
||||||
{
|
{
|
||||||
if (xdg_config_dirs) return xdg_config_dirs;
|
if (xdg_config_dirs) return xdg_config_dirs;
|
||||||
|
@ -177,18 +177,16 @@ efreet_dir_get(const char *key, const char *fallback)
|
||||||
* @brief Creates a list of directories as given in the environment key @a
|
* @brief Creates a list of directories as given in the environment key @a
|
||||||
* key or from the fallbacks in @a fallback
|
* key or from the fallbacks in @a fallback
|
||||||
*/
|
*/
|
||||||
static Ecore_List *
|
static Eina_List *
|
||||||
efreet_dirs_get(const char *key, const char *fallback)
|
efreet_dirs_get(const char *key, const char *fallback)
|
||||||
{
|
{
|
||||||
Ecore_List *dirs;
|
Eina_List *dirs = NULL;
|
||||||
const char *path;
|
const char *path;
|
||||||
char *tmp, *s, *p;
|
char *tmp, *s, *p;
|
||||||
|
|
||||||
path = getenv(key);
|
path = getenv(key);
|
||||||
if (!path || (path[0] == '\0')) path = fallback;
|
if (!path || (path[0] == '\0')) path = fallback;
|
||||||
|
|
||||||
dirs = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(dirs, ECORE_FREE_CB(eina_stringshare_del));
|
|
||||||
if (!path) return dirs;
|
if (!path) return dirs;
|
||||||
|
|
||||||
tmp = strdup(path);
|
tmp = strdup(path);
|
||||||
|
@ -197,14 +195,14 @@ efreet_dirs_get(const char *key, const char *fallback)
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (!ecore_list_find(dirs, ECORE_COMPARE_CB(strcmp), s))
|
if (!eina_list_search_unsorted(dirs, (Eina_Compare_Cb)strcmp, s))
|
||||||
ecore_list_append(dirs, (void *)eina_stringshare_add(s));
|
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(s));
|
||||||
|
|
||||||
s = ++p;
|
s = ++p;
|
||||||
p = strchr(s, ':');
|
p = strchr(s, ':');
|
||||||
}
|
}
|
||||||
if (!ecore_list_find(dirs, ECORE_COMPARE_CB(strcmp), s))
|
if (!eina_list_search_unsorted(dirs, ECORE_COMPARE_CB(strcmp), s))
|
||||||
ecore_list_append(dirs, (void *)eina_stringshare_add(s));
|
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(s));
|
||||||
FREE(tmp);
|
FREE(tmp);
|
||||||
|
|
||||||
return dirs;
|
return dirs;
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
#include <Ecore_Data.h>
|
#include <Ecore_Data.h>
|
||||||
|
|
||||||
EAPI const char *efreet_data_home_get(void);
|
EAPI const char *efreet_data_home_get(void);
|
||||||
EAPI Ecore_List *efreet_data_dirs_get(void);
|
EAPI Eina_List *efreet_data_dirs_get(void);
|
||||||
|
|
||||||
EAPI const char *efreet_config_home_get(void);
|
EAPI const char *efreet_config_home_get(void);
|
||||||
EAPI Ecore_List *efreet_config_dirs_get(void);
|
EAPI Eina_List *efreet_config_dirs_get(void);
|
||||||
|
|
||||||
EAPI const char *efreet_cache_home_get(void);
|
EAPI const char *efreet_cache_home_get(void);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ static Eina_Hash *efreet_desktop_cache = NULL;
|
||||||
/**
|
/**
|
||||||
* A list of the desktop types available
|
* A list of the desktop types available
|
||||||
*/
|
*/
|
||||||
static Ecore_List *efreet_desktop_types = NULL;
|
static Eina_List *efreet_desktop_types = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A unique id for each tmp file created while building a command
|
* A unique id for each tmp file created while building a command
|
||||||
|
@ -74,7 +74,7 @@ static char *efreet_string_append(char *dest, int *size,
|
||||||
int *len, const char *src);
|
int *len, const char *src);
|
||||||
static char *efreet_string_append_char(char *dest, int *size,
|
static char *efreet_string_append_char(char *dest, int *size,
|
||||||
int *len, char c);
|
int *len, char c);
|
||||||
static Ecore_List *efreet_desktop_command_build(Efreet_Desktop_Command *command);
|
static Eina_List *efreet_desktop_command_build(Efreet_Desktop_Command *command);
|
||||||
static void efreet_desktop_command_free(Efreet_Desktop_Command *command);
|
static void efreet_desktop_command_free(Efreet_Desktop_Command *command);
|
||||||
static char *efreet_desktop_command_append_quoted(char *dest, int *size,
|
static char *efreet_desktop_command_append_quoted(char *dest, int *size,
|
||||||
int *len, char *src);
|
int *len, char *src);
|
||||||
|
@ -106,7 +106,7 @@ static void *efreet_desktop_exec_cb(void *data, Efreet_Desktop *desktop,
|
||||||
|
|
||||||
static void efreet_desktop_type_info_free(Efreet_Desktop_Type_Info *info);
|
static void efreet_desktop_type_info_free(Efreet_Desktop_Type_Info *info);
|
||||||
static int efreet_desktop_command_flags_get(Efreet_Desktop *desktop);
|
static int efreet_desktop_command_flags_get(Efreet_Desktop *desktop);
|
||||||
static void *efreet_desktop_command_execs_process(Efreet_Desktop_Command *command, Ecore_List *execs);
|
static void *efreet_desktop_command_execs_process(Efreet_Desktop_Command *command, Eina_List *execs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
@ -121,10 +121,7 @@ efreet_desktop_init(void)
|
||||||
if (!ecore_file_init()) return --init;
|
if (!ecore_file_init()) return --init;
|
||||||
|
|
||||||
efreet_desktop_cache = eina_hash_string_superfast_new(NULL);
|
efreet_desktop_cache = eina_hash_string_superfast_new(NULL);
|
||||||
|
efreet_desktop_types = NULL;
|
||||||
efreet_desktop_types = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(efreet_desktop_types,
|
|
||||||
ECORE_FREE_CB(efreet_desktop_type_info_free));
|
|
||||||
|
|
||||||
EFREET_DESKTOP_TYPE_APPLICATION = efreet_desktop_type_add("Application",
|
EFREET_DESKTOP_TYPE_APPLICATION = efreet_desktop_type_add("Application",
|
||||||
efreet_desktop_application_fields_parse,
|
efreet_desktop_application_fields_parse,
|
||||||
|
@ -147,13 +144,21 @@ efreet_desktop_init(void)
|
||||||
int
|
int
|
||||||
efreet_desktop_shutdown(void)
|
efreet_desktop_shutdown(void)
|
||||||
{
|
{
|
||||||
|
Efreet_Desktop_Type_Info *info;
|
||||||
|
|
||||||
if (--init) return init;
|
if (--init) return init;
|
||||||
ecore_file_shutdown();
|
ecore_file_shutdown();
|
||||||
eina_stringshare_shutdown();
|
eina_stringshare_shutdown();
|
||||||
|
|
||||||
IF_RELEASE(desktop_environment);
|
IF_RELEASE(desktop_environment);
|
||||||
IF_FREE_HASH(efreet_desktop_cache);
|
IF_FREE_HASH(efreet_desktop_cache);
|
||||||
IF_FREE_LIST(efreet_desktop_types);
|
while (efreet_desktop_types)
|
||||||
|
{
|
||||||
|
info = eina_list_data_get(efreet_desktop_types);
|
||||||
|
efreet_desktop_type_info_free(info);
|
||||||
|
efreet_desktop_types = eina_list_remove_list(efreet_desktop_types,
|
||||||
|
efreet_desktop_types);
|
||||||
|
}
|
||||||
|
|
||||||
return init;
|
return init;
|
||||||
}
|
}
|
||||||
|
@ -353,6 +358,8 @@ efreet_desktop_read(Efreet_Desktop *desktop)
|
||||||
static void
|
static void
|
||||||
efreet_desktop_clear(Efreet_Desktop *desktop)
|
efreet_desktop_clear(Efreet_Desktop *desktop)
|
||||||
{
|
{
|
||||||
|
char *data;
|
||||||
|
|
||||||
IF_FREE(desktop->name);
|
IF_FREE(desktop->name);
|
||||||
IF_FREE(desktop->generic_name);
|
IF_FREE(desktop->generic_name);
|
||||||
IF_FREE(desktop->comment);
|
IF_FREE(desktop->comment);
|
||||||
|
@ -366,15 +373,25 @@ efreet_desktop_clear(Efreet_Desktop *desktop)
|
||||||
|
|
||||||
IF_FREE_LIST(desktop->only_show_in);
|
IF_FREE_LIST(desktop->only_show_in);
|
||||||
IF_FREE_LIST(desktop->not_show_in);
|
IF_FREE_LIST(desktop->not_show_in);
|
||||||
IF_FREE_LIST(desktop->categories);
|
while (desktop->categories)
|
||||||
IF_FREE_LIST(desktop->mime_types);
|
{
|
||||||
|
data = eina_list_data_get(desktop->categories);
|
||||||
|
eina_stringshare_del(data);
|
||||||
|
desktop->categories = eina_list_remove_list(desktop->categories, desktop->categories);
|
||||||
|
}
|
||||||
|
while (desktop->mime_types)
|
||||||
|
{
|
||||||
|
data = eina_list_data_get(desktop->mime_types);
|
||||||
|
eina_stringshare_del(data);
|
||||||
|
desktop->mime_types = eina_list_remove_list(desktop->mime_types, desktop->mime_types);
|
||||||
|
}
|
||||||
|
|
||||||
IF_FREE_HASH(desktop->x);
|
IF_FREE_HASH(desktop->x);
|
||||||
|
|
||||||
if (desktop->type_data)
|
if (desktop->type_data)
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Type_Info *info;
|
Efreet_Desktop_Type_Info *info;
|
||||||
info = ecore_list_index_goto(efreet_desktop_types, desktop->type);
|
info = eina_list_nth(efreet_desktop_types, desktop->type);
|
||||||
if (info->free_func)
|
if (info->free_func)
|
||||||
info->free_func(desktop->type_data);
|
info->free_func(desktop->type_data);
|
||||||
}
|
}
|
||||||
|
@ -397,7 +414,7 @@ efreet_desktop_save(Efreet_Desktop *desktop)
|
||||||
efreet_ini_section_add(ini, "Desktop Entry");
|
efreet_ini_section_add(ini, "Desktop Entry");
|
||||||
efreet_ini_section_set(ini, "Desktop Entry");
|
efreet_ini_section_set(ini, "Desktop Entry");
|
||||||
|
|
||||||
info = ecore_list_index_goto(efreet_desktop_types, desktop->type);
|
info = eina_list_nth(efreet_desktop_types, desktop->type);
|
||||||
if (info)
|
if (info)
|
||||||
{
|
{
|
||||||
efreet_ini_string_set(ini, "Type", info->type);
|
efreet_ini_string_set(ini, "Type", info->type);
|
||||||
|
@ -494,15 +511,24 @@ efreet_desktop_free(Efreet_Desktop *desktop)
|
||||||
|
|
||||||
IF_FREE_LIST(desktop->only_show_in);
|
IF_FREE_LIST(desktop->only_show_in);
|
||||||
IF_FREE_LIST(desktop->not_show_in);
|
IF_FREE_LIST(desktop->not_show_in);
|
||||||
IF_FREE_LIST(desktop->categories);
|
|
||||||
IF_FREE_LIST(desktop->mime_types);
|
while (desktop->categories)
|
||||||
|
{
|
||||||
|
eina_stringshare_del(eina_list_data_get(desktop->categories));
|
||||||
|
desktop->categories = eina_list_remove_list(desktop->categories, desktop->categories);
|
||||||
|
}
|
||||||
|
while (desktop->mime_types)
|
||||||
|
{
|
||||||
|
eina_stringshare_del(eina_list_data_get(desktop->mime_types));
|
||||||
|
desktop->mime_types = eina_list_remove_list(desktop->mime_types, desktop->mime_types);
|
||||||
|
}
|
||||||
|
|
||||||
IF_FREE_HASH(desktop->x);
|
IF_FREE_HASH(desktop->x);
|
||||||
|
|
||||||
if (desktop->type_data)
|
if (desktop->type_data)
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Type_Info *info;
|
Efreet_Desktop_Type_Info *info;
|
||||||
info = ecore_list_index_goto(efreet_desktop_types, desktop->type);
|
info = eina_list_nth(efreet_desktop_types, desktop->type);
|
||||||
if (info->free_func)
|
if (info->free_func)
|
||||||
info->free_func(desktop->type_data);
|
info->free_func(desktop->type_data);
|
||||||
}
|
}
|
||||||
|
@ -518,7 +544,7 @@ efreet_desktop_free(Efreet_Desktop *desktop)
|
||||||
* @brief Parses the @a desktop exec line and returns an Ecore_Exe.
|
* @brief Parses the @a desktop exec line and returns an Ecore_Exe.
|
||||||
*/
|
*/
|
||||||
EAPI void
|
EAPI void
|
||||||
efreet_desktop_exec(Efreet_Desktop *desktop, Ecore_List *files, void *data)
|
efreet_desktop_exec(Efreet_Desktop *desktop, Eina_List *files, void *data)
|
||||||
{
|
{
|
||||||
efreet_desktop_command_get(desktop, files, efreet_desktop_exec_cb, data);
|
efreet_desktop_command_get(desktop, files, efreet_desktop_exec_cb, data);
|
||||||
}
|
}
|
||||||
|
@ -564,7 +590,7 @@ EAPI unsigned int
|
||||||
efreet_desktop_category_count_get(Efreet_Desktop *desktop)
|
efreet_desktop_category_count_get(Efreet_Desktop *desktop)
|
||||||
{
|
{
|
||||||
if (!desktop || !desktop->categories) return 0;
|
if (!desktop || !desktop->categories) return 0;
|
||||||
return ecore_list_count(desktop->categories);
|
return eina_list_count(desktop->categories);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -577,17 +603,10 @@ efreet_desktop_category_add(Efreet_Desktop *desktop, const char *category)
|
||||||
{
|
{
|
||||||
if (!desktop) return;
|
if (!desktop) return;
|
||||||
|
|
||||||
if (!desktop->categories)
|
if (eina_list_search_unsorted(desktop->categories,
|
||||||
{
|
(Eina_Compare_Cb)strcmp, category)) return;
|
||||||
desktop->categories = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(desktop->categories,
|
|
||||||
ECORE_FREE_CB(eina_stringshare_del));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (ecore_list_find(desktop->categories,
|
|
||||||
ECORE_COMPARE_CB(strcmp), category)) return;
|
|
||||||
|
|
||||||
ecore_list_append(desktop->categories,
|
desktop->categories = eina_list_append(desktop->categories,
|
||||||
(void *)eina_stringshare_add(category));
|
(void *)eina_stringshare_add(category));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,17 +619,20 @@ efreet_desktop_category_add(Efreet_Desktop *desktop, const char *category)
|
||||||
EAPI int
|
EAPI int
|
||||||
efreet_desktop_category_del(Efreet_Desktop *desktop, const char *category)
|
efreet_desktop_category_del(Efreet_Desktop *desktop, const char *category)
|
||||||
{
|
{
|
||||||
int found = 0;
|
char *found = NULL;
|
||||||
|
|
||||||
if (!desktop || !desktop->categories) return 0;
|
if (!desktop || !desktop->categories) return 0;
|
||||||
|
|
||||||
if (ecore_list_find(desktop->categories,
|
if ((found = eina_list_search_unsorted(desktop->categories,
|
||||||
ECORE_COMPARE_CB(strcmp), category))
|
(Eina_Compare_Cb)strcmp, category)))
|
||||||
{
|
{
|
||||||
found = 1;
|
eina_stringshare_del(found);
|
||||||
ecore_list_remove(desktop->categories);
|
desktop->categories = eina_list_remove(desktop->categories, found);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -632,7 +654,7 @@ efreet_desktop_type_add(const char *type, Efreet_Desktop_Type_Parse_Cb parse_fun
|
||||||
info = NEW(Efreet_Desktop_Type_Info, 1);
|
info = NEW(Efreet_Desktop_Type_Info, 1);
|
||||||
if (!info) return 0;
|
if (!info) return 0;
|
||||||
|
|
||||||
id = ecore_list_count(efreet_desktop_types);
|
id = eina_list_count(efreet_desktop_types);
|
||||||
|
|
||||||
info->id = id;
|
info->id = id;
|
||||||
info->type = strdup(type);
|
info->type = strdup(type);
|
||||||
|
@ -640,7 +662,7 @@ efreet_desktop_type_add(const char *type, Efreet_Desktop_Type_Parse_Cb parse_fun
|
||||||
info->save_func = save_func;
|
info->save_func = save_func;
|
||||||
info->free_func = free_func;
|
info->free_func = free_func;
|
||||||
|
|
||||||
ecore_list_append(efreet_desktop_types, info);
|
efreet_desktop_types = eina_list_append(efreet_desktop_types, info);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -657,7 +679,7 @@ EAPI int
|
||||||
efreet_desktop_type_alias(int from_type, const char *alias)
|
efreet_desktop_type_alias(int from_type, const char *alias)
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Type_Info *info;
|
Efreet_Desktop_Type_Info *info;
|
||||||
info = ecore_list_index_goto(efreet_desktop_types, from_type);
|
info = eina_list_nth(efreet_desktop_types, from_type);
|
||||||
if (!info) return -1;
|
if (!info) return -1;
|
||||||
|
|
||||||
return efreet_desktop_type_add(alias, info->parse_func, info->save_func, info->free_func);
|
return efreet_desktop_type_add(alias, info->parse_func, info->save_func, info->free_func);
|
||||||
|
@ -696,11 +718,11 @@ static Efreet_Desktop_Type_Info *
|
||||||
efreet_desktop_type_parse(const char *type_str)
|
efreet_desktop_type_parse(const char *type_str)
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Type_Info *info;
|
Efreet_Desktop_Type_Info *info;
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
if (!type_str) return NULL;
|
if (!type_str) return NULL;
|
||||||
|
|
||||||
ecore_list_first_goto(efreet_desktop_types);
|
EINA_LIST_FOREACH(efreet_desktop_types, l, info)
|
||||||
while ((info = ecore_list_next(efreet_desktop_types)))
|
|
||||||
{
|
{
|
||||||
if (!strcmp(info->type, type_str))
|
if (!strcmp(info->type, type_str))
|
||||||
return info;
|
return info;
|
||||||
|
@ -711,23 +733,18 @@ efreet_desktop_type_parse(const char *type_str)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string: the raw string list
|
* @param string: the raw string list
|
||||||
* @return an Ecore_List of ecore string's
|
* @return an Eina_List of ecore string's
|
||||||
* @brief Parse ';' separate list of strings according to the desktop spec
|
* @brief Parse ';' separate list of strings according to the desktop spec
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_desktop_string_list_parse(const char *string)
|
efreet_desktop_string_list_parse(const char *string)
|
||||||
{
|
{
|
||||||
Ecore_List *list;
|
Eina_List *list = NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *s, *p;
|
char *s, *p;
|
||||||
|
|
||||||
if (!string) return NULL;
|
if (!string) return NULL;
|
||||||
|
|
||||||
list = ecore_list_new();
|
|
||||||
if (!list) return NULL;
|
|
||||||
|
|
||||||
ecore_list_free_cb_set(list, ECORE_FREE_CB(eina_stringshare_del));
|
|
||||||
|
|
||||||
tmp = strdup(string);
|
tmp = strdup(string);
|
||||||
s = tmp;
|
s = tmp;
|
||||||
|
|
||||||
|
@ -735,7 +752,7 @@ efreet_desktop_string_list_parse(const char *string)
|
||||||
{
|
{
|
||||||
if (p > tmp && *(p-1) == '\\') continue;
|
if (p > tmp && *(p-1) == '\\') continue;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
ecore_list_append(list, (void *)eina_stringshare_add(s));
|
list = eina_list_append(list, (void *)eina_stringshare_add(s));
|
||||||
s = p + 1;
|
s = p + 1;
|
||||||
}
|
}
|
||||||
/* If this is true, the .desktop file does not follow the standard */
|
/* If this is true, the .desktop file does not follow the standard */
|
||||||
|
@ -745,7 +762,7 @@ efreet_desktop_string_list_parse(const char *string)
|
||||||
printf("[Efreet]: Found a string list without ';' "
|
printf("[Efreet]: Found a string list without ';' "
|
||||||
"at the end: %s\n", string);
|
"at the end: %s\n", string);
|
||||||
#endif
|
#endif
|
||||||
ecore_list_append(list, (void *)eina_stringshare_add(s));
|
list = eina_list_append(list, (void *)eina_stringshare_add(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
@ -754,25 +771,25 @@ efreet_desktop_string_list_parse(const char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param list: Ecore_List with strings
|
* @param list: Eina_List with strings
|
||||||
* @return a raw string list
|
* @return a raw string list
|
||||||
* @brief Create a ';' separate list of strings according to the desktop spec
|
* @brief Create a ';' separate list of strings according to the desktop spec
|
||||||
*/
|
*/
|
||||||
EAPI char *
|
EAPI char *
|
||||||
efreet_desktop_string_list_join(Ecore_List *list)
|
efreet_desktop_string_list_join(Eina_List *list)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
char *string;
|
char *string;
|
||||||
size_t size, pos, len;
|
size_t size, pos, len;
|
||||||
|
|
||||||
if (ecore_list_empty_is(list)) return strdup("");
|
if (!list) return strdup("");
|
||||||
|
|
||||||
size = 1024;
|
size = 1024;
|
||||||
string = malloc(size);
|
string = malloc(size);
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
ecore_list_first_goto(list);
|
EINA_LIST_FOREACH(list, l, tmp)
|
||||||
while ((tmp = ecore_list_next(list)))
|
|
||||||
{
|
{
|
||||||
len = strlen(tmp);
|
len = strlen(tmp);
|
||||||
/* +1 for ';' */
|
/* +1 for ';' */
|
||||||
|
@ -1041,54 +1058,35 @@ efreet_desktop_x_fields_save(const Eina_Hash *hash, const void *key, void *value
|
||||||
static int
|
static int
|
||||||
efreet_desktop_environment_check(Efreet_Ini *ini)
|
efreet_desktop_environment_check(Efreet_Ini *ini)
|
||||||
{
|
{
|
||||||
Ecore_List *list;
|
Eina_List *list, *l;
|
||||||
const char *val;
|
int found = 0;
|
||||||
|
char *val;
|
||||||
|
|
||||||
|
if (!desktop_environment)
|
||||||
|
return 1;
|
||||||
|
|
||||||
list = efreet_desktop_string_list_parse(efreet_ini_string_get(ini, "OnlyShowIn"));
|
list = efreet_desktop_string_list_parse(efreet_ini_string_get(ini, "OnlyShowIn"));
|
||||||
if (list)
|
if (list)
|
||||||
{
|
{
|
||||||
int found = 0;
|
EINA_LIST_FREE(list, val)
|
||||||
|
|
||||||
if (desktop_environment)
|
|
||||||
{
|
|
||||||
ecore_list_first_goto(list);
|
|
||||||
while ((val = ecore_list_next(list)))
|
|
||||||
{
|
{
|
||||||
if (!strcmp(val, desktop_environment))
|
if (!strcmp(val, desktop_environment))
|
||||||
{
|
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
eina_stringshare_del(val);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_list_destroy(list);
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desktop_environment)
|
|
||||||
{
|
|
||||||
int found = 0;
|
|
||||||
|
|
||||||
list = efreet_desktop_string_list_parse(efreet_ini_string_get(ini, "NotShowIn"));
|
list = efreet_desktop_string_list_parse(efreet_ini_string_get(ini, "NotShowIn"));
|
||||||
if (list)
|
EINA_LIST_FREE(list, val)
|
||||||
{
|
|
||||||
ecore_list_first_goto(list);
|
|
||||||
while ((val = ecore_list_next(list)))
|
|
||||||
{
|
{
|
||||||
if (!strcmp(val, desktop_environment))
|
if (!strcmp(val, desktop_environment))
|
||||||
{
|
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
eina_stringshare_del(val);
|
||||||
}
|
|
||||||
}
|
|
||||||
ecore_list_destroy(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return !found;
|
return !found;
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1102,7 +1100,7 @@ efreet_desktop_environment_check(Efreet_Ini *ini)
|
||||||
* @brief Get a command to use to execute a desktop entry.
|
* @brief Get a command to use to execute a desktop entry.
|
||||||
*/
|
*/
|
||||||
EAPI void *
|
EAPI void *
|
||||||
efreet_desktop_command_get(Efreet_Desktop *desktop, Ecore_List *files,
|
efreet_desktop_command_get(Efreet_Desktop *desktop, Eina_List *files,
|
||||||
Efreet_Desktop_Command_Cb func, void *data)
|
Efreet_Desktop_Command_Cb func, void *data)
|
||||||
{
|
{
|
||||||
return efreet_desktop_command_progress_get(desktop, files, func, NULL, data);
|
return efreet_desktop_command_progress_get(desktop, files, func, NULL, data);
|
||||||
|
@ -1116,30 +1114,25 @@ efreet_desktop_command_get(Efreet_Desktop *desktop, Ecore_List *files,
|
||||||
*
|
*
|
||||||
* The returned list and each of its elements must be freed.
|
* The returned list and each of its elements must be freed.
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_desktop_command_local_get(Efreet_Desktop *desktop, Ecore_List *files)
|
efreet_desktop_command_local_get(Efreet_Desktop *desktop, Eina_List *files)
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Command *command;
|
Efreet_Desktop_Command *command;
|
||||||
char *file;
|
char *file;
|
||||||
Ecore_List *execs;
|
Eina_List *execs, *l;
|
||||||
|
|
||||||
if (!desktop || !desktop->exec) return NULL;
|
if (!desktop || !desktop->exec) return NULL;
|
||||||
|
|
||||||
command = NEW(Efreet_Desktop_Command, 1);
|
command = NEW(Efreet_Desktop_Command, 1);
|
||||||
if (!command) return 0;
|
if (!command) return 0;
|
||||||
|
|
||||||
command->files = ecore_list_new();
|
|
||||||
command->desktop = desktop;
|
command->desktop = desktop;
|
||||||
|
|
||||||
ecore_list_free_cb_set(command->files,
|
|
||||||
ECORE_FREE_CB(efreet_desktop_command_file_free));
|
|
||||||
|
|
||||||
command->flags = efreet_desktop_command_flags_get(desktop);
|
command->flags = efreet_desktop_command_flags_get(desktop);
|
||||||
/* get the required info for each file passed in */
|
/* get the required info for each file passed in */
|
||||||
if (files)
|
if (files)
|
||||||
{
|
{
|
||||||
ecore_list_first_goto(files);
|
EINA_LIST_FOREACH(files, l, file)
|
||||||
while ((file = ecore_list_next(files)))
|
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Command_File *dcf;
|
Efreet_Desktop_Command_File *dcf;
|
||||||
|
|
||||||
|
@ -1150,7 +1143,7 @@ efreet_desktop_command_local_get(Efreet_Desktop *desktop, Ecore_List *files)
|
||||||
efreet_desktop_command_file_free(dcf);
|
efreet_desktop_command_file_free(dcf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ecore_list_append(command->files, dcf);
|
command->files = eina_list_append(command->files, dcf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1173,13 +1166,15 @@ efreet_desktop_command_local_get(Efreet_Desktop *desktop, Ecore_List *files)
|
||||||
* updates for downloading of remote URI's passed in.
|
* updates for downloading of remote URI's passed in.
|
||||||
*/
|
*/
|
||||||
EAPI void *
|
EAPI void *
|
||||||
efreet_desktop_command_progress_get(Efreet_Desktop *desktop, Ecore_List *files,
|
efreet_desktop_command_progress_get(Efreet_Desktop *desktop, Eina_List *files,
|
||||||
Efreet_Desktop_Command_Cb cb_command,
|
Efreet_Desktop_Command_Cb cb_command,
|
||||||
Efreet_Desktop_Progress_Cb cb_progress,
|
Efreet_Desktop_Progress_Cb cb_progress,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Command *command;
|
Efreet_Desktop_Command *command;
|
||||||
|
Eina_List *l;
|
||||||
char *file;
|
char *file;
|
||||||
|
char *exec;
|
||||||
void *ret = NULL;
|
void *ret = NULL;
|
||||||
|
|
||||||
if (!desktop || !cb_command || !desktop->exec) return NULL;
|
if (!desktop || !cb_command || !desktop->exec) return NULL;
|
||||||
|
@ -1190,34 +1185,34 @@ efreet_desktop_command_progress_get(Efreet_Desktop *desktop, Ecore_List *files,
|
||||||
command->cb_command = cb_command;
|
command->cb_command = cb_command;
|
||||||
command->cb_progress = cb_progress;
|
command->cb_progress = cb_progress;
|
||||||
command->data = data;
|
command->data = data;
|
||||||
command->files = ecore_list_new();
|
|
||||||
command->desktop = desktop;
|
command->desktop = desktop;
|
||||||
|
|
||||||
ecore_list_free_cb_set(command->files,
|
|
||||||
ECORE_FREE_CB(efreet_desktop_command_file_free));
|
|
||||||
|
|
||||||
command->flags = efreet_desktop_command_flags_get(desktop);
|
command->flags = efreet_desktop_command_flags_get(desktop);
|
||||||
/* get the required info for each file passed in */
|
/* get the required info for each file passed in */
|
||||||
if (files)
|
if (files)
|
||||||
{
|
{
|
||||||
ecore_list_first_goto(files);
|
EINA_LIST_FOREACH(files, l, file)
|
||||||
while ((file = ecore_list_next(files)))
|
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Command_File *dcf;
|
Efreet_Desktop_Command_File *dcf;
|
||||||
|
|
||||||
dcf = efreet_desktop_command_file_process(command, file);
|
dcf = efreet_desktop_command_file_process(command, file);
|
||||||
if (!dcf) continue;
|
if (!dcf) continue;
|
||||||
ecore_list_append(command->files, dcf);
|
command->files = eina_list_append(command->files, dcf);
|
||||||
command->num_pending += dcf->pending;
|
command->num_pending += dcf->pending;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command->num_pending == 0)
|
if (command->num_pending == 0)
|
||||||
{
|
{
|
||||||
Ecore_List *execs;
|
Eina_List *execs;
|
||||||
execs = efreet_desktop_command_build(command);
|
execs = efreet_desktop_command_build(command);
|
||||||
ret = efreet_desktop_command_execs_process(command, execs);
|
ret = efreet_desktop_command_execs_process(command, execs);
|
||||||
ecore_list_destroy(execs);
|
while (execs)
|
||||||
|
{
|
||||||
|
exec = eina_list_data_get(execs);
|
||||||
|
free(exec);
|
||||||
|
execs = eina_list_remove_list(execs, execs);
|
||||||
|
}
|
||||||
efreet_desktop_command_free(command);
|
efreet_desktop_command_free(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1289,15 +1284,15 @@ efreet_desktop_command_flags_get(Efreet_Desktop *desktop)
|
||||||
* @param execs
|
* @param execs
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
efreet_desktop_command_execs_process(Efreet_Desktop_Command *command, Ecore_List *execs)
|
efreet_desktop_command_execs_process(Efreet_Desktop_Command *command, Eina_List *execs)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *exec;
|
char *exec;
|
||||||
int num;
|
int num;
|
||||||
void *ret = NULL;
|
void *ret = NULL;
|
||||||
|
|
||||||
num = ecore_list_count(execs);
|
num = eina_list_count(execs);
|
||||||
ecore_list_first_goto(execs);
|
EINA_LIST_FOREACH(execs, l, exec)
|
||||||
while ((exec = ecore_list_next(execs)))
|
|
||||||
{
|
{
|
||||||
ret = command->cb_command(command->data, command->desktop, exec, --num);
|
ret = command->cb_command(command->data, command->desktop, exec, --num);
|
||||||
}
|
}
|
||||||
|
@ -1313,31 +1308,26 @@ efreet_desktop_command_execs_process(Efreet_Desktop_Command *command, Ecore_List
|
||||||
* @param command: the command to build
|
* @param command: the command to build
|
||||||
* @return a list of executable strings
|
* @return a list of executable strings
|
||||||
*/
|
*/
|
||||||
static Ecore_List *
|
static Eina_List *
|
||||||
efreet_desktop_command_build(Efreet_Desktop_Command *command)
|
efreet_desktop_command_build(Efreet_Desktop_Command *command)
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Command_File *file = NULL;
|
Efreet_Desktop_Command_File *file = NULL;
|
||||||
int first = 1;
|
Eina_List *execs = NULL;
|
||||||
Ecore_List *execs;
|
Eina_List *l;
|
||||||
char *exec;
|
char *exec;
|
||||||
|
|
||||||
execs = ecore_list_new();
|
|
||||||
|
|
||||||
ecore_list_first_goto(command->files);
|
|
||||||
|
|
||||||
/* if the Exec field appends multiple, that will run the list to the end,
|
/* if the Exec field appends multiple, that will run the list to the end,
|
||||||
* causing this loop to only run once. otherwise, this loop will generate a
|
* causing this loop to only run once. otherwise, this loop will generate a
|
||||||
* command for each file in the list. if the list is empty, this
|
* command for each file in the list. if the list is empty, this
|
||||||
* will run once, removing any file field codes */
|
* will run once, removing any file field codes */
|
||||||
while ((file = ecore_list_next(command->files)) || first)
|
EINA_LIST_FOREACH(command->files, l, file)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int size = PATH_MAX;
|
int size = PATH_MAX;
|
||||||
int file_added = 0;
|
int file_added = 0;
|
||||||
|
|
||||||
first = 0;
|
|
||||||
|
|
||||||
exec = malloc(size);
|
exec = malloc(size);
|
||||||
p = command->desktop->exec;
|
p = command->desktop->exec;
|
||||||
len = 0;
|
len = 0;
|
||||||
|
@ -1437,7 +1427,7 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
|
||||||
#endif
|
#endif
|
||||||
exec[len++] = '\0';
|
exec[len++] = '\0';
|
||||||
|
|
||||||
ecore_list_append(execs, exec);
|
execs = eina_list_append(execs, exec);
|
||||||
|
|
||||||
/* If no file was added, then the Exec field doesn't contain any file
|
/* 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. */
|
* fields (fFuUdDnN). We only want to run the app once in this case. */
|
||||||
|
@ -1450,9 +1440,17 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
|
||||||
static void
|
static void
|
||||||
efreet_desktop_command_free(Efreet_Desktop_Command *command)
|
efreet_desktop_command_free(Efreet_Desktop_Command *command)
|
||||||
{
|
{
|
||||||
|
Efreet_Desktop_Command_File *dcf;
|
||||||
|
|
||||||
if (!command) return;
|
if (!command) return;
|
||||||
|
|
||||||
IF_FREE_LIST(command->files);
|
while (command->files)
|
||||||
|
{
|
||||||
|
dcf = eina_list_data_get(command->files);
|
||||||
|
efreet_desktop_command_file_free(dcf);
|
||||||
|
command->files = eina_list_remove_list(command->files,
|
||||||
|
command->files);
|
||||||
|
}
|
||||||
FREE(command);
|
FREE(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1490,12 +1488,12 @@ efreet_desktop_command_append_multiple(char *dest, int *size, int *len,
|
||||||
char type)
|
char type)
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Command_File *file;
|
Efreet_Desktop_Command_File *file;
|
||||||
|
Eina_List *l;
|
||||||
int first = 1;
|
int first = 1;
|
||||||
|
|
||||||
if (!command->files) return dest;
|
if (!command->files) return dest;
|
||||||
|
|
||||||
ecore_list_first_goto(command->files);
|
EINA_LIST_FOREACH(command->files, l, file)
|
||||||
while ((file = ecore_list_next(command->files)))
|
|
||||||
{
|
{
|
||||||
if (first)
|
if (first)
|
||||||
first = 0;
|
first = 0;
|
||||||
|
@ -1759,6 +1757,8 @@ efreet_desktop_cb_download_complete(void *data, const char *file __UNUSED__,
|
||||||
int status __UNUSED__)
|
int status __UNUSED__)
|
||||||
{
|
{
|
||||||
Efreet_Desktop_Command_File *f;
|
Efreet_Desktop_Command_File *f;
|
||||||
|
char *exec;
|
||||||
|
|
||||||
f = data;
|
f = data;
|
||||||
|
|
||||||
/* XXX check status... error handling, etc */
|
/* XXX check status... error handling, etc */
|
||||||
|
@ -1767,11 +1767,16 @@ efreet_desktop_cb_download_complete(void *data, const char *file __UNUSED__,
|
||||||
|
|
||||||
if (f->command->num_pending <= 0)
|
if (f->command->num_pending <= 0)
|
||||||
{
|
{
|
||||||
Ecore_List *execs;
|
Eina_List *execs;
|
||||||
execs = efreet_desktop_command_build(f->command);
|
execs = efreet_desktop_command_build(f->command);
|
||||||
/* TODO: Need to handle the return value from efreet_desktop_command_execs_process */
|
/* TODO: Need to handle the return value from efreet_desktop_command_execs_process */
|
||||||
efreet_desktop_command_execs_process(f->command, execs);
|
efreet_desktop_command_execs_process(f->command, execs);
|
||||||
ecore_list_destroy(execs);
|
while (execs)
|
||||||
|
{
|
||||||
|
exec = eina_list_data_get(execs);
|
||||||
|
free(exec);
|
||||||
|
execs = eina_list_remove_list(execs, execs);
|
||||||
|
}
|
||||||
efreet_desktop_command_free(f->command);
|
efreet_desktop_command_free(f->command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,12 +75,12 @@ struct _Efreet_Desktop
|
||||||
the given string as it's WM class or WM name */
|
the given string as it's WM class or WM name */
|
||||||
char *url; /**< URL to access if type is EFREET_TYPE_LINK */
|
char *url; /**< URL to access if type is EFREET_TYPE_LINK */
|
||||||
|
|
||||||
Ecore_List *only_show_in; /**< list of environments that should
|
Eina_List *only_show_in; /**< list of environments that should
|
||||||
display the icon */
|
display the icon */
|
||||||
Ecore_List *not_show_in; /**< list of environments that shoudn't
|
Eina_List *not_show_in; /**< list of environments that shoudn't
|
||||||
display the icon */
|
display the icon */
|
||||||
Ecore_List *categories; /**< Categories in which item should be shown */
|
Eina_List *categories; /**< Categories in which item should be shown */
|
||||||
Ecore_List *mime_types; /**< The mime types supppored by this app */
|
Eina_List *mime_types; /**< The mime types supppored by this app */
|
||||||
|
|
||||||
unsigned char no_display:1; /**< Don't display this application in menus */
|
unsigned char no_display:1; /**< Don't display this application in menus */
|
||||||
unsigned char hidden:1; /**< User delete the item */
|
unsigned char hidden:1; /**< User delete the item */
|
||||||
|
@ -103,21 +103,21 @@ EAPI int efreet_desktop_save_as(Efreet_Desktop *desktop,
|
||||||
const char *file);
|
const char *file);
|
||||||
|
|
||||||
EAPI void efreet_desktop_exec(Efreet_Desktop *desktop,
|
EAPI void efreet_desktop_exec(Efreet_Desktop *desktop,
|
||||||
Ecore_List *files, void *data);
|
Eina_List *files, void *data);
|
||||||
|
|
||||||
EAPI void efreet_desktop_environment_set(const char *environment);
|
EAPI void efreet_desktop_environment_set(const char *environment);
|
||||||
EAPI const char *efreet_desktop_environment_get(void);
|
EAPI const char *efreet_desktop_environment_get(void);
|
||||||
EAPI void *efreet_desktop_command_progress_get(Efreet_Desktop *desktop,
|
EAPI void *efreet_desktop_command_progress_get(Efreet_Desktop *desktop,
|
||||||
Ecore_List *files,
|
Eina_List *files,
|
||||||
Efreet_Desktop_Command_Cb cb_command,
|
Efreet_Desktop_Command_Cb cb_command,
|
||||||
Efreet_Desktop_Progress_Cb cb_prog,
|
Efreet_Desktop_Progress_Cb cb_prog,
|
||||||
void *data);
|
void *data);
|
||||||
EAPI void *efreet_desktop_command_get(Efreet_Desktop *desktop,
|
EAPI void *efreet_desktop_command_get(Efreet_Desktop *desktop,
|
||||||
Ecore_List *files,
|
Eina_List *files,
|
||||||
Efreet_Desktop_Command_Cb func,
|
Efreet_Desktop_Command_Cb func,
|
||||||
void *data);
|
void *data);
|
||||||
EAPI Ecore_List * efreet_desktop_command_local_get(Efreet_Desktop *desktop,
|
EAPI Eina_List * efreet_desktop_command_local_get(Efreet_Desktop *desktop,
|
||||||
Ecore_List *files);
|
Eina_List *files);
|
||||||
|
|
||||||
EAPI unsigned int efreet_desktop_category_count_get(Efreet_Desktop *desktop);
|
EAPI unsigned int efreet_desktop_category_count_get(Efreet_Desktop *desktop);
|
||||||
EAPI void efreet_desktop_category_add(Efreet_Desktop *desktop,
|
EAPI void efreet_desktop_category_add(Efreet_Desktop *desktop,
|
||||||
|
@ -133,8 +133,8 @@ EAPI int efreet_desktop_type_alias (int from_type,
|
||||||
const char *alias);
|
const char *alias);
|
||||||
EAPI void *efreet_desktop_type_data_get(Efreet_Desktop *desktop);
|
EAPI void *efreet_desktop_type_data_get(Efreet_Desktop *desktop);
|
||||||
|
|
||||||
EAPI Ecore_List *efreet_desktop_string_list_parse(const char *string);
|
EAPI Eina_List *efreet_desktop_string_list_parse(const char *string);
|
||||||
EAPI char *efreet_desktop_string_list_join(Ecore_List *list);
|
EAPI char *efreet_desktop_string_list_join(Eina_List *list);
|
||||||
|
|
||||||
EAPI void efreet_desktop_cache_flush(void);
|
EAPI void efreet_desktop_cache_flush(void);
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
static char *efreet_icon_deprecated_user_dir = NULL;
|
static char *efreet_icon_deprecated_user_dir = NULL;
|
||||||
static char *efreet_icon_user_dir = NULL;
|
static char *efreet_icon_user_dir = NULL;
|
||||||
static Eina_Hash *efreet_icon_themes = NULL;
|
static Eina_Hash *efreet_icon_themes = NULL;
|
||||||
static Ecore_List *efreet_icon_extensions = NULL;
|
static Eina_List *efreet_icon_extensions = NULL;
|
||||||
static Ecore_List *efreet_extra_icon_dirs = NULL;
|
static Eina_List *efreet_extra_icon_dirs = NULL;
|
||||||
static Eina_Hash *efreet_icon_cache = NULL;
|
static Eina_Hash *efreet_icon_cache = NULL;
|
||||||
|
|
||||||
static int efreet_icon_init_count = 0;
|
static int efreet_icon_init_count = 0;
|
||||||
|
@ -27,12 +27,12 @@ static char *efreet_icon_find_fallback(Efreet_Icon_Theme *theme,
|
||||||
const char *icon,
|
const char *icon,
|
||||||
unsigned int size);
|
unsigned int size);
|
||||||
static char *efreet_icon_list_find_fallback(Efreet_Icon_Theme *theme,
|
static char *efreet_icon_list_find_fallback(Efreet_Icon_Theme *theme,
|
||||||
Ecore_List *icons,
|
Eina_List *icons,
|
||||||
unsigned int size);
|
unsigned int size);
|
||||||
static char *efreet_icon_find_helper(Efreet_Icon_Theme *theme,
|
static char *efreet_icon_find_helper(Efreet_Icon_Theme *theme,
|
||||||
const char *icon, unsigned int size);
|
const char *icon, unsigned int size);
|
||||||
static char *efreet_icon_list_find_helper(Efreet_Icon_Theme *theme,
|
static char *efreet_icon_list_find_helper(Efreet_Icon_Theme *theme,
|
||||||
Ecore_List *icons, unsigned int size);
|
Eina_List *icons, unsigned int size);
|
||||||
static char *efreet_icon_lookup_icon(Efreet_Icon_Theme *theme,
|
static char *efreet_icon_lookup_icon(Efreet_Icon_Theme *theme,
|
||||||
const char *icon_name, unsigned int size);
|
const char *icon_name, unsigned int size);
|
||||||
static char *efreet_icon_fallback_icon(const char *icon_name);
|
static char *efreet_icon_fallback_icon(const char *icon_name);
|
||||||
|
@ -74,11 +74,20 @@ static int efreet_icon_theme_cache_check_dir(Efreet_Icon_Theme *theme,
|
||||||
const char *dir);
|
const char *dir);
|
||||||
|
|
||||||
static int efreet_icon_cache_find(Efreet_Icon_Cache *value, const char *key);
|
static int efreet_icon_cache_find(Efreet_Icon_Cache *value, const char *key);
|
||||||
static void efreet_icon_cache_flush(Ecore_List *list);
|
static void efreet_icon_cache_flush(Eina_List *list);
|
||||||
static void efreet_icon_cache_free(Efreet_Icon_Cache *value);
|
static void efreet_icon_cache_free(Efreet_Icon_Cache *value);
|
||||||
static char *efreet_icon_cache_check(Efreet_Icon_Theme *theme, const char *icon, unsigned int size);
|
static char *efreet_icon_cache_check(Efreet_Icon_Theme *theme, const char *icon, unsigned int size);
|
||||||
static void efreet_icon_cache_add(Efreet_Icon_Theme *theme, const char *icon, unsigned int size, const char *value);
|
static void efreet_icon_cache_add(Efreet_Icon_Theme *theme, const char *icon, unsigned int size, const char *value);
|
||||||
|
|
||||||
|
static void
|
||||||
|
_efreet_icon_cache_list_destroy(Eina_List *list)
|
||||||
|
{
|
||||||
|
Efreet_Icon_Cache *cache;
|
||||||
|
|
||||||
|
EINA_LIST_FREE(list, cache)
|
||||||
|
efreet_icon_cache_free(cache);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
* @return Returns 1 on success or 0 on failure
|
* @return Returns 1 on success or 0 on failure
|
||||||
|
@ -102,16 +111,13 @@ efreet_icon_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup the default extension list */
|
/* setup the default extension list */
|
||||||
efreet_icon_extensions = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(efreet_icon_extensions, free);
|
|
||||||
|
|
||||||
for (i = 0; default_exts[i] != NULL; i++)
|
for (i = 0; default_exts[i] != NULL; i++)
|
||||||
ecore_list_append(efreet_icon_extensions, strdup(default_exts[i]));
|
efreet_icon_extensions = eina_list_append(efreet_icon_extensions, strdup(default_exts[i]));
|
||||||
|
|
||||||
efreet_icon_themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_icon_theme_free));
|
efreet_icon_themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_icon_theme_free));
|
||||||
efreet_extra_icon_dirs = ecore_list_new();
|
|
||||||
|
|
||||||
efreet_icon_cache = eina_hash_pointer_new(EINA_FREE_CB(ecore_list_destroy));
|
efreet_extra_icon_dirs = NULL;
|
||||||
|
efreet_icon_cache = eina_hash_pointer_new(EINA_FREE_CB(_efreet_icon_cache_list_destroy));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -185,7 +191,7 @@ efreet_icon_user_dir_get(void)
|
||||||
EAPI void
|
EAPI void
|
||||||
efreet_icon_extension_add(const char *ext)
|
efreet_icon_extension_add(const char *ext)
|
||||||
{
|
{
|
||||||
ecore_list_prepend(efreet_icon_extensions, strdup(ext));
|
efreet_icon_extensions = eina_list_prepend(efreet_icon_extensions, strdup(ext));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,7 +202,7 @@ efreet_icon_extension_add(const char *ext)
|
||||||
* from first to last directory in this list. the strings in the list should
|
* from first to last directory in this list. the strings in the list should
|
||||||
* be created with eina_stringshare_add().
|
* be created with eina_stringshare_add().
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_icon_extra_list_get(void)
|
efreet_icon_extra_list_get(void)
|
||||||
{
|
{
|
||||||
return efreet_extra_icon_dirs;
|
return efreet_extra_icon_dirs;
|
||||||
|
@ -205,7 +211,7 @@ efreet_icon_extra_list_get(void)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_hash_keys(Eina_Hash *hash, const void *key, void *list)
|
_hash_keys(Eina_Hash *hash, const void *key, void *list)
|
||||||
{
|
{
|
||||||
ecore_list_append(list, key);
|
*(Eina_List**)list = eina_list_append(*(Eina_List**)list, key);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -214,10 +220,11 @@ _hash_keys(Eina_Hash *hash, const void *key, void *list)
|
||||||
* @brief Retrieves all of the non-hidden icon themes available on the system.
|
* @brief Retrieves all of the non-hidden icon themes available on the system.
|
||||||
* The returned list must be freed. Do not free the list data.
|
* The returned list must be freed. Do not free the list data.
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_icon_theme_list_get(void)
|
efreet_icon_theme_list_get(void)
|
||||||
{
|
{
|
||||||
Ecore_List *list, *theme_list;
|
Eina_List *list = NULL;
|
||||||
|
Eina_List *theme_list = NULL;
|
||||||
char *dir;
|
char *dir;
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
|
|
||||||
|
@ -226,13 +233,11 @@ efreet_icon_theme_list_get(void)
|
||||||
efreet_icon_theme_dir_validity_check();
|
efreet_icon_theme_dir_validity_check();
|
||||||
|
|
||||||
/* create the list for the user */
|
/* create the list for the user */
|
||||||
list = ecore_list_new();
|
|
||||||
theme_list = ecore_list_new();
|
|
||||||
it = eina_hash_iterator_key_new(efreet_icon_themes);
|
it = eina_hash_iterator_key_new(efreet_icon_themes);
|
||||||
eina_iterator_foreach(it, EINA_EACH(_hash_keys), theme_list);
|
eina_iterator_foreach(it, EINA_EACH(_hash_keys), &theme_list);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
ecore_list_first_goto(theme_list);
|
|
||||||
while ((dir = ecore_list_next(theme_list)))
|
EINA_LIST_FREE(theme_list, dir)
|
||||||
{
|
{
|
||||||
Efreet_Icon_Theme *theme;
|
Efreet_Icon_Theme *theme;
|
||||||
|
|
||||||
|
@ -242,9 +247,8 @@ efreet_icon_theme_list_get(void)
|
||||||
if (!theme->name.name) continue;
|
if (!theme->name.name) continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ecore_list_append(list, theme);
|
list = eina_list_append(list, theme);
|
||||||
}
|
}
|
||||||
ecore_list_destroy(theme_list);
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -282,6 +286,7 @@ efreet_icon_theme_find(const char *theme_name)
|
||||||
static char *
|
static char *
|
||||||
efreet_icon_remove_extension(const char *icon)
|
efreet_icon_remove_extension(const char *icon)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *tmp = NULL, *ext = NULL;
|
char *tmp = NULL, *ext = NULL;
|
||||||
|
|
||||||
tmp = strdup(icon);
|
tmp = strdup(icon);
|
||||||
|
@ -289,8 +294,7 @@ efreet_icon_remove_extension(const char *icon)
|
||||||
if (ext)
|
if (ext)
|
||||||
{
|
{
|
||||||
const char *ext2;
|
const char *ext2;
|
||||||
ecore_list_first_goto(efreet_icon_extensions);
|
EINA_LIST_FOREACH(efreet_icon_extensions, l, ext2)
|
||||||
while ((ext2 = ecore_list_next(efreet_icon_extensions)))
|
|
||||||
{
|
{
|
||||||
if (!strcmp(ext, ext2))
|
if (!strcmp(ext, ext2))
|
||||||
{
|
{
|
||||||
|
@ -386,28 +390,31 @@ efreet_icon_path_find(const char *theme_name, const char *icon, unsigned int siz
|
||||||
* back. This is useful when searching for mimetype icons.
|
* back. This is useful when searching for mimetype icons.
|
||||||
*/
|
*/
|
||||||
EAPI char *
|
EAPI char *
|
||||||
efreet_icon_list_find(const char *theme_name, Ecore_List *icons,
|
efreet_icon_list_find(const char *theme_name, Eina_List *icons,
|
||||||
unsigned int size)
|
unsigned int size)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
const char *icon = NULL;
|
const char *icon = NULL;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
char *data;
|
||||||
Efreet_Icon_Theme *theme;
|
Efreet_Icon_Theme *theme;
|
||||||
|
|
||||||
theme = efreet_icon_find_theme_check(theme_name);
|
theme = efreet_icon_find_theme_check(theme_name);
|
||||||
|
|
||||||
ecore_list_first_goto(icons);
|
|
||||||
#ifdef SLOPPY_SPEC
|
#ifdef SLOPPY_SPEC
|
||||||
{
|
{
|
||||||
Ecore_List *tmps = NULL;
|
Eina_List *tmps = NULL;
|
||||||
|
|
||||||
tmps = ecore_list_new();
|
EINA_LIST_FOREACH(icons, l, icon)
|
||||||
ecore_list_free_cb_set(tmps, free);
|
tmps = eina_list_append(tmps, efreet_icon_remove_extension(icon));
|
||||||
ecore_list_first_goto(icons);
|
|
||||||
while ((icon = ecore_list_next(icons)))
|
|
||||||
ecore_list_append(tmps, efreet_icon_remove_extension(icon));
|
|
||||||
|
|
||||||
value = efreet_icon_list_find_helper(theme, tmps, size);
|
value = efreet_icon_list_find_helper(theme, tmps, size);
|
||||||
ecore_list_destroy(tmps);
|
while (tmps)
|
||||||
|
{
|
||||||
|
data = eina_list_data_get(tmps);
|
||||||
|
free(data);
|
||||||
|
tmps = eina_list_remove_list(tmps, tmps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
value = efreet_icon_list_find_helper(theme, icons, size);
|
value = efreet_icon_list_find_helper(theme, icons, size);
|
||||||
|
@ -418,8 +425,7 @@ efreet_icon_list_find(const char *theme_name, Ecore_List *icons,
|
||||||
*/
|
*/
|
||||||
if (!value || (value == NON_EXISTING))
|
if (!value || (value == NON_EXISTING))
|
||||||
{
|
{
|
||||||
ecore_list_first_goto(icons);
|
EINA_LIST_FOREACH(icons, l, icon)
|
||||||
while ((icon = ecore_list_next(icons)))
|
|
||||||
{
|
{
|
||||||
value = efreet_icon_fallback_icon(icon);
|
value = efreet_icon_fallback_icon(icon);
|
||||||
if (value && (value != NON_EXISTING))
|
if (value && (value != NON_EXISTING))
|
||||||
|
@ -470,13 +476,13 @@ static char *
|
||||||
efreet_icon_find_fallback(Efreet_Icon_Theme *theme,
|
efreet_icon_find_fallback(Efreet_Icon_Theme *theme,
|
||||||
const char *icon, unsigned int size)
|
const char *icon, unsigned int size)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *parent = NULL;
|
char *parent = NULL;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
if (theme->inherits)
|
if (theme->inherits)
|
||||||
{
|
{
|
||||||
ecore_list_first_goto(theme->inherits);
|
EINA_LIST_FOREACH(theme->inherits, l, parent)
|
||||||
while ((parent = ecore_list_next(theme->inherits)))
|
|
||||||
{
|
{
|
||||||
Efreet_Icon_Theme *parent_theme;
|
Efreet_Icon_Theme *parent_theme;
|
||||||
|
|
||||||
|
@ -547,15 +553,15 @@ efreet_icon_find_helper(Efreet_Icon_Theme *theme,
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
efreet_icon_list_find_fallback(Efreet_Icon_Theme *theme,
|
efreet_icon_list_find_fallback(Efreet_Icon_Theme *theme,
|
||||||
Ecore_List *icons, unsigned int size)
|
Eina_List *icons, unsigned int size)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *parent = NULL;
|
char *parent = NULL;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
if (theme->inherits)
|
if (theme->inherits)
|
||||||
{
|
{
|
||||||
ecore_list_first_goto(theme->inherits);
|
EINA_LIST_FOREACH(theme->inherits, l, parent)
|
||||||
while ((parent = ecore_list_next(theme->inherits)))
|
|
||||||
{
|
{
|
||||||
Efreet_Icon_Theme *parent_theme;
|
Efreet_Icon_Theme *parent_theme;
|
||||||
|
|
||||||
|
@ -595,8 +601,9 @@ efreet_icon_list_find_fallback(Efreet_Icon_Theme *theme,
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
efreet_icon_list_find_helper(Efreet_Icon_Theme *theme,
|
efreet_icon_list_find_helper(Efreet_Icon_Theme *theme,
|
||||||
Ecore_List *icons, unsigned int size)
|
Eina_List *icons, unsigned int size)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
const char *icon = NULL;
|
const char *icon = NULL;
|
||||||
static int recurse = 0;
|
static int recurse = 0;
|
||||||
|
@ -610,8 +617,7 @@ efreet_icon_list_find_helper(Efreet_Icon_Theme *theme,
|
||||||
if (recurse > 256) return NULL;
|
if (recurse > 256) return NULL;
|
||||||
recurse++;
|
recurse++;
|
||||||
|
|
||||||
ecore_list_first_goto(icons);
|
EINA_LIST_FOREACH(icons, l, icon)
|
||||||
while ((icon = ecore_list_next(icons)))
|
|
||||||
{
|
{
|
||||||
value = efreet_icon_lookup_icon(theme, icon, size);
|
value = efreet_icon_lookup_icon(theme, icon, size);
|
||||||
if (value && (value != NON_EXISTING))
|
if (value && (value != NON_EXISTING))
|
||||||
|
@ -639,19 +645,19 @@ static char *
|
||||||
efreet_icon_lookup_icon(Efreet_Icon_Theme *theme, const char *icon_name,
|
efreet_icon_lookup_icon(Efreet_Icon_Theme *theme, const char *icon_name,
|
||||||
unsigned int size)
|
unsigned int size)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *icon = NULL, *tmp = NULL;
|
char *icon = NULL, *tmp = NULL;
|
||||||
Efreet_Icon_Theme_Directory *dir;
|
Efreet_Icon_Theme_Directory *dir;
|
||||||
int minimal_size = INT_MAX;
|
int minimal_size = INT_MAX;
|
||||||
|
|
||||||
if (!theme || (theme->paths.count == 0) || !icon_name || !size)
|
if (!theme || (theme->paths == NULL) || !icon_name || !size)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
icon = efreet_icon_cache_check(theme, icon_name, size);
|
icon = efreet_icon_cache_check(theme, icon_name, size);
|
||||||
if (icon) return icon;
|
if (icon) return icon;
|
||||||
|
|
||||||
/* search for allowed size == requested size */
|
/* search for allowed size == requested size */
|
||||||
ecore_list_first_goto(theme->directories);
|
EINA_LIST_FOREACH(theme->directories, l, dir)
|
||||||
while ((dir = ecore_list_next(theme->directories)))
|
|
||||||
{
|
{
|
||||||
if (!efreet_icon_directory_size_match(dir, size)) continue;
|
if (!efreet_icon_directory_size_match(dir, size)) continue;
|
||||||
icon = efreet_icon_lookup_directory(theme, dir,
|
icon = efreet_icon_lookup_directory(theme, dir,
|
||||||
|
@ -664,8 +670,7 @@ efreet_icon_lookup_icon(Efreet_Icon_Theme *theme, const char *icon_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search for any icon that matches */
|
/* search for any icon that matches */
|
||||||
ecore_list_first_goto(theme->directories);
|
EINA_LIST_FOREACH(theme->directories, l, dir)
|
||||||
while ((dir = ecore_list_next(theme->directories)))
|
|
||||||
{
|
{
|
||||||
int distance;
|
int distance;
|
||||||
|
|
||||||
|
@ -701,21 +706,15 @@ efreet_icon_lookup_directory(Efreet_Icon_Theme *theme,
|
||||||
Efreet_Icon_Theme_Directory *dir,
|
Efreet_Icon_Theme_Directory *dir,
|
||||||
const char *icon_name)
|
const char *icon_name)
|
||||||
{
|
{
|
||||||
if (theme->paths.count == 1)
|
Eina_List *l;
|
||||||
return efreet_icon_lookup_directory_helper(dir, theme->paths.path, icon_name);
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *icon;
|
char *icon;
|
||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
ecore_list_first_goto(theme->paths.path);
|
EINA_LIST_FOREACH(theme->paths, l, path)
|
||||||
while ((path = ecore_list_next(theme->paths.path)))
|
|
||||||
{
|
{
|
||||||
icon = efreet_icon_lookup_directory_helper(dir, path, icon_name);
|
icon = efreet_icon_lookup_directory_helper(dir, path, icon_name);
|
||||||
if (icon) return icon;
|
if (icon) return icon;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -802,12 +801,11 @@ efreet_icon_fallback_icon(const char *icon_name)
|
||||||
icon = efreet_icon_fallback_dir_scan(efreet_icon_user_dir_get(), icon_name);
|
icon = efreet_icon_fallback_dir_scan(efreet_icon_user_dir_get(), icon_name);
|
||||||
if (!icon)
|
if (!icon)
|
||||||
{
|
{
|
||||||
Ecore_List *xdg_dirs;
|
Eina_List *xdg_dirs, *l;
|
||||||
const char *dir;
|
const char *dir;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
|
||||||
ecore_list_first_goto(efreet_extra_icon_dirs);
|
EINA_LIST_FOREACH(efreet_extra_icon_dirs, l, dir)
|
||||||
while ((dir = ecore_list_next(efreet_extra_icon_dirs)))
|
|
||||||
{
|
{
|
||||||
icon = efreet_icon_fallback_dir_scan(dir, icon_name);
|
icon = efreet_icon_fallback_dir_scan(dir, icon_name);
|
||||||
if (icon)
|
if (icon)
|
||||||
|
@ -818,8 +816,8 @@ efreet_icon_fallback_icon(const char *icon_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
xdg_dirs = efreet_data_dirs_get();
|
xdg_dirs = efreet_data_dirs_get();
|
||||||
ecore_list_first_goto(xdg_dirs);
|
|
||||||
while ((dir = ecore_list_next(xdg_dirs)))
|
EINA_LIST_FOREACH(xdg_dirs, l, dir)
|
||||||
{
|
{
|
||||||
snprintf(path, PATH_MAX, "%s/icons", dir);
|
snprintf(path, PATH_MAX, "%s/icons", dir);
|
||||||
icon = efreet_icon_fallback_dir_scan(path, icon_name);
|
icon = efreet_icon_fallback_dir_scan(path, icon_name);
|
||||||
|
@ -848,6 +846,7 @@ efreet_icon_fallback_icon(const char *icon_name)
|
||||||
static char *
|
static char *
|
||||||
efreet_icon_fallback_dir_scan(const char *dir, const char *icon_name)
|
efreet_icon_fallback_dir_scan(const char *dir, const char *icon_name)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *icon = NULL;
|
char *icon = NULL;
|
||||||
char path[PATH_MAX], *ext;
|
char path[PATH_MAX], *ext;
|
||||||
const char *icon_path[] = { dir, "/", icon_name, NULL };
|
const char *icon_path[] = { dir, "/", icon_name, NULL };
|
||||||
|
@ -856,8 +855,7 @@ efreet_icon_fallback_dir_scan(const char *dir, const char *icon_name)
|
||||||
if (!dir || !icon_name) return NULL;
|
if (!dir || !icon_name) return NULL;
|
||||||
|
|
||||||
size = efreet_array_cat(path, sizeof(path), icon_path);
|
size = efreet_array_cat(path, sizeof(path), icon_path);
|
||||||
ecore_list_first_goto(efreet_icon_extensions);
|
EINA_LIST_FOREACH(efreet_icon_extensions, l, ext)
|
||||||
while ((ext = ecore_list_next(efreet_icon_extensions)))
|
|
||||||
{
|
{
|
||||||
ecore_strlcpy(path + size, ext, sizeof(path) - size);
|
ecore_strlcpy(path + size, ext, sizeof(path) - size);
|
||||||
|
|
||||||
|
@ -899,6 +897,7 @@ static char *
|
||||||
efreet_icon_lookup_directory_helper(Efreet_Icon_Theme_Directory *dir,
|
efreet_icon_lookup_directory_helper(Efreet_Icon_Theme_Directory *dir,
|
||||||
const char *path, const char *icon_name)
|
const char *path, const char *icon_name)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char *icon = NULL;
|
char *icon = NULL;
|
||||||
char file_path[PATH_MAX];
|
char file_path[PATH_MAX];
|
||||||
const char *ext, *path_strs[] = { path, "/", dir->name, "/", icon_name, NULL };
|
const char *ext, *path_strs[] = { path, "/", dir->name, "/", icon_name, NULL };
|
||||||
|
@ -906,8 +905,7 @@ efreet_icon_lookup_directory_helper(Efreet_Icon_Theme_Directory *dir,
|
||||||
|
|
||||||
len = efreet_array_cat(file_path, sizeof(file_path), path_strs);
|
len = efreet_array_cat(file_path, sizeof(file_path), path_strs);
|
||||||
|
|
||||||
ecore_list_first_goto(efreet_icon_extensions);
|
EINA_LIST_FOREACH(efreet_icon_extensions, l, ext)
|
||||||
while ((ext = ecore_list_next(efreet_icon_extensions)))
|
|
||||||
{
|
{
|
||||||
ecore_strlcpy(file_path + len, ext, sizeof(file_path) - len);
|
ecore_strlcpy(file_path + len, ext, sizeof(file_path) - len);
|
||||||
|
|
||||||
|
@ -1062,10 +1060,6 @@ efreet_icon_populate(Efreet_Icon *icon, const char *file)
|
||||||
{
|
{
|
||||||
char *t, *s, *p;
|
char *t, *s, *p;
|
||||||
|
|
||||||
icon->attach_points = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(icon->attach_points,
|
|
||||||
ECORE_FREE_CB(efreet_icon_point_free));
|
|
||||||
|
|
||||||
t = strdup(tmp);
|
t = strdup(tmp);
|
||||||
s = t;
|
s = t;
|
||||||
p = t;
|
p = t;
|
||||||
|
@ -1087,7 +1081,8 @@ efreet_icon_populate(Efreet_Icon *icon, const char *file)
|
||||||
if (p) *p = '\0';
|
if (p) *p = '\0';
|
||||||
|
|
||||||
point->y = atoi(s);
|
point->y = atoi(s);
|
||||||
ecore_list_append(icon->attach_points, point);
|
|
||||||
|
icon->attach_points = eina_list_append(icon->attach_points, point);
|
||||||
|
|
||||||
if (p) s = ++p;
|
if (p) s = ++p;
|
||||||
else s = NULL;
|
else s = NULL;
|
||||||
|
@ -1130,11 +1125,7 @@ efreet_icon_theme_free(Efreet_Icon_Theme *theme)
|
||||||
IF_FREE(theme->comment);
|
IF_FREE(theme->comment);
|
||||||
IF_FREE(theme->example_icon);
|
IF_FREE(theme->example_icon);
|
||||||
|
|
||||||
if (theme->paths.count == 1)
|
IF_FREE_LIST(theme->paths);
|
||||||
IF_FREE(theme->paths.path);
|
|
||||||
else
|
|
||||||
IF_FREE_LIST(theme->paths.path);
|
|
||||||
|
|
||||||
IF_FREE_LIST(theme->inherits);
|
IF_FREE_LIST(theme->inherits);
|
||||||
IF_FREE_LIST(theme->directories);
|
IF_FREE_LIST(theme->directories);
|
||||||
|
|
||||||
|
@ -1154,24 +1145,7 @@ efreet_icon_theme_path_add(Efreet_Icon_Theme *theme, const char *path)
|
||||||
{
|
{
|
||||||
if (!theme || !path) return;
|
if (!theme || !path) return;
|
||||||
|
|
||||||
if (theme->paths.count == 0)
|
theme->paths = eina_list_append(theme->paths, strdup(path));
|
||||||
theme->paths.path = strdup(path);
|
|
||||||
|
|
||||||
else if (theme->paths.count > 1)
|
|
||||||
ecore_list_append(theme->paths.path, strdup(path));
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *old;
|
|
||||||
|
|
||||||
old = theme->paths.path;
|
|
||||||
theme->paths.path = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(theme->paths.path, free);
|
|
||||||
|
|
||||||
ecore_list_append(theme->paths.path, old);
|
|
||||||
ecore_list_append(theme->paths.path, strdup(path));
|
|
||||||
}
|
|
||||||
theme->paths.count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1187,6 +1161,7 @@ efreet_icon_theme_path_add(Efreet_Icon_Theme *theme, const char *path)
|
||||||
static void
|
static void
|
||||||
efreet_icon_theme_cache_check(Efreet_Icon_Theme *theme)
|
efreet_icon_theme_cache_check(Efreet_Icon_Theme *theme)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
double new_check;
|
double new_check;
|
||||||
|
|
||||||
new_check = ecore_time_get();
|
new_check = ecore_time_get();
|
||||||
|
@ -1197,15 +1172,11 @@ efreet_icon_theme_cache_check(Efreet_Icon_Theme *theme)
|
||||||
if (theme->fake)
|
if (theme->fake)
|
||||||
efreet_icon_theme_dir_scan_all(theme->name.internal);
|
efreet_icon_theme_dir_scan_all(theme->name.internal);
|
||||||
|
|
||||||
else if (theme->paths.count == 1)
|
else
|
||||||
efreet_icon_theme_cache_check_dir(theme, theme->paths.path);
|
|
||||||
|
|
||||||
else if (theme->paths.count > 1)
|
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
ecore_list_first_goto(theme->paths.path);
|
EINA_LIST_FOREACH(theme->paths, l, path)
|
||||||
while ((path = ecore_list_next(theme->paths.path)))
|
|
||||||
{
|
{
|
||||||
if (!efreet_icon_theme_cache_check_dir(theme, path))
|
if (!efreet_icon_theme_cache_check_dir(theme, path))
|
||||||
break;
|
break;
|
||||||
|
@ -1248,15 +1219,14 @@ efreet_icon_theme_cache_check_dir(Efreet_Icon_Theme *theme, const char *dir)
|
||||||
static void
|
static void
|
||||||
efreet_icon_theme_dir_scan_all(const char *theme_name)
|
efreet_icon_theme_dir_scan_all(const char *theme_name)
|
||||||
{
|
{
|
||||||
Ecore_List *xdg_dirs;
|
Eina_List *xdg_dirs, *l;
|
||||||
char path[PATH_MAX], *dir;
|
char path[PATH_MAX], *dir;
|
||||||
|
|
||||||
efreet_icon_theme_dir_scan(efreet_icon_deprecated_user_dir_get(), theme_name);
|
efreet_icon_theme_dir_scan(efreet_icon_deprecated_user_dir_get(), theme_name);
|
||||||
efreet_icon_theme_dir_scan(efreet_icon_user_dir_get(), theme_name);
|
efreet_icon_theme_dir_scan(efreet_icon_user_dir_get(), theme_name);
|
||||||
|
|
||||||
xdg_dirs = efreet_data_dirs_get();
|
xdg_dirs = efreet_data_dirs_get();
|
||||||
ecore_list_first_goto(xdg_dirs);
|
EINA_LIST_FOREACH(xdg_dirs, l, dir)
|
||||||
while ((dir = ecore_list_next(xdg_dirs)))
|
|
||||||
{
|
{
|
||||||
snprintf(path, sizeof(path), "%s/icons", dir);
|
snprintf(path, sizeof(path), "%s/icons", dir);
|
||||||
efreet_icon_theme_dir_scan(path, theme_name);
|
efreet_icon_theme_dir_scan(path, theme_name);
|
||||||
|
@ -1384,9 +1354,6 @@ efreet_icon_theme_index_read(Efreet_Icon_Theme *theme, const char *path)
|
||||||
{
|
{
|
||||||
char *t, *s, *p;
|
char *t, *s, *p;
|
||||||
|
|
||||||
theme->inherits = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(theme->inherits, free);
|
|
||||||
|
|
||||||
t = strdup(tmp);
|
t = strdup(tmp);
|
||||||
s = t;
|
s = t;
|
||||||
p = strchr(s, ',');
|
p = strchr(s, ',');
|
||||||
|
@ -1395,11 +1362,11 @@ efreet_icon_theme_index_read(Efreet_Icon_Theme *theme, const char *path)
|
||||||
{
|
{
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
ecore_list_append(theme->inherits, strdup(s));
|
theme->inherits = eina_list_append(theme->inherits, strdup(s));
|
||||||
s = ++p;
|
s = ++p;
|
||||||
p = strchr(s, ',');
|
p = strchr(s, ',');
|
||||||
}
|
}
|
||||||
ecore_list_append(theme->inherits, strdup(s));
|
theme->inherits = eina_list_append(theme->inherits, strdup(s));
|
||||||
|
|
||||||
FREE(t);
|
FREE(t);
|
||||||
}
|
}
|
||||||
|
@ -1411,10 +1378,6 @@ efreet_icon_theme_index_read(Efreet_Icon_Theme *theme, const char *path)
|
||||||
{
|
{
|
||||||
char *t, *s, *p;
|
char *t, *s, *p;
|
||||||
|
|
||||||
theme->directories = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(theme->directories,
|
|
||||||
ECORE_FREE_CB(efreet_icon_theme_directory_free));
|
|
||||||
|
|
||||||
t = strdup(tmp);
|
t = strdup(tmp);
|
||||||
s = t;
|
s = t;
|
||||||
p = s;
|
p = s;
|
||||||
|
@ -1425,7 +1388,7 @@ efreet_icon_theme_index_read(Efreet_Icon_Theme *theme, const char *path)
|
||||||
|
|
||||||
if (p) *p = '\0';
|
if (p) *p = '\0';
|
||||||
|
|
||||||
ecore_list_append(theme->directories,
|
theme->directories = eina_list_append(theme->directories,
|
||||||
efreet_icon_theme_directory_new(ini, s));
|
efreet_icon_theme_directory_new(ini, s));
|
||||||
|
|
||||||
if (p) s = ++p;
|
if (p) s = ++p;
|
||||||
|
@ -1449,16 +1412,16 @@ efreet_icon_theme_index_read(Efreet_Icon_Theme *theme, const char *path)
|
||||||
static void
|
static void
|
||||||
efreet_icon_theme_dir_validity_check(void)
|
efreet_icon_theme_dir_validity_check(void)
|
||||||
{
|
{
|
||||||
Ecore_List *keys;
|
Eina_List *keys, *l;
|
||||||
const char *name;
|
const char *name;
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
|
|
||||||
keys = ecore_list_new();
|
keys = NULL;
|
||||||
it = eina_hash_iterator_key_new(efreet_icon_themes);
|
it = eina_hash_iterator_key_new(efreet_icon_themes);
|
||||||
eina_iterator_foreach(it, EINA_EACH(_hash_keys), keys);
|
eina_iterator_foreach(it, EINA_EACH(_hash_keys), &keys);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
ecore_list_first_goto(keys);
|
|
||||||
while ((name = ecore_list_next(keys)))
|
EINA_LIST_FOREACH(keys, l, name)
|
||||||
{
|
{
|
||||||
Efreet_Icon_Theme *theme;
|
Efreet_Icon_Theme *theme;
|
||||||
|
|
||||||
|
@ -1466,7 +1429,8 @@ efreet_icon_theme_dir_validity_check(void)
|
||||||
if (theme && !theme->valid && !theme->fake)
|
if (theme && !theme->valid && !theme->fake)
|
||||||
eina_hash_del(efreet_icon_themes, name, theme);
|
eina_hash_del(efreet_icon_themes, name, theme);
|
||||||
}
|
}
|
||||||
ecore_list_destroy(keys);
|
while (keys)
|
||||||
|
keys = eina_list_remove_list(keys, keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1561,18 +1525,21 @@ efreet_icon_cache_find(Efreet_Icon_Cache *value, const char *key)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
efreet_icon_cache_flush(Ecore_List *list)
|
efreet_icon_cache_flush(Eina_List *list)
|
||||||
{
|
{
|
||||||
/* TODO:
|
/* TODO:
|
||||||
* * Dynamic cache size
|
* * Dynamic cache size
|
||||||
* * Maybe add references to cache, so that we sort on how often a value is used
|
* * Maybe add references to cache, so that we sort on how often a value is used
|
||||||
*/
|
*/
|
||||||
while (ecore_list_count(list) > 100)
|
while (eina_list_count(list) > 100)
|
||||||
{
|
{
|
||||||
Efreet_Icon_Cache *cache;
|
Efreet_Icon_Cache *cache;
|
||||||
|
Eina_List *last;
|
||||||
|
|
||||||
cache = ecore_list_last_remove(list);
|
last = eina_list_last(list);
|
||||||
|
cache = eina_list_data_get(last);
|
||||||
efreet_icon_cache_free(cache);
|
efreet_icon_cache_free(cache);
|
||||||
|
list = eina_list_remove_list(list, last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,36 +1556,30 @@ efreet_icon_cache_free(Efreet_Icon_Cache *value)
|
||||||
static char *
|
static char *
|
||||||
efreet_icon_cache_check(Efreet_Icon_Theme *theme, const char *icon, unsigned int size)
|
efreet_icon_cache_check(Efreet_Icon_Theme *theme, const char *icon, unsigned int size)
|
||||||
{
|
{
|
||||||
Ecore_List *list;
|
Eina_List *list;
|
||||||
Efreet_Icon_Cache *cache;
|
Efreet_Icon_Cache *cache;
|
||||||
char key[4096];
|
char key[4096];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
list = eina_hash_find(efreet_icon_cache, &theme);
|
list = eina_hash_find(efreet_icon_cache, &theme);
|
||||||
if (!list)
|
if (!list) return NULL;
|
||||||
{
|
|
||||||
list = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(list, ECORE_FREE_CB(efreet_icon_cache_free));
|
|
||||||
eina_hash_add(efreet_icon_cache, &theme, list);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(key, sizeof(key), "%s %d", icon, size);
|
snprintf(key, sizeof(key), "%s %d", icon, size);
|
||||||
cache = ecore_list_find(list, ECORE_COMPARE_CB(efreet_icon_cache_find), key);
|
cache = eina_list_search_unsorted(list, (Eina_Compare_Cb)efreet_icon_cache_find, key);
|
||||||
if (cache)
|
if (cache)
|
||||||
{
|
{
|
||||||
ecore_list_remove(list);
|
|
||||||
if (!cache->path)
|
if (!cache->path)
|
||||||
{
|
{
|
||||||
ecore_list_prepend(list, cache);
|
list = eina_list_promote_list(list, eina_list_data_find_list(list, cache));
|
||||||
return NON_EXISTING;
|
return NON_EXISTING;
|
||||||
}
|
}
|
||||||
else if (!stat(cache->path, &st) && st.st_mtime == cache->lasttime)
|
else if (!stat(cache->path, &st) && st.st_mtime == cache->lasttime)
|
||||||
{
|
{
|
||||||
ecore_list_prepend(list, cache);
|
list = eina_list_promote_list(list, eina_list_data_find_list(list, cache));
|
||||||
return strdup(cache->path);
|
return strdup(cache->path);
|
||||||
}
|
}
|
||||||
efreet_icon_cache_free(cache);
|
efreet_icon_cache_free(cache);
|
||||||
|
list = eina_list_remove(list, cache);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1626,18 +1587,12 @@ efreet_icon_cache_check(Efreet_Icon_Theme *theme, const char *icon, unsigned int
|
||||||
static void
|
static void
|
||||||
efreet_icon_cache_add(Efreet_Icon_Theme *theme, const char *icon, unsigned int size, const char *value)
|
efreet_icon_cache_add(Efreet_Icon_Theme *theme, const char *icon, unsigned int size, const char *value)
|
||||||
{
|
{
|
||||||
Ecore_List *list;
|
Eina_List *list, *l;
|
||||||
Efreet_Icon_Cache *cache;
|
Efreet_Icon_Cache *cache;
|
||||||
char key[4096];
|
char key[4096];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
list = eina_hash_find(efreet_icon_cache, &theme);
|
list = eina_hash_find(efreet_icon_cache, &theme);
|
||||||
if (!list)
|
|
||||||
{
|
|
||||||
list = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(list, ECORE_FREE_CB(efreet_icon_cache_free));
|
|
||||||
eina_hash_add(efreet_icon_cache, &theme, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(key, sizeof(key), "%s %d", icon, size);
|
snprintf(key, sizeof(key), "%s %d", icon, size);
|
||||||
cache = NEW(Efreet_Icon_Cache, 1);
|
cache = NEW(Efreet_Icon_Cache, 1);
|
||||||
|
@ -1649,6 +1604,12 @@ efreet_icon_cache_add(Efreet_Icon_Theme *theme, const char *icon, unsigned int s
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cache->lasttime = ecore_time_get();
|
cache->lasttime = ecore_time_get();
|
||||||
ecore_list_prepend(list, cache);
|
|
||||||
|
l = list;
|
||||||
|
list = eina_list_prepend(list, cache);
|
||||||
|
|
||||||
|
if (!l) eina_hash_add(efreet_icon_cache, &theme, list);
|
||||||
|
else eina_hash_modify(efreet_icon_cache, &theme, list);
|
||||||
|
|
||||||
efreet_icon_cache_flush(list);
|
efreet_icon_cache_flush(list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,17 +66,11 @@ struct Efreet_Icon_Theme
|
||||||
char *example_icon; /**< Icon to use as an example of the theme */
|
char *example_icon; /**< Icon to use as an example of the theme */
|
||||||
|
|
||||||
/* An icon theme can have multiple directories that store it's icons. We
|
/* An icon theme can have multiple directories that store it's icons. We
|
||||||
* need to be able to find a search each one. If count is 1 then path
|
* need to be able to find a search each one. */
|
||||||
* will be a char * pointing to the directory. If count > 1 then path
|
|
||||||
* will be an Ecore_List of char *'s pointing to the directories */
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
void *path; /**< The paths */
|
|
||||||
int count; /**< The number of path's */
|
|
||||||
} paths; /**< The paths to this theme */
|
|
||||||
|
|
||||||
Ecore_List *inherits; /**< Icon themes we inherit from */
|
Eina_List *paths; /**< The paths */
|
||||||
Ecore_List *directories; /**< List of subdirectories for this theme */
|
Eina_List *inherits; /**< Icon themes we inherit from */
|
||||||
|
Eina_List *directories; /**< List of subdirectories for this theme */
|
||||||
|
|
||||||
double last_cache_check; /**< Last time the cache was checked */
|
double last_cache_check; /**< Last time the cache was checked */
|
||||||
|
|
||||||
|
@ -135,7 +129,7 @@ struct Efreet_Icon
|
||||||
} embedded_text_rectangle; /**< Rectangle where text can
|
} embedded_text_rectangle; /**< Rectangle where text can
|
||||||
be displayed on the icon */
|
be displayed on the icon */
|
||||||
|
|
||||||
Ecore_List *attach_points; /**< List of points to be used as anchor
|
Eina_List *attach_points; /**< List of points to be used as anchor
|
||||||
points for emblems/overlays */
|
points for emblems/overlays */
|
||||||
|
|
||||||
unsigned int ref_count; /**< References to this icon */
|
unsigned int ref_count; /**< References to this icon */
|
||||||
|
@ -161,14 +155,14 @@ struct Efreet_Icon_Point
|
||||||
EAPI const char *efreet_icon_user_dir_get(void);
|
EAPI const char *efreet_icon_user_dir_get(void);
|
||||||
EAPI void efreet_icon_extension_add(const char *ext);
|
EAPI void efreet_icon_extension_add(const char *ext);
|
||||||
|
|
||||||
EAPI Ecore_List *efreet_icon_extra_list_get(void);
|
EAPI Eina_List *efreet_icon_extra_list_get(void);
|
||||||
EAPI Ecore_List *efreet_icon_theme_list_get(void);
|
EAPI Eina_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,
|
||||||
unsigned int 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,
|
Eina_List *icons,
|
||||||
unsigned int 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,
|
||||||
|
|
|
@ -141,7 +141,6 @@ efreet_ini_parse(const char *file)
|
||||||
|
|
||||||
if (line_start[header_length] == ']')
|
if (line_start[header_length] == ']')
|
||||||
{
|
{
|
||||||
Eina_Hash *old;
|
|
||||||
const char *header;
|
const char *header;
|
||||||
|
|
||||||
header = alloca(header_length * sizeof(unsigned char));
|
header = alloca(header_length * sizeof(unsigned char));
|
||||||
|
@ -180,7 +179,6 @@ efreet_ini_parse(const char *file)
|
||||||
if (sep < line_length)
|
if (sep < line_length)
|
||||||
{
|
{
|
||||||
const char *key, *value;
|
const char *key, *value;
|
||||||
char *old;
|
|
||||||
int key_end, value_start, value_end;
|
int key_end, value_start, value_end;
|
||||||
|
|
||||||
/* trim whitespace from end of key */
|
/* trim whitespace from end of key */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,7 +46,7 @@ struct Efreet_Menu
|
||||||
const char *icon; /**< Icon for this entry */
|
const char *icon; /**< Icon for this entry */
|
||||||
|
|
||||||
Efreet_Desktop *desktop; /**< The desktop we refer too */
|
Efreet_Desktop *desktop; /**< The desktop we refer too */
|
||||||
Ecore_List *entries; /**< The menu items */
|
Eina_List *entries; /**< The menu items */
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI int efreet_menu_kde_legacy_init(void);
|
EAPI int efreet_menu_kde_legacy_init(void);
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
static Ecore_List *globs = NULL; /* contains Efreet_Mime_Glob structs */
|
static Eina_List *globs = NULL; /* contains Efreet_Mime_Glob structs */
|
||||||
static Ecore_List *magics = NULL; /* contains Efreet_Mime_Magic structs */
|
static Eina_List *magics = NULL; /* contains Efreet_Mime_Magic structs */
|
||||||
static Eina_Hash *wild = NULL; /* contains *.ext and mime.types globs*/
|
static Eina_Hash *wild = NULL; /* contains *.ext and mime.types globs*/
|
||||||
static Eina_Hash *monitors = NULL; /* contains file monitors */
|
static Eina_Hash *monitors = NULL; /* contains file monitors */
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ struct Efreet_Mime_Magic
|
||||||
{
|
{
|
||||||
unsigned int priority;
|
unsigned int priority;
|
||||||
const char *mime;
|
const char *mime;
|
||||||
Ecore_List *entries;
|
Eina_List *entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,7 +175,8 @@ EAPI char *
|
||||||
efreet_mime_type_icon_get(const char *mime, const char *theme, unsigned int 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;
|
char *data;
|
||||||
|
Eina_List *icons = NULL;
|
||||||
const char *env = NULL;
|
const char *env = NULL;
|
||||||
char *p = NULL, *pp = NULL, *ppp = NULL;
|
char *p = NULL, *pp = NULL, *ppp = NULL;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
@ -183,9 +184,6 @@ efreet_mime_type_icon_get(const char *mime, const char *theme, unsigned int size
|
||||||
if (!mime || !theme || !size)
|
if (!mime || !theme || !size)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
icons = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(icons, free);
|
|
||||||
|
|
||||||
/* Standard icon name */
|
/* Standard icon name */
|
||||||
p = strdup(mime);
|
p = strdup(mime);
|
||||||
pp = p;
|
pp = p;
|
||||||
|
@ -194,21 +192,21 @@ efreet_mime_type_icon_get(const char *mime, const char *theme, unsigned int size
|
||||||
if (*pp == '/') *pp = '-';
|
if (*pp == '/') *pp = '-';
|
||||||
pp++;
|
pp++;
|
||||||
}
|
}
|
||||||
ecore_list_append(icons, p);
|
icons = eina_list_append(icons, p);
|
||||||
|
|
||||||
/* Environment Based icon names */
|
/* Environment Based icon names */
|
||||||
if ((env = efreet_desktop_environment_get()))
|
if ((env = efreet_desktop_environment_get()))
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s-mime-%s", env, p);
|
snprintf(buf, sizeof(buf), "%s-mime-%s", env, p);
|
||||||
ecore_list_append(icons, strdup(buf));
|
icons = eina_list_append(icons, strdup(buf));
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s-%s", env, p);
|
snprintf(buf, sizeof(buf), "%s-%s", env, p);
|
||||||
ecore_list_append(icons, strdup(buf));
|
icons = eina_list_append(icons, strdup(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mime prefixed icon names */
|
/* Mime prefixed icon names */
|
||||||
snprintf(buf, sizeof(buf), "mime-%s", p);
|
snprintf(buf, sizeof(buf), "mime-%s", p);
|
||||||
ecore_list_append(icons, strdup(buf));
|
icons = eina_list_append(icons, strdup(buf));
|
||||||
|
|
||||||
/* Generic icons */
|
/* Generic icons */
|
||||||
pp = strdup(p);
|
pp = strdup(p);
|
||||||
|
@ -217,16 +215,21 @@ efreet_mime_type_icon_get(const char *mime, const char *theme, unsigned int size
|
||||||
*ppp = '\0';
|
*ppp = '\0';
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s-generic", pp);
|
snprintf(buf, sizeof(buf), "%s-generic", pp);
|
||||||
ecore_list_append(icons, strdup(buf));
|
icons = eina_list_append(icons, strdup(buf));
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s", pp);
|
snprintf(buf, sizeof(buf), "%s", pp);
|
||||||
ecore_list_append(icons, strdup(buf));
|
icons = eina_list_append(icons, strdup(buf));
|
||||||
}
|
}
|
||||||
FREE(pp);
|
FREE(pp);
|
||||||
|
|
||||||
/* Search for icons using list */
|
/* Search for icons using list */
|
||||||
icon = efreet_icon_list_find(theme, icons, size);
|
icon = efreet_icon_list_find(theme, icons, size);
|
||||||
ecore_list_destroy(icons);
|
while (icons)
|
||||||
|
{
|
||||||
|
data = eina_list_data_get(icons);
|
||||||
|
free(data);
|
||||||
|
icons = eina_list_remove_list(icons, icons);
|
||||||
|
}
|
||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
@ -250,6 +253,7 @@ efreet_mime_magic_type_get(const char *file)
|
||||||
EAPI const char *
|
EAPI const char *
|
||||||
efreet_mime_globs_type_get(const char *file)
|
efreet_mime_globs_type_get(const char *file)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
Efreet_Mime_Glob *g;
|
Efreet_Mime_Glob *g;
|
||||||
char *sl, *p;
|
char *sl, *p;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -272,8 +276,7 @@ efreet_mime_globs_type_get(const char *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fallback to the other globs if not found */
|
/* Fallback to the other globs if not found */
|
||||||
ecore_list_first_goto(globs);
|
EINA_LIST_FOREACH(globs, l, g)
|
||||||
while ((g = ecore_list_next(globs)))
|
|
||||||
{
|
{
|
||||||
if (efreet_mime_glob_match(file, g->glob))
|
if (efreet_mime_glob_match(file, g->glob))
|
||||||
return g->mime;
|
return g->mime;
|
||||||
|
@ -282,8 +285,7 @@ efreet_mime_globs_type_get(const char *file)
|
||||||
ext = alloca(strlen(file) + 1);
|
ext = alloca(strlen(file) + 1);
|
||||||
for (s = file, p = ext; *s; s++, p++) *p = tolower(*s);
|
for (s = file, p = ext; *s; s++, p++) *p = tolower(*s);
|
||||||
*p = 0;
|
*p = 0;
|
||||||
ecore_list_first_goto(globs);
|
EINA_LIST_FOREACH(globs, l, g)
|
||||||
while ((g = ecore_list_next(globs)))
|
|
||||||
{
|
{
|
||||||
if (efreet_mime_glob_case_match(ext, g->glob))
|
if (efreet_mime_glob_case_match(ext, g->glob))
|
||||||
return g->mime;
|
return g->mime;
|
||||||
|
@ -358,17 +360,19 @@ efreet_mime_monitor_add(const char *file)
|
||||||
* Also reads the /etc/mime.types file.
|
* Also reads the /etc/mime.types file.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
efreet_mime_load_globs(Ecore_List *datadirs, const char *datahome)
|
efreet_mime_load_globs(Eina_List *datadirs, const char *datahome)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
const char *datadir = NULL;
|
const char *datadir = NULL;
|
||||||
|
|
||||||
IF_FREE_HASH(wild);
|
IF_FREE_HASH(wild);
|
||||||
wild = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
|
wild = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
|
||||||
IF_FREE_LIST(globs);
|
while (globs)
|
||||||
globs = ecore_list_new();
|
{
|
||||||
ecore_list_free_cb_set(globs, efreet_mime_glob_free);
|
efreet_mime_glob_free(eina_list_data_get(globs));
|
||||||
|
globs = eina_list_remove_list(globs, globs);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is here for legacy reasons. It is mentioned briefly
|
* This is here for legacy reasons. It is mentioned briefly
|
||||||
|
@ -379,13 +383,13 @@ efreet_mime_load_globs(Ecore_List *datadirs, const char *datahome)
|
||||||
efreet_mime_mime_types_load("/etc/mime.types");
|
efreet_mime_mime_types_load("/etc/mime.types");
|
||||||
|
|
||||||
datadir = datahome;
|
datadir = datahome;
|
||||||
ecore_list_first_goto(datadirs);
|
|
||||||
while (datadir)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "%s/mime/globs", datadir);
|
snprintf(buf, sizeof(buf), "%s/mime/globs", datadir);
|
||||||
efreet_mime_shared_mimeinfo_globs_load(buf);
|
efreet_mime_shared_mimeinfo_globs_load(buf);
|
||||||
|
|
||||||
datadir = ecore_list_next(datadirs);
|
EINA_LIST_FOREACH(datadirs, l, datadir)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s/mime/globs", datadir);
|
||||||
|
efreet_mime_shared_mimeinfo_globs_load(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,23 +401,26 @@ efreet_mime_load_globs(Ecore_List *datadirs, const char *datahome)
|
||||||
* @brief Read all magic files in XDG data/home dirs.
|
* @brief Read all magic files in XDG data/home dirs.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
efreet_mime_load_magics(Ecore_List *datadirs, const char *datahome)
|
efreet_mime_load_magics(Eina_List *datadirs, const char *datahome)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
const char *datadir = NULL;
|
const char *datadir = NULL;
|
||||||
|
|
||||||
IF_FREE_LIST(magics);
|
while (magics)
|
||||||
magics = ecore_list_new();
|
{
|
||||||
ecore_list_free_cb_set(magics, efreet_mime_magic_free);
|
efreet_mime_magic_free(eina_list_data_get(magics));
|
||||||
|
magics = eina_list_remove_list(magics, magics);
|
||||||
|
}
|
||||||
|
|
||||||
datadir = datahome;
|
datadir = datahome;
|
||||||
ecore_list_first_goto(datadirs);
|
|
||||||
while (datadir)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "%s/mime/magic", datadir);
|
snprintf(buf, sizeof(buf), "%s/mime/magic", datadir);
|
||||||
efreet_mime_shared_mimeinfo_magic_load(buf);
|
efreet_mime_shared_mimeinfo_magic_load(buf);
|
||||||
|
|
||||||
datadir = ecore_list_next(datadirs);
|
EINA_LIST_FOREACH(datadirs, l, datadir)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s/mime/magic", datadir);
|
||||||
|
efreet_mime_shared_mimeinfo_magic_load(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +442,7 @@ efreet_mime_cb_update_file(void *data __UNUSED__,
|
||||||
Ecore_File_Event event __UNUSED__,
|
Ecore_File_Event event __UNUSED__,
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
Ecore_List *datadirs = NULL;
|
Eina_List *datadirs = NULL;
|
||||||
const char *datahome = NULL;
|
const char *datahome = NULL;
|
||||||
|
|
||||||
if (!(datahome = efreet_data_home_get()))
|
if (!(datahome = efreet_data_home_get()))
|
||||||
|
@ -460,7 +467,8 @@ efreet_mime_cb_update_file(void *data __UNUSED__,
|
||||||
static int
|
static int
|
||||||
efreet_mime_init_files(void)
|
efreet_mime_init_files(void)
|
||||||
{
|
{
|
||||||
Ecore_List *datadirs = NULL;
|
Eina_List *l;
|
||||||
|
Eina_List *datadirs = NULL;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
const char *datahome, *datadir = NULL;
|
const char *datahome, *datadir = NULL;
|
||||||
|
|
||||||
|
@ -475,13 +483,13 @@ efreet_mime_init_files(void)
|
||||||
* We watch the directories so we can watch for new files
|
* We watch the directories so we can watch for new files
|
||||||
*/
|
*/
|
||||||
datadir = datahome;
|
datadir = datahome;
|
||||||
ecore_list_first_goto(datadirs);
|
|
||||||
while (datadir)
|
|
||||||
{
|
|
||||||
snprintf(buf, PATH_MAX, "%s/mime", datadir);
|
snprintf(buf, PATH_MAX, "%s/mime", datadir);
|
||||||
efreet_mime_monitor_add(buf);
|
efreet_mime_monitor_add(buf);
|
||||||
|
|
||||||
datadir = ecore_list_next(datadirs);
|
EINA_LIST_FOREACH(datadirs, l, datadir)
|
||||||
|
{
|
||||||
|
snprintf(buf, PATH_MAX, "%s/mime", datadir);
|
||||||
|
efreet_mime_monitor_add(buf);
|
||||||
}
|
}
|
||||||
efreet_mime_monitor_add("/etc/mime.types");
|
efreet_mime_monitor_add("/etc/mime.types");
|
||||||
|
|
||||||
|
@ -622,19 +630,14 @@ efreet_mime_glob_remove(const char *glob)
|
||||||
{
|
{
|
||||||
Efreet_Mime_Glob *mime = NULL;
|
Efreet_Mime_Glob *mime = NULL;
|
||||||
|
|
||||||
mime = ecore_list_first_goto(globs);
|
if ((mime = eina_list_search_unsorted(globs, (Eina_Compare_Cb)strcmp, glob)))
|
||||||
while ((mime = ecore_list_current(globs)))
|
|
||||||
{
|
|
||||||
if (!strcmp(glob, mime->glob))
|
|
||||||
{
|
{
|
||||||
ecore_list_remove(globs);
|
globs = eina_list_remove(globs, mime);
|
||||||
IF_RELEASE(mime->glob);
|
IF_RELEASE(mime->glob);
|
||||||
IF_RELEASE(mime->mime);
|
IF_RELEASE(mime->mime);
|
||||||
FREE(mime);
|
FREE(mime);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ecore_list_next(globs);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -763,7 +766,7 @@ efreet_mime_shared_mimeinfo_globs_load(const char *file)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
efreet_mime_glob_remove(ext);
|
efreet_mime_glob_remove(ext);
|
||||||
ecore_list_append(globs, mime);
|
globs = eina_list_append(globs, mime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -882,10 +885,7 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
|
||||||
char *val, buf[512];
|
char *val, buf[512];
|
||||||
|
|
||||||
mime = NEW(Efreet_Mime_Magic, 1);
|
mime = NEW(Efreet_Mime_Magic, 1);
|
||||||
mime->entries = ecore_list_new();
|
magics = eina_list_append(magics, mime);
|
||||||
ecore_list_free_cb_set(mime->entries,
|
|
||||||
efreet_mime_magic_entry_free);
|
|
||||||
ecore_list_append(magics, mime);
|
|
||||||
|
|
||||||
val = ++ptr;
|
val = ++ptr;
|
||||||
while ((*val != ':')) val++;
|
while ((*val != ':')) val++;
|
||||||
|
@ -926,7 +926,7 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
|
||||||
entry->value = NULL;
|
entry->value = NULL;
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
ecore_list_append(mime->entries, entry);
|
mime->entries = eina_list_append(mime->entries, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(*ptr)
|
switch(*ptr)
|
||||||
|
@ -1050,6 +1050,7 @@ efreet_mime_magic_check_priority(const char *file,
|
||||||
{
|
{
|
||||||
Efreet_Mime_Magic *m = NULL;
|
Efreet_Mime_Magic *m = NULL;
|
||||||
Efreet_Mime_Magic_Entry *e = NULL;
|
Efreet_Mime_Magic_Entry *e = NULL;
|
||||||
|
Eina_List *l, *ll;
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
unsigned int i = 0, offset = 0,level = 0, match = 0, bytes_read = 0;
|
unsigned int i = 0, offset = 0,level = 0, match = 0, bytes_read = 0;
|
||||||
const char *last_mime = NULL;
|
const char *last_mime = NULL;
|
||||||
|
@ -1058,7 +1059,7 @@ efreet_mime_magic_check_priority(const char *file,
|
||||||
f = fopen(file, "rb");
|
f = fopen(file, "rb");
|
||||||
if (!f) return NULL;
|
if (!f) return NULL;
|
||||||
|
|
||||||
if (!(m = ecore_list_first_goto(magics)))
|
if (!magics)
|
||||||
{
|
{
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1070,7 +1071,7 @@ efreet_mime_magic_check_priority(const char *file,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((m = ecore_list_next(magics)))
|
EINA_LIST_FOREACH(magics, l, m)
|
||||||
{
|
{
|
||||||
if ((start != 0) && (m->priority > start))
|
if ((start != 0) && (m->priority > start))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1078,8 +1079,7 @@ efreet_mime_magic_check_priority(const char *file,
|
||||||
if (m->priority < end)
|
if (m->priority < end)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ecore_list_first_goto(m->entries);
|
EINA_LIST_FOREACH(m->entries, ll, e)
|
||||||
while ((e = ecore_list_next(m->entries)))
|
|
||||||
{
|
{
|
||||||
if ((level < e->indent) && !match)
|
if ((level < e->indent) && !match)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1157,9 +1157,15 @@ static void
|
||||||
efreet_mime_magic_free(void *data)
|
efreet_mime_magic_free(void *data)
|
||||||
{
|
{
|
||||||
Efreet_Mime_Magic *m = data;
|
Efreet_Mime_Magic *m = data;
|
||||||
|
Efreet_Mime_Magic_Entry *entry = NULL;
|
||||||
|
|
||||||
IF_RELEASE(m->mime);
|
IF_RELEASE(m->mime);
|
||||||
IF_FREE_LIST(m->entries);
|
while (m->entries)
|
||||||
|
{
|
||||||
|
entry = eina_list_data_get(m->entries);
|
||||||
|
efreet_mime_magic_entry_free(entry);
|
||||||
|
m->entries = eina_list_remove_list(m->entries, m->entries);
|
||||||
|
}
|
||||||
IF_FREE(m);
|
IF_FREE(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,10 +71,7 @@
|
||||||
* If x is a valid pointer destroy x and set to NULL
|
* If x is a valid pointer destroy x and set to NULL
|
||||||
*/
|
*/
|
||||||
#define IF_FREE_LIST(x) do { \
|
#define IF_FREE_LIST(x) do { \
|
||||||
if (x) { \
|
x = eina_list_free(x); \
|
||||||
Ecore_List *__tmp; __tmp = (x); (x) = NULL; ecore_list_destroy(__tmp); \
|
|
||||||
} \
|
|
||||||
(x) = NULL; \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,7 +143,7 @@ struct Efreet_Desktop_Command
|
||||||
Efreet_Desktop_Progress_Cb cb_progress;
|
Efreet_Desktop_Progress_Cb cb_progress;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
Ecore_List *files; /**< list of Efreet_Desktop_Command_File */
|
Eina_List *files; /**< list of Efreet_Desktop_Command_File */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,8 +175,8 @@ void efreet_icon_shutdown(void);
|
||||||
|
|
||||||
int efreet_menu_init(void);
|
int efreet_menu_init(void);
|
||||||
void efreet_menu_shutdown(void);
|
void efreet_menu_shutdown(void);
|
||||||
Ecore_List *efreet_default_dirs_get(const char *user_dir,
|
Eina_List *efreet_default_dirs_get(const char *user_dir,
|
||||||
Ecore_List *system_dirs,
|
Eina_List *system_dirs,
|
||||||
const char *suffix);
|
const char *suffix);
|
||||||
|
|
||||||
int efreet_ini_init(void);
|
int efreet_ini_init(void);
|
||||||
|
|
|
@ -178,12 +178,12 @@ efreet_trash_empty_trash(void)
|
||||||
* when you don't need anymore)
|
* when you don't need anymore)
|
||||||
* @brief List all the files and directory currently inside the trash.
|
* @brief List all the files and directory currently inside the trash.
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List*
|
EAPI Eina_List*
|
||||||
efreet_trash_ls(void)
|
efreet_trash_ls(void)
|
||||||
{
|
{
|
||||||
char *infofile;
|
char *infofile;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
Ecore_List *files;
|
Eina_List *files, *l;
|
||||||
|
|
||||||
// NOTE THIS FUNCTION NOW IS NOT COMPLETE AS I DON'T NEED IT
|
// NOTE THIS FUNCTION NOW IS NOT COMPLETE AS I DON'T NEED IT
|
||||||
// TODO read the name from the infofile instead of the filename
|
// TODO read the name from the infofile instead of the filename
|
||||||
|
@ -191,7 +191,7 @@ efreet_trash_ls(void)
|
||||||
snprintf(buf, PATH_MAX, "%s/files", efreet_trash_dir_get());
|
snprintf(buf, PATH_MAX, "%s/files", efreet_trash_dir_get());
|
||||||
files = ecore_file_ls(buf);
|
files = ecore_file_ls(buf);
|
||||||
|
|
||||||
while ((infofile = ecore_list_next(files)))
|
EINA_LIST_FOREACH(files, l, infofile)
|
||||||
printf("FILE: %s\n", infofile);
|
printf("FILE: %s\n", infofile);
|
||||||
|
|
||||||
return files;
|
return files;
|
||||||
|
|
|
@ -11,7 +11,7 @@ typedef struct Efreet_Util_Desktop Efreet_Util_Desktop;
|
||||||
|
|
||||||
struct Efreet_Cache_Fill
|
struct Efreet_Cache_Fill
|
||||||
{
|
{
|
||||||
Ecore_List *dirs;
|
Eina_List *dirs;
|
||||||
Efreet_Cache_Fill_Dir *current;
|
Efreet_Cache_Fill_Dir *current;
|
||||||
DIR *files;
|
DIR *files;
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ struct Efreet_Cache_Search
|
||||||
|
|
||||||
struct Efreet_Cache_Search_List
|
struct Efreet_Cache_Search_List
|
||||||
{
|
{
|
||||||
Ecore_List *list;
|
Eina_List *list;
|
||||||
const char *what;
|
const char *what;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ static void efreet_util_monitor(const char *path, const char *file_id, int prior
|
||||||
static void efreet_util_monitor_cb(void *data, Ecore_File_Monitor *monitor,
|
static void efreet_util_monitor_cb(void *data, Ecore_File_Monitor *monitor,
|
||||||
Ecore_File_Event event, const char *path);
|
Ecore_File_Event event, const char *path);
|
||||||
static void efreet_util_monitor_free(void *data);
|
static void efreet_util_monitor_free(void *data);
|
||||||
static void efreet_util_menus_find_helper(Ecore_List *menus, const char *config_dir);
|
static void efreet_util_menus_find_helper(Eina_List *menus, const char *config_dir);
|
||||||
|
|
||||||
static void efreet_util_desktops_by_category_add(Efreet_Desktop *desktop);
|
static void efreet_util_desktops_by_category_add(Efreet_Desktop *desktop);
|
||||||
static void efreet_util_desktops_by_category_remove(Efreet_Desktop *desktop);
|
static void efreet_util_desktops_by_category_remove(Efreet_Desktop *desktop);
|
||||||
|
@ -89,7 +89,7 @@ static Eina_Hash *desktops_by_category = NULL;
|
||||||
static Ecore_Idler *idler = NULL;
|
static Ecore_Idler *idler = NULL;
|
||||||
static Efreet_Cache_Fill *fill = NULL;
|
static Efreet_Cache_Fill *fill = NULL;
|
||||||
|
|
||||||
static Ecore_List *monitors = NULL;
|
static Eina_List *monitors = NULL;
|
||||||
|
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ EAPI int EFREET_EVENT_DESKTOP_CHANGE = 0;
|
||||||
EAPI int
|
EAPI int
|
||||||
efreet_util_init(void)
|
efreet_util_init(void)
|
||||||
{
|
{
|
||||||
Ecore_List *dirs;
|
Eina_List *dirs;
|
||||||
|
|
||||||
if (init++) return init;
|
if (init++) return init;
|
||||||
|
|
||||||
|
@ -109,14 +109,11 @@ efreet_util_init(void)
|
||||||
EFREET_EVENT_DESKTOP_CHANGE = ecore_event_type_new();
|
EFREET_EVENT_DESKTOP_CHANGE = ecore_event_type_new();
|
||||||
desktop_by_file_id = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_util_desktop_free));
|
desktop_by_file_id = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_util_desktop_free));
|
||||||
file_id_by_desktop_path = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
|
file_id_by_desktop_path = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
|
||||||
desktops_by_category = eina_hash_string_superfast_new(EINA_FREE_CB(ecore_list_destroy));
|
desktops_by_category = eina_hash_string_superfast_new(EINA_FREE_CB(eina_list_free));
|
||||||
|
|
||||||
monitors = ecore_list_new();
|
monitors = NULL;
|
||||||
ecore_list_free_cb_set(monitors, efreet_util_monitor_free);
|
|
||||||
|
|
||||||
fill = NEW(Efreet_Cache_Fill, 1);
|
fill = NEW(Efreet_Cache_Fill, 1);
|
||||||
fill->dirs = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(fill->dirs, efreet_util_cache_dir_free);
|
|
||||||
dirs = efreet_default_dirs_get(efreet_data_home_get(), efreet_data_dirs_get(),
|
dirs = efreet_default_dirs_get(efreet_data_home_get(), efreet_data_dirs_get(),
|
||||||
"applications");
|
"applications");
|
||||||
if (dirs)
|
if (dirs)
|
||||||
|
@ -125,14 +122,15 @@ efreet_util_init(void)
|
||||||
char *path;
|
char *path;
|
||||||
int priority = 0;
|
int priority = 0;
|
||||||
|
|
||||||
while ((path = ecore_list_first_remove(dirs)))
|
while (dirs)
|
||||||
{
|
{
|
||||||
|
path = eina_list_data_get(dirs);
|
||||||
dir = NEW(Efreet_Cache_Fill_Dir, 1);
|
dir = NEW(Efreet_Cache_Fill_Dir, 1);
|
||||||
dir->path = path;
|
dir->path = path;
|
||||||
dir->priority = priority++;
|
dir->priority = priority++;
|
||||||
ecore_list_append(fill->dirs, dir);
|
fill->dirs = eina_list_append(fill->dirs, dir);
|
||||||
|
dirs = eina_list_remove_list(dirs, dirs);
|
||||||
}
|
}
|
||||||
ecore_list_destroy(dirs);
|
|
||||||
}
|
}
|
||||||
idler = ecore_idler_add(efreet_util_cache_fill, NULL);
|
idler = ecore_idler_add(efreet_util_cache_fill, NULL);
|
||||||
return init;
|
return init;
|
||||||
|
@ -141,12 +139,21 @@ efreet_util_init(void)
|
||||||
EAPI int
|
EAPI int
|
||||||
efreet_util_shutdown(void)
|
efreet_util_shutdown(void)
|
||||||
{
|
{
|
||||||
|
Efreet_Monitor *em;
|
||||||
|
Efreet_Cache_Fill_Dir *dir;
|
||||||
|
|
||||||
if (--init) return init;
|
if (--init) return init;
|
||||||
|
|
||||||
if (idler)
|
if (idler)
|
||||||
{
|
{
|
||||||
ecore_idler_del(idler);
|
ecore_idler_del(idler);
|
||||||
IF_FREE_LIST(fill->dirs);
|
while (fill->dirs)
|
||||||
|
{
|
||||||
|
dir = eina_list_data_get(fill->dirs);
|
||||||
|
efreet_util_cache_dir_free(dir);
|
||||||
|
fill->dirs = eina_list_remove_list(fill->dirs, fill->dirs);
|
||||||
|
}
|
||||||
|
|
||||||
if (fill->current) efreet_util_cache_dir_free(fill->current);
|
if (fill->current) efreet_util_cache_dir_free(fill->current);
|
||||||
if (fill->files) closedir(fill->files);
|
if (fill->files) closedir(fill->files);
|
||||||
free(fill);
|
free(fill);
|
||||||
|
@ -156,7 +163,12 @@ efreet_util_shutdown(void)
|
||||||
IF_FREE_HASH(desktop_by_file_id);
|
IF_FREE_HASH(desktop_by_file_id);
|
||||||
IF_FREE_HASH(file_id_by_desktop_path);
|
IF_FREE_HASH(file_id_by_desktop_path);
|
||||||
|
|
||||||
IF_FREE_LIST(monitors);
|
while (monitors)
|
||||||
|
{
|
||||||
|
em = eina_list_data_get(monitors);
|
||||||
|
efreet_util_monitor_free(em);
|
||||||
|
monitors = eina_list_remove_list(monitors, monitors);
|
||||||
|
}
|
||||||
|
|
||||||
IF_FREE_HASH(desktops_by_category);
|
IF_FREE_HASH(desktops_by_category);
|
||||||
|
|
||||||
|
@ -166,27 +178,29 @@ efreet_util_shutdown(void)
|
||||||
static char *
|
static char *
|
||||||
efreet_util_path_in_default(const char *section, const char *path)
|
efreet_util_path_in_default(const char *section, const char *path)
|
||||||
{
|
{
|
||||||
Ecore_List *dirs;
|
Eina_List *dirs, *l;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
||||||
dirs = efreet_default_dirs_get(efreet_data_home_get(), efreet_data_dirs_get(),
|
dirs = efreet_default_dirs_get(efreet_data_home_get(), efreet_data_dirs_get(),
|
||||||
section);
|
section);
|
||||||
|
|
||||||
ecore_list_first_goto(dirs);
|
EINA_LIST_FREE(dirs, dir)
|
||||||
while ((dir = ecore_list_next(dirs)))
|
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
len = strlen(dir);
|
len = strlen(dir);
|
||||||
if (!strncmp(path, dir, strlen(dir)))
|
if (!strncmp(path, dir, strlen(dir)))
|
||||||
{
|
{
|
||||||
ret = strdup(dir);
|
ret = dir;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
free(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_list_destroy(dirs);
|
EINA_LIST_FREE(dirs, dir)
|
||||||
|
if (ret != dir) free(dir);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,13 +246,13 @@ efreet_util_path_to_file_id(const char *path)
|
||||||
return file_id;
|
return file_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_util_desktop_mime_list(const char *mime)
|
efreet_util_desktop_mime_list(const char *mime)
|
||||||
{
|
{
|
||||||
Efreet_Cache_Search_List search;
|
Efreet_Cache_Search_List search;
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
|
|
||||||
search.list = ecore_list_new();
|
search.list = NULL;
|
||||||
search.what = eina_stringshare_add(mime);
|
search.what = eina_stringshare_add(mime);
|
||||||
|
|
||||||
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
||||||
|
@ -247,7 +261,6 @@ efreet_util_desktop_mime_list(const char *mime)
|
||||||
|
|
||||||
eina_stringshare_del(search.what);
|
eina_stringshare_del(search.what);
|
||||||
|
|
||||||
if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
|
|
||||||
return search.list;
|
return search.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +281,11 @@ efreet_util_desktop_wm_class_find(const char *wmname, const char *wmclass)
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
ud = search.result;
|
ud = search.result;
|
||||||
|
|
||||||
if (ud) return ud->desktop;
|
if (ud)
|
||||||
|
{
|
||||||
|
efreet_desktop_ref(ud->desktop);
|
||||||
|
return ud->desktop;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +294,7 @@ efreet_util_desktop_file_id_find(const char *file_id)
|
||||||
{
|
{
|
||||||
Efreet_Desktop *desktop = NULL;
|
Efreet_Desktop *desktop = NULL;
|
||||||
Efreet_Util_Desktop *ud = NULL;
|
Efreet_Util_Desktop *ud = NULL;
|
||||||
Ecore_List *dirs;
|
Eina_List *dirs, *l;
|
||||||
const char *dir;
|
const char *dir;
|
||||||
int priority = 0;
|
int priority = 0;
|
||||||
|
|
||||||
|
@ -289,8 +306,7 @@ efreet_util_desktop_file_id_find(const char *file_id)
|
||||||
"applications");
|
"applications");
|
||||||
if (!dirs) return NULL;
|
if (!dirs) return NULL;
|
||||||
|
|
||||||
ecore_list_first_goto(dirs);
|
EINA_LIST_FOREACH(dirs, l, dir)
|
||||||
while ((dir = ecore_list_next(dirs)))
|
|
||||||
{
|
{
|
||||||
char *tmp, *p;
|
char *tmp, *p;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
@ -310,7 +326,11 @@ efreet_util_desktop_file_id_find(const char *file_id)
|
||||||
if (desktop) break;
|
if (desktop) break;
|
||||||
priority++;
|
priority++;
|
||||||
}
|
}
|
||||||
ecore_list_destroy(dirs);
|
while (dirs)
|
||||||
|
{
|
||||||
|
free(eina_list_data_get(dirs));
|
||||||
|
dirs = eina_list_remove_list(dirs, dirs);
|
||||||
|
}
|
||||||
if (desktop)
|
if (desktop)
|
||||||
{
|
{
|
||||||
Efreet_Event_Desktop_Change *ev;
|
Efreet_Event_Desktop_Change *ev;
|
||||||
|
@ -347,8 +367,10 @@ efreet_util_desktop_exec_find(const char *exec)
|
||||||
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_exec), &search);
|
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_exec), &search);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
if (search.result) return search.result->desktop;
|
if (!search.result) return NULL;
|
||||||
return NULL;
|
|
||||||
|
efreet_desktop_ref(search.result->desktop);
|
||||||
|
return search.result->desktop;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Efreet_Desktop *
|
EAPI Efreet_Desktop *
|
||||||
|
@ -366,8 +388,8 @@ efreet_util_desktop_name_find(const char *name)
|
||||||
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_name), &search);
|
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_name), &search);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
if (search.result) return search.result->desktop;
|
efreet_desktop_ref(search.result->desktop);
|
||||||
return NULL;
|
return search.result->desktop;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Efreet_Desktop *
|
EAPI Efreet_Desktop *
|
||||||
|
@ -385,95 +407,99 @@ efreet_util_desktop_generic_name_find(const char *generic_name)
|
||||||
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_generic_name), &search);
|
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_generic_name), &search);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
if (search.result) return search.result->desktop;
|
efreet_desktop_ref(search.result->desktop);
|
||||||
return NULL;
|
return search.result->desktop;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_util_desktop_name_glob_list(const char *glob)
|
efreet_util_desktop_name_glob_list(const char *glob)
|
||||||
{
|
{
|
||||||
Efreet_Cache_Search_List search;
|
Efreet_Cache_Search_List search;
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
|
|
||||||
search.list = ecore_list_new();
|
search.list = NULL;
|
||||||
search.what = glob;
|
search.what = glob;
|
||||||
|
|
||||||
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
||||||
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_name_glob), &search);
|
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_name_glob), &search);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
|
|
||||||
return search.list;
|
return search.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_util_desktop_exec_glob_list(const char *glob)
|
efreet_util_desktop_exec_glob_list(const char *glob)
|
||||||
{
|
{
|
||||||
Efreet_Cache_Search_List search;
|
Efreet_Cache_Search_List search;
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
|
|
||||||
search.list = ecore_list_new();
|
search.list = NULL;
|
||||||
search.what = glob;
|
search.what = glob;
|
||||||
|
|
||||||
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
||||||
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_exec_glob), &search);
|
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_exec_glob), &search);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
|
|
||||||
return search.list;
|
return search.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_util_desktop_generic_name_glob_list(const char *glob)
|
efreet_util_desktop_generic_name_glob_list(const char *glob)
|
||||||
{
|
{
|
||||||
Efreet_Cache_Search_List search;
|
Efreet_Cache_Search_List search;
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
|
|
||||||
search.list = ecore_list_new();
|
search.list = NULL;
|
||||||
search.what = glob;
|
search.what = glob;
|
||||||
|
|
||||||
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
||||||
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_generic_name_glob), &search);
|
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_generic_name_glob), &search);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
|
|
||||||
return search.list;
|
return search.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_util_desktop_comment_glob_list(const char *glob)
|
efreet_util_desktop_comment_glob_list(const char *glob)
|
||||||
{
|
{
|
||||||
Efreet_Cache_Search_List search;
|
Efreet_Cache_Search_List search;
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
|
|
||||||
search.list = ecore_list_new();
|
search.list = NULL;
|
||||||
search.what = glob;
|
search.what = glob;
|
||||||
|
|
||||||
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
it = eina_hash_iterator_data_new(desktop_by_file_id);
|
||||||
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_comment_glob), &search);
|
eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_comment_glob), &search);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
|
|
||||||
return search.list;
|
return search.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_hash_keys(Eina_Hash *hash, const void *key, void *fdata)
|
||||||
|
{
|
||||||
|
Eina_List **l = fdata;
|
||||||
|
|
||||||
|
*l = eina_list_append(*l, key);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find all desktop categories
|
* Find all desktop categories
|
||||||
* This list must be freed using ecore_list_destroy()
|
* This list must be freed using ecore_list_destroy()
|
||||||
*
|
*
|
||||||
* @return an Ecore_List of category names (const char *)
|
* @return an Eina_List of category names (const char *)
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_util_desktop_categories_list(void)
|
efreet_util_desktop_categories_list(void)
|
||||||
{
|
{
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
Ecore_List *list;
|
Eina_List *list = NULL;
|
||||||
|
|
||||||
list = ecore_list_new();
|
|
||||||
if (list)
|
|
||||||
{
|
|
||||||
it = eina_hash_iterator_key_new(desktops_by_category);
|
it = eina_hash_iterator_key_new(desktops_by_category);
|
||||||
eina_iterator_foreach(it, EINA_EACH(desktops_by_category), list);
|
if (it)
|
||||||
|
{
|
||||||
|
eina_iterator_foreach(it, EINA_EACH(_hash_keys), &list);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +514,7 @@ efreet_util_desktop_categories_list(void)
|
||||||
* @param category the category name
|
* @param category the category name
|
||||||
* @return a list of desktops
|
* @return a list of desktops
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_util_desktop_category_list(const char *category)
|
efreet_util_desktop_category_list(const char *category)
|
||||||
{
|
{
|
||||||
return eina_hash_find(desktops_by_category, category);
|
return eina_hash_find(desktops_by_category, category);
|
||||||
|
@ -505,6 +531,7 @@ dump(Eina_Hash *hash, const char *key, void *value, __UNUSED__ void *data)
|
||||||
static int
|
static int
|
||||||
efreet_util_cache_fill(__UNUSED__ void *data)
|
efreet_util_cache_fill(__UNUSED__ void *data)
|
||||||
{
|
{
|
||||||
|
Efreet_Cache_Fill_Dir *dir;
|
||||||
struct dirent *file = NULL;
|
struct dirent *file = NULL;
|
||||||
double start;
|
double start;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
@ -521,10 +548,17 @@ efreet_util_cache_fill(__UNUSED__ void *data)
|
||||||
}
|
}
|
||||||
if (!fill->current)
|
if (!fill->current)
|
||||||
{
|
{
|
||||||
fill->current = ecore_list_first_remove(fill->dirs);
|
fill->current = eina_list_data_get(fill->dirs);
|
||||||
|
fill->dirs = eina_list_remove_list(fill->dirs, fill->dirs);
|
||||||
if (!fill->current)
|
if (!fill->current)
|
||||||
{
|
{
|
||||||
IF_FREE_LIST(fill->dirs);
|
while (fill->dirs)
|
||||||
|
{
|
||||||
|
dir = eina_list_data_get(fill->dirs);
|
||||||
|
efreet_util_cache_dir_free(dir);
|
||||||
|
fill->dirs = eina_list_remove_list(fill->dirs, fill->dirs);
|
||||||
|
}
|
||||||
|
|
||||||
free(fill);
|
free(fill);
|
||||||
idler = NULL;
|
idler = NULL;
|
||||||
fill = NULL;
|
fill = NULL;
|
||||||
|
@ -572,7 +606,7 @@ efreet_util_cache_fill(__UNUSED__ void *data)
|
||||||
dir->path = strdup(buf);
|
dir->path = strdup(buf);
|
||||||
dir->file_id = strdup(file_id);
|
dir->file_id = strdup(file_id);
|
||||||
dir->priority = fill->current->priority;
|
dir->priority = fill->current->priority;
|
||||||
ecore_list_append(fill->dirs, dir);
|
fill->dirs = eina_list_append(fill->dirs, dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
efreet_util_cache_add(buf, file_id, fill->current->priority, 0);
|
efreet_util_cache_add(buf, file_id, fill->current->priority, 0);
|
||||||
|
@ -781,21 +815,20 @@ efreet_util_cache_search_mime(__UNUSED__ const Eina_Hash *hash, void *value, voi
|
||||||
{
|
{
|
||||||
Efreet_Cache_Search_List *search;
|
Efreet_Cache_Search_List *search;
|
||||||
Efreet_Util_Desktop *ud;
|
Efreet_Util_Desktop *ud;
|
||||||
|
Eina_List *l;
|
||||||
const char *mime;
|
const char *mime;
|
||||||
|
|
||||||
search = fdata;
|
search = fdata;
|
||||||
ud = value;
|
ud = value;
|
||||||
|
|
||||||
if (!ud->desktop->mime_types) return EINA_FALSE;
|
if (!ud->desktop->mime_types) return EINA_FALSE;
|
||||||
ecore_list_first_goto(ud->desktop->mime_types);
|
EINA_LIST_FOREACH(ud->desktop->mime_types, l, mime)
|
||||||
while ((mime = ecore_list_next(ud->desktop->mime_types)))
|
|
||||||
{
|
|
||||||
if (search->what == mime)
|
if (search->what == mime)
|
||||||
{
|
{
|
||||||
ecore_list_append(search->list, ud->desktop);
|
efreet_desktop_ref(ud->desktop);
|
||||||
|
search->list = eina_list_append(search->list, ud->desktop);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,6 +841,7 @@ efreet_util_cache_search_wm_class(__UNUSED__ const Eina_Hash *hash, void *value,
|
||||||
ud = value;
|
ud = value;
|
||||||
search = fdata;
|
search = fdata;
|
||||||
|
|
||||||
|
if (!ud->desktop) return EINA_TRUE;
|
||||||
if (!ud->desktop->startup_wm_class) return EINA_TRUE;
|
if (!ud->desktop->startup_wm_class) return EINA_TRUE;
|
||||||
if ((search->what2) && (!strcmp(ud->desktop->startup_wm_class, search->what2)))
|
if ((search->what2) && (!strcmp(ud->desktop->startup_wm_class, search->what2)))
|
||||||
{
|
{
|
||||||
|
@ -899,8 +933,12 @@ efreet_util_cache_search_name_glob(__UNUSED__ const Eina_Hash *hash, void *value
|
||||||
search = fdata;
|
search = fdata;
|
||||||
ud = value;
|
ud = value;
|
||||||
|
|
||||||
|
if (!ud->desktop) return EINA_TRUE;
|
||||||
if (efreet_util_glob_match(ud->desktop->name, search->what))
|
if (efreet_util_glob_match(ud->desktop->name, search->what))
|
||||||
ecore_list_append(search->list, ud->desktop);
|
{
|
||||||
|
efreet_desktop_ref(ud->desktop);
|
||||||
|
search->list = eina_list_append(search->list, ud->desktop);
|
||||||
|
}
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,12 +954,14 @@ efreet_util_cache_search_exec_glob(__UNUSED__ const Eina_Hash *hash, void *value
|
||||||
|
|
||||||
if (!ud->desktop->exec) return EINA_FALSE;
|
if (!ud->desktop->exec) return EINA_FALSE;
|
||||||
exec = ecore_file_app_exe_get(ud->desktop->exec);
|
exec = ecore_file_app_exe_get(ud->desktop->exec);
|
||||||
if (exec)
|
if (!exec) return EINA_TRUE;
|
||||||
{
|
|
||||||
if (efreet_util_glob_match(exec, search->what))
|
if (efreet_util_glob_match(exec, search->what))
|
||||||
ecore_list_append(search->list, ud->desktop);
|
{
|
||||||
free(exec);
|
efreet_desktop_ref(ud->desktop);
|
||||||
|
search->list = eina_list_append(search->list, ud->desktop);
|
||||||
}
|
}
|
||||||
|
free(exec);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,7 +975,10 @@ efreet_util_cache_search_generic_name_glob(__UNUSED__ const Eina_Hash *hash, voi
|
||||||
ud = value;
|
ud = value;
|
||||||
|
|
||||||
if (efreet_util_glob_match(ud->desktop->generic_name, search->what))
|
if (efreet_util_glob_match(ud->desktop->generic_name, search->what))
|
||||||
ecore_list_append(search->list, ud->desktop);
|
{
|
||||||
|
efreet_desktop_ref(ud->desktop);
|
||||||
|
search->list = eina_list_append(search->list, ud->desktop);
|
||||||
|
}
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,7 +992,10 @@ efreet_util_cache_search_comment_glob(__UNUSED__ const Eina_Hash *hash, void *va
|
||||||
ud = value;
|
ud = value;
|
||||||
|
|
||||||
if (efreet_util_glob_match(ud->desktop->comment, search->what))
|
if (efreet_util_glob_match(ud->desktop->comment, search->what))
|
||||||
ecore_list_append(search->list, ud->desktop);
|
{
|
||||||
|
efreet_desktop_ref(ud->desktop);
|
||||||
|
search->list = eina_list_append(search->list, ud->desktop);
|
||||||
|
}
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,7 +1023,7 @@ efreet_util_monitor(const char *path, const char *file_id, int priority)
|
||||||
em->monitor = ecore_file_monitor_add(path, efreet_util_monitor_cb, em);
|
em->monitor = ecore_file_monitor_add(path, efreet_util_monitor_cb, em);
|
||||||
if (file_id) em->file_id = strdup(file_id);
|
if (file_id) em->file_id = strdup(file_id);
|
||||||
em->priority = priority;
|
em->priority = priority;
|
||||||
ecore_list_append(monitors, em);
|
monitors = eina_list_append(monitors, em);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1007,15 +1053,13 @@ efreet_util_monitor_cb(void *data, Ecore_File_Monitor *monitor __UNUSED__,
|
||||||
if (!fill)
|
if (!fill)
|
||||||
{
|
{
|
||||||
fill = NEW(Efreet_Cache_Fill, 1);
|
fill = NEW(Efreet_Cache_Fill, 1);
|
||||||
fill->dirs = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(fill->dirs, efreet_util_cache_dir_free);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = NEW(Efreet_Cache_Fill_Dir, 1);
|
dir = NEW(Efreet_Cache_Fill_Dir, 1);
|
||||||
dir->path = strdup(path);
|
dir->path = strdup(path);
|
||||||
dir->file_id = strdup(file_id);
|
dir->file_id = strdup(file_id);
|
||||||
dir->priority = em->priority;
|
dir->priority = em->priority;
|
||||||
ecore_list_append(fill->dirs, dir);
|
fill->dirs = eina_list_append(fill->dirs, dir);
|
||||||
|
|
||||||
if (!idler)
|
if (!idler)
|
||||||
idler = ecore_idler_add(efreet_util_cache_fill, NULL);
|
idler = ecore_idler_add(efreet_util_cache_fill, NULL);
|
||||||
|
@ -1028,8 +1072,8 @@ efreet_util_monitor_cb(void *data, Ecore_File_Monitor *monitor __UNUSED__,
|
||||||
/* Ignore, we should already have a monitor on any subdir */
|
/* Ignore, we should already have a monitor on any subdir */
|
||||||
break;
|
break;
|
||||||
case ECORE_FILE_EVENT_DELETED_SELF:
|
case ECORE_FILE_EVENT_DELETED_SELF:
|
||||||
if (ecore_list_goto(monitors, em))
|
if (eina_list_data_find(monitors, em))
|
||||||
ecore_list_remove(monitors);
|
eina_list_remove(monitors, em);
|
||||||
efreet_util_monitor_free(em);
|
efreet_util_monitor_free(em);
|
||||||
break;
|
break;
|
||||||
case ECORE_FILE_EVENT_MODIFIED:
|
case ECORE_FILE_EVENT_MODIFIED:
|
||||||
|
@ -1053,27 +1097,24 @@ efreet_util_monitor_free(void *data)
|
||||||
* Returns a list of .menu files found in the various config dirs.
|
* Returns a list of .menu files found in the various config dirs.
|
||||||
* @return An ecore list of menu file paths (const char *). This must be freed with ecore_list_destroy().
|
* @return An ecore list of menu file paths (const char *). This must be freed with ecore_list_destroy().
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_List *
|
EAPI Eina_List *
|
||||||
efreet_util_menus_find(void)
|
efreet_util_menus_find(void)
|
||||||
{
|
{
|
||||||
Ecore_List *menus, *dirs;
|
Eina_List *menus = NULL;
|
||||||
|
Eina_List *dirs, *l;
|
||||||
const char *dir;
|
const char *dir;
|
||||||
|
|
||||||
menus = ecore_list_new();
|
|
||||||
ecore_list_free_cb_set(menus, ECORE_FREE_CB(free));
|
|
||||||
|
|
||||||
efreet_util_menus_find_helper(menus, efreet_config_home_get());
|
efreet_util_menus_find_helper(menus, efreet_config_home_get());
|
||||||
|
|
||||||
dirs = efreet_config_dirs_get();
|
dirs = efreet_config_dirs_get();
|
||||||
ecore_list_first_goto(dirs);
|
EINA_LIST_FOREACH(dirs, l, dir)
|
||||||
while ((dir = ecore_list_next(dirs)))
|
|
||||||
efreet_util_menus_find_helper(menus, dir);
|
efreet_util_menus_find_helper(menus, dir);
|
||||||
|
|
||||||
return menus;
|
return menus;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
efreet_util_menus_find_helper(Ecore_List *menus, const char *config_dir)
|
efreet_util_menus_find_helper(Eina_List *menus, const char *config_dir)
|
||||||
{
|
{
|
||||||
DIR *files = NULL;
|
DIR *files = NULL;
|
||||||
struct dirent *file = NULL;
|
struct dirent *file = NULL;
|
||||||
|
@ -1091,7 +1132,7 @@ efreet_util_menus_find_helper(Ecore_List *menus, const char *config_dir)
|
||||||
snprintf(fbuf, PATH_MAX, "%s/%s", dbuf, file->d_name);
|
snprintf(fbuf, PATH_MAX, "%s/%s", dbuf, file->d_name);
|
||||||
if (ecore_file_is_dir(fbuf)) continue;
|
if (ecore_file_is_dir(fbuf)) continue;
|
||||||
|
|
||||||
ecore_list_append(menus, strdup(fbuf));
|
menus = eina_list_append(menus, strdup(fbuf));
|
||||||
}
|
}
|
||||||
closedir(files);
|
closedir(files);
|
||||||
}
|
}
|
||||||
|
@ -1099,42 +1140,40 @@ efreet_util_menus_find_helper(Ecore_List *menus, const char *config_dir)
|
||||||
static void
|
static void
|
||||||
efreet_util_desktops_by_category_add(Efreet_Desktop *desktop)
|
efreet_util_desktops_by_category_add(Efreet_Desktop *desktop)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
const char *category;
|
const char *category;
|
||||||
|
|
||||||
if (!desktop->categories) return;
|
if (!desktop->categories) return;
|
||||||
|
|
||||||
ecore_list_first_goto(desktop->categories);
|
EINA_LIST_FOREACH(desktop->categories, l, category)
|
||||||
while ((category = ecore_list_next(desktop->categories)))
|
|
||||||
{
|
{
|
||||||
Ecore_List *list;
|
Eina_List *list;
|
||||||
list = eina_hash_find(desktops_by_category, category);
|
list = eina_hash_find(desktops_by_category, category);
|
||||||
if (!list)
|
if (!eina_list_data_find(list, desktop))
|
||||||
{
|
list = eina_list_append(list, desktop);
|
||||||
list = ecore_list_new();
|
eina_hash_modify(desktops_by_category, category, list);
|
||||||
eina_hash_add(desktops_by_category, category, list);
|
|
||||||
}
|
|
||||||
if (!ecore_list_goto(list, desktop))
|
|
||||||
ecore_list_append(list, desktop);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
efreet_util_desktops_by_category_remove(Efreet_Desktop *desktop)
|
efreet_util_desktops_by_category_remove(Efreet_Desktop *desktop)
|
||||||
{
|
{
|
||||||
|
Eina_List *l;
|
||||||
const char *category;
|
const char *category;
|
||||||
|
|
||||||
if (!desktop->categories) return;
|
if (!desktop->categories) return;
|
||||||
|
|
||||||
ecore_list_first_goto(desktop->categories);
|
EINA_LIST_FOREACH(desktop->categories, l, category)
|
||||||
while ((category = ecore_list_next(desktop->categories)))
|
|
||||||
{
|
{
|
||||||
Ecore_List *list;
|
Eina_List *list;
|
||||||
list = eina_hash_find(desktops_by_category, category);
|
list = eina_hash_find(desktops_by_category, category);
|
||||||
if (!list) continue;
|
if (!list) continue;
|
||||||
if (ecore_list_goto(list, desktop))
|
if (eina_list_data_find(list, desktop))
|
||||||
ecore_list_remove(list);
|
list = eina_list_remove(list, desktop);
|
||||||
if (ecore_list_empty_is(list))
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ EAPI int efreet_util_shutdown(void);
|
||||||
|
|
||||||
EAPI const char *efreet_util_path_to_file_id(const char *path);
|
EAPI const char *efreet_util_path_to_file_id(const char *path);
|
||||||
|
|
||||||
EAPI Ecore_List *efreet_util_desktop_mime_list(const char *mime);
|
EAPI Eina_List *efreet_util_desktop_mime_list(const char *mime);
|
||||||
|
|
||||||
EAPI Efreet_Desktop *efreet_util_desktop_wm_class_find(const char *wmname, const char *wmclass);
|
EAPI Efreet_Desktop *efreet_util_desktop_wm_class_find(const char *wmname, const char *wmclass);
|
||||||
EAPI Efreet_Desktop *efreet_util_desktop_file_id_find(const char *file_id);
|
EAPI Efreet_Desktop *efreet_util_desktop_file_id_find(const char *file_id);
|
||||||
|
@ -33,15 +33,15 @@ EAPI Efreet_Desktop *efreet_util_desktop_exec_find(const char *exec);
|
||||||
EAPI Efreet_Desktop *efreet_util_desktop_name_find(const char *name);
|
EAPI Efreet_Desktop *efreet_util_desktop_name_find(const char *name);
|
||||||
EAPI Efreet_Desktop *efreet_util_desktop_generic_name_find(const char *generic_name);
|
EAPI Efreet_Desktop *efreet_util_desktop_generic_name_find(const char *generic_name);
|
||||||
|
|
||||||
EAPI Ecore_List *efreet_util_desktop_name_glob_list(const char *glob);
|
EAPI Eina_List *efreet_util_desktop_name_glob_list(const char *glob);
|
||||||
EAPI Ecore_List *efreet_util_desktop_exec_glob_list(const char *glob);
|
EAPI Eina_List *efreet_util_desktop_exec_glob_list(const char *glob);
|
||||||
EAPI Ecore_List *efreet_util_desktop_generic_name_glob_list(const char *glob);
|
EAPI Eina_List *efreet_util_desktop_generic_name_glob_list(const char *glob);
|
||||||
EAPI Ecore_List *efreet_util_desktop_comment_glob_list(const char *glob);
|
EAPI Eina_List *efreet_util_desktop_comment_glob_list(const char *glob);
|
||||||
|
|
||||||
EAPI Ecore_List *efreet_util_desktop_categories_list(void);
|
EAPI Eina_List *efreet_util_desktop_categories_list(void);
|
||||||
EAPI Ecore_List *efreet_util_desktop_category_list(const char *category);
|
EAPI Eina_List *efreet_util_desktop_category_list(const char *category);
|
||||||
|
|
||||||
EAPI Ecore_List *efreet_util_menus_find(void);
|
EAPI Eina_List *efreet_util_menus_find(void);
|
||||||
|
|
||||||
EAPI extern int EFREET_EVENT_DESKTOP_LIST_CHANGE;
|
EAPI extern int EFREET_EVENT_DESKTOP_LIST_CHANGE;
|
||||||
EAPI extern int EFREET_EVENT_DESKTOP_CHANGE;
|
EAPI extern int EFREET_EVENT_DESKTOP_CHANGE;
|
||||||
|
|
Loading…
Reference in New Issue