Add wrapper for common dbus methods

SVN revision: 24195
This commit is contained in:
sebastid 2006-07-25 14:34:47 +00:00 committed by sebastid
parent ea6d530cfa
commit 51100f55f5
3 changed files with 97 additions and 0 deletions

View File

@ -24,6 +24,7 @@ ecore_dbus.c \
ecore_dbus_message.c \
ecore_dbus_marshal.c \
ecore_dbus_unmarshal.c \
ecore_dbus_methods.c \
ecore_dbus_utils.c \
ecore_dbus_private.h

View File

@ -124,6 +124,7 @@ ecore_dbus_server_connect(Ecore_DBus_Type compl_type, char *name, int port,
switch (type)
{
#if 0
/* Get address from DBUS_SESSION_BUS_ADDRESS env */
case ECORE_DBUS_BUS_SESSION:
svr->server =
ecore_con_server_connect(ECORE_CON_LOCAL_USER | extra, name, port, svr);

View File

@ -0,0 +1,95 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
/* Standard dbus methods */
#include "ecore_private.h"
#include "Ecore_Con.h"
#include "Ecore_DBus.h"
#include "ecore_dbus_private.h"
int
ecore_dbus_method_hello(Ecore_DBus_Server *svr)
{
return ecore_dbus_message_new_method_call(svr,
"org.freedesktop.DBus" /*destination*/,
"/org/freedesktop/DBus" /*path*/,
"org.freedesktop.DBus" /*interface*/,
"Hello" /*method*/, NULL /*fmt*/);
}
int
ecore_dbus_method_list_names(Ecore_DBus_Server *svr)
{
return ecore_dbus_message_new_method_call(svr,
"org.freedesktop.DBus" /*destination*/,
"/org/freedesktop/DBus" /*path*/,
"org.freedesktop.DBus" /*interface*/,
"ListNames" /*method*/, NULL /*fmt*/);
}
int
ecore_dbus_method_name_has_owner(Ecore_DBus_Server *svr, char *name)
{
return ecore_dbus_message_new_method_call(svr,
"org.freedesktop.DBus" /*destination*/,
"/org/freedesktop/DBus" /*path*/,
"org.freedesktop.DBus" /*interface*/,
"NameHasOwner" /*method*/,
"s" /*fmt*/, name);
}
int
ecore_dbus_method_start_service_by_name(Ecore_DBus_Server *svr, char *name, unsigned int flags)
{
return ecore_dbus_message_new_method_call(svr,
"org.freedesktop.DBus" /*destination*/,
"/org/freedesktop/DBus" /*path*/,
"org.freedesktop.DBus" /*interface*/,
"StartServiceByName" /*method*/,
"su" /*fmt*/, name, flags);
}
int
ecore_dbus_method_get_name_owner(Ecore_DBus_Server *svr, char *name)
{
return ecore_dbus_message_new_method_call(svr,
"org.freedesktop.DBus" /*destination*/,
"/org/freedesktop/DBus" /*path*/,
"org.freedesktop.DBus" /*interface*/,
"GetNameOwner" /*method*/,
"s" /*fmt*/, name);
}
int
ecore_dbus_method_get_connection_unix_user(Ecore_DBus_Server *svr, char *connection)
{
return ecore_dbus_message_new_method_call(svr,
"org.freedesktop.DBus" /*destination*/,
"/org/freedesktop/DBus" /*path*/,
"org.freedesktop.DBus" /*interface*/,
"GetConnectionUnixUser" /*method*/,
"s" /*fmt*/, connection);
}
int
ecore_dbus_method_add_match(Ecore_DBus_Server *svr, char *match)
{
return ecore_dbus_message_new_method_call(svr,
"org.freedesktop.DBus" /*destination*/,
"/org/freedesktop/DBus" /*path*/,
"org.freedesktop.DBus" /*interface*/,
"AddMatch" /*method*/,
"s" /*fmt*/, match);
}
int
ecore_dbus_method_remove_match(Ecore_DBus_Server *svr, char *match)
{
return ecore_dbus_message_new_method_call(svr,
"org.freedesktop.DBus" /*destination*/,
"/org/freedesktop/DBus" /*path*/,
"org.freedesktop.DBus" /*interface*/,
"RemoveMatch" /*method*/,
"s" /*fmt*/, match);
}