Sebastian Dransfeld wrote:
Stephane Bauland wrote:
Hi there, i patch e_dbus core to use eina instead of ecore, i have to
do e_hal, e_nm,
and other stuff too, but i would like to know what you think about that.
Please don't touch nm as I'm doing a major cleanup.
Sebastian
Then, i finaly patch all ecore_list and ecore_hash from e_dbus. I follow
cedric's recommandations.
--
Stephane 'rookmoot' Bauland.
Index: bin/hal.c
===================================================================
--- bin/hal.c (revision 37423)
+++ bin/hal.c (working copy)
@@ -365,6 +365,7 @@
static void
cb_test_get_all_devices(void *user_data, void *reply_data, DBusError *error)
{
+ Eina_List *l = NULL;
E_Hal_Manager_Get_All_Devices_Return *ret = reply_data;
char *device;
@@ -377,16 +378,14 @@
return;
}
- ecore_list_first_goto(ret->strings);
- while ((device = ecore_list_next(ret->strings)))
- {
+ EINA_LIST_FOREACH(ret->strings, l, device)
printf("device: %s\n", device);
- }
}
static void
cb_test_find_device_by_capability_storage(void *user_data, void *reply_data, DBusError *error)
{
+ Eina_List *l = NULL;
E_Hal_Manager_Find_Device_By_Capability_Return *ret = reply_data;
char *device;
@@ -399,14 +398,14 @@
return;
}
- ecore_list_first_goto(ret->strings);
- while ((device = ecore_list_next(ret->strings)))
+ EINA_LIST_FOREACH(ret->strings, l, device)
storage_append(device);
}
static void
cb_test_find_device_by_capability_volume(void *user_data, void *reply_data, DBusError *error)
{
+ Eina_List *l = NULL;
E_Hal_Manager_Find_Device_By_Capability_Return *ret = reply_data;
char *device;
@@ -419,8 +418,7 @@
return;
}
- ecore_list_first_goto(ret->strings);
- while ((device = ecore_list_next(ret->strings)))
+ EINA_LIST_FOREACH(ret->strings, l, device)
volume_append(device);
}
Index: lib/dbus/e_dbus_signal.c
===================================================================
--- lib/dbus/e_dbus_signal.c (revision 37423)
+++ lib/dbus/e_dbus_signal.c (working copy)
@@ -27,7 +27,7 @@
* Free a signal handler
* @param sh the signal handler to free
*/
-static void
+void
e_dbus_signal_handler_free(E_DBus_Signal_Handler *sh)
{
free(sh->sender);
@@ -187,9 +187,7 @@
if (!conn->signal_handlers)
{
- conn->signal_handlers = ecore_list_new();
- ecore_list_free_cb_set
- (conn->signal_handlers, ECORE_FREE_CB(e_dbus_signal_handler_free));
+ conn->signal_handlers = NULL;
conn->signal_dispatcher = cb_signal_dispatcher;
}
@@ -207,8 +205,7 @@
data->sh = sh;
e_dbus_get_name_owner(conn, sender, cb_name_owner, data);
}
-
- ecore_list_append(conn->signal_handlers, sh);
+ conn->signal_handlers = eina_list_append(conn->signal_handlers, sh);
return sh;
}
@@ -252,42 +249,42 @@
dbus_bus_remove_match(conn->conn, match, NULL);
if (!conn->signal_handlers) return;
- if (!ecore_list_goto(conn->signal_handlers, sh)) return;
- ecore_list_remove(conn->signal_handlers);
+ conn->signal_handlers = eina_list_remove(conn->signal_handlers, sh);
e_dbus_signal_handler_free(sh);
}
static void
cb_signal_dispatcher(E_DBus_Connection *conn, DBusMessage *msg)
{
+ Eina_List *l = NULL;
E_DBus_Signal_Handler *sh;
- ecore_list_first_goto(conn->signal_handlers);
- while ((sh = ecore_list_next(conn->signal_handlers)))
- {
- if ((!sh->cb_signal) || (sh->delete_me)) continue;
-
- if (sh->sender && !dbus_message_has_sender(msg, sh->sender)) continue;
- if (sh->path && !dbus_message_has_path(msg, sh->path)) continue;
- if (sh->interface && !dbus_message_has_interface(msg, sh->interface)) continue;
- if (sh->member && !dbus_message_has_member(msg, sh->member)) continue;
-
- sh->cb_signal(sh->data, msg);
- }
+ EINA_LIST_FOREACH(conn->signal_handlers, l, sh)
+ {
+ if ((!sh->cb_signal) || (sh->delete_me)) continue;
+
+ if (sh->sender && !dbus_message_has_sender(msg, sh->sender)) continue;
+ if (sh->path && !dbus_message_has_path(msg, sh->path)) continue;
+ if (sh->interface && !dbus_message_has_interface(msg, sh->interface)) continue;
+ if (sh->member && !dbus_message_has_member(msg, sh->member)) continue;
+
+ sh->cb_signal(sh->data, msg);
+ }
}
void
e_dbus_signal_handlers_clean(E_DBus_Connection *conn)
{
+ Eina_List *l = NULL;
E_DBus_Signal_Handler *sh;
if (!e_dbus_handler_deletions) return;
if (!conn->signal_handlers) return;
- ecore_list_first_goto(conn->signal_handlers);
- while ((sh = ecore_list_next(conn->signal_handlers)))
- {
- if (sh->delete_me)
- e_dbus_signal_handler_del(conn, sh);
- }
+
+ EINA_LIST_FOREACH(conn->signal_handlers, l, sh)
+ {
+ if (sh->delete_me)
+ e_dbus_signal_handler_del(conn, sh);
+ }
e_dbus_handler_deletions = 0;
}
Index: lib/dbus/e_dbus_private.h
===================================================================
--- lib/dbus/e_dbus_private.h (revision 37423)
+++ lib/dbus/e_dbus_private.h (working copy)
@@ -13,9 +13,9 @@
DBusConnection *conn;
char *conn_name;
- Ecore_List *fd_handlers;
- Ecore_List *timeouts;
- Ecore_List *signal_handlers;
+ Eina_List *fd_handlers;
+ Eina_List *timeouts;
+ Eina_List *signal_handlers;
void (*signal_dispatcher)(E_DBus_Connection *conn, DBusMessage *msg);
Ecore_Idler *idler;
@@ -36,6 +36,7 @@
extern int e_dbus_idler_active;
void e_dbus_signal_handlers_clean(E_DBus_Connection *conn);
+void e_dbus_signal_handler_free(E_DBus_Signal_Handler *sh);
const char *e_dbus_basic_type_as_string(int type);
Index: lib/dbus/e_dbus.c
===================================================================
--- lib/dbus/e_dbus.c (revision 37423)
+++ lib/dbus/e_dbus.c (working copy)
@@ -8,7 +8,6 @@
#include <string.h>
#include <Ecore.h>
-#include <Ecore_Data.h>
#define NUM_BUS_TYPES 3
@@ -103,7 +102,7 @@
NULL,
NULL);
- ecore_list_append(hd->cd->fd_handlers, hd->fd_handler);
+ hd->cd->fd_handlers = eina_list_append(hd->cd->fd_handlers, hd->fd_handler);
}
@@ -115,8 +114,7 @@
DEBUG(5, "e_dbus_handler_data_free\n");
if (hd->fd_handler)
{
- if (ecore_list_goto(hd->cd->fd_handlers, hd->fd_handler))
- ecore_list_remove(hd->cd->fd_handlers);
+ hd->cd->fd_handlers = eina_list_remove(hd->cd->fd_handlers, hd->fd_handler);
ecore_main_fd_handler_del(hd->fd_handler);
}
free(hd);
@@ -158,8 +156,8 @@
DEBUG(1, "Not connected\n");
cd->shared_type = -1;
- cd->fd_handlers = ecore_list_new();
- cd->timeouts = ecore_list_new();
+ cd->fd_handlers = NULL;
+ cd->timeouts = NULL;
return cd;
}
@@ -172,21 +170,31 @@
Ecore_Timer *timer;
DEBUG(5, "e_dbus_connection free!\n");
- ecore_list_first_goto(cd->fd_handlers);
- while ((fd_handler = ecore_list_next(cd->fd_handlers)))
- ecore_main_fd_handler_del(fd_handler);
- ecore_list_destroy(cd->fd_handlers);
+ while (cd->fd_handlers)
+ {
+ ecore_main_fd_handler_del(eina_list_data_get(cd->fd_handlers));
+ cd->fd_handlers = eina_list_remove_list(cd->fd_handlers,
+ cd->fd_handlers);
+ }
- ecore_list_first_goto(cd->timeouts);
- while ((timer = ecore_list_next(cd->timeouts)))
- ecore_timer_del(timer);
- ecore_list_destroy(cd->timeouts);
+ while (cd->timeouts)
+ {
+ ecore_timer_del(eina_list_data_get(cd->timeouts));
+ cd->timeouts = eina_list_remove_list(cd->timeouts, cd->timeouts);
+ }
if (cd->shared_type != -1)
shared_connections[cd->shared_type] = NULL;
if (cd->signal_handlers)
- ecore_list_destroy(cd->signal_handlers);
+ {
+ while (cd->signal_handlers)
+ {
+ e_dbus_signal_handler_free(eina_list_data_get(cd->signal_handlers));
+ cd->signal_handlers = eina_list_remove_list(cd->signal_handlers,
+ cd->signal_handlers);
+ }
+ }
if (cd->conn_name) free(cd->conn_name);
@@ -278,23 +286,23 @@
td->timeout = timeout;
if (dbus_timeout_get_enabled(timeout)) td->handler = ecore_timer_add(td->interval, e_dbus_timeout_handler, td);
- ecore_list_append(td->cd->timeouts, td->handler);
-
+ td->cd->timeouts = eina_list_append(td->cd->timeouts, td->handler);
return true;
}
static void
cb_timeout_del(DBusTimeout *timeout, void *data)
{
+ Eina_List *l = NULL;
E_DBus_Timeout_Data *td;
+
DEBUG(5, "timeout del!\n");
td = (E_DBus_Timeout_Data *)dbus_timeout_get_data(timeout);
if (td->handler)
{
- if (ecore_list_goto(td->cd->timeouts, td->handler))
- ecore_list_remove(td->cd->timeouts);
+ td->cd->timeouts = eina_list_remove(td->cd->timeouts, td->handler);
ecore_timer_del(td->handler);
td->handler = NULL;
}
@@ -348,8 +356,7 @@
if (hd->fd_handler)
{
- if (ecore_list_goto(hd->cd->fd_handlers, hd->fd_handler))
- ecore_list_remove(hd->cd->fd_handlers);
+ hd->cd->fd_handlers = eina_list_remove(hd->cd->fd_handlers, hd->fd_handler);
ecore_main_fd_handler_del(hd->fd_handler);
hd->fd_handler = NULL;
}
Index: lib/dbus/e_dbus_object.c
===================================================================
--- lib/dbus/e_dbus_object.c (revision 37423)
+++ lib/dbus/e_dbus_object.c (working copy)
@@ -26,7 +26,7 @@
static void _introspect_arg_append(Ecore_Strbuf *buf, const char *type, const char *direction, int level);
-//static Ecore_List *standard_methods = NULL;
+//static Eina_List *standard_methods = NULL;
static DBusObjectPathVTable vtable = {
@@ -42,7 +42,7 @@
{
E_DBus_Connection *conn;
char *path;
- Ecore_List *interfaces;
+ Eina_List *interfaces;
char *introspection_data;
int introspection_dirty;
@@ -55,7 +55,7 @@
struct E_DBus_Interface
{
char *name;
- Ecore_List *methods;
+ Eina_List *methods;
int refcount;
};
@@ -219,8 +219,7 @@
e_dbus_connection_ref(conn);
obj->path = strdup(object_path);
obj->data = data;
- obj->interfaces = ecore_list_new();
- ecore_list_free_cb_set(obj->interfaces, (Ecore_Free_Cb)e_dbus_interface_unref);
+ obj->interfaces = NULL;
e_dbus_object_interface_attach(obj, introspectable_interface);
@@ -241,10 +240,19 @@
dbus_connection_unregister_object_path(obj->conn->conn, obj->path);
e_dbus_connection_close(obj->conn);
- if (obj->path) free(obj->path);
- ecore_list_destroy(obj->interfaces);
- if (obj->introspection_data) free(obj->introspection_data);
+ if (obj->path)
+ free(obj->path);
+ while (obj->interfaces)
+ {
+ e_dbus_interface_unref(eina_list_data_get(obj->interfaces));
+ obj->interfaces = eina_list_remove_list(obj->interfaces,
+ obj->interfaces);
+ }
+
+ if (obj->introspection_data)
+ free(obj->introspection_data);
+
free(obj);
}
@@ -284,7 +292,7 @@
e_dbus_object_interface_attach(E_DBus_Object *obj, E_DBus_Interface *iface)
{
e_dbus_interface_ref(iface);
- ecore_list_append(obj->interfaces, iface);
+ obj->interfaces = eina_list_append(obj->interfaces, iface);
obj->introspection_dirty = 1;
DEBUG(4, "e_dbus_object_interface_attach (%s, %s) ", obj->path, iface->name);
}
@@ -295,10 +303,8 @@
E_DBus_Interface *found;
DEBUG(4, "e_dbus_object_interface_detach (%s, %s) ", obj->path, iface->name);
- found = ecore_list_goto(obj->interfaces, iface);
- if (found == NULL) return;
- ecore_list_remove(obj->interfaces);
+ obj->interfaces = eina_list_remove(obj->interfaces, iface);
obj->introspection_dirty = 1;
e_dbus_interface_unref(iface);
}
@@ -321,8 +327,15 @@
static void
e_dbus_interface_free(E_DBus_Interface *iface)
{
- if (iface->name) free(iface->name);
- if (iface->methods) ecore_list_destroy(iface->methods);
+ if (iface->name)
+ free(iface->name);
+
+ while (iface->methods)
+ {
+ e_dbus_object_method_free(eina_list_data_get(iface->methods));
+ iface->methods = eina_list_remove_list(iface->methods,
+ iface->methods);
+ }
free(iface);
}
@@ -348,7 +361,7 @@
DEBUG(4, "Add method %s: %p\n", member, m);
if (!m) return 0;
- ecore_list_append(iface->methods, m);
+ iface->methods = eina_list_append(iface->methods, m);
return 1;
}
@@ -357,15 +370,15 @@
{
E_DBus_Interface *iface;
- if (!interface) return NULL;
+ if (!interface)
+ return NULL;
iface = calloc(1, sizeof(E_DBus_Interface));
if (!iface) return NULL;
iface->refcount = 1;
iface->name = strdup(interface);
- iface->methods = ecore_list_new();
- ecore_list_free_cb_set(iface->methods, (Ecore_Free_Cb)e_dbus_object_method_free);
+ iface->methods = NULL;
return iface;
}
@@ -406,21 +419,22 @@
static E_DBus_Method *
e_dbus_object_method_find(E_DBus_Object *obj, const char *interface, const char *member)
{
+ Eina_List *l = NULL, *l2 = NULL;
E_DBus_Method *m;
E_DBus_Interface *iface;
+
if (!obj || !member) return NULL;
- ecore_list_first_goto(obj->interfaces);
- while ((iface = ecore_list_next(obj->interfaces)))
- {
- if (strcmp(interface, iface->name)) continue;
- ecore_list_first_goto(iface->methods);
- while ((m = ecore_list_next(iface->methods)))
+ EINA_LIST_FOREACH(obj->interfaces, l, iface)
{
- if (!strcmp(member, m->member))
- return m;
+ if (strcmp(interface, iface->name))
+ continue;
+ EINA_LIST_FOREACH(iface->methods, l2, m)
+ {
+ if (!strcmp(member, m->member))
+ return m;
+ }
}
- }
return NULL;
}
@@ -462,6 +476,7 @@
Ecore_Strbuf *
e_dbus_object_introspect(E_DBus_Object *obj)
{
+ Eina_List *l = NULL;
Ecore_Strbuf *buf;
int level = 0;
E_DBus_Interface *iface;
@@ -476,8 +491,7 @@
ecore_strbuf_append(buf, "\">\n");
level++;
- ecore_list_first_goto(obj->interfaces);
- while ((iface = ecore_list_next(obj->interfaces)))
+ EINA_LIST_FOREACH(obj->interfaces, l, iface)
_introspect_interface_append(buf, iface, level);
ecore_strbuf_append(buf, "</node>\n");
@@ -495,7 +509,9 @@
static void
_introspect_interface_append(Ecore_Strbuf *buf, E_DBus_Interface *iface, int level)
{
+ Eina_List *l = NULL;
E_DBus_Method *method;
+
_introspect_indent_append(buf, level);
ecore_strbuf_append(buf, "<interface name=\"");
ecore_strbuf_append(buf, iface->name);
@@ -503,8 +519,8 @@
level++;
DEBUG(4, "introspect iface: %s\n", iface->name);
- ecore_list_first_goto(iface->methods);
- while ((method = ecore_list_next(iface->methods)))
+
+ EINA_LIST_FOREACH(iface->methods, l, method)
_introspect_method_append(buf, method, level);
level--;
Index: lib/hal/e_hal_manager.c
===================================================================
--- lib/hal/e_hal_manager.c (revision 37423)
+++ lib/hal/e_hal_manager.c (working copy)
@@ -22,15 +22,8 @@
dbus_set_error(err, DBUS_ERROR_NO_MEMORY, "");
return NULL;
}
+ ret->strings = NULL;
- ret->strings = ecore_list_new();
- if (!ret->strings)
- {
- dbus_set_error(err, DBUS_ERROR_NO_MEMORY, "");
- free(ret);
- return NULL;
- }
-
dbus_message_iter_init(msg, &iter);
dbus_message_iter_recurse(&iter, &sub);
while (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID)
@@ -38,7 +31,8 @@
char *dev = NULL;
dbus_message_iter_get_basic(&sub, &dev);
- if (dev) ecore_list_append(ret->strings, dev);
+ if (dev)
+ ret->strings = eina_list_append(ret->strings, dev);
dbus_message_iter_next(&sub);
}
@@ -51,7 +45,8 @@
E_Hal_String_List_Return *ret = data;
if (!ret) return;
- ecore_list_destroy(ret->strings);
+ while (ret->strings)
+ ret->strings = eina_list_free(ret->strings);
free(ret);
}
Index: lib/hal/e_hal_util.c
===================================================================
--- lib/hal/e_hal_util.c (revision 37423)
+++ lib/hal/e_hal_util.c (working copy)
@@ -10,7 +10,10 @@
e_hal_property_free(E_Hal_Property *prop)
{
if (prop->type == E_HAL_PROPERTY_TYPE_STRLIST)
- ecore_list_destroy(prop->val.strlist);
+ {
+ while (prop->val.strlist)
+ prop->val.strlist = eina_list_free(prop->val.strlist);
+ }
free(prop);
}
@@ -26,7 +29,7 @@
E_Hal_Property *prop;
if (err) *err = 0;
if (!properties->properties) return NULL;
- prop = ecore_hash_get(properties->properties, key);
+ prop = eina_hash_find(properties->properties, key);
if (prop) return strdup(prop->val.s);
if (err) *err = 1;
@@ -39,7 +42,7 @@
E_Hal_Property *prop;
if (err) *err = 0;
if (!properties->properties) return 0;
- prop = ecore_hash_get(properties->properties, key);
+ prop = eina_hash_find(properties->properties, key);
if (prop) return prop->val.b;
if (err) *err = 1;
@@ -52,7 +55,7 @@
E_Hal_Property *prop;
if (err) *err = 0;
if (!properties->properties) return 0;
- prop = ecore_hash_get(properties->properties, key);
+ prop = eina_hash_find(properties->properties, key);
if (prop) return prop->val.i;
if (err) *err = 1;
@@ -65,7 +68,7 @@
E_Hal_Property *prop;
if (err) *err = 0;
if (!properties->properties) return 0;
- prop = ecore_hash_get(properties->properties, key);
+ prop = eina_hash_find(properties->properties, key);
if (prop) return prop->val.u64;
if (err) *err = 1;
@@ -78,20 +81,20 @@
E_Hal_Property *prop;
if (err) *err = 0;
if (!properties->properties) return 0;
- prop = ecore_hash_get(properties->properties, key);
+ prop = eina_hash_find(properties->properties, key);
if (prop) return prop->val.d;
if (err) *err = 1;
return 0;
}
-EAPI Ecore_List *
+EAPI Eina_List *
e_hal_property_strlist_get(E_Hal_Properties *properties, const char *key, int *err)
{
E_Hal_Property *prop;
if (err) *err = 0;
if (!properties->properties) return NULL;
- prop = ecore_hash_get(properties->properties, key);
+ prop = eina_hash_find(properties->properties, key);
if (prop) return prop->val.strlist;
if (err) *err = 1;
Index: lib/hal/e_hal_device.c
===================================================================
--- lib/hal/e_hal_device.c (revision 37423)
+++ lib/hal/e_hal_device.c (working copy)
@@ -88,9 +88,10 @@
return NULL;
}
- ret->properties = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- ecore_hash_free_key_cb_set(ret->properties, ECORE_FREE_CB(eina_stringshare_del));
- ecore_hash_free_value_cb_set(ret->properties, ECORE_FREE_CB(e_hal_property_free));
+ ret->properties = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
+ // ret->properties = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ //ecore_hash_free_key_cb_set(ret->properties, ECORE_FREE_CB(eina_stringshare_del));
+ //ecore_hash_free_value_cb_set(ret->properties, ECORE_FREE_CB(e_hal_property_free));
dbus_message_iter_init(msg, &iter);
@@ -130,13 +131,13 @@
prop->type = E_HAL_PROPERTY_TYPE_STRLIST;
{
DBusMessageIter list_iter;
- prop->val.strlist = ecore_list_new();
+ prop->val.strlist = NULL;
dbus_message_iter_recurse(&v_iter, &list_iter);
while (dbus_message_iter_get_arg_type(&list_iter) != DBUS_TYPE_INVALID)
{
char *str;
dbus_message_iter_get_basic(&list_iter, &str);
- ecore_list_append(prop->val.strlist, str);
+ prop->val.strlist = eina_list_append(prop->val.strlist, str);
dbus_message_iter_next(&list_iter);
}
}
@@ -145,7 +146,7 @@
printf("Error: unexpected property type (%s): %c\n", name, dbus_message_iter_get_arg_type(&v_iter));
break;
}
- ecore_hash_set(ret->properties, (void *)eina_stringshare_add(name), prop);
+ eina_hash_add(ret->properties, (void *)eina_stringshare_add(name), prop);
dbus_message_iter_next(&a_iter);
}
@@ -159,7 +160,7 @@
E_Hal_Device_Get_All_Properties_Return *ret = data;
if (!ret) return;
- ecore_hash_destroy(ret->properties);
+ eina_hash_free(ret->properties);
free(ret);
}
@@ -243,9 +244,10 @@
* @param data custom data pointer for the callback function
*/
EAPI int
-e_hal_device_volume_mount(E_DBus_Connection *conn, const char *udi, const char *mount_point, const char *fstype, Ecore_List *options, E_DBus_Callback_Func cb_func, void *data)
+e_hal_device_volume_mount(E_DBus_Connection *conn, const char *udi, const char *mount_point, const char *fstype, Eina_List *options, E_DBus_Callback_Func cb_func, void *data)
{
DBusMessage *msg;
+ Eina_List *l = NULL;
DBusMessageIter iter, subiter;
int ret;
@@ -259,11 +261,8 @@
if (options)
{
const char *opt;
- ecore_list_first_goto(options);
- while ((opt = ecore_list_next(options)))
- {
+ EINA_LIST_FOREACH(options, l, opt)
dbus_message_iter_append_basic(&subiter, DBUS_TYPE_STRING, &opt);
- }
}
dbus_message_iter_close_container(&iter, &subiter) ;
@@ -284,9 +283,10 @@
* @param data cuatom data pointer for the callback function
*/
EAPI int
-e_hal_device_volume_unmount(E_DBus_Connection *conn, const char *udi, Ecore_List *options, E_DBus_Callback_Func cb_func, void *data)
+e_hal_device_volume_unmount(E_DBus_Connection *conn, const char *udi, Eina_List *options, E_DBus_Callback_Func cb_func, void *data)
{
DBusMessage *msg;
+ Eina_List *l = NULL;
DBusMessageIter iter, subiter;
int ret;
@@ -297,11 +297,8 @@
if (options)
{
const char *opt;
- ecore_list_first_goto(options);
- while ((opt = ecore_list_next(options)))
- {
+ EINA_LIST_FOREACH(options, l, opt)
dbus_message_iter_append_basic(&subiter, DBUS_TYPE_STRING, &opt);
- }
}
dbus_message_iter_close_container(&iter, &subiter) ;
@@ -320,9 +317,10 @@
* @param data cuatom data pointer for the callback function
*/
EAPI int
-e_hal_device_volume_eject(E_DBus_Connection *conn, const char *udi, Ecore_List *options, E_DBus_Callback_Func cb_func, void *data)
+e_hal_device_volume_eject(E_DBus_Connection *conn, const char *udi, Eina_List *options, E_DBus_Callback_Func cb_func, void *data)
{
DBusMessage *msg;
+ Eina_List *l = NULL;
DBusMessageIter iter, subiter;
int ret;
@@ -333,11 +331,8 @@
if (options)
{
const char *opt;
- ecore_list_first_goto(options);
- while ((opt = ecore_list_next(options)))
- {
+ EINA_LIST_FOREACH(options, l, opt)
dbus_message_iter_append_basic(&subiter, DBUS_TYPE_STRING, &opt);
- }
}
dbus_message_iter_close_container(&iter, &subiter) ;
Index: lib/hal/e_hal_util.h
===================================================================
--- lib/hal/e_hal_util.h (revision 37423)
+++ lib/hal/e_hal_util.h (working copy)
@@ -9,6 +9,6 @@
int e_hal_property_int_get(E_Hal_Properties *properties, const char *key, int *err);
dbus_uint64_t e_hal_property_uint64_get(E_Hal_Properties *properties, const char *key, int *err);
double e_hal_property_double_get(E_Hal_Properties *properties, const char *key, int *err);
-Ecore_List *e_hal_property_strlist_get(E_Hal_Properties *properties, const char *key, int *err);
+Eina_List *e_hal_property_strlist_get(E_Hal_Properties *properties, const char *key, int *err);
#endif
Index: lib/hal/E_Hal.h
===================================================================
--- lib/hal/E_Hal.h (revision 37423)
+++ lib/hal/E_Hal.h (working copy)
@@ -38,7 +38,7 @@
struct E_Hal_String_List_Return
{
- Ecore_List *strings; /* list of const char * */
+ Eina_List *strings; /* list of const char * */
};
struct E_Hal_Bool_Return
@@ -77,13 +77,13 @@
dbus_bool_t b;
double d;
dbus_uint64_t u64;
- Ecore_List *strlist;
+ Eina_List *strlist;
} val;
};
struct E_Hal_Properties
{
- Ecore_Hash *properties;
+ Eina_Hash *properties;
};
typedef struct E_Hal_Properties E_Hal_Device_Get_All_Properties_Return;
@@ -122,12 +122,12 @@
EAPI int e_hal_property_int_get(E_Hal_Properties *properties, const char *key, int *err);
EAPI dbus_uint64_t e_hal_property_uint64_get(E_Hal_Properties *properties, const char *key, int *err);
EAPI double e_hal_property_double_get(E_Hal_Properties *properties, const char *key, int *err);
- EAPI Ecore_List *e_hal_property_strlist_get(E_Hal_Properties *properties, const char *key, int *err);
+ EAPI Eina_List *e_hal_property_strlist_get(E_Hal_Properties *properties, const char *key, int *err);
/* (un)mount */
- EAPI int e_hal_device_volume_mount(E_DBus_Connection *conn, const char *udi, const char *mount_point, const char *fstype, Ecore_List *options, E_DBus_Callback_Func cb_func, void *data);
- EAPI int e_hal_device_volume_unmount(E_DBus_Connection *conn, const char *udi, Ecore_List *options, E_DBus_Callback_Func cb_func, void *data);
- EAPI int e_hal_device_volume_eject(E_DBus_Connection *conn, const char *udi, Ecore_List *options, E_DBus_Callback_Func cb_func, void *data);
+ EAPI int e_hal_device_volume_mount(E_DBus_Connection *conn, const char *udi, const char *mount_point, const char *fstype, Eina_List *options, E_DBus_Callback_Func cb_func, void *data);
+ EAPI int e_hal_device_volume_unmount(E_DBus_Connection *conn, const char *udi, Eina_List *options, E_DBus_Callback_Func cb_func, void *data);
+ EAPI int e_hal_device_volume_eject(E_DBus_Connection *conn, const char *udi, Eina_List *options, E_DBus_Callback_Func cb_func, void *data);
#ifdef __cplusplus
}
Index: lib/notification/E_Notify.h
===================================================================
--- lib/notification/E_Notify.h (revision 37423)
+++ lib/notification/E_Notify.h (working copy)
@@ -83,7 +83,7 @@
struct E_Notification_Return_Get_Capabilities
{
- Ecore_List *capabilities;
+ Eina_List *capabilities;
};
struct E_Notification_Return_Get_Server_Information
@@ -155,7 +155,7 @@
/* actions */
EAPI void e_notification_action_add(E_Notification *n, const char *action_id, const char *action_name);
- EAPI Ecore_List *e_notification_actions_get(E_Notification *n);
+ EAPI Eina_List *e_notification_actions_get(E_Notification *n);
/* hint mutators */
EAPI void e_notification_hint_urgency_set(E_Notification *n, char urgency);
Index: lib/notification/notification.c
===================================================================
--- lib/notification/notification.c (revision 37423)
+++ lib/notification/notification.c (working copy)
@@ -7,7 +7,6 @@
#include "e_notify_private.h"
/* private functions */
-static Ecore_List * e_notification_action_list_new();
static E_Notification_Action *e_notification_action_new(const char *id, const char *name);
static void e_notification_action_free(E_Notification_Action *act);
@@ -39,6 +38,7 @@
n = calloc(1, sizeof(E_Notification));
if (!n) return NULL;
n->refcount = 1;
+ n->actions = NULL;
return n;
}
@@ -58,6 +58,8 @@
EAPI void
e_notification_free(E_Notification *n)
{
+ Eina_List *l;
+
if (!n) return;
if (n->app_name) free(n->app_name);
@@ -65,7 +67,16 @@
if (n->summary) free(n->summary);
if (n->body) free(n->body);
- if (n->actions) ecore_list_destroy(n->actions);
+ if (n->actions)
+ {
+ l = n->actions;
+ while (l)
+ {
+ e_notification_action_free(eina_list_data_get(l));
+ l = eina_list_remove_list(l, l);
+ }
+ n->actions = eina_list_free(n->actions);
+ }
if (n->hints.category) free(n->hints.category);
if (n->hints.desktop) free(n->hints.desktop);
@@ -115,11 +126,8 @@
{
E_Notification_Action *a;
- if (!n->actions)
- n->actions = e_notification_action_list_new();
-
a = e_notification_action_new(action_id, action_name);
- ecore_list_append(n->actions, a);
+ n->actions = eina_list_append(n->actions, a);
}
@@ -173,7 +181,7 @@
return note->body;
}
-EAPI Ecore_List *
+EAPI Eina_List *
e_notification_actions_get(E_Notification *note)
{
return note->actions;
@@ -199,15 +207,6 @@
/***** actions *****/
-static Ecore_List *
-e_notification_action_list_new()
-{
- Ecore_List *alist;
- alist = ecore_list_new();
- ecore_list_free_cb_set(alist, (Ecore_Free_Cb)e_notification_action_free);
- return alist;
-}
-
static E_Notification_Action *
e_notification_action_new(const char *id, const char *name)
{
Index: lib/notification/marshal.c
===================================================================
--- lib/notification/marshal.c (revision 37423)
+++ lib/notification/marshal.c (working copy)
@@ -74,24 +74,24 @@
}
void
-e_notify_marshal_string_list_as_array(DBusMessageIter *iter, Ecore_List *strings)
+e_notify_marshal_string_list_as_array(DBusMessageIter *iter, Eina_List *strings)
{
const char *str;
DBusMessageIter arr;
+ Eina_List *l = NULL;
dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "s", &arr);
- ecore_list_first_goto(strings);
- while((str = ecore_list_next(strings)))
+ EINA_LIST_FOREACH(strings, l, str)
dbus_message_iter_append_basic(&arr, DBUS_TYPE_STRING, &str);
dbus_message_iter_close_container(iter, &arr);
}
-Ecore_List *
+Eina_List *
e_notify_unmarshal_string_array_as_list(DBusMessageIter *iter, DBusError *err)
{
- Ecore_List *strings;
+ Eina_List *strings;
char *sig;
int ret;
DBusMessageIter arr;
@@ -101,15 +101,14 @@
dbus_free(sig);
if (!ret) return NULL;
- strings = ecore_list_new();
- ecore_list_free_cb_set(strings, ECORE_FREE_CB(free)); //XXX use eina_stringshare_release?
+ strings = NULL;
dbus_message_iter_recurse(iter, &arr);
while(dbus_message_iter_has_next(&arr))
{
const char *str;
dbus_message_iter_get_basic(&arr, &str);
- ecore_list_append(strings, strdup(str)); //XXX use eina_stringshare_instance?
+ strings = eina_list_append(strings, eina_stringshare_add(str));
dbus_message_iter_next(&arr);
}
return strings;
@@ -160,7 +159,12 @@
E_Notification_Return_Get_Capabilities *ret = data;
if (!ret) return;
- ecore_list_destroy(ret->capabilities);
+ while (ret->capabilities)
+ {
+ evas_stringshare_del(eina_list_data_get(ret->capabilities));
+ ret->capabilities = eina_list_remove_list(ret->capabilities,
+ ret->capabilities);
+ }
free(ret);
}
@@ -296,6 +300,7 @@
DBusMessage *
e_notify_marshal_notify(E_Notification *n)
{
+ Eina_List *l = NULL;
DBusMessage *msg;
DBusMessageIter iter, sub;
@@ -319,12 +324,11 @@
if (n->actions)
{
E_Notification_Action *action;
- ecore_list_first_goto(n->actions);
- while ((action = ecore_list_next(n->actions)))
- {
- dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &(action->id));
- dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &(action->name));
- }
+ EINA_LIST_FOREACH(n->actions, l, action)
+ {
+ dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &(action->id));
+ dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &(action->name));
+ }
}
dbus_message_iter_close_container(&iter, &sub);
@@ -430,7 +434,7 @@
E_Notification_Return_Notify *ret = data;
if (!ret) return;
- free(ret);
+ // free(ret);
}
void
Index: lib/notification/e_notify_private.h
===================================================================
--- lib/notification/e_notify_private.h (revision 37423)
+++ lib/notification/e_notify_private.h (working copy)
@@ -16,8 +16,8 @@
void e_notify_marshal_dict_int(DBusMessageIter *iter, const char *key, int value);
void e_notify_marshal_string_array(DBusMessageIter *iter, const char **strings);
-void e_notify_marshal_string_list_as_array(DBusMessageIter *iter, Ecore_List *strings);
-Ecore_List * e_notify_unmarshal_string_array_as_list(DBusMessageIter *iter, DBusError *err);
+void e_notify_marshal_string_list_as_array(DBusMessageIter *iter, Eina_List *strings);
+Eina_List * e_notify_unmarshal_string_array_as_list(DBusMessageIter *iter, DBusError *err);
DBusMessage * e_notify_marshal_get_capabilities();
DBusMessage * e_notify_marshal_get_capabilities_return(DBusMessage *method_call, const char **capabilities);
void * e_notify_unmarshal_get_capabilities_return(DBusMessage *msg, DBusError *err);
@@ -63,7 +63,7 @@
char *body;
int expire_timeout;
- Ecore_List *actions;
+ Eina_List *actions;
struct
{
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel