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);
00092 
00117 osso_context_t *osso_initialize_with_connections(const gchar *application,
00118                         const gchar *version,
00119                         DBusConnection *system_conn,
00120                         DBusConnection *session_conn);
00121 
00129 void osso_deinitialize(osso_context_t *osso);
00130 
00131 /* @} */
00132 /************************************************************************/
00138 /* @{*/
00139 
00144 typedef struct {
00145   int type; 
00146   union {
00147     guint32 u; 
00148     gint32 i; 
00149     gboolean b; 
00150     gdouble d; 
00151     gchar *s; 
00152   } value; 
00153 }
00154 osso_rpc_t;
00155 
00170 void osso_rpc_free_val (osso_rpc_t *rpc);
00171 
00190 typedef gint (osso_rpc_cb_f)(const gchar *interface, const gchar *method,
00191                              GArray *arguments, gpointer data,
00192                              osso_rpc_t *retval);
00193 
00206 typedef void (osso_rpc_async_f)(const gchar *interface,
00207                                 const gchar *method,
00208                                 osso_rpc_t *retval, gpointer data);
00209 
00256 osso_return_t osso_rpc_run (osso_context_t * osso, const gchar * service,
00257                             const gchar * object_path,
00258                             const gchar * interface, const gchar * method,
00259                             osso_rpc_t * retval, int argument_type, ...);
00260 
00267 typedef void osso_rpc_argfill (DBusMessage *msg, void *data);
00268 
00284 osso_return_t osso_rpc_run_with_argfill (osso_context_t * osso,
00285                                          const gchar * service,
00286                                          const gchar * object_path,
00287                                          const gchar * interface,
00288                                          const gchar * method,
00289                                          osso_rpc_t * retval,
00290                                          osso_rpc_argfill *argfill,
00291                                          gpointer argfill_data);
00292 
00297 osso_return_t osso_rpc_run_system (osso_context_t * osso, const gchar * service,
00298                             const gchar * object_path,
00299                             const gchar * interface, const gchar * method,
00300                             osso_rpc_t * retval, int argument_type, ...);
00301 
00302 /* See #osso_rpc_run_with_argfill.  The RPC call is sent on the system
00303  * bus instead.
00304  *
00305  * WARNING: Using this function is not recommended, because it will
00306  * make your program more dependent on the DBus API due to the
00307  * appending of arguments to a DBusMessage.
00308  */
00309 osso_return_t osso_rpc_run_system_with_argfill (osso_context_t * osso,
00310                                                 const gchar * service,
00311                                                 const gchar * object_path,
00312                                                 const gchar * interface,
00313                                                 const gchar * method,
00314                                                 osso_rpc_t *retval,
00315                                                 osso_rpc_argfill *argfill,
00316                                                 gpointer argfill_data);
00317 
00349 osso_return_t osso_rpc_run_with_defaults (osso_context_t * osso,
00350                                           const gchar * application,
00351                                           const gchar * method,
00352                                           osso_rpc_t * retval,
00353                                           int argument_type, ...);
00354 
00383 osso_return_t osso_rpc_async_run (osso_context_t * osso,
00384                                   const gchar * service,
00385                                   const gchar * object_path,
00386                                   const gchar * interface,
00387                                   const gchar * method,
00388                                   osso_rpc_async_f * async_cb, gpointer data,
00389                                   int argument_type, ...);
00390 
00406 osso_return_t osso_rpc_async_run_with_argfill (osso_context_t * osso,
00407                                                const gchar * service,
00408                                                const gchar * object_path,
00409                                                const gchar * interface,
00410                                                const gchar * method,
00411                                                osso_rpc_async_f * async_cb,
00412                                                gpointer data,
00413                                                osso_rpc_argfill *argfill,
00414                                                gpointer argfill_data);
00415 
00445 osso_return_t osso_rpc_async_run_with_defaults (osso_context_t * osso,
00446                                                 const gchar * application,
00447                                                 const gchar * method,
00448                                                 osso_rpc_async_f * async_cb,
00449                                                 gpointer data,
00450                                                 int argument_type, ...);
00451 
00457 typedef void osso_rpc_retval_free_f (osso_rpc_t *retval);
00458 
00479 osso_return_t osso_rpc_set_cb_f_with_free (osso_context_t * osso, const gchar * service,
00480                                            const gchar * object_path,
00481                                            const gchar * interface, osso_rpc_cb_f * cb,
00482                                            gpointer data,
00483                                            osso_rpc_retval_free_f *retval_free);
00484 
00488 osso_return_t osso_rpc_set_cb_f (osso_context_t * osso, const gchar * service,
00489                                  const gchar * object_path,
00490                                  const gchar * interface, osso_rpc_cb_f * cb,
00491                                  gpointer data);
00492 
00505 osso_return_t osso_rpc_set_default_cb_f_with_free (osso_context_t * osso,
00506                                                    osso_rpc_cb_f * cb, gpointer data,
00507                                                    osso_rpc_retval_free_f *retval_free);
00508 
00512 osso_return_t osso_rpc_set_default_cb_f (osso_context_t * osso,
00513                                          osso_rpc_cb_f * cb, gpointer data);
00514 
00515 
00528 osso_return_t osso_rpc_unset_cb_f (osso_context_t * osso,
00529                                    const gchar * service,
00530                                    const gchar * object_path,
00531                                    const gchar * interface,
00532                                    osso_rpc_cb_f * cb, gpointer data);
00533 
00543 osso_return_t osso_rpc_unset_default_cb_f (osso_context_t * osso,
00544                                            osso_rpc_cb_f * cb, gpointer data);
00545 
00552 osso_return_t osso_rpc_get_timeout (osso_context_t * osso, gint * timeout);
00553 
00560 osso_return_t osso_rpc_set_timeout(osso_context_t * osso, gint timeout);
00561 
00562 /* @}*/
00563 /**********************************************************************/
00648 osso_return_t osso_application_top(osso_context_t *osso,
00649                                    const gchar *application,
00650                                    const gchar *arguments);
00651 
00663 typedef void(osso_application_top_cb_f)(const gchar *arguments,
00664                                         gpointer data);
00665 
00678 osso_return_t osso_application_set_top_cb(osso_context_t *osso,
00679                                           osso_application_top_cb_f *cb,
00680                                           gpointer data);
00681 
00694 osso_return_t osso_application_unset_top_cb(osso_context_t *osso,
00695                                             osso_application_top_cb_f *cb,
00696                                             gpointer data);
00697 
00698 /**********************************************************************/
00699 /* @}*/
00725 
00731 typedef void(osso_application_autosave_cb_f)(gpointer data);
00732 
00743 osso_return_t osso_application_set_autosave_cb(osso_context_t *osso,
00744                                                osso_application_autosave_cb_f *cb,
00745                                                gpointer data);
00746 
00757 osso_return_t osso_application_unset_autosave_cb(osso_context_t *osso,
00758                                                  osso_application_autosave_cb_f *cb,
00759                                                  gpointer data);
00760 
00772 osso_return_t osso_application_userdata_changed(osso_context_t *osso);
00773 
00782 osso_return_t osso_application_autosave_force(osso_context_t *osso);
00783 
00784 /*
00785  * Returns the application name of a Libosso context.
00786  * @param osso The library context as returned by #osso_initialize.
00787  * @return The name of the parent application, or NULL if the context
00788  * is invalid.
00789  */
00790 const gchar * osso_application_name_get(osso_context_t *osso);
00791 
00792 /*
00793  * Returns the application version of a Libosso context.
00794  * @param osso The library context as returned by #osso_initialize.
00795  * @return The version of the application, or NULL if the context is
00796  * invalid.
00797  */
00798 const gchar * osso_application_version_get(osso_context_t *osso);
00799 
00802 /**********************************************************************/
00806 /* @{*/
00807 
00827 osso_return_t osso_statusbar_send_event(osso_context_t *osso,
00828                                         const gchar *name,
00829                                         gint argument1, gint argument2,
00830                                         const gchar *argument3,
00831                                         osso_rpc_t *retval);
00832 
00833 /* @}*/
00837 /* @{*/
00838 
00843 typedef void(osso_time_cb_f)(gpointer data);
00844 
00855 osso_return_t osso_time_set_notification_cb(osso_context_t *osso,
00856                                             osso_time_cb_f *cb,
00857                                             gpointer data);
00868 osso_return_t osso_time_set(osso_context_t *osso, time_t new_time);
00869 
00870 /* @}*/
00874 /* @{*/
00875 
00906 typedef void(osso_locale_change_cb_f)(const char *new_locale, gpointer data);
00907 
00918 osso_return_t osso_locale_change_set_notification_cb(osso_context_t *osso,
00919                                             osso_locale_change_cb_f *cb,
00920                                             gpointer data);
00921 
00932 osso_return_t osso_locale_set(osso_context_t *osso, char *new_locale);
00933 
00934 /* @}*/
00938 /* @{*/
00939 
00944 typedef enum {
00945   OSSO_GN_WARNING = 0, 
00946   OSSO_GN_ERROR,         
00947   OSSO_GN_NOTICE,        
00948   OSSO_GN_WAIT
00949 } osso_system_note_type_t;
00950 
00972 osso_return_t osso_system_note_dialog(osso_context_t *osso,
00973                                       const gchar *message,
00974                                       osso_system_note_type_t type,
00975                                       osso_rpc_t *retval);
00976 
00992 osso_return_t osso_system_note_infoprint(osso_context_t *osso,
00993                                          const gchar *text,
00994                                          osso_rpc_t *retval);
00995 
00996 /* @}*/
00997 /**********************************************************************/
01108 /* @{*/
01109 
01113 typedef struct {
01114   guint32 state_size; 
01115   gpointer state_data; 
01116 } osso_state_t;
01117 
01148 osso_return_t osso_state_write(osso_context_t *osso, osso_state_t *state);
01149 
01188 osso_return_t osso_state_read(osso_context_t *osso, osso_state_t *state);
01189 
01190 
01191 /* @}*/
01192 /**********************************************************************/
01196 /* @{*/
01213 osso_return_t osso_cp_plugin_execute(osso_context_t *osso,
01214                                      const gchar *filename,
01215                                      gpointer data, gboolean user_activated);
01216 
01227 osso_return_t osso_cp_plugin_save_state(osso_context_t *osso,
01228                                         const gchar *filename,
01229                                         gpointer data);
01230 /* @}*/
01231 /**********************************************************************/
01238 typedef enum {
01239   OSSO_DEVMODE_NORMAL = 0, /* Normal mode */
01240   OSSO_DEVMODE_FLIGHT,     /* Flight mode */
01241   OSSO_DEVMODE_OFFLINE,    /* Offline mode; unsupported! */
01242   OSSO_DEVMODE_INVALID     /* Should *never* occur! */
01243 } osso_devmode_t;
01244 
01245 
01252 typedef struct {
01253   gboolean shutdown_ind; 
01254   gboolean save_unsaved_data_ind; 
01256   gboolean memory_low_ind; 
01257   gboolean system_inactivity_ind; 
01260   osso_devmode_t sig_device_mode_ind; 
01261 } osso_hw_state_t;
01262 
01263 
01274 osso_return_t osso_display_state_on(osso_context_t *osso);
01275 
01287 osso_return_t osso_display_blanking_pause(osso_context_t *osso);
01288 
01296 typedef void (osso_hw_cb_f)(osso_hw_state_t *state, gpointer data);
01297 
01313 osso_return_t osso_hw_set_event_cb(osso_context_t *osso,
01314                                    osso_hw_state_t *state,
01315                                    osso_hw_cb_f *cb, gpointer data);
01316 
01325 osso_return_t osso_hw_unset_event_cb(osso_context_t *osso,
01326                                      osso_hw_state_t *state);
01327 
01328 
01329 typedef enum {
01330   OSSO_DISPLAY_ON,
01331   OSSO_DISPLAY_OFF,
01332   OSSO_DISPLAY_DIMMED
01333 } osso_display_state_t;
01334 
01335 typedef void(osso_display_event_cb_f)(osso_display_state_t state,
01336                                       gpointer data);
01337 
01349 osso_return_t osso_hw_set_display_event_cb(osso_context_t *osso,
01350                                            osso_display_event_cb_f *cb,
01351                                            gpointer data);
01352 
01354 /**********************************************************************/
01359 
01368 typedef void (osso_mime_cb_f)(gpointer data, int argc, gchar **argv);
01369 
01382 osso_return_t osso_mime_set_cb(osso_context_t *osso, osso_mime_cb_f *cb,
01383                                gpointer data);
01384 
01393 osso_return_t osso_mime_unset_cb(osso_context_t *osso);
01394 
01395 osso_return_t osso_mime_unset_cb_full(osso_context_t *osso,
01396                                       osso_mime_cb_f *cb, gpointer data);
01405 gpointer osso_get_dbus_connection(osso_context_t *osso);
01406 
01407 
01414 gpointer osso_get_sys_dbus_connection(osso_context_t *osso);
01415 
01417 G_END_DECLS
01418 
01419 #endif /* LIBOSSO_H_*/

Generated on Thu Mar 5 11:56:07 2009 for Libosso by  doxygen 1.5.1