• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libosso.h

Go to the documentation of this file.
00001 
00026 #ifndef LIBOSSO_H_
00027 #define LIBOSSO_H_
00028 
00029 #define LIBOSSO_API_MAJOR 2
00030 #define LIBOSSO_API_MINOR 21
00031 
00032 #include <glib.h>
00033 #include <time.h>
00034 #include <syslog.h>
00035 
00036 #define DBUS_API_SUBJECT_TO_CHANGE
00037 
00038 #include <dbus/dbus.h>
00039 #include <dbus/dbus-protocol.h>
00040 
00041 G_BEGIN_DECLS
00042 
00043 
00047 typedef enum {
00048   OSSO_OK = 0, 
00049   OSSO_ERROR = -1, 
00050   OSSO_INVALID = -2, 
00051   OSSO_RPC_ERROR = -4, 
00052   OSSO_ERROR_NAME = -3,
00053   OSSO_ERROR_NO_STATE = -5, 
00054   OSSO_ERROR_STATE_SIZE = -6 
00056 } osso_return_t;
00057 
00058 
00066 typedef struct osso_af_context_t osso_context_t;
00067 
00091 osso_context_t * osso_initialize(const gchar *application,
00092                                  const gchar* version,
00093                                  gboolean activation,
00094                                  GMainContext *context);
00095 
00120 osso_context_t *osso_initialize_with_connections(const gchar *application,
00121                         const gchar *version,
00122                         DBusConnection *system_conn,
00123                         DBusConnection *session_conn);
00124 
00132 void osso_deinitialize(osso_context_t *osso);
00133 
00134 /* @} */
00135 /************************************************************************/
00141 /* @{*/
00142 
00147 typedef struct {
00148   int type; 
00149   union {
00150     guint32 u; 
00151     gint32 i; 
00152     gboolean b; 
00153     gdouble d; 
00154     gchar *s; 
00155   } value; 
00156 }
00157 osso_rpc_t;
00158 
00173 void osso_rpc_free_val (osso_rpc_t *rpc);
00174 
00193 typedef gint (osso_rpc_cb_f)(const gchar *interface, const gchar *method,
00194                              GArray *arguments, gpointer data,
00195                              osso_rpc_t *retval);
00196 
00209 typedef void (osso_rpc_async_f)(const gchar *interface,
00210                                 const gchar *method,
00211                                 osso_rpc_t *retval, gpointer data);
00212 
00259 osso_return_t osso_rpc_run (osso_context_t * osso, const gchar * service,
00260                             const gchar * object_path,
00261                             const gchar * interface, const gchar * method,
00262                             osso_rpc_t * retval, int argument_type, ...);
00263 
00270 typedef void osso_rpc_argfill (DBusMessage *msg, void *data);
00271 
00287 osso_return_t osso_rpc_run_with_argfill (osso_context_t * osso,
00288                                          const gchar * service,
00289                                          const gchar * object_path,
00290                                          const gchar * interface,
00291                                          const gchar * method,
00292                                          osso_rpc_t * retval,
00293                                          osso_rpc_argfill *argfill,
00294                                          gpointer argfill_data);
00295 
00300 osso_return_t osso_rpc_run_system (osso_context_t * osso, const gchar * service,
00301                             const gchar * object_path,
00302                             const gchar * interface, const gchar * method,
00303                             osso_rpc_t * retval, int argument_type, ...);
00304 
00305 /* See #osso_rpc_run_with_argfill.  The RPC call is sent on the system
00306  * bus instead.
00307  *
00308  * WARNING: Using this function is not recommended, because it will
00309  * make your program more dependent on the DBus API due to the
00310  * appending of arguments to a DBusMessage.
00311  */
00312 osso_return_t osso_rpc_run_system_with_argfill (osso_context_t * osso,
00313                                                 const gchar * service,
00314                                                 const gchar * object_path,
00315                                                 const gchar * interface,
00316                                                 const gchar * method,
00317                                                 osso_rpc_t *retval,
00318                                                 osso_rpc_argfill *argfill,
00319                                                 gpointer argfill_data);
00320 
00352 osso_return_t osso_rpc_run_with_defaults (osso_context_t * osso,
00353                                           const gchar * application,
00354                                           const gchar * method,
00355                                           osso_rpc_t * retval,
00356                                           int argument_type, ...);
00357 
00386 osso_return_t osso_rpc_async_run (osso_context_t * osso,
00387                                   const gchar * service,
00388                                   const gchar * object_path,
00389                                   const gchar * interface,
00390                                   const gchar * method,
00391                                   osso_rpc_async_f * async_cb, gpointer data,
00392                                   int argument_type, ...);
00393 
00409 osso_return_t osso_rpc_async_run_with_argfill (osso_context_t * osso,
00410                                                const gchar * service,
00411                                                const gchar * object_path,
00412                                                const gchar * interface,
00413                                                const gchar * method,
00414                                                osso_rpc_async_f * async_cb,
00415                                                gpointer data,
00416                                                osso_rpc_argfill *argfill,
00417                                                gpointer argfill_data);
00418 
00448 osso_return_t osso_rpc_async_run_with_defaults (osso_context_t * osso,
00449                                                 const gchar * application,
00450                                                 const gchar * method,
00451                                                 osso_rpc_async_f * async_cb,
00452                                                 gpointer data,
00453                                                 int argument_type, ...);
00454 
00460 typedef void osso_rpc_retval_free_f (osso_rpc_t *retval);
00461 
00482 osso_return_t osso_rpc_set_cb_f_with_free (osso_context_t * osso, const gchar * service,
00483                                            const gchar * object_path,
00484                                            const gchar * interface, osso_rpc_cb_f * cb,
00485                                            gpointer data,
00486                                            osso_rpc_retval_free_f *retval_free);
00487 
00491 osso_return_t osso_rpc_set_cb_f (osso_context_t * osso, const gchar * service,
00492                                  const gchar * object_path,
00493                                  const gchar * interface, osso_rpc_cb_f * cb,
00494                                  gpointer data);
00495 
00508 osso_return_t osso_rpc_set_default_cb_f_with_free (osso_context_t * osso,
00509                                                    osso_rpc_cb_f * cb, gpointer data,
00510                                                    osso_rpc_retval_free_f *retval_free);
00511 
00515 osso_return_t osso_rpc_set_default_cb_f (osso_context_t * osso,
00516                                          osso_rpc_cb_f * cb, gpointer data);
00517 
00518 
00531 osso_return_t osso_rpc_unset_cb_f (osso_context_t * osso,
00532                                    const gchar * service,
00533                                    const gchar * object_path,
00534                                    const gchar * interface,
00535                                    osso_rpc_cb_f * cb, gpointer data);
00536 
00546 osso_return_t osso_rpc_unset_default_cb_f (osso_context_t * osso,
00547                                            osso_rpc_cb_f * cb, gpointer data);
00548 
00555 osso_return_t osso_rpc_get_timeout (osso_context_t * osso, gint * timeout);
00556 
00563 osso_return_t osso_rpc_set_timeout(osso_context_t * osso, gint timeout);
00564 
00565 /* @}*/
00566 /**********************************************************************/
00651 osso_return_t osso_application_top(osso_context_t *osso,
00652                                    const gchar *application,
00653                                    const gchar *arguments);
00654 
00666 typedef void(osso_application_top_cb_f)(const gchar *arguments,
00667                                         gpointer data);
00668 
00681 osso_return_t osso_application_set_top_cb(osso_context_t *osso,
00682                                           osso_application_top_cb_f *cb,
00683                                           gpointer data);
00684 
00697 osso_return_t osso_application_unset_top_cb(osso_context_t *osso,
00698                                             osso_application_top_cb_f *cb,
00699                                             gpointer data);
00700 
00701 /**********************************************************************/
00702 /* @}*/
00728 
00734 typedef void(osso_application_autosave_cb_f)(gpointer data);
00735 
00746 osso_return_t osso_application_set_autosave_cb(osso_context_t *osso,
00747                                                osso_application_autosave_cb_f *cb,
00748                                                gpointer data);
00749 
00760 osso_return_t osso_application_unset_autosave_cb(osso_context_t *osso,
00761                                                  osso_application_autosave_cb_f *cb,
00762                                                  gpointer data);
00763 
00775 osso_return_t osso_application_userdata_changed(osso_context_t *osso);
00776 
00785 osso_return_t osso_application_autosave_force(osso_context_t *osso);
00786 
00787 /*
00788  * Returns the application name of a Libosso context.
00789  * @param osso The library context as returned by #osso_initialize.
00790  * @return The name of the parent application, or NULL if the context
00791  * is invalid.
00792  */
00793 const gchar * osso_application_name_get(osso_context_t *osso);
00794 
00795 /*
00796  * Returns the application version of a Libosso context.
00797  * @param osso The library context as returned by #osso_initialize.
00798  * @return The version of the application, or NULL if the context is
00799  * invalid.
00800  */
00801 const gchar * osso_application_version_get(osso_context_t *osso);
00802 
00805 /**********************************************************************/
00809 /* @{*/
00810 
00830 osso_return_t osso_statusbar_send_event(osso_context_t *osso,
00831                                         const gchar *name,
00832                                         gint argument1, gint argument2,
00833                                         const gchar *argument3,
00834                                         osso_rpc_t *retval);
00835 
00836 /* @}*/
00840 /* @{*/
00841 
00846 typedef void(osso_time_cb_f)(gpointer data);
00847 
00858 osso_return_t osso_time_set_notification_cb(osso_context_t *osso,
00859                                             osso_time_cb_f *cb,
00860                                             gpointer data);
00871 osso_return_t osso_time_set(osso_context_t *osso, time_t new_time);
00872 
00873 /* @}*/
00877 /* @{*/
00878 
00909 typedef void(osso_locale_change_cb_f)(const char *new_locale, gpointer data);
00910 
00921 osso_return_t osso_locale_change_set_notification_cb(osso_context_t *osso,
00922                                             osso_locale_change_cb_f *cb,
00923                                             gpointer data);
00924 
00935 osso_return_t osso_locale_set(osso_context_t *osso, char *new_locale);
00936 
00937 /* @}*/
00941 /* @{*/
00942 
00947 typedef enum {
00948   OSSO_GN_WARNING = 0, 
00949   OSSO_GN_ERROR,         
00950   OSSO_GN_NOTICE,        
00951   OSSO_GN_WAIT
00952 } osso_system_note_type_t;
00953 
00975 osso_return_t osso_system_note_dialog(osso_context_t *osso,
00976                                       const gchar *message,
00977                                       osso_system_note_type_t type,
00978                                       osso_rpc_t *retval);
00979 
00995 osso_return_t osso_system_note_infoprint(osso_context_t *osso,
00996                                          const gchar *text,
00997                                          osso_rpc_t *retval);
00998 
00999 /* @}*/
01000 /**********************************************************************/
01111 /* @{*/
01112 
01116 typedef struct {
01117   guint32 state_size; 
01118   gpointer state_data; 
01119 } osso_state_t;
01120 
01151 osso_return_t osso_state_write(osso_context_t *osso, osso_state_t *state);
01152 
01191 osso_return_t osso_state_read(osso_context_t *osso, osso_state_t *state);
01192 
01193 
01194 /* @}*/
01195 /**********************************************************************/
01199 /* @{*/
01216 osso_return_t osso_cp_plugin_execute(osso_context_t *osso,
01217                                      const gchar *filename,
01218                                      gpointer data, gboolean user_activated);
01219 
01230 osso_return_t osso_cp_plugin_save_state(osso_context_t *osso,
01231                                         const gchar *filename,
01232                                         gpointer data);
01233 /* @}*/
01234 /**********************************************************************/
01241 typedef enum {
01242   OSSO_DEVMODE_NORMAL = 0, /* Normal mode */
01243   OSSO_DEVMODE_FLIGHT,     /* Flight mode */
01244   OSSO_DEVMODE_OFFLINE,    /* Offline mode; unsupported! */
01245   OSSO_DEVMODE_INVALID     /* Should *never* occur! */
01246 } osso_devmode_t;
01247 
01248 
01255 typedef struct {
01256   gboolean shutdown_ind; 
01257   gboolean save_unsaved_data_ind; 
01259   gboolean memory_low_ind; 
01260   gboolean system_inactivity_ind; 
01263   osso_devmode_t sig_device_mode_ind; 
01264 } osso_hw_state_t;
01265 
01266 
01277 osso_return_t osso_display_state_on(osso_context_t *osso);
01278 
01290 osso_return_t osso_display_blanking_pause(osso_context_t *osso);
01291 
01299 typedef void (osso_hw_cb_f)(osso_hw_state_t *state, gpointer data);
01300 
01316 osso_return_t osso_hw_set_event_cb(osso_context_t *osso,
01317                                    osso_hw_state_t *state,
01318                                    osso_hw_cb_f *cb, gpointer data);
01319 
01328 osso_return_t osso_hw_unset_event_cb(osso_context_t *osso,
01329                                      osso_hw_state_t *state);
01330 
01331 
01332 typedef enum {
01333   OSSO_DISPLAY_ON,
01334   OSSO_DISPLAY_OFF,
01335   OSSO_DISPLAY_DIMMED
01336 } osso_display_state_t;
01337 
01338 typedef void(osso_display_event_cb_f)(osso_display_state_t state,
01339                                       gpointer data);
01340 
01352 osso_return_t osso_hw_set_display_event_cb(osso_context_t *osso,
01353                                            osso_display_event_cb_f *cb,
01354                                            gpointer data);
01355 
01357 /**********************************************************************/
01362 
01371 typedef void (osso_mime_cb_f)(gpointer data, int argc, gchar **argv);
01372 
01385 osso_return_t osso_mime_set_cb(osso_context_t *osso, osso_mime_cb_f *cb,
01386                                gpointer data);
01387 
01396 osso_return_t osso_mime_unset_cb(osso_context_t *osso);
01397 
01398 osso_return_t osso_mime_unset_cb_full(osso_context_t *osso,
01399                                       osso_mime_cb_f *cb, gpointer data);
01408 gpointer osso_get_dbus_connection(osso_context_t *osso);
01409 
01410 
01417 gpointer osso_get_sys_dbus_connection(osso_context_t *osso);
01418 
01420 G_END_DECLS
01421 
01422 #endif /* LIBOSSO_H_*/

Generated on Thu Mar 10 2011 13:46:29 for Libosso by  doxygen 1.7.1