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",
54 unref_function = "osso_deinitialize", cname = "osso_context_t",
55 cprefix = "osso_", cheader_filename = "libosso.h")]
56 public class Context {
57 [CCode (cname = "osso_initialize")]
58 public Context (string application, string version, bool activation,
59 GLib.MainContext? context);
62 public Status rpc_run (string service, string object_path, string iface,
63 string method, out Rpc retval, int argument_type,
65 public Status rpc_run_system (string service, string object_path,
66 string iface, string method,
67 out Rpc retval, int argument_type, ...);
68 public Status rpc_run_with_defaults (string application, string method,
69 out Rpc retval, int argument_type,
71 public Status rpc_async_run (string service, string object_path,
72 string iface, string method,
73 RpcAsync? async_callback, void* data,
74 int argument_type, ...);
75 public Status rpc_async_run_with_defaults (string application,
77 RpcAsync? async_callback,
79 int argument_type, ...);
80 [CCode (cname = "osso_rpc_set_cb_f")]
81 public Status set_rpc_callback (string service, string object_path,
82 string iface, RpcCallback cb,
84 [CCode (cname = "osso_rpc_set_default_cb_f")]
85 public Status set_rpc_default_callback (RpcCallback cb, void* data);
86 [CCode (cname = "osso_rpc_unset_cb_f")]
87 public Status unset_rpc_callback (string service, string object_path,
88 string iface, RpcCallback cb,
90 [CCode (cname = "osso_rpc_unset_default_cb_f")]
91 public Status unset_rpc_default_callback (RpcCallback cb,
93 [CCode (cname = "osso_rpc_get_timeout")]
94 public Status get_rpc_timeout (ref int timeout);
95 [CCode (cname = "osso_rpc_set_timeout")]
96 public Status set_rpc_timeout (int timeout);
99 public Status application_top (string application, string arguments);
100 [CCode (cname = "osso_application_set_top_callback")]
101 public Status set_application_top_callback (ApplicationTopCallback cb,
103 [CCode (cname = "osso_application_unset_top_callback")]
104 public Status unset_application_top_callback (ApplicationTopCallback cb,
106 [CCode (cname = "osso_application_set_autosave_callback")]
107 public Status set_application_autosave_callback (
108 ApplicationAutosaveCallback cb, void* data);
109 [CCode (cname = "osso_application_unset_autosave_callback")]
110 public Status unset_application_autosave_callback (
111 ApplicationAutosaveCallback cb, void* data);
112 public Status application_userdata_changed ();
113 public Status application_autosave_force ();
114 [CCode (cname = "osso_application_name_get")]
115 public string get_application_name ();
116 [CCode (cname = "osso_application_version_get")]
117 public string get_application_version ();
119 public Status statusbar_send_event (string name, int argument1,
120 int argument2, string argument3,
123 /* Time Notification */
124 [CCode (cname = "osso_time_set_notification_cb")]
125 public Status set_time_notification_callback (TimeCallback cb,
127 [CCode (cname = "osso_time_set")]
128 //public Status set_time (time_t new_time);
131 [CCode (cname = "osso_locale_change_set_notification_cb")]
132 public Status set_locale_change_notification_callback (
133 LocaleChangeCallback cb, void* data);
134 [CCode (cname = "osso_locale_set")]
135 public Status set_locale (string new_locale);
138 public Status system_note_dialog (string message, SystemNoteType type,
140 public Status system_note_infoprint (string text, out Rpc retval);
143 [CCode (cname = "osso_state_write")]
144 public Status state_write (ref State state);
145 [CCode (cname = "osso_state_read")]
146 public Status state_read (ref State state);
149 [CCode (cname = "osso_cp_plugin_execute")]
150 public Status plugin_execute (string filename, void* data,
151 bool user_activated);
152 [CCode (cname = "osso_cp_plugin_execute")]
153 public Status plugin_save (string filename, void* data);
156 public Status display_state_on ();
157 public Status display_blanking_pause ();
159 [CCode (cname = "osso_hw_set_event_cb")]
160 public Status set_hw_event_callback (void* state,
161 HWCallback cb, void* data);
162 [CCode (cname = "osso_hw_unset_event_cb")]
163 public Status unset_hw_event_callback (ref HWState state, void* data);
164 [CCode (cname = "osso_hw_set_display_event_cb")]
165 public Status set_hw_display_event_callback (DisplayEventCallback cb,
169 [CCode (cname = "osso_mime_set_cb")]
170 public Status set_mime_callback (MimeCallback cb, void* data);
171 [CCode (cname = "osso_mime_unset_cb")]
172 public Status unset_mime_callback ();
173 [CCode (cname = "osso_mime_unset_cb_full")]
174 public Status unset_mime_callback_full (MimeCallback cb,
178 public void* get_dbus_connection ();
179 public void* get_sys_dbus_connection ();
183 [CCode (cname = "osso_rpc_cb_f")]
184 public static delegate int RpcCallback (string iface, string method,
185 GLib.Array arguments, void* data,
187 [CCode (cname = "osso_rpc_async_f")]
188 public static delegate int RpcAsync (string iface, string method,
189 out Rpc rpc, void* data);
191 [CCode (cname = "osso_application_top_cb_f")]
192 public static delegate void ApplicationTopCallback (string arguments,
194 [CCode (cname = "osso_application_autosave_cb_f")]
195 public static delegate void ApplicationAutosaveCallback (void* data);
196 [CCode (cname = "osso_time_cb_f")]
197 public static delegate void TimeCallback (void* data);
198 [CCode (cname = "osso_locale_change_cb_f")]
199 public static delegate void LocaleChangeCallback (string new_locale,
201 [CCode (cname = "osso_display_event_cb_f")]
202 public static delegate void DisplayEventCallback (DisplayState state,
205 [CCode (cname = "osso_hw_cb_f*")]
206 public static delegate void HWCallback (ref HWState state, void* data);
208 [CCode (cname = "osso_mime_cb_f")]
209 public static delegate void MimeCallback (void* data, string[] args);
212 [CCode (cname = "osso_state_t")]
213 public struct State {
214 public uint32 state_size;
215 public void* state_data;
218 [CCode (cname = "osso_hw_state_t")]
219 public struct HWState {
220 public bool shutdown_ind;
221 public bool save_unsaved_data_ind;
222 public bool memory_low_ind;
223 public bool system_inactivity_ind;
224 public DevMode sig_device_mode_ind;
227 [CCode (unref_function = "osso_rpc_free_val", cname = "osso_rpc_t")]
230 public GLib.Value value;
234 [CCode (cname = "osso_return_t", cprefix = "OSSO_")]
245 [CCode (cname = "osso_system_note_type_t", cprefix = "OSSO_GN_")]
246 public enum SystemNoteType {
253 [CCode (cname = "osso_devmode_t", cprefix = "OSSO_DEVMODE_")]
254 public enum DevMode {
261 [CCode (cname = "osso_display_state_t", cprefix = "OSSO_DISPLAY_")]
262 public enum DisplayState {
268 [CCode (cprefix = "GDK_", has_type_id = "0", cheader_filename = "gdk/gdkkeysyms.h")]
274 [CCode (cname = "GDK_Return")]
276 [CCode (cname = "GDK_F6")]
278 [CCode (cname = "GDK_F7")]
280 [CCode (cname = "GDK_F8")]
282 [CCode (cname = "GDK_Escape")]
284 [CCode (cname = "GDK_F4")]
286 [CCode (cname = "GDK_F5")]
288 [CCode (cname = "GDK_Execute")]