"\tenlightenment_info -prop 0xb88ffaa0 Layer : Get the \"Layer\" property for specified window\n" \
"\tenlightenment_info -prop 0xb88ffaa0 Hidden 1 : Set the \"Hidden\" property for specified window\n" \
"\tenlightenment_info -prop -pid 2502 Hidden 0 : Set the \"Hidden\" property for all windows belonged to a process\n" \
- "\tenlightenment_info -prop -name err : Get all properties for windows whose names contain an \"err\" substring\n"
+ "\tenlightenment_info -prop -name err : Get all properties for windows whose names contain an \"err\" substring\n" \
+ "\tenlightenment_info -prop -name \"\" : Get all properties for all windows\n"
static void
_cb_window_prop_get(const Eldbus_Message *msg)
const char *name = NULL, *text = NULL;
Eldbus_Message_Iter *array, *ec;
Eina_Bool res;
- const char *title = NULL;
- const char *value = NULL;
res = eldbus_message_error_get(msg, &name, &text);
EINA_SAFETY_ON_TRUE_GOTO(res, finish);
res = eldbus_message_arguments_get(msg, "a(ss)", &array);
EINA_SAFETY_ON_FALSE_GOTO(res, finish);
- res = eldbus_message_iter_arguments_get(array, "(ss)", &ec);
- EINA_SAFETY_ON_FALSE_GOTO(res, finish);
-
- res = eldbus_message_iter_arguments_get(ec, "ss", &title, &value);
- EINA_SAFETY_ON_FALSE_GOTO(res, finish);
-
- /* iterators will be destroyed during the message destroying */
-
- /* to handle no-dbus errors */
- if (title && !strncmp(title, "error", sizeof("error")))
- {
- printf(" Error: %s\n", value);
- return;
- }
-
printf("--------------------------------------[ window prop ]-----------------------------------------------------\n");
while (eldbus_message_iter_get_and_next(array, 'r', &ec))
{
+ const char *title = NULL;
+ const char *value = NULL;
+
res = eldbus_message_iter_arguments_get(ec,
"ss",
&title,
return;
finish:
- printf("dbus error");
+ printf("error:\n");
if ((name) || (text))
{
- printf(":\n errname:%s errmsg:%s", name, text);
+ printf(" %s :: (%s)\n", name, text);
}
- printf("\n");
}
static void
}
/* all checks about win_id/pid/win_name, property_name, property_value sanity are performed on server side,
- * in case of an error a reply message contains error description (ss) */
+ * in case of an error an error message contained error description will be returned */
if (!_e_info_client_eldbus_message_with_args("get_window_prop", _cb_window_prop_get, "usss",
mode, value, property_name, property_value))
printf("_e_info_client_eldbus_message_with_args error");
#undef __WINDOW_PROP_ARG_APPEND_TYPE
}
-static void
-_msg_window_prop_append(Eldbus_Message_Iter *iter, uint32_t mode, const char *value)
+static Eldbus_Message *
+_msg_window_prop_append(const Eldbus_Message *msg, uint32_t mode, const char *value)
{
const static int WINDOW_ID_MODE = 0;
const static int WINDOW_PID_MODE = 1;
const static int WINDOW_NAME_MODE = 2;
- Eldbus_Message_Iter *array_of_ec;
+ Eldbus_Message_Iter *iter, *array_of_ec;
+ Eldbus_Message *reply;
E_Client *ec;
Evas_Object *o;
uint64_t value_number = 0;
Eina_Bool res = EINA_FALSE;
-
- eldbus_message_iter_arguments_append(iter, "a(ss)", &array_of_ec);
+ Eina_Bool window_exists = EINA_FALSE;
if (mode == WINDOW_ID_MODE || mode == WINDOW_PID_MODE)
{
else
res = e_util_string_to_ulong(value, (unsigned long *)&value_number, 10);
- EINA_SAFETY_ON_FALSE_GOTO(res, finish);
+ if (res == EINA_FALSE)
+ {
+ ERR("get_window_prop: invalid input arguments");
+
+ return eldbus_message_error_new(msg, INVALID_ARGS,
+ "get_window_prop: invalid input arguments");
+ }
}
}
+ /* msg - is a method call message */
+ reply = eldbus_message_method_return_new(msg);
+ iter = eldbus_message_iter_get(reply);
+ eldbus_message_iter_arguments_append(iter, "a(ss)", &array_of_ec);
+
for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
{
ec = evas_object_data_get(o, "E_Client");
if (win == value_number)
{
+ window_exists = EINA_TRUE;
_msg_window_prop_client_append(array_of_ec, ec);
break;
}
}
if (pid == value_number)
{
+ window_exists = EINA_TRUE;
_msg_window_prop_client_append(array_of_ec, ec);
}
}
const char *find = strstr(name, value);
if (find)
- _msg_window_prop_client_append(array_of_ec, ec);
+ {
+ window_exists = EINA_TRUE;
+ _msg_window_prop_client_append(array_of_ec, ec);
+ }
}
}
}
finish:
eldbus_message_iter_container_close(iter, array_of_ec);
+
+ if (window_exists == EINA_TRUE)
+ return reply;
+
+ /* TODO: I'm not sure we gotta do it. But, who's responsible for message freeing if we've not it
+ * returned to caller(eldbus)? */
+ eldbus_message_unref(reply);
+
+ return eldbus_message_error_new(msg, WIN_NOT_EXIST, "get_window_prop: specified window(s) doesn't exist");
}
static Eldbus_Message *
static Eldbus_Message *
_e_info_server_cb_window_prop_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
{
- Eldbus_Message *reply = eldbus_message_method_return_new(msg);
uint32_t mode = 0;
const char *value = NULL;
const char *property_name = NULL, *property_value = NULL;
if (!eldbus_message_arguments_get(msg, "usss", &mode, &value, &property_name, &property_value))
{
ERR("Error getting arguments.");
- return reply;
+
+ return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
+ "get_window_prop: an attempt to get arguments from method call message failed");
}
INF("property_name: %s, property_value: %s", property_name, property_value);
- _msg_window_prop_append(eldbus_message_iter_get(reply), mode, value);
- return reply;
+ return _msg_window_prop_append(msg, mode, value);
}
static Eldbus_Message *
#ifdef HAVE_DLOG
{ "dlog", ELDBUS_ARGS({"i", "using dlog"}), NULL, _e_info_server_cb_dlog_switch, 0},
#endif
- { "get_window_prop", ELDBUS_ARGS({"usss", "query_mode_value"}), ELDBUS_ARGS({"a(ss)", "array_of_ec"}), _e_info_server_cb_window_prop_get, 0},
+ { "get_window_prop", ELDBUS_ARGS({"usss", "prop_manage_request"}), ELDBUS_ARGS({"a(ss)", "array_of_ec"}), _e_info_server_cb_window_prop_get, 0},
{ "get_connected_clients", NULL, ELDBUS_ARGS({"a(ss)", "array of ec"}), _e_info_server_cb_connected_clients_get, 0 },
{ "rotation_query", ELDBUS_ARGS({"i", "query_rotation"}), NULL, _e_info_server_cb_rotation_query, 0},
{ "rotation_message", ELDBUS_ARGS({"iii", "rotation_message"}), NULL, _e_info_server_cb_rotation_message, 0},