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 
00087 osso_context_t * osso_initialize(const gchar *application,
00088                                  const gchar* version,
00089                                  gboolean activation,
00090                                  GMainContext *context);
00098 void osso_deinitialize(osso_context_t *osso);
00099 
00100 /* @} */
00101 /************************************************************************/
00107 /* @{*/
00108 
00113 typedef struct {
00114   int type; 
00115   union {
00116     guint32 u; 
00117     gint32 i; 
00118     gboolean b; 
00119     gdouble d; 
00120     gchar *s; 
00121   } value; 
00122 }
00123 osso_rpc_t;
00124 
00139 void osso_rpc_free_val (osso_rpc_t *rpc);
00140 
00159 typedef gint (osso_rpc_cb_f)(const gchar *interface, const gchar *method,
00160                              GArray *arguments, gpointer data,
00161                              osso_rpc_t *retval);
00162 
00175 typedef void (osso_rpc_async_f)(const gchar *interface,
00176                                 const gchar *method,
00177                                 osso_rpc_t *retval, gpointer data);
00178 
00225 osso_return_t osso_rpc_run (osso_context_t * osso, const gchar * service,
00226                             const gchar * object_path,
00227                             const gchar * interface, const gchar * method,
00228                             osso_rpc_t * retval, int argument_type, ...);
00229 
00236 typedef void osso_rpc_argfill (DBusMessage *msg, void *data);
00237 
00253 osso_return_t osso_rpc_run_with_argfill (osso_context_t * osso,
00254                                          const gchar * service,
00255                                          const gchar * object_path,
00256                                          const gchar * interface,
00257                                          const gchar * method,
00258                                          osso_rpc_t * retval,
00259                                          osso_rpc_argfill *argfill,
00260                                          gpointer argfill_data);
00261 
00266 osso_return_t osso_rpc_run_system (osso_context_t * osso, const gchar * service,
00267                             const gchar * object_path,
00268                             const gchar * interface, const gchar * method,
00269                             osso_rpc_t * retval, int argument_type, ...);
00270 
00271 /* See #osso_rpc_run_with_argfill.  The RPC call is sent on the system
00272  * bus instead.
00273  *
00274  * WARNING: Using this function is not recommended, because it will
00275  * make your program more dependent on the DBus API due to the
00276  * appending of arguments to a DBusMessage.
00277  */
00278 osso_return_t osso_rpc_run_system_with_argfill (osso_context_t * osso,
00279                                                 const gchar * service,
00280                                                 const gchar * object_path,
00281                                                 const gchar * interface,
00282                                                 const gchar * method,
00283                                                 osso_rpc_t *retval,
00284                                                 osso_rpc_argfill *argfill,
00285                                                 gpointer argfill_data);
00286 
00318 osso_return_t osso_rpc_run_with_defaults (osso_context_t * osso,
00319                                           const gchar * application,
00320                                           const gchar * method,
00321                                           osso_rpc_t * retval,
00322                                           int argument_type, ...);
00323 
00352 osso_return_t osso_rpc_async_run (osso_context_t * osso,
00353                                   const gchar * service,
00354                                   const gchar * object_path,
00355                                   const gchar * interface,
00356                                   const gchar * method,
00357                                   osso_rpc_async_f * async_cb, gpointer data,
00358                                   int argument_type, ...);
00359 
00375 osso_return_t osso_rpc_async_run_with_argfill (osso_context_t * osso,
00376                                                const gchar * service,
00377                                                const gchar * object_path,
00378                                                const gchar * interface,
00379                                                const gchar * method,
00380                                                osso_rpc_async_f * async_cb,
00381                                                gpointer data,
00382                                                osso_rpc_argfill *argfill,
00383                                                gpointer argfill_data);
00384 
00414 osso_return_t osso_rpc_async_run_with_defaults (osso_context_t * osso,
00415                                                 const gchar * application,
00416                                                 const gchar * method,
00417                                                 osso_rpc_async_f * async_cb,
00418                                                 gpointer data,
00419                                                 int argument_type, ...);
00420 
00426 typedef void osso_rpc_retval_free_f (osso_rpc_t *retval);
00427 
00448 osso_return_t osso_rpc_set_cb_f_with_free (osso_context_t * osso, const gchar * service,
00449                                            const gchar * object_path,
00450                                            const gchar * interface, osso_rpc_cb_f * cb,
00451                                            gpointer data,
00452                                            osso_rpc_retval_free_f *retval_free);
00453 
00457 osso_return_t osso_rpc_set_cb_f (osso_context_t * osso, const gchar * service,
00458                                  const gchar * object_path,
00459                                  const gchar * interface, osso_rpc_cb_f * cb,
00460                                  gpointer data);
00461 
00474 osso_return_t osso_rpc_set_default_cb_f_with_free (osso_context_t * osso,
00475                                                    osso_rpc_cb_f * cb, gpointer data,
00476                                                    osso_rpc_retval_free_f *retval_free);
00477 
00481 osso_return_t osso_rpc_set_default_cb_f (osso_context_t * osso,
00482                                          osso_rpc_cb_f * cb, gpointer data);
00483 
00484 
00497 osso_return_t osso_rpc_unset_cb_f (osso_context_t * osso,
00498                                    const gchar * service,
00499                                    const gchar * object_path,
00500                                    const gchar * interface,
00501                                    osso_rpc_cb_f * cb, gpointer data);
00502 
00512 osso_return_t osso_rpc_unset_default_cb_f (osso_context_t * osso,
00513                                            osso_rpc_cb_f * cb, gpointer data);
00514 
00521 osso_return_t osso_rpc_get_timeout (osso_context_t * osso, gint * timeout);
00522 
00529 osso_return_t osso_rpc_set_timeout(osso_context_t * osso, gint timeout);
00530 
00531 /* @}*/
00532 /**********************************************************************/
00617 osso_return_t osso_application_top(osso_context_t *osso,
00618                                    const gchar *application,
00619                                    const gchar *arguments);
00620 
00632 typedef void(osso_application_top_cb_f)(const gchar *arguments,
00633                                         gpointer data);
00634 
00647 osso_return_t osso_application_set_top_cb(osso_context_t *osso,
00648                                           osso_application_top_cb_f *cb,
00649                                           gpointer data);
00650 
00663 osso_return_t osso_application_unset_top_cb(osso_context_t *osso,
00664                                             osso_application_top_cb_f *cb,
00665                                             gpointer data);
00666 
00667 /**********************************************************************/
00668 /* @}*/
00694 
00700 typedef void(osso_application_autosave_cb_f)(gpointer data);
00701 
00712 osso_return_t osso_application_set_autosave_cb(osso_context_t *osso,
00713                                                osso_application_autosave_cb_f *cb,
00714                                                gpointer data);
00715 
00726 osso_return_t osso_application_unset_autosave_cb(osso_context_t *osso,
00727                                                  osso_application_autosave_cb_f *cb,
00728                                                  gpointer data);
00729 
00741 osso_return_t osso_application_userdata_changed(osso_context_t *osso);
00742 
00751 osso_return_t osso_application_autosave_force(osso_context_t *osso);
00752 
00753 /*
00754  * Returns the application name of a Libosso context.
00755  * @param osso The library context as returned by #osso_initialize.
00756  * @return The name of the parent application, or NULL if the context
00757  * is invalid.
00758  */
00759 const gchar * osso_application_name_get(osso_context_t *osso);
00760 
00761 /*
00762  * Returns the application version of a Libosso context.
00763  * @param osso The library context as returned by #osso_initialize.
00764  * @return The version of the application, or NULL if the context is
00765  * invalid.
00766  */
00767 const gchar * osso_application_version_get(osso_context_t *osso);
00768 
00771 /**********************************************************************/
00775 /* @{*/
00776 
00796 osso_return_t osso_statusbar_send_event(osso_context_t *osso,
00797                                         const gchar *name,
00798                                         gint argument1, gint argument2,
00799                                         const gchar *argument3,
00800                                         osso_rpc_t *retval);
00801 
00802 /* @}*/
00806 /* @{*/
00807 
00812 typedef void(osso_time_cb_f)(gpointer data);
00813 
00824 osso_return_t osso_time_set_notification_cb(osso_context_t *osso,
00825                                             osso_time_cb_f *cb,
00826                                             gpointer data);
00837 osso_return_t osso_time_set(osso_context_t *osso, time_t new_time);
00838 
00839 /* @}*/
00843 /* @{*/
00844 
00875 typedef void(osso_locale_change_cb_f)(const char *new_locale, gpointer data);
00876 
00887 osso_return_t osso_locale_change_set_notification_cb(osso_context_t *osso,
00888                                             osso_locale_change_cb_f *cb,
00889                                             gpointer data);
00890 
00901 osso_return_t osso_locale_set(osso_context_t *osso, char *new_locale);
00902 
00903 /* @}*/
00907 /* @{*/
00908 
00913 typedef enum {
00914   OSSO_GN_WARNING = 0, 
00915   OSSO_GN_ERROR,         
00916   OSSO_GN_NOTICE,        
00917   OSSO_GN_WAIT
00918 } osso_system_note_type_t;
00919 
00941 osso_return_t osso_system_note_dialog(osso_context_t *osso,
00942                                       const gchar *message,
00943                                       osso_system_note_type_t type,
00944                                       osso_rpc_t *retval);
00945 
00961 osso_return_t osso_system_note_infoprint(osso_context_t *osso,
00962                                          const gchar *text,
00963                                          osso_rpc_t *retval);
00964 
00965 /* @}*/
00966 /**********************************************************************/
01077 /* @{*/
01078 
01082 typedef struct {
01083   guint32 state_size; 
01084   gpointer state_data; 
01085 } osso_state_t;
01086 
01117 osso_return_t osso_state_write(osso_context_t *osso, osso_state_t *state);
01118 
01157 osso_return_t osso_state_read(osso_context_t *osso, osso_state_t *state);
01158 
01159 
01160 /* @}*/
01161 /**********************************************************************/
01165 /* @{*/
01182 osso_return_t osso_cp_plugin_execute(osso_context_t *osso,
01183                                      const gchar *filename,
01184                                      gpointer data, gboolean user_activated);
01185 
01196 osso_return_t osso_cp_plugin_save_state(osso_context_t *osso,
01197                                         const gchar *filename,
01198                                         gpointer data);
01199 /* @}*/
01200 /**********************************************************************/
01207 typedef enum {
01208   OSSO_DEVMODE_NORMAL = 0, /* Normal mode */
01209   OSSO_DEVMODE_FLIGHT,     /* Flight mode */
01210   OSSO_DEVMODE_OFFLINE,    /* Offline mode; unsupported! */
01211   OSSO_DEVMODE_INVALID     /* Should *never* occur! */
01212 } osso_devmode_t;
01213 
01214 
01221 typedef struct {
01222   gboolean shutdown_ind; 
01223   gboolean save_unsaved_data_ind; 
01225   gboolean memory_low_ind; 
01226   gboolean system_inactivity_ind; 
01229   osso_devmode_t sig_device_mode_ind; 
01230 } osso_hw_state_t;
01231 
01232 
01243 osso_return_t osso_display_state_on(osso_context_t *osso);
01244 
01256 osso_return_t osso_display_blanking_pause(osso_context_t *osso);
01257 
01265 typedef void (osso_hw_cb_f)(osso_hw_state_t *state, gpointer data);
01266 
01282 osso_return_t osso_hw_set_event_cb(osso_context_t *osso,
01283                                    osso_hw_state_t *state,
01284                                    osso_hw_cb_f *cb, gpointer data);
01285 
01294 osso_return_t osso_hw_unset_event_cb(osso_context_t *osso,
01295                                      osso_hw_state_t *state);
01296 
01297 
01298 typedef enum {
01299   OSSO_DISPLAY_ON,
01300   OSSO_DISPLAY_OFF,
01301   OSSO_DISPLAY_DIMMED
01302 } osso_display_state_t;
01303 
01304 typedef void(osso_display_event_cb_f)(osso_display_state_t state,
01305                                       gpointer data);
01306 
01318 osso_return_t osso_hw_set_display_event_cb(osso_context_t *osso,
01319                                            osso_display_event_cb_f *cb,
01320                                            gpointer data);
01321 
01323 /**********************************************************************/
01328 
01337 typedef void (osso_mime_cb_f)(gpointer data, int argc, gchar **argv);
01338 
01351 osso_return_t osso_mime_set_cb(osso_context_t *osso, osso_mime_cb_f *cb,
01352                                gpointer data);
01353 
01362 osso_return_t osso_mime_unset_cb(osso_context_t *osso);
01363 
01364 osso_return_t osso_mime_unset_cb_full(osso_context_t *osso,
01365                                       osso_mime_cb_f *cb, gpointer data);
01374 gpointer osso_get_dbus_connection(osso_context_t *osso);
01375 
01376 
01383 gpointer osso_get_sys_dbus_connection(osso_context_t *osso);
01384 
01386 G_END_DECLS
01387 
01388 #endif /* LIBOSSO_H_*/

Generated on Thu Oct 4 11:35:32 2007 for Libosso by  doxygen 1.5.1