Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

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 
00228 osso_return_t osso_rpc_run (osso_context_t * osso, const gchar * service,
00229                             const gchar * object_path,
00230                             const gchar * interface, const gchar * method,
00231                             osso_rpc_t * retval, int argument_type, ...);
00232 
00239 typedef void osso_rpc_argfill (DBusMessage *msg, void *data);
00240 
00256 osso_return_t osso_rpc_run_with_argfill (osso_context_t * osso,
00257                                          const gchar * service,
00258                                          const gchar * object_path,
00259                                          const gchar * interface,
00260                                          const gchar * method,
00261                                          osso_rpc_t * retval,
00262                                          osso_rpc_argfill *argfill,
00263                                          gpointer argfill_data);
00264 
00269 osso_return_t osso_rpc_run_system (osso_context_t * osso, const gchar * service,
00270                             const gchar * object_path,
00271                             const gchar * interface, const gchar * method,
00272                             osso_rpc_t * retval, int argument_type, ...);
00273 
00274 /* See #osso_rpc_run_with_argfill.  The RPC call is sent on the system
00275  * bus instead.
00276  *
00277  * WARNING: Using this function is not recommended, because it will
00278  * make your program more dependent on the DBus API due to the
00279  * appending of arguments to a DBusMessage.
00280  */
00281 osso_return_t osso_rpc_run_system_with_argfill (osso_context_t * osso,
00282                                                 const gchar * service,
00283                                                 const gchar * object_path,
00284                                                 const gchar * interface,
00285                                                 const gchar * method,
00286                                                 osso_rpc_t *retval,
00287                                                 osso_rpc_argfill *argfill,
00288                                                 gpointer argfill_data);
00289 
00321 osso_return_t osso_rpc_run_with_defaults (osso_context_t * osso,
00322                                           const gchar * application,
00323                                           const gchar * method,
00324                                           osso_rpc_t * retval,
00325                                           int argument_type, ...);
00326 
00355 osso_return_t osso_rpc_async_run (osso_context_t * osso,
00356                                   const gchar * service,
00357                                   const gchar * object_path,
00358                                   const gchar * interface,
00359                                   const gchar * method,
00360                                   osso_rpc_async_f * async_cb, gpointer data,
00361                                   int argument_type, ...);
00362 
00378 osso_return_t osso_rpc_async_run_with_argfill (osso_context_t * osso,
00379                                                const gchar * service,
00380                                                const gchar * object_path,
00381                                                const gchar * interface,
00382                                                const gchar * method,
00383                                                osso_rpc_async_f * async_cb,
00384                                                gpointer data,
00385                                                osso_rpc_argfill *argfill,
00386                                                gpointer argfill_data);
00387 
00417 osso_return_t osso_rpc_async_run_with_defaults (osso_context_t * osso,
00418                                                 const gchar * application,
00419                                                 const gchar * method,
00420                                                 osso_rpc_async_f * async_cb,
00421                                                 gpointer data,
00422                                                 int argument_type, ...);
00423 
00429 typedef void osso_rpc_retval_free_f (osso_rpc_t *retval);
00430 
00451 osso_return_t osso_rpc_set_cb_f_with_free (osso_context_t * osso, const gchar * service,
00452                                            const gchar * object_path,
00453                                            const gchar * interface, osso_rpc_cb_f * cb,
00454                                            gpointer data,
00455                                            osso_rpc_retval_free_f *retval_free);
00456 
00460 osso_return_t osso_rpc_set_cb_f (osso_context_t * osso, const gchar * service,
00461                                  const gchar * object_path,
00462                                  const gchar * interface, osso_rpc_cb_f * cb,
00463                                  gpointer data);
00464 
00477 osso_return_t osso_rpc_set_default_cb_f_with_free (osso_context_t * osso,
00478                                                    osso_rpc_cb_f * cb, gpointer data,
00479                                                    osso_rpc_retval_free_f *retval_free);
00480 
00484 osso_return_t osso_rpc_set_default_cb_f (osso_context_t * osso,
00485                                          osso_rpc_cb_f * cb, gpointer data);
00486 
00487 
00500 osso_return_t osso_rpc_unset_cb_f (osso_context_t * osso,
00501                                    const gchar * service,
00502                                    const gchar * object_path,
00503                                    const gchar * interface,
00504                                    osso_rpc_cb_f * cb, gpointer data);
00505 
00515 osso_return_t osso_rpc_unset_default_cb_f (osso_context_t * osso,
00516                                            osso_rpc_cb_f * cb, gpointer data);
00517 
00524 osso_return_t osso_rpc_get_timeout (osso_context_t * osso, gint * timeout);
00525 
00532 osso_return_t osso_rpc_set_timeout(osso_context_t * osso, gint timeout);
00533 
00534 /* @}*/
00535 /**********************************************************************/
00620 osso_return_t osso_application_top(osso_context_t *osso,
00621                                    const gchar *application,
00622                                    const gchar *arguments);
00623 
00635 typedef void(osso_application_top_cb_f)(const gchar *arguments,
00636                                         gpointer data);
00637 
00650 osso_return_t osso_application_set_top_cb(osso_context_t *osso,
00651                                           osso_application_top_cb_f *cb,
00652                                           gpointer data);
00653 
00666 osso_return_t osso_application_unset_top_cb(osso_context_t *osso,
00667                                             osso_application_top_cb_f *cb,
00668                                             gpointer data);
00669 
00670 /**********************************************************************/
00671 /* @}*/
00697 
00703 typedef void(osso_application_autosave_cb_f)(gpointer data);
00704 
00715 osso_return_t osso_application_set_autosave_cb(osso_context_t *osso,
00716                                                osso_application_autosave_cb_f *cb,
00717                                                gpointer data);
00718 
00729 osso_return_t osso_application_unset_autosave_cb(osso_context_t *osso,
00730                                                  osso_application_autosave_cb_f *cb,
00731                                                  gpointer data);
00732 
00744 osso_return_t osso_application_userdata_changed(osso_context_t *osso);
00745 
00754 osso_return_t osso_application_autosave_force(osso_context_t *osso);
00755 
00756 /*
00757  * Returns the application name of a Libosso context.
00758  * @param osso The library context as returned by #osso_initialize.
00759  * @return The name of the parent application, or NULL if the context
00760  * is invalid.
00761  */
00762 const gchar * osso_application_name_get(osso_context_t *osso);
00763 
00764 /*
00765  * Returns the application version of a Libosso context.
00766  * @param osso The library context as returned by #osso_initialize.
00767  * @return The version of the application, or NULL if the context is
00768  * invalid.
00769  */
00770 const gchar * osso_application_version_get(osso_context_t *osso);
00771 
00774 /**********************************************************************/
00778 /* @{*/
00779 
00799 osso_return_t osso_statusbar_send_event(osso_context_t *osso,
00800                                         const gchar *name,
00801                                         gint argument1, gint argument2,
00802                                         const gchar *argument3,
00803                                         osso_rpc_t *retval);
00804 
00805 /* @}*/
00809 /* @{*/
00810 
00815 typedef void(osso_time_cb_f)(gpointer data);
00816 
00827 osso_return_t osso_time_set_notification_cb(osso_context_t *osso,
00828                                             osso_time_cb_f *cb,
00829                                             gpointer data);
00840 osso_return_t osso_time_set(osso_context_t *osso, time_t new_time);
00841 
00842 /* @}*/
00846 /* @{*/
00847 
00852 typedef enum {
00853   OSSO_GN_WARNING = 0, 
00854   OSSO_GN_ERROR,         
00855   OSSO_GN_NOTICE,        
00856   OSSO_GN_WAIT
00857 } osso_system_note_type_t;
00858 
00880 osso_return_t osso_system_note_dialog(osso_context_t *osso,
00881                                       const gchar *message,
00882                                       osso_system_note_type_t type,
00883                                       osso_rpc_t *retval);
00884 
00900 osso_return_t osso_system_note_infoprint(osso_context_t *osso,
00901                                          const gchar *text,
00902                                          osso_rpc_t *retval);
00903 
00904 /* @}*/
00905 /**********************************************************************/
01016 /* @{*/
01017 
01021 typedef struct {
01022   guint32 state_size; 
01023   gpointer state_data; 
01024 } osso_state_t;
01025 
01056 osso_return_t osso_state_write(osso_context_t *osso, osso_state_t *state);
01057 
01096 osso_return_t osso_state_read(osso_context_t *osso, osso_state_t *state);
01097 
01098 
01099 /* @}*/
01100 /**********************************************************************/
01104 /* @{*/
01121 osso_return_t osso_cp_plugin_execute(osso_context_t *osso,
01122                                      const gchar *filename,
01123                                      gpointer data, gboolean user_activated);
01124 
01135 osso_return_t osso_cp_plugin_save_state(osso_context_t *osso,
01136                                         const gchar *filename,
01137                                         gpointer data);
01138 /* @}*/
01139 /**********************************************************************/
01146 typedef enum {
01147   OSSO_DEVMODE_NORMAL = 0, /* Normal mode */
01148   OSSO_DEVMODE_FLIGHT,     /* Flight mode */
01149   OSSO_DEVMODE_OFFLINE,    /* Offline mode; unsupported! */
01150   OSSO_DEVMODE_INVALID     /* Should *never* occur! */
01151 } osso_devmode_t;
01152 
01153 
01160 typedef struct {
01161   gboolean shutdown_ind; 
01162   gboolean save_unsaved_data_ind; 
01164   gboolean memory_low_ind; 
01165   gboolean system_inactivity_ind; 
01167   osso_devmode_t sig_device_mode_ind; 
01168 } osso_hw_state_t;
01169 
01170 
01181 osso_return_t osso_display_state_on(osso_context_t *osso);
01182 
01194 osso_return_t osso_display_blanking_pause(osso_context_t *osso);
01195 
01203 typedef void (osso_hw_cb_f)(osso_hw_state_t *state, gpointer data);
01204 
01220 osso_return_t osso_hw_set_event_cb(osso_context_t *osso,
01221                                    osso_hw_state_t *state,
01222                                    osso_hw_cb_f *cb, gpointer data);
01223 
01232 osso_return_t osso_hw_unset_event_cb(osso_context_t *osso,
01233                                      osso_hw_state_t *state);
01234 
01236 /**********************************************************************/
01241 
01250 typedef void (osso_mime_cb_f)(gpointer data, int argc, gchar **argv);
01251 
01264 osso_return_t osso_mime_set_cb(osso_context_t *osso, osso_mime_cb_f *cb,
01265                                gpointer data);
01266 
01275 osso_return_t osso_mime_unset_cb(osso_context_t *osso);
01276 
01277 osso_return_t osso_mime_unset_cb_full(osso_context_t *osso,
01278                                       osso_mime_cb_f *cb, gpointer data);
01287 gpointer osso_get_dbus_connection(osso_context_t *osso);
01288 
01289 
01296 gpointer osso_get_sys_dbus_connection(osso_context_t *osso);
01297 
01298 
01299 
01300 /************************************************************************/
01301 /************************************************************************/
01302 /*******         OBSOLETE API BELOW -- DO NOT USE                     ***/
01303 /************************************************************************/
01304 /************************************************************************/
01305 
01313 /* @{*/
01314 
01318 typedef void (osso_application_exit_cb)(gboolean die_now, gpointer data);
01319 
01323 osso_return_t osso_application_set_exit_cb(osso_context_t *osso,
01324                                            osso_application_exit_cb *cb,
01325                                            gpointer data);
01326 
01336 int osso_state_open_write(osso_context_t *osso);
01337 
01346 int osso_state_open_read(osso_context_t *osso);
01347 
01356 void osso_state_close(osso_context_t *osso, gint fd);
01357 
01371 osso_return_t osso_tasknav_mail_add(osso_context_t *osso, guint id,
01372                                     const gchar *subject, const gchar *sender,
01373                                     gboolean attachment, const gchar *date);
01374 
01385 osso_return_t osso_tasknav_mail_del(osso_context_t *osso, guint id);
01386 
01398 osso_return_t osso_tasknav_mail_set_outbox_count(osso_context_t *osso,
01399                                                  guint count);
01400 
01415 osso_context_t * osso_application_initialize(const gchar *application,
01416                                              const gchar *version,
01417                                              osso_application_top_cb_f *cb,
01418                                              gpointer callback_data);
01419 
01420 
01421 G_END_DECLS
01422 
01423 #endif /* LIBOSSO_H_*/

Generated on Mon Dec 18 16:43:35 2006 for Libosso by  doxygen 1.4.2