Revert "codegen: Don't implicitly initialize local variables with an initializer"
[vala-gnome.git] / vapi / libosso.vapi
blob3194021387d673593b6d417a03f4a161a58fc276
1 /*
2  * libosso.vapi
3  *
4  * Copyright (C) 2007 Instituto Nokia de Tecnologia
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
19  *
20  * Author:
21  *     Marcelo Lira dos Santos <setanta@gmail.com>
22  *
23  *
24  * ChangeLog:
25  *
26  * 2009-02-16: Jukka-Pekka Iivonen <jukka-pekka.iivonen@nokia.com>
27  *
28  *           * Context.rpc_async_run: changed the async_cb type to RpcAsync?.
29  *             Context.rpc_async_run_with_defaults: same here
30  *
31  *
32  * 2009-02-10: Jukka-Pekka Iivonen <jukka-pekka.iivonen@nokia.com>
33  *
34  *           * Converted 'pointer' to 'void*'.
35  *
36  *           * Changed the name of Osso.Error to Osso.Status.
37  *
38  *           * Changed the type of 4th argument of Context.Context ().
39  *
40  *           * Made all fields of HWState public.
41  *
42  *           * Removed all argfill functions.
43  *
44  *
45  * Initial code based on r78 from
46  *
47  *     http://code.google.com/p/setanta-labs/source/browse/trunk/vala/osso/libosso.vala
48  */
50 [CCode (cheader_filename = "libosso.h")]
51 namespace Osso {
53         [CCode (ref_function = "osso_initialize", unref_function = "osso_deinitialize", cname = "osso_context_t", cprefix = "osso_", cheader_filename = "libosso.h")]
54         public class Context {
55                 [CCode (cname = "osso_initialize")]
56                 public Context (string application, string version, bool activation, GLib.MainContext? context);
58                 /* RPC */
59                 public Status rpc_run (string service, string object_path, string iface, string method, out Rpc retval, int argument_type, ...);
60                 public Status rpc_run_system (string service, string object_path, string iface, string method, out Rpc retval, int argument_type, ...);
61                 public Status rpc_run_with_defaults (string application, string method, out Rpc retval, int argument_type, ...);
62                 public Status rpc_async_run (string service, string object_path, string iface, string method, RpcAsync? async_callback, void* data, int argument_type, ...);
63                 public Status rpc_async_run_with_defaults (string application, string method, RpcAsync? async_callback, void* data,int argument_type, ...);
64                 [CCode (cname = "osso_rpc_set_cb_f")]
65                 public Status set_rpc_callback (string service, string object_path, string iface, RpcCallback cb, void* data);
66                 [CCode (cname = "osso_rpc_set_default_cb_f")]
67                 public Status set_rpc_default_callback (RpcCallback cb, void* data);
68                 [CCode (cname = "osso_rpc_unset_cb_f")]
69                 public Status unset_rpc_callback (string service, string object_path, string iface, RpcCallback cb, void* data);
70                 [CCode (cname = "osso_rpc_unset_default_cb_f")]
71                 public Status unset_rpc_default_callback (RpcCallback cb, void* data);
72                 [CCode (cname = "osso_rpc_get_timeout")]
73                 public Status get_rpc_timeout (ref int timeout);
74                 [CCode (cname = "osso_rpc_set_timeout")]
75                 public Status set_rpc_timeout (int timeout);
77                 /* Application */
78                 public Status application_top (string application, string arguments);
79                 [CCode (cname = "osso_application_set_top_callback")]
80                 public Status set_application_top_callback (ApplicationTopCallback cb, void* data);
81                 [CCode (cname = "osso_application_unset_top_callback")]
82                 public Status unset_application_top_callback (ApplicationTopCallback cb, void* data);
83                 [CCode (cname = "osso_application_set_autosave_callback")]
84                 public Status set_application_autosave_callback (ApplicationAutosaveCallback cb, void* data);
85                 [CCode (cname = "osso_application_unset_autosave_callback")]
86                 public Status unset_application_autosave_callback (ApplicationAutosaveCallback cb, void* data);
87                 public Status application_userdata_changed ();
88                 public Status application_autosave_force ();
89                 [CCode (cname = "osso_application_name_get")]
90                 public string get_application_name ();
91                 [CCode (cname = "osso_application_version_get")]
92                 public string get_application_version ();
94                 public Status statusbar_send_event (string name, int argument1, int argument2, string argument3, out Rpc retval);
96                 /* Time Notification */
97                 [CCode (cname = "osso_time_set_notification_cb")]
98                 public Status set_time_notification_callback (TimeCallback cb, void* data);
99                 //[CCode (cname = "osso_time_set")]
100                 //public Status set_time (time_t new_time);
102                 /* Locale */
103                 [CCode (cname = "osso_locale_change_set_notification_cb")]
104                 public Status set_locale_change_notification_callback (LocaleChangeCallback cb, void* data);
105                 [CCode (cname = "osso_locale_set")]
106                 public Status set_locale (string new_locale);
108                 /* System Note */
109                 public Status system_note_dialog (string message, SystemNoteType type, out Rpc retval);
110                 public Status system_note_infoprint (string text, out Rpc retval);
112                 /* State Saving */
113                 [CCode (cname = "osso_state_write")]
114                 public Status state_write (ref State state);
115                 [CCode (cname = "osso_state_read")]
116                 public Status state_read (ref State state);
118                 /* Plugin */
119                 [CCode (cname = "osso_cp_plugin_execute")]
120                 public Status plugin_execute (string filename, void* data, bool user_activated);
121                 [CCode (cname = "osso_cp_plugin_execute")]
122                 public Status plugin_save (string filename, void* data);
124                 /* Device State */
125                 public Status display_state_on ();
126                 public Status display_blanking_pause ();
128                 [CCode (cname = "osso_hw_set_event_cb")]
129                 public Status set_hw_event_callback (void* state, HWCallback cb, void* data);
130                 [CCode (cname = "osso_hw_unset_event_cb")]
131                 public Status unset_hw_event_callback (ref HWState state, void* data);
132                 [CCode (cname = "osso_hw_set_display_event_cb")]
133                 public Status set_hw_display_event_callback (DisplayEventCallback cb, void* data);
135                 /* Mime */
136                 [CCode (cname = "osso_mime_set_cb")]
137                 public Status set_mime_callback (MimeCallback cb, void* data);
138                 [CCode (cname = "osso_mime_unset_cb")]
139                 public Status unset_mime_callback ();
140                 [CCode (cname = "osso_mime_unset_cb_full")]
141                 public Status unset_mime_callback_full (MimeCallback cb, void* data);
143                 /* DBus */
144                 public void* get_dbus_connection ();
145                 public void* get_sys_dbus_connection ();
146         }
148         /* Callbacks */
149         [CCode (cname = "osso_rpc_cb_f", has_target = false)]
150         public delegate int RpcCallback (string iface, string method, GLib.Array arguments, void* data, out Rpc rpc);
151         [CCode (cname = "osso_rpc_async_f", has_target = false)]
152         public delegate int RpcAsync (string iface, string method, out Rpc rpc, void* data);
154         [CCode (cname = "osso_application_top_cb_f", has_target = false)]
155         public delegate void ApplicationTopCallback (string arguments, void* data);
156         [CCode (cname = "osso_application_autosave_cb_f", has_target = false)]
157         public delegate void ApplicationAutosaveCallback (void* data);
158         [CCode (cname = "osso_time_cb_f", has_target = false)]
159         public delegate void TimeCallback (void* data);
160         [CCode (cname = "osso_locale_change_cb_f", has_target = false)]
161         public delegate void LocaleChangeCallback (string new_locale, void* data);
162         [CCode (cname = "osso_display_event_cb_f", has_target = false)]
163         public delegate void DisplayEventCallback (DisplayState state, void* data);
165         [CCode (cname = "osso_hw_cb_f*", has_target = false)]
166         public delegate void HWCallback (ref HWState state, void* data);
168         [CCode (cname = "osso_mime_cb_f", has_target = false)]
169         public delegate void MimeCallback (void* data, string[] args);
171         /* Structs */
172         [CCode (cname = "osso_state_t")]
173         public struct State {
174                 public uint32 state_size;
175                 public void* state_data;
176         }
178         [CCode (cname = "osso_hw_state_t")]
179         public struct HWState {
180                 public bool shutdown_ind;
181                 public bool save_unsaved_data_ind;
182                 public bool memory_low_ind;
183                 public bool system_inactivity_ind;
184                 public DevMode sig_device_mode_ind;
185         }
187         [CCode (destroy_function = "osso_rpc_free_val", cname = "osso_rpc_t")]
188         public struct Rpc {
189                 public int type;
190                 [CCode (cname = "value.u")]
191                 private uint32 u;
192                 [CCode (cname = "value.i")]
193                 private int32 i;
194                 [CCode (cname = "value.b")]
195                 private bool b;
196                 [CCode (cname = "value.d")]
197                 private double d;
198                 [CCode (cname = "value.s")]
199                 private string s;
200                 public uint32 to_uint32 () requires (type == 'u') {
201                         return u;
202                 }
203                 public int32 to_int32 () requires (type == 'i') {
204                         return i;
205                 }
206                 public bool to_bool () requires (type == 'b') {
207                         return b;
208                 }
209                 public double to_double () requires (type == 'd') {
210                         return d;
211                 }
212                 public unowned string to_string () requires (type == 's') {
213                         return s;
214                 }
215         }
217         /* Enums */
218         [CCode (cname = "osso_return_t", cprefix = "OSSO_")]
219         public enum Status {
220                 OK,
221                 ERROR,
222                 INVALID,
223                 RPC_ERROR,
224                 ERROR_NAME,
225                 ERROR_NO_STATE,
226                 ERROR_STATE_SIZE
227         }
229         [CCode (cname = "osso_system_note_type_t", cprefix = "OSSO_GN_")]
230         public enum SystemNoteType {
231                 WARNING,
232                 ERROR,
233                 NOTICE,
234                 WAIT
235         }
237         [CCode (cname = "osso_devmode_t", cprefix = "OSSO_DEVMODE_")]
238         public enum DevMode {
239                 NORMAL,
240                 FLIGHT,
241                 OFFLINE,
242                 INVALID
243         }
245         [CCode (cname = "osso_display_state_t", cprefix = "OSSO_DISPLAY_")]
246         public enum DisplayState {
247                 ON,
248                 OFF,
249                 DIMMED
250         }
252         [CCode (cprefix = "GDK_", has_type_id = false, cheader_filename = "gdk/gdkkeysyms.h")]
253         public enum KeySym {
254                 Up,
255                 Down,
256                 Left,
257                 Right,
258                 [CCode (cname = "GDK_Return")]
259                 Select,
260                 [CCode (cname = "GDK_F6")]
261                 FullScreen,
262                 [CCode (cname = "GDK_F7")]
263                 ZoomIn,
264                 [CCode (cname = "GDK_F8")]
265                 ZoomOut,
266                 [CCode (cname = "GDK_Escape")]
267                 Close,
268                 [CCode (cname = "GDK_F4")]
269                 OpenMenu,
270                 [CCode (cname = "GDK_F5")]
271                 ShowHome,
272                 [CCode (cname = "GDK_Execute")]
273                 Power
274         }