#include "E_Hal.h"
#include <config.h>
-#include "e_dbus_private.h"
#if EWL_GUI
#include <Ewl.h>
{
Volume *v;
Eina_List *l;
- E_DBUS_LOG_INFO("storage_free: %s", storage->udi);
+ EINA_LOG_INFO("storage_free: %s", storage->udi);
/* disconnect storage from volume */
EINA_LIST_FOREACH(storage->volumes, l, v)
{
Volume *v;
if (!udi) return NULL;
- E_DBUS_LOG_INFO("ADDING %s", udi);
+ EINA_LOG_INFO("ADDING %s", udi);
v = volume_new();
v->udi = strdup(udi);
volumes = eina_list_append(volumes, v);
EINA_LIST_FOREACH(ret->strings, l, device)
{
- E_DBUS_LOG_INFO("device: %s", device);
+ EINA_LOG_INFO("device: %s", device);
}
}
dbus_error_init(&err);
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
udi = strdup(udi);
- E_DBUS_LOG_INFO("Ehal: Device added: %s", udi);
+ EINA_LOG_INFO("Ehal: Device added: %s", udi);
ret = e_hal_device_query_capability(conn, udi, "storage", cb_is_storage, strdup(udi));
e_hal_device_query_capability(conn, udi, "volume", cb_is_volume, strdup(udi));
}
dbus_error_init(&err);
dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
- E_DBUS_LOG_INFO("Removed: %s", udi);
+ EINA_LOG_INFO("Removed: %s", udi);
storage_remove(udi);
volume_remove(udi);
}
{
Volume *vol = user_data;
vol->mounted = 0;
- E_DBUS_LOG_INFO("Volume unmounted reply: %s", vol->udi);
+ EINA_LOG_INFO("Volume unmounted reply: %s", vol->udi);
}
static void
{
Volume *vol = user_data;
vol->mounted = 1;
- E_DBUS_LOG_INFO("Volume mounted reply: %s", vol->udi);
+ EINA_LOG_INFO("Volume mounted reply: %s", vol->udi);
}
static void
Device *dev = data;
char buf[4096];
- E_DBUS_LOG_INFO("Device clicked: %s", dev->udi);
+ EINA_LOG_INFO("Device clicked: %s", dev->udi);
if (dev->type == DEVICE_TYPE_VOLUME)
{
Volume *vol = (Volume *)dev;
mount_point = buf;
}
- E_DBUS_LOG_INFO("Attempting to mount %s to %s", vol->udi, mount_point);
+ EINA_LOG_INFO("Attempting to mount %s to %s", vol->udi, mount_point);
e_hal_device_volume_mount(conn, vol->udi, mount_point, vol->fstype, NULL, cb_volume_mounted, vol);
}
}
}
else
{
- fprintf(stderr, "Invalid device type.");
- buf[0] = 0;
+ EINA_LOG_ERR("Invalid device type.");
+ buf[0] = 0;
}
ewl_icon_label_set(icon, buf);
ecore_init();
eina_init();
e_dbus_init();
+ e_hal_init();
#if EWL_GUI
efreet_init();
if (!ewl_init(&argc, argv))
{
- E_DBUS_LOG_INFO(stderr, "Unable to init EWL.");
+ EINA_LOG_INFO("Unable to init EWL.");
return 1;
}
#endif
conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
if (!conn)
{
- E_DBUS_LOG_INFO(stderr, "Error connecting to system bus. Is it running?");
+ EINA_LOG_INFO("Error connecting to system bus. Is it running?");
return 1;
}
}
e_dbus_connection_close(conn);
e_dbus_shutdown();
+ e_hal_shutdown();
eina_shutdown();
ecore_shutdown();
return 1;
* listen for NameOwnerChanged signals for names we have SignalHandler's for
* remap SH to listen for signals from new owner
*/
-int _E_DBUS_LOG_DOM_GLOBAL = -1;
+int _e_dbus_log_dom = -1;
static int connection_slot = -1;
static int init = 0;
E_DBus_Handler_Data *hd;
unsigned int condition = 0;
- E_DBUS_LOG_DBG("fd handler (%ld)!", (long int)fd_handler);
+ DBG("fd handler (%ld)!", (long int)fd_handler);
hd = data;
if (!hd->enabled) {
- E_DBUS_LOG_DBG("handler disabled");
+ DBG("handler disabled");
if (hd->fd_handler) ecore_main_fd_handler_del(hd->fd_handler);
hd->fd_handler = NULL;
return 0;
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE)) condition |= DBUS_WATCH_WRITABLE;
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR)) condition |= DBUS_WATCH_ERROR;
- if (condition & DBUS_WATCH_ERROR) E_DBUS_LOG_DBG("DBUS watch error");
+ if (condition & DBUS_WATCH_ERROR) DBG("DBUS watch error");
dbus_watch_handle(hd->watch, condition);
hd = NULL;
Ecore_Fd_Handler_Flags eflags;
if (hd->fd_handler) return;
- E_DBUS_LOG_DBG("fd handler add (%d)", hd->fd);
+ DBG("fd handler add (%d)", hd->fd);
dflags = dbus_watch_get_flags(hd->watch);
eflags = ECORE_FD_ERROR;
{
E_DBus_Handler_Data *hd = data;
- E_DBUS_LOG_DBG("e_dbus_handler_data_free");
+ DBG("e_dbus_handler_data_free");
if (hd->fd_handler)
{
hd->cd->fd_handlers = eina_list_remove(hd->cd->fd_handlers, hd->cd->fd_handlers);
#else
hd->fd = dbus_watch_get_fd(hd->watch);
#endif
- E_DBUS_LOG_DBG("watch add (enabled: %d)", hd->enabled);
+ DBG("watch add (enabled: %d)", hd->enabled);
if (hd->enabled) e_dbus_fd_handler_add(hd);
}
conn_name = dbus_bus_get_unique_name(conn);
if (conn_name)
{
- E_DBUS_LOG_DBG("Connected! Name: %s", conn_name);
+ DBG("Connected! Name: %s", conn_name);
cd->conn_name = strdup(conn_name);
}
else
- E_DBUS_LOG_DBG("Not connected");
+ DBG("Not connected");
cd->shared_type = -1;
cd->fd_handlers = NULL;
E_DBus_Connection *cd = data;
Ecore_Fd_Handler *fd_handler;
Ecore_Timer *timer;
- E_DBUS_LOG_DBG("e_dbus_connection free!");
+ DBG("e_dbus_connection free!");
EINA_LIST_FREE(cd->fd_handlers, fd_handler)
ecore_main_fd_handler_del(fd_handler);
cb_main_wakeup(void *data)
{
E_DBus_Connection *cd;
- E_DBUS_LOG_DBG("wakeup main!");
+ DBG("wakeup main!");
cd = data;
if (!cd->idler) cd->idler = ecore_idler_add(e_dbus_idler, cd);
- else E_DBUS_LOG_DBG("already idling");
+ else DBG("already idling");
}
static void
{
E_DBus_Connection *cd;
- E_DBUS_LOG_DBG("dispatch status: %d!", new_status);
+ DBG("dispatch status: %d!", new_status);
cd = data;
if (new_status == DBUS_DISPATCH_DATA_REMAINS && !cd->idler) cd->idler = ecore_idler_add(e_dbus_idler, cd);
if (dbus_timeout_get_enabled(td->timeout))
{
- E_DBUS_LOG_DBG("timeout_handler (not enabled, ending)");
+ DBG("timeout_handler (not enabled, ending)");
td->handler = NULL;
return 0;
}
- E_DBUS_LOG_DBG("timeout handler!");
+ DBG("timeout handler!");
dbus_timeout_handle(td->timeout);
return 1;
}
e_dbus_timeout_data_free(void *timeout_data)
{
E_DBus_Timeout_Data *td = timeout_data;
- E_DBUS_LOG_DBG("e_dbus_timeout_data_free");
+ DBG("e_dbus_timeout_data_free");
if (td->handler) ecore_timer_del(td->handler);
free(td);
}
E_DBus_Timeout_Data *td;
cd = data;
- E_DBUS_LOG_DBG("timeout add!");
+ DBG("timeout add!");
td = calloc(1, sizeof(E_DBus_Timeout_Data));
td->cd = cd;
dbus_timeout_set_data(timeout, (void *)td, e_dbus_timeout_data_free);
cb_timeout_del(DBusTimeout *timeout, void *data)
{
E_DBus_Timeout_Data *td;
- E_DBUS_LOG_DBG("timeout del!");
+ DBG("timeout del!");
td = (E_DBus_Timeout_Data *)dbus_timeout_get_data(timeout);
cb_timeout_toggle(DBusTimeout *timeout, void *data)
{
E_DBus_Timeout_Data *td;
- E_DBUS_LOG_DBG("timeout toggle!");
+ DBG("timeout toggle!");
td = (E_DBus_Timeout_Data *)dbus_timeout_get_data(timeout);
E_DBus_Connection *cd;
cd = data;
- E_DBUS_LOG_DBG("cb_watch_add");
+ DBG("cb_watch_add");
e_dbus_connection_data_watch_add(cd, watch);
return true;
{
E_DBus_Handler_Data *hd;
- E_DBUS_LOG_DBG("cb_watch_del");
+ DBG("cb_watch_del");
hd = (E_DBus_Handler_Data *)dbus_watch_get_data(watch);
if (hd->fd_handler)
{
E_DBus_Handler_Data *hd;
- E_DBUS_LOG_DBG("cb_watch_toggle");
+ DBG("cb_watch_toggle");
hd = dbus_watch_get_data(watch);
if (!hd) return;
e_dbus_filter(DBusConnection *conn, DBusMessage *message, void *user_data)
{
E_DBus_Connection *cd = user_data;
- E_DBUS_LOG_DBG("-----------------");
- E_DBUS_LOG_DBG("Message!");
+ DBG("-----------------");
+ DBG("Message!");
- E_DBUS_LOG_DBG("type: %s", dbus_message_type_to_string(dbus_message_get_type(message)));
- E_DBUS_LOG_DBG("path: %s", dbus_message_get_path(message));
- E_DBUS_LOG_DBG("interface: %s", dbus_message_get_interface(message));
- E_DBUS_LOG_DBG("member: %s", dbus_message_get_member(message));
- E_DBUS_LOG_DBG("sender: %s", dbus_message_get_sender(message));
+ DBG("type: %s", dbus_message_type_to_string(dbus_message_get_type(message)));
+ DBG("path: %s", dbus_message_get_path(message));
+ DBG("interface: %s", dbus_message_get_interface(message));
+ DBG("member: %s", dbus_message_get_member(message));
+ DBG("sender: %s", dbus_message_get_sender(message));
switch (dbus_message_get_type(message))
{
case DBUS_MESSAGE_TYPE_METHOD_CALL:
- E_DBUS_LOG_DBG("signature: %s", dbus_message_get_signature(message));
+ DBG("signature: %s", dbus_message_get_signature(message));
break;
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
- E_DBUS_LOG_DBG("reply serial %d", dbus_message_get_reply_serial(message));
+ DBG("reply serial %d", dbus_message_get_reply_serial(message));
break;
case DBUS_MESSAGE_TYPE_ERROR:
- E_DBUS_LOG_DBG("error: %s", dbus_message_get_error_name(message));
+ DBG("error: %s", dbus_message_get_error_name(message));
break;
case DBUS_MESSAGE_TYPE_SIGNAL:
dbus_message_ref(message);
default:
break;
}
- E_DBUS_LOG_DBG("-----------------");
+ DBG("-----------------");
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
if (DBUS_DISPATCH_COMPLETE == dbus_connection_get_dispatch_status(cd->conn))
{
- E_DBUS_LOG_DBG("done dispatching!");
+ DBG("done dispatching!");
cd->idler = NULL;
return 0;
}
e_dbus_idler_active++;
dbus_connection_ref(cd->conn);
- E_DBUS_LOG_DBG("dispatch!");
+ DBG("dispatch!");
dbus_connection_dispatch(cd->conn);
dbus_connection_unref(cd->conn);
e_dbus_idler_active--;
conn = dbus_bus_get_private(type, &err);
if (dbus_error_is_set(&err))
{
- E_DBUS_LOG_ERR("Error connecting to bus: %s", err.message);
+ ERR("Error connecting to bus: %s", err.message);
dbus_error_free(&err);
return NULL;
}
econn = e_dbus_connection_setup(conn);
if (!econn)
{
- E_DBUS_LOG_ERR("Error setting up dbus connection.");
+ ERR("Error setting up dbus connection.");
dbus_connection_close(conn);
dbus_connection_unref(conn);
return NULL;
EAPI void
e_dbus_connection_close(E_DBus_Connection *conn)
{
- E_DBUS_LOG_DBG("e_dbus_connection_close");
+ DBG("e_dbus_connection_close");
if (e_dbus_idler_active)
{
fprintf(stderr,"E-dbus: Enable to initialize the eina module");
return -1;
}
-
- _E_DBUS_LOG_DOM_GLOBAL = eina_log_domain_register("e_dbus",E_DBUS_COLOR_DEFAULT);
- if(_E_DBUS_LOG_DOM_GLOBAL < 0)
+ _e_dbus_log_dom = eina_log_domain_register("e_dbus",E_DBUS_COLOR_DEFAULT);
+ if(_e_dbus_log_dom < 0)
{
- EINA_LOG_ERR("E-dbus: Enable to create a log domain\n");
+ EINA_LOG_ERR("Enable to create a 'e_dbus' log domain");
eina_shutdown();
return -1;
}
{
if (--init) return init;
e_dbus_object_shutdown();
- eina_log_domain_unregister(_E_DBUS_LOG_DOM_GLOBAL);
+ eina_log_domain_unregister(_e_dbus_log_dom);
+ _e_dbus_log_dom = -1;
eina_shutdown();
return init;
}
(destination, path, "org.freedesktop.DBus.Peer", method_name);
if (!msg)
{
- E_DBUS_LOG_ERR("E-dbus Error: failed to create message for method call: %s() at "
+ ERR("E-dbus Error: failed to create message for method call: %s() at "
"\"%s\" at \"%s\"",
method_name, destination, path);
return NULL;
dbus_message_unref(msg);
if (!ret)
- E_DBUS_LOG_ERR("E-dbus Error: could not %s() \"%s\" at \"%s\".",
+ ERR("E-dbus Error: could not %s() \"%s\" at \"%s\".",
method_name, destination, path);
return ret;
if (!conn)
{
- E_DBUS_LOG_ERR("E-dbus Error: no connection for call of %s", method_name);
+ ERR("E-dbus Error: no connection for call of %s", method_name);
return NULL;
}
(destination, path, "org.freedesktop.DBus.Properties", method_name);
if (!msg)
{
- E_DBUS_LOG_ERR("E-dbus Error: failed to create message for method call: %s() at "
+ ERR("E-dbus Error: failed to create message for method call: %s() at "
"\"%s\" at \"%s\"",
method_name, destination, path);
return NULL;
dbus_message_unref(msg);
if (!ret)
- E_DBUS_LOG_ERR("ERROR: failed to call GetAll() at \"%s\" at \"%s\"",
+ ERR("ERROR: failed to call GetAll() at \"%s\" at \"%s\"",
destination, path);
return ret;
dbus_message_unref(msg);
if (!ret)
- E_DBUS_LOG_ERR("E-dbus Error: failed to call Get() at \"%s\" at \"%s\"",
+ ERR("E-dbus Error: failed to call Get() at \"%s\" at \"%s\"",
destination, path);
return ret;
dbus_message_unref(msg);
if (!ret)
- E_DBUS_LOG_ERR("E-dbus Error: failed to call Set() at \"%s\" at \"%s\"",
+ ERR("E-dbus Error: failed to call Set() at \"%s\" at \"%s\"",
destination, path);
return ret;
if (!dbus_pending_call_get_completed(pending))
{
- E_DBUS_LOG_INFO("E-dbus: NOT COMPLETED");
+ INFO("E-dbus: NOT COMPLETED");
free(data);
dbus_message_unref(msg);
dbus_pending_call_unref(pending);
("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
method_name);
if (!msg)
- E_DBUS_LOG_ERR("E-dbus Error: failed to create message for method call: %s",
+ ERR("E-dbus Error: failed to create message for method call: %s",
method_name);
return msg;
}
if (!conn)
{
- E_DBUS_LOG_ERR("E.dbus Error: no connection for call of %s", method_name);
+ ERR("E.dbus Error: no connection for call of %s", method_name);
return NULL;
}
dbus_message_unref(msg);
if (!ret)
- E_DBUS_LOG_ERR("E-dbus Error: failed to call %s()", method_name);
+ ERR("E-dbus Error: failed to call %s()", method_name);
return ret;
}
if (!conn)
{
- E_DBUS_LOG_ERR("E-dbus Error: no connection for call of %s", method_name);
+ ERR("E-dbus Error: no connection for call of %s", method_name);
return NULL;
}
dbus_message_unref(msg);
if (!ret)
- E_DBUS_LOG_ERR("E-dbus Error: failed to call %s(\"%s\")", method_name, str);
+ ERR("E-dbus Error: failed to call %s(\"%s\")", method_name, str);
return ret;
}
if (!conn)
{
- E_DBUS_LOG_ERR("E-dbus Error: no connection for call of RequestName");
+ ERR("E-dbus Error: no connection for call of RequestName");
return NULL;
}
if (!conn)
{
- E_DBUS_LOG_ERR("ERROR: no connection for call of %s", method_name);
+ ERR("ERROR: no connection for call of %s", method_name);
return NULL;
}
dbus_message_unref(msg);
if (!ret)
- E_DBUS_LOG_ERR("E-dbus Error: failed to call %s(\"%s\")", method_name, name);
+ ERR("E-dbus Error: failed to call %s(\"%s\")", method_name, name);
return ret;
}
if (!obj) return;
- E_DBUS_LOG_DBG("e_dbus_object_free (%s)", obj->path);
+ DBG("e_dbus_object_free (%s)", obj->path);
dbus_connection_unregister_object_path(obj->conn->conn, obj->path);
e_dbus_connection_close(obj->conn);
e_dbus_interface_ref(iface);
obj->interfaces = eina_list_append(obj->interfaces, iface);
obj->introspection_dirty = 1;
- E_DBUS_LOG_DBG("e_dbus_object_interface_attach (%s, %s) ", obj->path, iface->name);
+ DBG("e_dbus_object_interface_attach (%s, %s) ", obj->path, iface->name);
}
EAPI void
{
E_DBus_Interface *found;
- E_DBUS_LOG_DBG("e_dbus_object_interface_detach (%s, %s) ", obj->path, iface->name);
+ DBG("e_dbus_object_interface_detach (%s, %s) ", obj->path, iface->name);
found = eina_list_data_find(obj->interfaces, iface);
if (found == NULL) return;
e_dbus_interface_ref(E_DBus_Interface *iface)
{
iface->refcount++;
- E_DBUS_LOG_DBG("e_dbus_interface_ref (%s) = %d", iface->name, iface->refcount);
+ DBG("e_dbus_interface_ref (%s) = %d", iface->name, iface->refcount);
}
EAPI void
e_dbus_interface_unref(E_DBus_Interface *iface)
{
- E_DBUS_LOG_DBG("e_dbus_interface_unref (%s) = %d", iface->name, iface->refcount - 1);
+ DBG("e_dbus_interface_unref (%s) = %d", iface->name, iface->refcount - 1);
if (--(iface->refcount) == 0)
e_dbus_interface_free(iface);
}
E_DBus_Method *m;
m = e_dbus_method_new(member, signature, reply_signature, func);
- E_DBUS_LOG_DBG("E-dbus: Add method %s: %p", member, m);
+ DBG("E-dbus: Add method %s: %p", member, m);
if (!m) return 0;
iface->methods = eina_list_append(iface->methods, m);
E_DBus_Signal *s;
s = e_dbus_signal_new(name, signature);
- E_DBUS_LOG_DBG("E-dbus: Add signal %s: %p", name, s);
+ DBG("E-dbus: Add signal %s: %p", name, s);
if (!s) return 0;
iface->signals = eina_list_append(iface->signals, s);
ecore_strbuf_append(buf, "\">\n");
level++;
- E_DBUS_LOG_DBG("introspect iface: %s", iface->name);
+ DBG("introspect iface: %s", iface->name);
EINA_LIST_FOREACH(iface->methods, l, method)
_introspect_method_append(buf, method, level);
EINA_LIST_FOREACH(iface->signals, l, signal)
char *type;
_introspect_indent_append(buf, level);
- E_DBUS_LOG_DBG("introspect method: %s\n", method->member);
+ DBG("introspect method: %s\n", method->member);
ecore_strbuf_append(buf, "<method name=\"");
ecore_strbuf_append(buf, method->member);
ecore_strbuf_append(buf, "\">\n");
char *type;
_introspect_indent_append(buf, level);
- E_DBUS_LOG_DBG("introspect signal: %s", signal->name);
+ DBG("introspect signal: %s", signal->name);
ecore_strbuf_append(buf, "<signal name=\"");
ecore_strbuf_append(buf, signal->name);
ecore_strbuf_append(buf, "\">\n");
#include "Ecore_Data.h"
#include "eina_log.h"
-#define E_DBUS_COLOR_DEFAULT "\033[36m"
-extern int _E_DBUS_LOG_DOM_GLOBAL ;
-#define E_DBUS_LOG_DBG(...) EINA_LOG_DOM_DBG(_E_DBUS_LOG_DOM_GLOBAL , __VA_ARGS__)
-#define E_DBUS_LOG_INFO(...) EINA_LOG_DOM_INFO(_E_DBUS_LOG_DOM_GLOBAL , __VA_ARGS__)
-#define E_DBUS_LOG_WARN(...) EINA_LOG_DOM_WARN(_E_DBUS_LOG_DOM_GLOBAL , __VA_ARGS__)
-#define E_DBUS_LOG_ERR(...) EINA_LOG_DOM_ERR(_E_DBUS_LOG_DOM_GLOBAL , __VA_ARGS__)
+#ifndef E_DBUS_COLOR_DEFAULT
+#define E_DBUS_COLOR_DEFAULT EINA_COLOR_CYAN
+#endif
+extern int _e_dbus_log_dom;
+#define DBG(...) EINA_LOG_DOM_DBG(_e_dbus_log_dom, __VA_ARGS__)
+#define INFO(...) EINA_LOG_DOM_INFO(_e_dbus_log_dom, __VA_ARGS__)
+#define WARN(...) EINA_LOG_DOM_WARN(_e_dbus_log_dom, __VA_ARGS__)
+#define ERR(...) EINA_LOG_DOM_ERR(_e_dbus_log_dom, __VA_ARGS__)
struct E_DBus_Connection
error:
if (err)
- E_DBUS_LOG_ERR("Error: %s %s", err->name, err->message);
+ ERR("Error: %s %s", err->name, err->message);
/* FIXME: this is bad. the handler gets silently freed and the caller has no
* idea that it was freed - or if, or when.
conn->signal_handlers = eina_list_remove(conn->signal_handlers, sh);
if (*used + keyword_size + value_size + sizeof(",=''") >= size)
{
- E_DBUS_LOG_ERR("cannot add match %s='%s': too long!", keyword, value);
+ ERR("cannot add match %s='%s': too long!", keyword, value);
return 0;
}
sh = malloc(sizeof(*sh) + len);
if (!sh)
{
- E_DBUS_LOG_ERR("could not allocate signal handler.");
+ ERR("could not allocate signal handler.");
return NULL;
}
extern "C" {
#endif
+ EAPI int e_hal_init(void);
+ EAPI int e_hal_shutdown(void);
+
/* org.freedesktop.Hal.Device */
EAPI DBusPendingCall *e_hal_device_get_property(E_DBus_Connection *conn, const char *udi, const char *property, E_DBus_Callback_Func cb_func, void *data);
EAPI DBusPendingCall *e_hal_device_get_all_properties(E_DBus_Connection *conn, const char *udi, E_DBus_Callback_Func cb_func, void *data);
lib_LTLIBRARIES = libehal.la
include_HEADERS = E_Hal.h
+noinst_HEADERS = e_hal_private.h
+
libehal_la_SOURCES = \
E_Hal.h \
e_hal_device.c \
e_hal_manager.c \
-e_hal_util.c
+e_hal_util.c \
+e_hal_main.c
libehal_la_LIBADD = \
@EDBUS_LIBS@ \
#include <E_Hal.h>
-#include <e_dbus_private.h>
+#include "e_hal_private.h"
#define e_hal_device_call_new(udi, member) dbus_message_new_method_call(E_HAL_SENDER, udi, E_HAL_DEVICE_INTERFACE, member)
#define e_hal_device_volume_call_new(udi, member) dbus_message_new_method_call(E_HAL_SENDER, udi, E_HAL_DEVICE_VOLUME_INTERFACE, member)
}
break;
default:
- E_DBUS_LOG_WARN("Ehal Error: unexpected property type (%s): %c", name, dbus_message_iter_get_arg_type(&v_iter));
+ WARN("Ehal Error: unexpected property type (%s): %c", name, dbus_message_iter_get_arg_type(&v_iter));
break;
}
eina_hash_add(ret->properties, name, prop);
--- /dev/null
+#include <E_Hal.h>
+#include "e_hal_private.h"
+
+int _e_dbus_hal_log_dom = -1;
+int _e_dbus_hal_init_count = 0;
+
+EAPI int
+e_hal_init(void)
+{
+ if (_e_dbus_hal_init_count)
+ return ++_e_dbus_hal_init_count;
+
+ if (!eina_init())
+ return 0;
+
+ _e_dbus_hal_log_dom = eina_log_domain_register
+ ("e_hal", E_DBUS_COLOR_DEFAULT);
+ if (_e_dbus_hal_log_dom < 0)
+ {
+ EINA_LOG_ERR("Could not register 'e_hal' log domain.");
+ goto error_log_domain;
+ return 0;
+ }
+
+ if (!e_dbus_init()) {
+ ERR("Could not initialize E_DBus.");
+ goto error_e_dbus;
+ }
+
+ _e_dbus_hal_init_count = 1;
+ return 1;
+
+ error_e_dbus:
+ eina_log_domain_unregister(_e_dbus_hal_log_dom);
+ _e_dbus_hal_log_dom = -1;
+ error_log_domain:
+ eina_shutdown();
+ return 0;
+}
+
+EAPI int
+e_hal_shutdown(void)
+{
+ _e_dbus_hal_init_count--;
+ if (_e_dbus_hal_init_count)
+ return _e_dbus_hal_init_count;
+
+ e_dbus_shutdown();
+
+ eina_log_domain_unregister(_e_dbus_hal_log_dom);
+ _e_dbus_hal_log_dom = -1;
+ eina_shutdown();
+
+ return 0;
+}
#include "E_Hal.h"
+#include "e_hal_private.h"
#define e_hal_manager_call_new(member) dbus_message_new_method_call(E_HAL_SENDER, E_HAL_MANAGER_PATH, E_HAL_MANAGER_INTERFACE, member)
--- /dev/null
+#ifndef E_HAL_PRIVATE_H
+#define E_HAL_PRIVATE_H
+
+#ifndef E_DBUS_COLOR_DEFAULT
+#define E_DBUS_COLOR_DEFAULT EINA_COLOR_CYAN
+#endif
+extern int _e_dbus_hal_log_dom;
+#ifdef ERR
+#undef ERR
+#endif
+#ifdef INF
+#undef INF
+#endif
+#ifdef WARN
+#undef WARN
+#endif
+#ifdef DBG
+#undef DBG
+#endif
+
+#define DBG(...) EINA_LOG_DOM_DBG(_e_dbus_hal_log_dom, __VA_ARGS__)
+#define INFO(...) EINA_LOG_DOM_INFO(_e_dbus_hal_log_dom, __VA_ARGS__)
+#define WARN(...) EINA_LOG_DOM_WARN(_e_dbus_hal_log_dom, __VA_ARGS__)
+#define ERR(...) EINA_LOG_DOM_ERR(_e_dbus_hal_log_dom, __VA_ARGS__)
+
+#endif
#include <E_Hal.h>
#include <string.h>
+#include "e_hal_private.h"
/**
* @internal
lib_LTLIBRARIES = libenotify.la
include_HEADERS = E_Notify.h E_Notification_Daemon.h
+noinst_HEADERS = e_notify_private.h
+
libenotify_la_SOURCES = \
E_Notify.h \
E_Notification_Daemon.h \
#include "E_Notify.h"
#include "e_notify_private.h"
-#include "e_dbus_private.h"
static E_DBus_Connection *client_conn;
static int init_count = 0;
if(_e_dbus_notification_log_dom < 0)
{
- E_DBUS_LOG_ERR("E-Dbus-notification Error: Impossible to create e_dbus_motification domain");
+ ERR("E-Dbus-notification Error: Impossible to create e_dbus_motification domain");
e_dbus_shutdown();
return 0;
}
#include "E_Notify.h"
#include "E_Notification_Daemon.h"
#include "e_notify_private.h"
-#include "e_dbus_private.h"
#include <string.h>
static int e_notification_daemon_bus_init(E_Notification_Daemon *daemon);
E_Notification_Image * e_notify_unmarshal_hint_image(DBusMessageIter *iter);
-extern int _e_dbus_notification_log_dom ;
+#ifndef E_DBUS_COLOR_DEFAULT
+#define E_DBUS_COLOR_DEFAULT EINA_COLOR_CYAN
+#endif
+extern int _e_dbus_notification_log_dom;
+
+#ifdef ERR
#undef ERR
+#endif
+#ifdef INF
#undef INF
+#endif
+#ifdef WARN
#undef WARN
+#endif
+#ifdef DBG
#undef DBG
+#endif
+
+#define DBG(...) EINA_LOG_DOM_DBG(_e_dbus_notification_log_dom, __VA_ARGS__)
+#define INFO(...) EINA_LOG_DOM_INFO(_e_dbus_notification_log_dom, __VA_ARGS__)
+#define WARN(...) EINA_LOG_DOM_WARN(_e_dbus_notification_log_dom, __VA_ARGS__)
+#define ERR(...) EINA_LOG_DOM_ERR(_e_dbus_notification_log_dom, __VA_ARGS__)
-#define DBG(...) EINA_LOG_DOM_DBG(_e_dbus_notification_log_dom , __VA_ARGS__)
-#define INFO(...) EINA_LOG_DOM_INFO(_e_dbus_notification_log_dom , __VA_ARGS__)
-#define WARN(...) EINA_LOG_DOM_WARN(_e_dbus_notification_log_dom , __VA_ARGS__)
-#define ERR(...) EINA_LOG_DOM_ERR(_e_dbus_notification_log_dom , __VA_ARGS__)
struct E_Notification_Image
{