4 * Copyright (C) 2007 Instituto Nokia de Tecnologia
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.
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.
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
21 * Marcelo Lira dos Santos <setanta@gmail.com>
26 * 2009-02-16: Jukka-Pekka Iivonen <jukka-pekka.iivonen@nokia.com>
28 * * Context.rpc_async_run: changed the async_cb type to RpcAsync?.
29 * Context.rpc_async_run_with_defaults: same here
32 * 2009-02-10: Jukka-Pekka Iivonen <jukka-pekka.iivonen@nokia.com>
34 * * Converted 'pointer' to 'void*'.
36 * * Changed the name of Osso.Error to Osso.Status.
38 * * Changed the type of 4th argument of Context.Context ().
40 * * Made all fields of HWState public.
42 * * Removed all argfill functions.
45 * Initial code based on r78 from
47 * http://code.google.com/p/setanta-labs/source/browse/trunk/vala/osso/libosso.vala
50 [CCode (cheader_filename = "libosso.h")]
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);
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);
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);
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);
109 public Status system_note_dialog (string message, SystemNoteType type, out Rpc retval);
110 public Status system_note_infoprint (string text, out Rpc retval);
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);
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);
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);
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);
144 public void* get_dbus_connection ();
145 public void* get_sys_dbus_connection ();
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);
172 [CCode (cname = "osso_state_t")]
173 public struct State {
174 public uint32 state_size;
175 public void* state_data;
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;
187 [CCode (destroy_function = "osso_rpc_free_val", cname = "osso_rpc_t")]
190 [CCode (cname = "value.u")]
192 [CCode (cname = "value.i")]
194 [CCode (cname = "value.b")]
196 [CCode (cname = "value.d")]
198 [CCode (cname = "value.s")]
200 public uint32 to_uint32 () requires (type == 'u') {
203 public int32 to_int32 () requires (type == 'i') {
206 public bool to_bool () requires (type == 'b') {
209 public double to_double () requires (type == 'd') {
212 public unowned string to_string () requires (type == 's') {
218 [CCode (cname = "osso_return_t", cprefix = "OSSO_")]
229 [CCode (cname = "osso_system_note_type_t", cprefix = "OSSO_GN_")]
230 public enum SystemNoteType {
237 [CCode (cname = "osso_devmode_t", cprefix = "OSSO_DEVMODE_")]
238 public enum DevMode {
245 [CCode (cname = "osso_display_state_t", cprefix = "OSSO_DISPLAY_")]
246 public enum DisplayState {
252 [CCode (cprefix = "GDK_", has_type_id = false, cheader_filename = "gdk/gdkkeysyms.h")]
258 [CCode (cname = "GDK_Return")]
260 [CCode (cname = "GDK_F6")]
262 [CCode (cname = "GDK_F7")]
264 [CCode (cname = "GDK_F8")]
266 [CCode (cname = "GDK_Escape")]
268 [CCode (cname = "GDK_F4")]
270 [CCode (cname = "GDK_F5")]
272 [CCode (cname = "GDK_Execute")]