- DBusError err;
- dbus_bool_t dbus_ret;
- char *raw_data = NULL;
- int raw_data_len = 0;
-
- if (msg != NULL && name != NULL &&
- w != NULL && h != NULL && pri != NULL &&
- handler != NULL) {
- dbus_error_init(&err);
- dbus_ret = dbus_message_get_args(msg, &err,
- DBUS_TYPE_STRING, name,
- DBUS_TYPE_UINT32, w,
- DBUS_TYPE_UINT32, h,
- DBUS_TYPE_UINT32, pri,
- DBUS_TYPE_STRING, &raw_data,
- DBUS_TYPE_UINT32, &raw_data_len,
- DBUS_TYPE_INVALID);
- if (!dbus_ret) {
- ERR("fail to get args : %s", err.message);
- if (*name == NULL) {
- ERR("Failed to get a service name, give up");
- dbus_error_free(&err);
- return MINICONTROL_ERROR_DBUS;
- }
- }
-
- if (raw_data != NULL && raw_data_len > 0) {
- _minictrl_handler_get_handler_from_raw_data(handler, raw_data, raw_data_len);
- } else {
- ERR("failed to get handler from DBUS message");
- }
- dbus_error_free(&err);
- }
-
- return MINICONTROL_ERROR_NONE;
-}
-
-static void _provider_start_cb(void *data, DBusMessage *msg)
-{
- char *svr_name = NULL;
- unsigned int w = 0;
- unsigned int h = 0;
- unsigned int pri = 0;
- minicontrol_h handler = NULL;
- minicontrol_priority_e priority;
-
- if (_provider_get_data_from_dbus_message(msg, &svr_name, &w, &h, &pri, &handler) != MINICONTROL_ERROR_NONE) {
- ERR("fail to data from DBUS message");
- return ;
- }
-
- priority = _int_to_priority(pri);
-
- if (g_monitor_h->callback) {
- g_monitor_h->callback(MINICONTROL_ACTION_START,
- svr_name, w, h, priority,
- g_monitor_h->user_data);
- }
- if (g_monitor_h->callback_with_handler) {
- g_monitor_h->callback_with_handler(MINICONTROL_ACTION_START,
- svr_name, w, h, priority,
- handler,
- g_monitor_h->user_data);
- }
-
- if (handler != NULL) {
- _minictrl_handler_destroy(handler);
- }
-}
-
-static void _provider_realized_cb(void *data, DBusMessage *msg)
-{
- char *svr_name = NULL;
- unsigned int w = 0;
- unsigned int h = 0;
- unsigned int pri = 0;
- minicontrol_h handler = NULL;
- minicontrol_priority_e priority;
-
- if (_provider_get_data_from_dbus_message(msg, &svr_name, &w, &h, &pri, &handler) != MINICONTROL_ERROR_NONE) {
- ERR("fail to data from DBUS message");
- return ;
- }
-
- priority = _int_to_priority(pri);
-
- if (g_monitor_h->callback) {
- g_monitor_h->callback(MINICONTROL_ACTION_REALIZE,
- svr_name, w, h, priority,
- g_monitor_h->user_data);
- }
- if (g_monitor_h->callback_with_handler) {
- g_monitor_h->callback_with_handler(MINICONTROL_ACTION_REALIZE,
- svr_name, w, h, priority,
- handler,
- g_monitor_h->user_data);
- }
-
- if (handler != NULL) {
- _minictrl_handler_destroy(handler);
- }
-}
-
-static void _provider_stop_cb(void *data, DBusMessage *msg)
-{
- char *svr_name = NULL;
- unsigned int w = 0;
- unsigned int h = 0;
- unsigned int pri = 0;
- minicontrol_h handler = NULL;
- minicontrol_priority_e priority;
-
- if (_provider_get_data_from_dbus_message(msg, &svr_name, &w, &h, &pri, &handler) != MINICONTROL_ERROR_NONE) {
- ERR("fail to data from DBUS message");
- return ;
- }
-
- priority = _int_to_priority(pri);
-
- if (g_monitor_h->callback) {
- g_monitor_h->callback(MINICONTROL_ACTION_STOP,
- svr_name, w, h, priority,
- g_monitor_h->user_data);
- }
- if (g_monitor_h->callback_with_handler) {
- g_monitor_h->callback_with_handler(MINICONTROL_ACTION_STOP,
- svr_name, w, h, priority,
- handler,
- g_monitor_h->user_data);
- }
-
- if (handler != NULL) {
- _minictrl_handler_destroy(handler);
- }
-}
-
-static void _provider_resize_cb(void *data, DBusMessage *msg)
-{
- char *svr_name = NULL;
- unsigned int w = 0;
- unsigned int h = 0;
- unsigned int pri = 0;
- minicontrol_h handler = NULL;
- minicontrol_priority_e priority;
-
- if (_provider_get_data_from_dbus_message(msg, &svr_name, &w, &h, &pri, &handler) != MINICONTROL_ERROR_NONE) {
- ERR("fail to data from DBUS message");
- return ;
- }
-
- priority = _int_to_priority(pri);
-
- if (g_monitor_h->callback) {
- g_monitor_h->callback(MINICONTROL_ACTION_RESIZE,
- svr_name, w, h, priority,
- g_monitor_h->user_data);
- }
- if (g_monitor_h->callback_with_handler) {
- g_monitor_h->callback_with_handler(MINICONTROL_ACTION_RESIZE,
- svr_name, w, h, priority,
- handler,
- g_monitor_h->user_data);
- }