Kaydet (Commit) 8c3039dc authored tarafından Bahadır Kandemir's avatar Bahadır Kandemir

Support for listing running method calls

üst bfaf6580
......@@ -25,6 +25,10 @@
<arg name="method_name" type="s" direction="in"/>
<arg name="killed_calls" type="i" direction="out"/>
</method>
<method name="listRunning" action_id="">
<arg name="all" type="b" direction="in"/>
<arg name="methods" type="as" direction="out"/>
</method>
<method name="setLocale" action_id="">
<arg name="locale" type="s" direction="in"/>
</method>
......
......@@ -172,6 +172,18 @@ handle_core_message(DBusMessage *bus_msg, const char *path, const char *iface, c
// log_debug("Killed %d processes.\n", total);
bus_reply_object(bus_msg, PyInt_FromLong((long) total), "i");
}
else if (strcmp(method, "listRunning") == 0) {
int i;
PyObject *py_list = PyList_New(0);
// Iterate over all child processes
for (i = 0; i < my_proc.nr_children; i++) {
struct ProcChild *child = &my_proc.children[i];
if (PyTuple_GetItem(py_args, 0) == Py_True || dbus_message_has_sender(child->bus_msg, sender)) {
PyList_Append(py_list, PyString_FromFormat("%s.%s", dbus_message_get_interface(child->bus_msg), dbus_message_get_member(child->bus_msg)));
}
}
bus_reply_object(bus_msg, py_list, "as");
}
}
static DBusHandlerResult
......@@ -194,7 +206,7 @@ filter_func(DBusConnection *conn, DBusMessage *bus_msg, void *data)
log_debug("Got message '%s.%s' from '%s'\n", iface, method, sender);
if (strcmp(config_interface, iface) == 0 && strcmp(path, "/") == 0) {
// "setLocale" and "cancel" methods are handled in main process
if (strcmp(method, "setLocale") == 0 || strcmp(method, "cancel") == 0) {
if (strcmp(method, "setLocale") == 0 || strcmp(method, "cancel") == 0 || strcmp(method, "listRunning") == 0) {
handle_core_message(bus_msg, path, iface, method, sender, py_args);
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment