libosso.h

Go to the documentation of this file.
00001 
00026 #ifndef LIBOSSO_H_
00027 #define LIBOSSO_H_
00028 
00029 #include <glib.h>
00030 #include <time.h>
00031 #include <syslog.h>
00032 
00033 #define DBUS_API_SUBJECT_TO_CHANGE
00034 
00035 #include <dbus/dbus.h>
00036 #include <dbus/dbus-protocol.h>
00037 
00038 G_BEGIN_DECLS
00039 
00040 
00044 typedef enum {
00045   OSSO_OK = 0, 
00046   OSSO_ERROR = -1, 
00047   OSSO_INVALID = -2, 
00048   OSSO_RPC_ERROR = -4, 
00049   OSSO_ERROR_NAME = -3,
00050   OSSO_ERROR_NO_STATE = -5, 
00051   OSSO_ERROR_STATE_SIZE = -6 
00053 } osso_return_t;
00054 
00055 
00063 typedef struct osso_af_context_t osso_context_t;
00064 
00088 osso_context_t * osso_initialize(const gchar *application,
00089                                  const gchar* version,
00090                                  gboolean activation,
00091                                  GMainContext *context);
00099 void osso_deinitialize(osso_context_t *osso);
00100 
00101 /* @} */
00102 /************************************************************************/
00108 /* @{*/
00109 
00114 typedef struct {
00115   int type; 
00116   union {
00117     guint32 u; 
00118     gint32 i; 
00119     gboolean b; 
00120     gdouble d; 
00121     gchar *s; 
00122   } value; 
00123 }
00124 osso_rpc_t;
00125 
00140 void osso_rpc_free_val (osso_rpc_t *rpc);
00141 
00160 typedef gint (osso_rpc_cb_f)(const gchar *interface, const gchar *method,
00161                              GArray *arguments, gpointer data,
00162                              osso_rpc_t *retval);
00163 
00176 typedef void (osso_rpc_async_f)(const gchar *interface,
00177                                 const gchar *method,
00178                                 osso_rpc_t *retval, gpointer data);
00179 
00226 osso_return_t osso_rpc_run (osso_context_t * osso, const gchar * service,
00227                             const gchar * object_path,
00228                             const gchar * interface, const gchar * method,
00229                             osso_rpc_t * retval, int argument_type, ...);
00230 
00237 typedef void osso_rpc_argfill (DBusMessage *msg, void *data);
00238 
00254 osso_return_t osso_rpc_run_with_argfill (osso_context_t * osso,
00255                                          const gchar * service,
00256                                          const gchar * object_path,
00257                                          const gchar * interface,
00258                                          const gchar * method,
00259                                          osso_rpc_t * retval,
00260                                          osso_rpc_argfill *argfill,
00261                                          gpointer argfill_data);
00262 
00267 osso_return_t osso_rpc_run_system (osso_context_t * osso, const gchar * service,
00268                             const gchar * object_path,
00269                             const gchar * interface, const gchar * method,
00270                             osso_rpc_t * retval, int argument_type, ...);
00271 
00272 /* See #osso_rpc_run_with_argfill.  The RPC call is sent on the system
00273  * bus instead.
00274  *
00275  * WARNING: Using this function is not recommended, because it will
00276  * make your program more dependent on the DBus API due to the
00277  * appending of arguments to a DBusMessage.
00278  */
00279 osso_return_t osso_rpc_run_system_with_argfill (osso_context_t * osso,
00280                                                 const gchar * service,
00281                                                 const gchar * object_path,
00282                                                 const gchar * interface,
00283                                                 const gchar * method,
00284                                                 osso_rpc_t *retval,
00285                                                 osso_rpc_argfill *argfill,
00286                                                 gpointer argfill_data);
00287 
00319 osso_return_t osso_rpc_run_with_defaults (osso_context_t * osso,
00320                                           const gchar * application,
00321                                           const gchar * method,
00322                                           osso_rpc_t * retval,
00323                                           int argument_type, ...);
00324 
00353 osso_return_t osso_rpc_async_run (osso_context_t * osso,
00354                                   const gchar * service,
00355                                   const gchar * object_path,
00356                                   const gchar * interface,
00357                                   const gchar * method,
00358                                   osso_rpc_async_f * async_cb, gpointer data,
00359                                   int argument_type, ...);
00360 
00376 osso_return_t osso_rpc_async_run_with_argfill (osso_context_t * osso,
00377                                                const gchar * service,
00378                                                const gchar * object_path,
00379                                                const gchar * interface,
00380                                                const gchar * method,
00381                                                osso_rpc_async_f * async_cb,
00382                                                gpointer data,
00383                                                osso_rpc_argfill *argfill,
00384                                                gpointer argfill_data);
00385 
00415 osso_return_t osso_rpc_async_run_with_defaults (osso_context_t * osso,
00416                                                 const gchar * application,
00417                                                 const gchar * method,
00418                                                 osso_rpc_async_f * async_cb,
00419                                                 gpointer data,
00420                                                 int argument_type, ...);
00421 
00427 typedef void osso_rpc_retval_free_f (osso_rpc_t *retval);
00428 
00449 osso_return_t osso_rpc_set_cb_f_with_free (osso_context_t * osso, const gchar * service,
00450                                            const gchar * object_path,
00451                                            const gchar * interface, osso_rpc_cb_f * cb,
00452                                            gpointer data,
00453                                            osso_rpc_retval_free_f *retval_free);
00454 
00458 osso_return_t osso_rpc_set_cb_f (osso_context_t * osso, const gchar * service,
00459                                  const gchar * object_path,
00460                                  const gchar * interface, osso_rpc_cb_f * cb,
00461                                  gpointer data);
00462 
00475 osso_return_t osso_rpc_set_default_cb_f_with_free (osso_context_t * osso,
00476                                                    osso_rpc_cb_f * cb, gpointer data,
00477                                                    osso_rpc_retval_free_f *retval_free);
00478 
00482 osso_return_t osso_rpc_set_default_cb_f (osso_context_t * osso,
00483                                          osso_rpc_cb_f * cb, gpointer data);
00484 
00485 
00498 osso_return_t osso_rpc_unset_cb_f (osso_context_t * osso,
00499                                    const gchar * service,
00500                                    const gchar * object_path,
00501                                    const gchar * interface,
00502                                    osso_rpc_cb_f * cb, gpointer data);
00503 
00513 osso_return_t osso_rpc_unset_default_cb_f (osso_context_t * osso,
00514                                            osso_rpc_cb_f * cb, gpointer data);
00515 
00522 osso_return_t osso_rpc_get_timeout (osso_context_t * osso, gint * timeout);
00523 
00530 osso_return_t osso_rpc_set_timeout(osso_context_t * osso, gint timeout);
00531 
00532 /* @}*/
00533 /**********************************************************************/
00618 osso_return_t osso_application_top(osso_context_t *osso,
00619                                    const gchar *application,
00620                                    const gchar *arguments);
00621 
00633 typedef void(osso_application_top_cb_f)(const gchar *arguments,
00634                                         gpointer data);
00635 
00648 osso_return_t osso_application_set_top_cb(osso_context_t *osso,
00649                                           osso_application_top_cb_f *cb,
00650                                           gpointer data);
00651 
00664 osso_return_t osso_application_unset_top_cb(osso_context_t *osso,
00665                                             osso_application_top_cb_f *cb,
00666                                             gpointer data);
00667 
00668 /**********************************************************************/
00669 /* @}*/
00695 
00701 typedef void(osso_application_autosave_cb_f)(gpointer data);
00702 
00713 osso_return_t osso_application_set_autosave_cb(osso_context_t *osso,
00714                                                osso_application_autosave_cb_f *cb,
00715                                                gpointer data);
00716 
00727 osso_return_t osso_application_unset_autosave_cb(osso_context_t *osso,
00728                                                  osso_application_autosave_cb_f *cb,
00729                                                  gpointer data);
00730 
00742 osso_return_t osso_application_userdata_changed(osso_context_t *osso);
00743 
00752 osso_return_t osso_application_autosave_force(osso_context_t *osso);
00753 
00754 /*
00755  * Returns the application name of a Libosso context.
00756  * @param osso The library context as returned by #osso_initialize.
00757  * @return The name of the parent application, or NULL if the context
00758  * is invalid.
00759  */
00760 const gchar * osso_application_name_get(osso_context_t *osso);
00761 
00762 /*
00763  * Returns the application version of a Libosso context.
00764  * @param osso The library context as returned by #osso_initialize.
00765  * @return The version of the application, or NULL if the context is
00766  * invalid.
00767  */
00768 const gchar * osso_application_version_get(osso_context_t *osso);
00769 
00772 /**********************************************************************/
00776 /* @{*/
00777 
00797 osso_return_t osso_statusbar_send_event(osso_context_t *osso,
00798                                         const gchar *name,
00799                                         gint argument1, gint argument2,
00800                                         const gchar *argument3,
00801                                         osso_rpc_t *retval);
00802 
00803 /* @}*/
00807 /* @{*/
00808 
00813 typedef void(osso_time_cb_f)(gpointer data);
00814 
00825 osso_return_t osso_time_set_notification_cb(osso_context_t *osso,
00826                                             osso_time_cb_f *cb,
00827                                             gpointer data);
00838 osso_return_t osso_time_set(osso_context_t *osso, time_t new_time);
00839 
00840 /* @}*/
00844 /* @{*/
00845 
00876 typedef void(osso_locale_change_cb_f)(const char *new_locale, gpointer data);
00877 
00888 osso_return_t osso_locale_change_set_notification_cb(osso_context_t *osso,
00889                                             osso_locale_change_cb_f *cb,
00890                                             gpointer data);
00891 
00902 osso_return_t osso_locale_set(osso_context_t *osso, char *new_locale);
00903 
00904 /* @}*/
00908 /* @{*/
00909 
00914 typedef enum {
00915   OSSO_GN_WARNING = 0, 
00916   OSSO_GN_ERROR,         
00917   OSSO_GN_NOTICE,        
00918   OSSO_GN_WAIT
00919 } osso_system_note_type_t;
00920 
00942 osso_return_t osso_system_note_dialog(osso_context_t *osso,
00943                                       const gchar *message,
00944                                       osso_system_note_type_t type,
00945                                       osso_rpc_t *retval);
00946 
00962 osso_return_t osso_system_note_infoprint(osso_context_t *osso,
00963                                          const gchar *text,
00964                                          osso_rpc_t *retval);
00965 
00966 /* @}*/
00967 /**********************************************************************/
01078 /* @{*/
01079 
01083 typedef struct {
01084   guint32 state_size; 
01085   gpointer state_data; 
01086 } osso_state_t;
01087 
01118 osso_return_t osso_state_write(osso_context_t *osso, osso_state_t *state);
01119 
01158 osso_return_t osso_state_read(osso_context_t *osso, osso_state_t *state);
01159 
01160 
01161 /* @}*/
01162 /**********************************************************************/
01166 /* @{*/
01183 osso_return_t osso_cp_plugin_execute(osso_context_t *osso,
01184                                      const gchar *filename,
01185                                      gpointer data, gboolean user_activated);
01186 
01197 osso_return_t osso_cp_plugin_save_state(osso_context_t *osso,
01198                                         const gchar *filename,
01199                                         gpointer data);
01200 /* @}*/
01201 /**********************************************************************/
01208 typedef enum {
01209   OSSO_DEVMODE_NORMAL = 0, /* Normal mode */
01210   OSSO_DEVMODE_FLIGHT,     /* Flight mode */
01211   OSSO_DEVMODE_OFFLINE,    /* Offline mode; unsupported! */
01212   OSSO_DEVMODE_INVALID     /* Should *never* occur! */
01213 } osso_devmode_t;
01214 
01215 
01222 typedef struct {
01223   gboolean shutdown_ind; 
01224   gboolean save_unsaved_data_ind; 
01226   gboolean memory_low_ind; 
01227   gboolean system_inactivity_ind; 
01230   osso_devmode_t sig_device_mode_ind; 
01231 } osso_hw_state_t;
01232 
01233 
01244 osso_return_t osso_display_state_on(osso_context_t *osso);
01245 
01257 osso_return_t osso_display_blanking_pause(osso_context_t *osso);
01258 
01266 typedef void (osso_hw_cb_f)(osso_hw_state_t *state, gpointer data);
01267 
01283 osso_return_t osso_hw_set_event_cb(osso_context_t *osso,
01284                                    osso_hw_state_t *state,
01285                                    osso_hw_cb_f *cb, gpointer data);
01286 
01295 osso_return_t osso_hw_unset_event_cb(osso_context_t *osso,
01296                                      osso_hw_state_t *state);
01297 
01298 
01299 typedef enum {
01300   OSSO_DISPLAY_ON,
01301   OSSO_DISPLAY_OFF,
01302   OSSO_DISPLAY_DIMMED
01303 } osso_display_state_t;
01304 
01305 typedef void(osso_display_event_cb_f)(osso_display_state_t state,
01306                                       gpointer data);
01307 
01319 osso_return_t osso_hw_set_display_event_cb(osso_context_t *osso,
01320                                            osso_display_event_cb_f *cb,
01321                                            gpointer data);
01322 
01324 /**********************************************************************/
01329 
01338 typedef void (osso_mime_cb_f)(gpointer data, int argc, gchar **argv);
01339 
01352 osso_return_t osso_mime_set_cb(osso_context_t *osso, osso_mime_cb_f *cb,
01353                                gpointer data);
01354 
01363 osso_return_t osso_mime_unset_cb(osso_context_t *osso);
01364 
01365 osso_return_t osso_mime_unset_cb_full(osso_context_t *osso,
01366                                       osso_mime_cb_f *cb, gpointer data);
01375 gpointer osso_get_dbus_connection(osso_context_t *osso);
01376 
01377 
01384 gpointer osso_get_sys_dbus_connection(osso_context_t *osso);
01385 
01387 G_END_DECLS
01388 
01389 #endif /* LIBOSSO_H_*/

Generated on Wed Jan 16 15:51:04 2008 for Libosso by  doxygen 1.5.1