summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/dbus.c
diff options
context:
space:
mode:
authorracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-26 12:58:53 +0000
committerracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-26 12:58:53 +0000
commit0433269983081e1a7a4483b70e7a32cd0714bc40 (patch)
tree9e3dc21c11a1837493ac5f2272c31303bfa1dad6 /beryl-plugins/src/dbus.c
parentdf813571beb642ae0e42b1e12b44bd75aebec601 (diff)
downloadmarex-dev-0433269983081e1a7a4483b70e7a32cd0714bc40.tar.gz
marex-dev-0433269983081e1a7a4483b70e7a32cd0714bc40.tar.bz2
Some upstream changes
git-svn-id: file:///beryl/trunk@3172 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/dbus.c')
-rw-r--r--beryl-plugins/src/dbus.c84
1 files changed, 71 insertions, 13 deletions
diff --git a/beryl-plugins/src/dbus.c b/beryl-plugins/src/dbus.c
index 1ab0c7b..d927c3c 100644
--- a/beryl-plugins/src/dbus.c
+++ b/beryl-plugins/src/dbus.c
@@ -40,6 +40,7 @@
#define BERYL_DBUS_GET_MEMBER_NAME "get"
#define BERYL_DBUS_GET_METADATA_MEMBER_NAME "getMetadata"
#define BERYL_DBUS_LIST_MEMBER_NAME "list"
+#define BERYL_DBUS_GET_PLUGINS_MEMBER_NAME "getPlugins"
#define BERYL_DBUS_CHANGED_SIGNAL_NAME "changed"
typedef enum
@@ -866,6 +867,33 @@ dbusHandleGetMetadataMessage(DBusConnection * connection,
}
+static Bool
+dbusHandleGetPluginsMessage( DBusConnection *connection, DBusMessage *message, CompDisplay *d)
+{
+ DBusMessage *reply;
+ char **plugins, **p;
+ int n;
+
+ reply = dbus_message_new_method_return ( message );
+
+ plugins = availablePlugins(&n);
+ if (plugins)
+ {
+ p=plugins;
+
+ while (n--)
+ {
+ dbus_message_append_args(reply,DBUS_TYPE_STRING,p,DBUS_TYPE_INVALID);
+ free(*p);
+ p++;
+ }
+ free (plugins);
+ }
+ dbus_connection_send(connection,reply,NULL);
+ dbus_connection_flush(connection);
+ return TRUE;
+}
+
static DBusHandlerResult
dbusHandleMessage(DBusConnection * connection,
DBusMessage * message, void *userData)
@@ -891,33 +919,66 @@ dbusHandleMessage(DBusConnection * connection,
if (!dbus_message_get_path_decomposed(message, &path))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (!path[0] || !path[1] || !path[2] || !path[3])
+ if (!path[0] || !path[1] || !path[2])
+ {
+ dbus_free_string_array (path);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
+ }
+
if (strcmp(path[0], "org") ||
strcmp(path[1], "freedesktop") || strcmp(path[2], "beryl"))
+ {
+ dbus_free_string_array (path);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
- if (dbus_message_has_member(message, BERYL_DBUS_ACTIVATE_MEMBER_NAME) &&
- path[5])
+ if (dbus_message_has_member (message, BERYL_DBUS_GET_PLUGINS_MEMBER_NAME))
+ {
+ if (dbusHandleGetPluginsMessage(connection,message,d))
+ {
+ dbus_free_string_array(path);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ }
+
+ if (!path[3] || !path[4])
+ {
+ dbus_free_string_array(path);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ if (dbus_message_has_member (message, BERYL_DBUS_LIST_MEMBER_NAME))
+ {
+ if (dbusHandleListMessage(connection,message,d, &path[4]))
+ {
+ dbus_free_string_array(path);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ }
+
+ if (!path[5])
+ {
+ dbus_free_string_array(path);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ if (dbus_message_has_member(message, BERYL_DBUS_ACTIVATE_MEMBER_NAME) )
{
status = dbusHandleActionMessage(connection, message, d, &path[3],
TRUE);
}
else if (dbus_message_has_member(message,
- BERYL_DBUS_DEACTIVATE_MEMBER_NAME) &&
- path[5])
+ BERYL_DBUS_DEACTIVATE_MEMBER_NAME) )
{
status = dbusHandleActionMessage(connection, message, d, &path[3],
FALSE);
}
- else if (dbus_message_has_member(message, BERYL_DBUS_SET_MEMBER_NAME) &&
- path[5])
+ else if (dbus_message_has_member(message, BERYL_DBUS_SET_MEMBER_NAME) )
{
status = dbusHandleSetOptionMessage(connection, message, d, &path[3]);
}
else if (dbus_message_has_member(message,
- BERYL_DBUS_GET_MEMBER_NAME) && path[5])
+ BERYL_DBUS_GET_MEMBER_NAME))
{
status = dbusHandleGetOptionMessage(connection, message, d, &path[3]);
}
@@ -927,10 +988,7 @@ dbusHandleMessage(DBusConnection * connection,
status = dbusHandleGetMetadataMessage(connection, message, d,
&path[3]);
}
- else if (dbus_message_has_member(message, BERYL_DBUS_LIST_MEMBER_NAME))
- {
- status = dbusHandleListMessage(connection, message, d, &path[3]);
- }
+
dbus_free_string_array(path);