Fix a potential leak.
[evas_quartz.git] / proto / ecore_dbus / ecore_dbus_methods.c
blobd0630bb71983d3cfd1236eed203bbcd8fa3abc03
1 /*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4 /* Standard dbus methods */
6 #include "ecore_private.h"
7 #include "Ecore_Con.h"
8 #include "Ecore_DBus.h"
9 #include "ecore_dbus_private.h"
11 EAPI int
12 ecore_dbus_method_hello(Ecore_DBus_Server *svr,
13 Ecore_DBus_Method_Return_Cb method_cb,
14 Ecore_DBus_Error_Cb error_cb,
15 void *data)
17 if (svr->unique_name)
19 printf("Ecore_DBus: Already registered on the message bus.\n");
20 return 0;
22 return ecore_dbus_message_new_method_call(svr,
23 "/org/freedesktop/DBus" /*path*/,
24 "org.freedesktop.DBus" /*interface*/,
25 "Hello" /*method*/,
26 "org.freedesktop.DBus" /*destination*/,
27 method_cb, error_cb, data,
28 NULL /*fmt*/);
31 EAPI int
32 ecore_dbus_method_list_names(Ecore_DBus_Server *svr,
33 Ecore_DBus_Method_Return_Cb method_cb,
34 Ecore_DBus_Error_Cb error_cb,
35 void *data)
37 return ecore_dbus_message_new_method_call(svr,
38 "/org/freedesktop/DBus" /*path*/,
39 "org.freedesktop.DBus" /*interface*/,
40 "ListNames" /*method*/,
41 "org.freedesktop.DBus" /*destination*/,
42 method_cb, error_cb, data,
43 NULL /*fmt*/);
46 EAPI int
47 ecore_dbus_method_name_has_owner(Ecore_DBus_Server *svr, char *name,
48 Ecore_DBus_Method_Return_Cb method_cb,
49 Ecore_DBus_Error_Cb error_cb,
50 void *data)
52 return ecore_dbus_message_new_method_call(svr,
53 "/org/freedesktop/DBus" /*path*/,
54 "org.freedesktop.DBus" /*interface*/,
55 "NameHasOwner" /*method*/,
56 "org.freedesktop.DBus" /*destination*/,
57 method_cb, error_cb, data,
58 "s" /*fmt*/, name);
61 EAPI int
62 ecore_dbus_method_start_service_by_name(Ecore_DBus_Server *svr, char *name, unsigned int flags,
63 Ecore_DBus_Method_Return_Cb method_cb,
64 Ecore_DBus_Error_Cb error_cb,
65 void *data)
67 return ecore_dbus_message_new_method_call(svr,
68 "/org/freedesktop/DBus" /*path*/,
69 "org.freedesktop.DBus" /*interface*/,
70 "StartServiceByName" /*method*/,
71 "org.freedesktop.DBus" /*destination*/,
72 method_cb, error_cb, data,
73 "su" /*fmt*/, name, flags);
76 EAPI int
77 ecore_dbus_method_get_name_owner(Ecore_DBus_Server *svr, char *name,
78 Ecore_DBus_Method_Return_Cb method_cb,
79 Ecore_DBus_Error_Cb error_cb,
80 void *data)
82 return ecore_dbus_message_new_method_call(svr,
83 "/org/freedesktop/DBus" /*path*/,
84 "org.freedesktop.DBus" /*interface*/,
85 "GetNameOwner" /*method*/,
86 "org.freedesktop.DBus" /*destination*/,
87 method_cb, error_cb, data,
88 "s" /*fmt*/, name);
91 EAPI int
92 ecore_dbus_method_get_connection_unix_user(Ecore_DBus_Server *svr, char *connection,
93 Ecore_DBus_Method_Return_Cb method_cb,
94 Ecore_DBus_Error_Cb error_cb,
95 void *data)
97 return ecore_dbus_message_new_method_call(svr,
98 "/org/freedesktop/DBus" /*path*/,
99 "org.freedesktop.DBus" /*interface*/,
100 "GetConnectionUnixUser" /*method*/,
101 "org.freedesktop.DBus" /*destination*/,
102 method_cb, error_cb, data,
103 "s" /*fmt*/, connection);
106 EAPI int
107 ecore_dbus_method_add_match(Ecore_DBus_Server *svr, char *match,
108 Ecore_DBus_Method_Return_Cb method_cb,
109 Ecore_DBus_Error_Cb error_cb,
110 void *data)
112 return ecore_dbus_message_new_method_call(svr,
113 "/org/freedesktop/DBus" /*path*/,
114 "org.freedesktop.DBus" /*interface*/,
115 "AddMatch" /*method*/,
116 "org.freedesktop.DBus" /*destination*/,
117 method_cb, error_cb, data,
118 "s" /*fmt*/, match);
121 EAPI int
122 ecore_dbus_method_remove_match(Ecore_DBus_Server *svr, char *match,
123 Ecore_DBus_Method_Return_Cb method_cb,
124 Ecore_DBus_Error_Cb error_cb,
125 void *data)
127 return ecore_dbus_message_new_method_call(svr,
128 "/org/freedesktop/DBus" /*path*/,
129 "org.freedesktop.DBus" /*interface*/,
130 "RemoveMatch" /*method*/,
131 "org.freedesktop.DBus" /*destination*/,
132 method_cb, error_cb, data,
133 "s" /*fmt*/, match);
136 EAPI int
137 ecore_dbus_method_request_name(Ecore_DBus_Server *svr, char *name, int flags,
138 Ecore_DBus_Method_Return_Cb method_cb,
139 Ecore_DBus_Error_Cb error_cb,
140 void *data)
142 return ecore_dbus_message_new_method_call(svr,
143 "/org/freedesktop/DBus" /*path*/,
144 "org.freedesktop.DBus" /*interface*/,
145 "RequestName" /*method*/,
146 "org.freedesktop.DBus" /*destination*/,
147 method_cb, error_cb, data,
148 "su" /*fmt*/, name, flags);
151 EAPI int
152 ecore_dbus_method_release_name(Ecore_DBus_Server *svr, char *name,
153 Ecore_DBus_Method_Return_Cb method_cb,
154 Ecore_DBus_Error_Cb error_cb,
155 void *data)
157 return ecore_dbus_message_new_method_call(svr,
158 "/org/freedesktop/DBus" /*path*/,
159 "org.freedesktop.DBus" /*interface*/,
160 "RequestName" /*method*/,
161 "org.freedesktop.DBus" /*destination*/,
162 method_cb, error_cb, data,
163 "s" /*fmt*/, name);