libosso.h

Go to the documentation of this file.
00001 
00025 #ifndef LIBOSSO_H_
00026 #define LIBOSSO_H_
00027 
00028 #include <glib.h>
00029 #include <time.h>
00030 #include <syslog.h>
00031 
00032 #define DBUS_API_SUBJECT_TO_CHANGE
00033 
00034 #include <dbus/dbus.h>
00035 #include <dbus/dbus-protocol.h>
00036 
00037 G_BEGIN_DECLS
00038 
00039 
00043 typedef enum {
00044   OSSO_OK = 0, 
00045   OSSO_ERROR = -1, 
00046   OSSO_INVALID = -2, 
00047   OSSO_RPC_ERROR = -4, 
00048   OSSO_ERROR_NAME = -3,
00049   OSSO_ERROR_NO_STATE = -5, 
00050   OSSO_ERROR_STATE_SIZE = -6 
00052 } osso_return_t;
00053 
00054 
00062 typedef struct osso_af_context_t osso_context_t;
00063 
00086 osso_context_t * osso_initialize(const gchar *application,
00087                                  const gchar* version,
00088                                  gboolean activation,
00089                                  GMainContext *context);
00097 void osso_deinitialize(osso_context_t *osso);
00098 
00099 /* @} */
00100 /************************************************************************/
00106 /* @{*/
00107 
00112 typedef struct {
00113   int type; 
00114   union {
00115     guint32 u; 
00116     gint32 i; 
00117     gboolean b; 
00118     gdouble d; 
00119     gchar *s; 
00120   } value; 
00121 }
00122 osso_rpc_t;
00123 
00138 void osso_rpc_free_val (osso_rpc_t *rpc);
00139 
00158 typedef gint (osso_rpc_cb_f)(const gchar *interface, const gchar *method,
00159                              GArray *arguments, gpointer data,
00160                              osso_rpc_t *retval);
00161 
00174 typedef void (osso_rpc_async_f)(const gchar *interface,
00175                                 const gchar *method,
00176                                 osso_rpc_t *retval, gpointer data);
00177 
00227 osso_return_t osso_rpc_run (osso_context_t * osso, const gchar * service,
00228                             const gchar * object_path,
00229                             const gchar * interface, const gchar * method,
00230                             osso_rpc_t * retval, int argument_type, ...);
00231 
00238 typedef void osso_rpc_argfill (DBusMessage *msg, void *data);
00239 
00255 osso_return_t osso_rpc_run_with_argfill (osso_context_t * osso,
00256                                          const gchar * service,
00257                                          const gchar * object_path,
00258                                          const gchar * interface,
00259                                          const gchar * method,
00260                                          osso_rpc_t * retval,
00261                                          osso_rpc_argfill *argfill,
00262                                          gpointer argfill_data);
00263 
00268 osso_return_t osso_rpc_run_system (osso_context_t * osso, const gchar * service,
00269                             const gchar * object_path,
00270                             const gchar * interface, const gchar * method,
00271                             osso_rpc_t * retval, int argument_type, ...);
00272 
00273 /* See #osso_rpc_run_with_argfill.  The RPC call is sent on the system
00274  * bus instead.
00275  *
00276  * WARNING: Using this function is not recommended, because it will
00277  * make your program more dependent on the DBus API due to the
00278  * appending of arguments to a DBusMessage.
00279  */
00280 osso_return_t osso_rpc_run_system_with_argfill (osso_context_t * osso,
00281                                                 const gchar * service,
00282                                                 const gchar * object_path,
00283                                                 const gchar * interface,
00284                                                 const gchar * method,
00285                                                 osso_rpc_t *retval,
00286                                                 osso_rpc_argfill *argfill,
00287                                                 gpointer argfill_data);
00288 
00320 osso_return_t osso_rpc_run_with_defaults (osso_context_t * osso,
00321                                           const gchar * application,
00322                                           const gchar * method,
00323                                           osso_rpc_t * retval,
00324                                           int argument_type, ...);
00325 
00354 osso_return_t osso_rpc_async_run (osso_context_t * osso,
00355                                   const gchar * service,
00356                                   const gchar * object_path,
00357                                   const gchar * interface,
00358                                   const gchar * method,
00359                                   osso_rpc_async_f * async_cb, gpointer data,
00360                                   int argument_type, ...);
00361 
00377 osso_return_t osso_rpc_async_run_with_argfill (osso_context_t * osso,
00378                                                const gchar * service,
00379                                                const gchar * object_path,
00380                                                const gchar * interface,
00381                                                const gchar * method,
00382                                                osso_rpc_async_f * async_cb,
00383                                                gpointer data,
00384                                                osso_rpc_argfill *argfill,
00385                                                gpointer argfill_data);
00386 
00416 osso_return_t osso_rpc_async_run_with_defaults (osso_context_t * osso,
00417                                                 const gchar * application,
00418                                                 const gchar * method,
00419                                                 osso_rpc_async_f * async_cb,
00420                                                 gpointer data,
00421                                                 int argument_type, ...);
00422 
00428 typedef void osso_rpc_retval_free_f (osso_rpc_t *retval);
00429 
00450 osso_return_t osso_rpc_set_cb_f_with_free (osso_context_t * osso, const gchar * service,
00451                                            const gchar * object_path,
00452                                            const gchar * interface, osso_rpc_cb_f * cb,
00453                                            gpointer data,
00454                                            osso_rpc_retval_free_f *retval_free);
00455 
00459 osso_return_t osso_rpc_set_cb_f (osso_context_t * osso, const gchar * service,
00460                                  const gchar * object_path,
00461                                  const gchar * interface, osso_rpc_cb_f * cb,
00462                                  gpointer data);
00463 
00476 osso_return_t osso_rpc_set_default_cb_f_with_free (osso_context_t * osso,
00477                                                    osso_rpc_cb_f * cb, gpointer data,
00478                                                    osso_rpc_retval_free_f *retval_free);
00479 
00483 osso_return_t osso_rpc_set_default_cb_f (osso_context_t * osso,
00484                                          osso_rpc_cb_f * cb, gpointer data);
00485 
00486 
00499 osso_return_t osso_rpc_unset_cb_f (osso_context_t * osso,
00500                                    const gchar * service,
00501                                    const gchar * object_path,
00502                                    const gchar * interface,
00503                                    osso_rpc_cb_f * cb, gpointer data);
00504 
00514 osso_return_t osso_rpc_unset_default_cb_f (osso_context_t * osso,
00515                                            osso_rpc_cb_f * cb, gpointer data);
00516 
00523 osso_return_t osso_rpc_get_timeout (osso_context_t * osso, gint * timeout);
00524 
00531 osso_return_t osso_rpc_set_timeout(osso_context_t * osso, gint timeout);
00532 
00533 /* @}*/
00534 /**********************************************************************/
00619 osso_return_t osso_application_top(osso_context_t *osso,
00620                                    const gchar *application,
00621                                    const gchar *arguments);
00622 
00634 typedef void(osso_application_top_cb_f)(const gchar *arguments,
00635                                         gpointer data);
00636 
00649 osso_return_t osso_application_set_top_cb(osso_context_t *osso,
00650                                           osso_application_top_cb_f *cb,
00651                                           gpointer data);
00652 
00665 osso_return_t osso_application_unset_top_cb(osso_context_t *osso,
00666                                             osso_application_top_cb_f *cb,
00667                                             gpointer data);
00668 
00669 /**********************************************************************/
00670 /* @}*/
00696 
00702 typedef void(osso_application_autosave_cb_f)(gpointer data);
00703 
00714 osso_return_t osso_application_set_autosave_cb(osso_context_t *osso,
00715                                                osso_application_autosave_cb_f *cb,
00716                                                gpointer data);
00717 
00728 osso_return_t osso_application_unset_autosave_cb(osso_context_t *osso,
00729                                                  osso_application_autosave_cb_f *cb,
00730                                                  gpointer data);
00731 
00743 osso_return_t osso_application_userdata_changed(osso_context_t *osso);
00744 
00753 osso_return_t osso_application_autosave_force(osso_context_t *osso);
00754 
00755 /*
00756  * Returns the application name of a Libosso context.
00757  * @param osso The library context as returned by #osso_initialize.
00758  * @return The name of the parent application, or NULL if the context
00759  * is invalid.
00760  */
00761 const gchar * osso_application_name_get(osso_context_t *osso);
00762 
00763 /*
00764  * Returns the application version of a Libosso context.
00765  * @param osso The library context as returned by #osso_initialize.
00766  * @return The version of the application, or NULL if the context is
00767  * invalid.
00768  */
00769 const gchar * osso_application_version_get(osso_context_t *osso);
00770 
00773 /**********************************************************************/
00777 /* @{*/
00778 
00798 osso_return_t osso_statusbar_send_event(osso_context_t *osso,
00799                                         const gchar *name,
00800                                         gint argument1, gint argument2,
00801                                         const gchar *argument3,
00802                                         osso_rpc_t *retval);
00803 
00804 /* @}*/
00808 /* @{*/
00809 
00814 typedef void(osso_time_cb_f)(gpointer data);
00815 
00826 osso_return_t osso_time_set_notification_cb(osso_context_t *osso,
00827                                             osso_time_cb_f *cb,
00828                                             gpointer data);
00839 osso_return_t osso_time_set(osso_context_t *osso, time_t new_time);
00840 
00841 /* @}*/
00845 /* @{*/
00846 
00851 typedef enum {
00852   OSSO_GN_WARNING = 0, 
00853   OSSO_GN_ERROR,         
00854   OSSO_GN_NOTICE,        
00855   OSSO_GN_WAIT
00856 } osso_system_note_type_t;
00857 
00879 osso_return_t osso_system_note_dialog(osso_context_t *osso,
00880                                       const gchar *message,
00881                                       osso_system_note_type_t type,
00882                                       osso_rpc_t *retval);
00883 
00899 osso_return_t osso_system_note_infoprint(osso_context_t *osso,
00900                                          const gchar *text,
00901                                          osso_rpc_t *retval);
00902 
00903 /* @}*/
00904 /**********************************************************************/
00938 /* @{*/
00939 
00943 typedef struct {
00944   guint32 state_size; 
00945   gpointer state_data; 
00946 } osso_state_t;
00947 
00978 osso_return_t osso_state_write(osso_context_t *osso, osso_state_t *state);
00979 
01018 osso_return_t osso_state_read(osso_context_t *osso, osso_state_t *state);
01019 
01020 
01021 /* @}*/
01022 /**********************************************************************/
01026 /* @{*/
01043 osso_return_t osso_cp_plugin_execute(osso_context_t *osso,
01044                                      const gchar *filename,
01045                                      gpointer data, gboolean user_activated);
01046 
01057 osso_return_t osso_cp_plugin_save_state(osso_context_t *osso,
01058                                         const gchar *filename,
01059                                         gpointer data);
01060 /* @}*/
01061 /**********************************************************************/
01068 typedef enum {
01069   OSSO_DEVMODE_NORMAL = 0, /* Normal mode */
01070   OSSO_DEVMODE_FLIGHT,     /* Flight mode */
01071   OSSO_DEVMODE_OFFLINE,    /* Offline mode; unsupported! */
01072   OSSO_DEVMODE_INVALID     /* Should *never* occur! */
01073 } osso_devmode_t;
01074 
01075 
01082 typedef struct {
01083   gboolean shutdown_ind; 
01084   gboolean save_unsaved_data_ind; 
01086   gboolean memory_low_ind; 
01087   gboolean system_inactivity_ind; 
01089   osso_devmode_t sig_device_mode_ind; 
01090 } osso_hw_state_t;
01091 
01092 
01101 osso_return_t osso_display_state_on(osso_context_t *osso);
01102 
01112 osso_return_t osso_display_blanking_pause(osso_context_t *osso);
01113 
01121 typedef void (osso_hw_cb_f)(osso_hw_state_t *state, gpointer data);
01122 
01138 osso_return_t osso_hw_set_event_cb(osso_context_t *osso,
01139                                    osso_hw_state_t *state,
01140                                    osso_hw_cb_f *cb, gpointer data);
01141 
01150 osso_return_t osso_hw_unset_event_cb(osso_context_t *osso,
01151                                      osso_hw_state_t *state);
01152 
01154 /**********************************************************************/
01159 
01168 typedef void (osso_mime_cb_f)(gpointer data, int argc, gchar **argv);
01169 
01182 osso_return_t osso_mime_set_cb(osso_context_t *osso, osso_mime_cb_f *cb,
01183                                gpointer data);
01184 
01193 osso_return_t osso_mime_unset_cb(osso_context_t *osso);
01202 gpointer osso_get_dbus_connection(osso_context_t *osso);
01203 
01204 
01211 gpointer osso_get_sys_dbus_connection(osso_context_t *osso);
01212 
01213 
01214 
01215 /************************************************************************/
01216 /************************************************************************/
01217 /*******         OBSOLETE API BELOW -- DO NOT USE                     ***/
01218 /************************************************************************/
01219 /************************************************************************/
01220 
01228 /* @{*/
01229 
01235 typedef void (osso_application_exit_cb)(gboolean die_now, gpointer data);
01236 
01247 osso_return_t osso_application_set_exit_cb(osso_context_t *osso,
01248                                            osso_application_exit_cb *cb,
01249                                            gpointer data);
01250 
01260 int osso_state_open_write(osso_context_t *osso);
01261 
01270 int osso_state_open_read(osso_context_t *osso);
01271 
01280 void osso_state_close(osso_context_t *osso, gint fd);
01281 
01295 osso_return_t osso_tasknav_mail_add(osso_context_t *osso, guint id,
01296                                     const gchar *subject, const gchar *sender,
01297                                     gboolean attachment, const gchar *date);
01298 
01309 osso_return_t osso_tasknav_mail_del(osso_context_t *osso, guint id);
01310 
01322 osso_return_t osso_tasknav_mail_set_outbox_count(osso_context_t *osso,
01323                                                  guint count);
01324 
01339 osso_context_t * osso_application_initialize(const gchar *application,
01340                                              const gchar *version,
01341                                              osso_application_top_cb_f *cb,
01342                                              gpointer callback_data);
01343 
01344 
01345 G_END_DECLS
01346 
01347 #endif /* LIBOSSO_H_*/

Generated on Thu Jul 6 13:33:57 2006 for LibOSSO by  doxygen 1.4.6