Release 0.41.92
[vala-gnome.git] / vapi / dbus-glib-1.vapi
blobf79574c4e37ad230feaf030d849b876fb2dcd92f
1 /* dbus-glib-1.vala
2  *
3  * Copyright (C) 2007-2010  Jürg Billeter
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18  *
19  * Author:
20  *      Jürg Billeter <j@bitron.ch>
21  *  Michael 'Mickey' Lauer <mlauer@vanille-media.de>
22  */
24 [CCode (cheader_filename = "dbus/dbus-glib-lowlevel.h,dbus/dbus-glib.h", gir_namespace = "DBusGLib", gir_version = "1.0")]
25 namespace DBus {
26         public const string SERVICE_DBUS;
27         public const string PATH_DBUS;
28         public const string INTERFACE_DBUS;
30         public const string INTERFACE_INTROSPECTABLE;
31         public const string INTERFACE_PROPERTIES;
32         public const string INTERFACE_PEER;
34         [CCode (cname = "dbus_g_thread_init")]
35         public static void thread_init ();
37         [CCode (cprefix = "DBUS_BUS_")]
38         public enum BusType {
39                 SESSION,
40                 SYSTEM,
41                 STARTER
42         }
44         [CCode (lower_case_cprefix = "dbus_bus_")]
45         namespace RawBus {
46                 public static RawConnection get (BusType type, ref RawError error);
47         }
49         [CCode (ref_function = "dbus_connection_ref", unref_function = "dbus_connection_unref", cname = "DBusConnection", cprefix = "dbus_connection_")]
50         public class RawConnection {
51                 [CCode (cname = "dbus_connection_setup_with_g_main")]
52                 public void setup_with_main (GLib.MainContext? context = null);
53                 [CCode (cname = "dbus_connection_get_g_connection")]
54                 public unowned Connection get_g_connection ();
55                 [CCode (cname = "dbus_connection_register_g_object")]
56                 public void register_object (string at_path, GLib.Object object);
58                 public bool send (RawMessage message, uint32? client_serial);
59                 public RawMessage send_with_reply_and_block (RawMessage message, int timeout_milliseconds, ref RawError error);
61                 public bool add_filter (RawHandleMessageFunction function, RawFreeFunction? free_data_function = null);
62                 public void remove_filter (RawHandleMessageFunction function);
64                 [CCode (cname = "dbus_bus_add_match")]
65                 public void add_match (string rule, ref RawError error);
66                 [CCode (cname = "dbus_bus_remove_match")]
67                 public void remove_match (string rule, ref RawError error);
68                 [CCode (cname = "dbus_bus_get_unique_name")]
69                 public unowned string get_unique_name();
70                 [CCode (cname = "dbus_bus_request_name")]
71                 public int request_name(string name, uint flags, ref RawError error);
72                 [CCode (cname="dbus_bus_release_name")]
73                 public int release_name(string name, ref RawError error);
74         }
76         [CCode (cname = "DBusError", cprefix = "dbus_error_", destroy_function = "dbus_error_free")]
77         public struct RawError {
78                 public string name;
79                 public string message;
81                 public RawError ();
82                 public bool has_name (string name);
83                 public bool is_set ();
84         }
86         [CCode (cname = "DBusFreeFunction", has_target = false)]
87         public delegate void* RawFreeFunction (void* memory);
88         [CCode (cname = "DBusHandleMessageFunction", instance_pos = -1)]
89         public delegate RawHandlerResult RawHandleMessageFunction(RawConnection connection, RawMessage message);
91         [CCode (cname = "DBusHandlerResult", cprefix = "DBUS_HANDLER_RESULT_")]
92         public enum RawHandlerResult {
93                 HANDLED,
94                 NOT_YET_HANDLED,
95                 NEED_MEMORY
96         }
98         [CCode (cname = "DBusMessageIter", cprefix = "dbus_message_iter_")]
99         public struct RawMessageIter {
100                 public bool has_next ();
101                 public bool next ();
102                 public string get_signature ();
103                 public int get_arg_type ();
104                 public int get_element_type ();
105                 public void recurse (RawMessageIter sub);
106                 public void get_basic (void* value);
107                 public bool open_container (RawType arg_type, string? signature, RawMessageIter sub);
108                 public bool close_container (RawMessageIter sub);
109                 public bool append_basic (RawType arg_type, void* value);
111                 [CCode (cname = "dbus_message_type_from_string")]
112                 public static int type_from_string (string type);
113                 [CCode (cname = "dbus_message_type_to_string")]
114                 public static string type_to_string (int type);
115         }
117         [CCode (ref_function = "dbus_message_ref", unref_function = "dbus_message_unref", cname = "DBusMessage", cprefix = "dbus_message_")]
118         public class RawMessage {
119                 [CCode (cname = "dbus_message_new_method_call")]
120                 public RawMessage.call (string bus_name, string path, string interface, string method);
121                 [CCode (sentinel = "DBUS_TYPE_INVALID")]
122                 public bool append_args (RawType first_arg_type, ...);
123                 [CCode (cname = "dbus_message_iter_init")]
124                 public bool iter_init (RawMessageIter iter);
125                 [CCode (cname = "dbus_message_iter_init_append")]
126                 public bool iter_init_append (RawMessageIter iter);
128                 public RawMessageType get_type ();
129                 public bool   set_path (string object_path);
130                 public unowned string get_path ();
131                 public bool   has_path (string object_path);
132                 public bool   set_interface (string iface);
133                 public unowned string get_interface ();
134                 public bool   has_interface (string iface);
135                 public bool   set_member (string member);
136                 public unowned string get_member ();
137                 public bool   has_member (string member);
138                 public bool   set_error_name (string name);
139                 public unowned string get_error_name ();
140                 public bool   set_destination (string destination);
141                 public unowned string get_destination ();
142                 public bool   set_sender (string sender);
143                 public unowned string get_sender ();
144                 public unowned string get_signature ();
145                 public void   set_no_reply (bool no_reply);
146                 public bool   get_no_reply ();
147                 public bool   is_method_call (string iface, string method);
148                 public bool   is_signal (string iface, string signal_name);
149                 public bool   is_error (string error_name);
150                 public bool   has_destination (string bus_name);
151                 public bool   has_sender (string unique_bus_name);
152                 public bool   has_signature (string signature);
153                 public uint32 get_serial ();
154                 public void   set_serial (uint32 serial);
155                 public bool   set_reply_serial (uint32 reply_serial);
156                 public uint32 get_reply_serial ();
157                 public void   set_auto_start (bool auto_start);
158                 public bool   get_auto_start ();
159                 public bool   get_path_decomposed (out char[] path );
160         }
162         [CCode (cname = "int", cprefix = "DBUS_MESSAGE_TYPE_")]
163         public enum RawMessageType {
164                 INVALID,
165                 METHOD_CALL,
166                 METHOD_RETURN,
167                 ERROR,
168                 SIGNAL
169         }
171         [CCode (cname = "int", cprefix = "DBUS_TYPE_")]
172         public enum RawType {
173                 INVALID,
174                 BYTE,
175                 BOOLEAN,
176                 INT16,
177                 UINT16,
178                 INT32,
179                 UINT32,
180                 INT64,
181                 UINT64,
182                 DOUBLE,
183                 STRING,
184                 OBJECT_PATH,
185                 SIGNATURE,
186                 ARRAY,
187                 VARIANT,
188                 STRUCT,
189                 DICT_ENTRY,
190         }
192         [DBus (name = "org.freedesktop.DBus.Error")]
193         [CCode (cname = "DBusGError", lower_case_csuffix = "gerror", cprefix = "DBUS_GERROR_")]
194         public errordomain Error {
195                 FAILED,
196                 NO_MEMORY,
197                 SERVICE_UNKNOWN,
198                 NAME_HAS_NO_OWNER,
199                 NO_REPLY,
200                 [DBus (name = "IOError")]
201                 IO_ERROR,
202                 BAD_ADDRESS,
203                 NOT_SUPPORTED,
204                 LIMITS_EXCEEDED,
205                 ACCESS_DENIED,
206                 AUTH_FAILED,
207                 NO_SERVER,
208                 TIMEOUT,
209                 NO_NETWORK,
210                 ADDRESS_IN_USE,
211                 DISCONNECTED,
212                 INVALID_ARGS,
213                 FILE_NOT_FOUND,
214                 FILE_EXISTS,
215                 UNKNOWN_METHOD,
216                 TIMED_OUT,
217                 MATCH_RULE_NOT_FOUND,
218                 MATCH_RULE_INVALID,
219                 [DBus (name = "Spawn.ExecFailed")]
220                 SPAWN_EXEC_FAILED,
221                 [DBus (name = "Spawn.ForkFailed")]
222                 SPAWN_FORK_FAILED,
223                 [DBus (name = "Spawn.ChildExited")]
224                 SPAWN_CHILD_EXITED,
225                 [DBus (name = "Spawn.ChildSignaled")]
226                 SPAWN_CHILD_SIGNALED,
227                 [DBus (name = "Spawn.Failed")]
228                 SPAWN_FAILED,
229                 UNIX_PROCESS_ID_UNKNOWN,
230                 INVALID_SIGNATURE,
231                 INVALID_FILE_CONTENT,
232                 [DBus (name = "SELinuxSecurityContextUnknown")]
233                 SELINUX_SECURITY_CONTEXT_UNKNOWN,
234                 REMOTE_EXCEPTION
235         }
237         public struct Bus {
238                 [CCode (cname = "dbus_g_bus_get")]
239                 public static Connection get (BusType type) throws Error;
240         }
242         [Compact]
243         [CCode (ref_function = "dbus_g_connection_ref", unref_function = "dbus_g_connection_unref", cname = "DBusGConnection")]
244         public class Connection {
245                 [CCode (cname = "dbus_g_connection_open")]
246                 public Connection (string address) throws Error;
247                 [CCode (cname = "dbus_g_proxy_new_for_name")]
248                 public Object get_object (string name, string path, string? interface_ = null);
249                 [CCode (cname="dbus_g_proxy_new_for_name_owner")]
250                 public Object get_object_for_name_owner (string name, string path, string? interface_ = null) throws Error;
251                 [CCode (cname = "dbus_g_proxy_new_from_type")]
252                 public GLib.Object get_object_from_type (string name, string path, string interface_, GLib.Type type);
253                 [CCode (cname = "dbus_g_connection_register_g_object")]
254                 public void register_object (string at_path, GLib.Object object);
255                 [CCode (cname = "dbus_g_connection_unregister_g_object")]
256                 public void unregister_object (GLib.Object object);
257                 [CCode (cname = "dbus_g_connection_lookup_g_object")]
258                 public unowned GLib.Object lookup_object (string at_path);
259                 [CCode (cname = "dbus_g_connection_get_connection")]
260                 public unowned RawConnection get_connection ();
261         }
263         [CCode (cname = "DBusGProxy", lower_case_csuffix = "g_proxy")]
264         public class Object : GLib.Object {
265                 public bool call (string method, out GLib.Error error, GLib.Type first_arg_type, ...);
266                 public unowned ProxyCall begin_call (string method, ProxyCallNotify notify, GLib.DestroyNotify destroy, GLib.Type first_arg_type, ...);
267                 public bool end_call (ProxyCall call, out GLib.Error error, GLib.Type first_arg_type, ...);
268                 public void cancel_call (ProxyCall call);
269                 public unowned string get_path ();
270                 public unowned string get_bus_name ();
271                 public unowned string get_interface ();
272                 public GLib.HashTable<string,GLib.Value?> get_all (string interface_name) throws DBus.Error;
274                 public signal void destroy ();
275         }
277         [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "DBUS_TYPE_G_OBJECT_PATH", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed", type_signature = "o")]
278         public class ObjectPath : string {
279                 [CCode (cname = "g_strdup")]
280                 public ObjectPath (string path);
281         }
283         [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string")]
284         public class BusName : string {
285                 [CCode (cname = "g_strdup")]
286                 public BusName (string bus_name);
287         }
289         [CCode (cname = "DBusGProxyCallNotify")]
290         public delegate void ProxyCallNotify (Object obj, ProxyCall call_id);
292         [CCode (cname = "DBusGProxyCall")]
293         public class ProxyCall {
294         }
296         [CCode (cname = "DBusGMethodInvocation")]
297         public class MethodInvocation {
298         }
300         [Flags]
301         [CCode (cname = "uint")]
302         public enum NameFlag {
303                 ALLOW_REPLACEMENT,
304                 REPLACE_EXISTING,
305                 DO_NOT_QUEUE
306         }
308         [CCode (cname = "int")]
309         public enum RequestNameReply {
310                 PRIMARY_OWNER,
311                 IN_QUEUE,
312                 EXISTS,
313                 ALREADY_OWNER
314         }