Autosaving


Typedefs

typedef void( osso_application_autosave_cb_f )(gpointer data)

Functions

osso_return_t osso_application_set_autosave_cb (osso_context_t *osso, osso_application_autosave_cb_f *cb, gpointer data)
osso_return_t osso_application_unset_autosave_cb (osso_context_t *osso, osso_application_autosave_cb_f *cb, gpointer data)
osso_return_t osso_application_userdata_changed (osso_context_t *osso)
osso_return_t osso_application_autosave_force (osso_context_t *osso)
const gchar * osso_application_name_get (osso_context_t *osso)
const gchar * osso_application_version_get (osso_context_t *osso)

Detailed Description

How to use autosave:
The application registers callback function(s) that is/are called by Libosso to save the user data (such as an unsaved document). Whenever the user data changes, the application calls osso_application_userdata_changed to tell Libosso that the callback(s) should be called in the future.

Libosso will call the callback(s) when:

  1. a "dirty data" timer in Libosso expires
  2. Libosso gets a message from the system that unsaved user data should be saved (e.g. at shutdown)

The application should call osso_application_autosave_force whenever it is switched to the background (untopped).

After the autosave callbacks have been called, the timer inside Libosso is reset and the application needs to call osso_application_userdata_changed again when it has new "dirty" user data.


Typedef Documentation

typedef void( osso_application_autosave_cb_f)(gpointer data)

This is the type for the autosave callback function.

Parameters:
data Arbitrary application specific pointer.


Function Documentation

osso_return_t osso_application_autosave_force ( osso_context_t osso  ) 

This function forces a call to the application's autosave function, and resets the autosave timeout.

Parameters:
osso The library context as returned by osso_initialize.
Returns:
OSSO_OK if all goes well, OSSO_ERROR if an error occurred, or OSSO_INVALID if some parameter is invalid.

const gchar* osso_application_name_get ( osso_context_t osso  ) 

osso_return_t osso_application_set_autosave_cb ( osso_context_t osso,
osso_application_autosave_cb_f cb,
gpointer  data 
)

This function registers an autosave callback function.

Parameters:
osso The library context as returned by osso_initialize.
cb The callback function.
data Arbitrary application specific pointer that will be passed to the callback and ignored by Libosso.
Returns:
OSSO_OK if all goes well, OSSO_ERROR if an error occurred, or OSSO_INVALID if some parameter is invalid.

osso_return_t osso_application_unset_autosave_cb ( osso_context_t osso,
osso_application_autosave_cb_f cb,
gpointer  data 
)

This function unregisters an autosave callback function.

Parameters:
osso The library context as returned by osso_initialize.
cb The callback function.
data Arbitrary application specific pointer that will be passed to the callback and ignored by Libosso.
Returns:
OSSO_OK if all goes well, OSSO_ERROR if an error occurred, or OSSO_INVALID if some parameter is invalid.

osso_return_t osso_application_userdata_changed ( osso_context_t osso  ) 

This function is called by the application when the user data has been changed, so that Libosso knows that a call to the autosave callback is needed in the future to save the user data. The dirty state will be cleared every time the application's autosave callback function is called.

Parameters:
osso The library context as returned by osso_initialize.
Returns:
OSSO_OK if all goes well, OSSO_ERROR if an error occurred or OSSO_INVALID if some parameter is invalid.

const gchar* osso_application_version_get ( osso_context_t osso  ) 


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