SharingPluginInterface

SharingPluginInterface — The Sharing plugin GModule interface.

Synopsis

enum                SharingPluginInterfaceSendResult;
enum                SharingPluginInterfaceAccountSetupResult;
enum                SharingPluginInterfaceAccountValidateResult;
enum                SharingPluginInterfaceEditAccountResult;
enum                SharingPluginInterfaceUpdateOptionsResult;
guint               (*SharingPluginInterfaceInit)       (gboolean *dead_mans_switch);
guint               (*SharingPluginInterfaceUninit)     (gboolean *dead_mans_switch);
SharingPluginInterfaceSendResult (*SharingPluginInterfaceSend)
                                                        (SharingTransfer *transfer,
                                                         ConIcConnection *con,
                                                         gboolean *dead_mans_switch);
SharingPluginInterfaceAccountSetupResult (*SharingPluginInterfaceAccountSetup)
                                                        (GtkWindow *parent,
                                                         SharingService *service,
                                                         SharingAccount **worked_on,
                                                         osso_context_t *osso);
SharingPluginInterfaceAccountValidateResult (*SharingPluginInterfaceAccountValidate)
                                                        (SharingAccount *account,
                                                         ConIcConnection *con,
                                                         gboolean *cont,
                                                         gboolean *dead_mans_switch);
SharingPluginInterfaceEditAccountResult (*SharingPluginInterfaceEditAccount)
                                                        (GtkWindow *parent,
                                                         SharingAccount *account,
                                                         ConIcConnection *con,
                                                         gboolean *dead_mans_switch);
gboolean            (*SharingPluginInterfaceUpdateOptions)
                                                        (SharingAccount *account,
                                                         ConIcConnection *con,
                                                         gboolean *cont,
                                                         gboolean *dead_mans_switch,
                                                         UpdateOptionsCallback cb_func,
                                                         gpointer cb_data);
void                (*UpdateOptionsCallback)            (SharingPluginInterfaceUpdateOptionsResult result,
                                                         gpointer cb_data);

Description

SharingPluginInterface defines the interface that the Sharing framework uses when calling a sharing plugin.

Details

enum SharingPluginInterfaceSendResult

typedef enum {
    SHARING_SEND_SUCCESS = 0,
    SHARING_SEND_ERROR_UNKNOWN = 1,
    SHARING_SEND_ERROR_AUTH = 2,
    SHARING_SEND_ERROR_CONNECTION = 3,
    SHARING_SEND_CANCELLED = 4,
    SHARING_SEND_ERROR_FILE_FORMAT = 5,
    SHARING_SEND_ERROR_UPLOAD_LIMIT = 6,
    SHARING_SEND_ERROR_ACCOUNT_NOT_FOUND = 7,
    SHARING_SEND_ERROR_TIMEOUT = 8
} SharingPluginInterfaceSendResult;

enum SharingPluginInterfaceAccountSetupResult

typedef enum {
    SHARING_ACCOUNT_SETUP_SUCCESS = 0,
    SHARING_ACCOUNT_SETUP_ERROR_UNKNOWN = 1,
    SHARING_ACCOUNT_SETUP_ERROR_CONNECTION = 2
} SharingPluginInterfaceAccountSetupResult;

SHARING_ACCOUNT_SETUP_SUCCESS Setup UI flow succesfully completed.
SHARING_ACCOUNT_SETUP_ERROR_UNKNOWN General failure.
SHARING_ACCOUNT_SETUP_ERROR_CONNECTION Connection or connection timeout error.

enum SharingPluginInterfaceAccountValidateResult

typedef enum {
    SHARING_ACCOUNT_VALIDATE_SUCCESS = 0,
    SHARING_ACCOUNT_VALIDATE_ACCOUNT_NOT_FOUND = 1,
    SHARING_ACCOUNT_VALIDATE_FAILED = 2,
    SHARING_ACCOUNT_VALIDATE_ERROR_UNKNOWN = 3,
    SHARING_ACCOUNT_VALIDATE_ERROR_CONNECTION = 4,
    SHARING_ACCOUNT_VALIDATE_NOT_STARTED = 5,
    SHARING_ACCOUNT_VALIDATE_CANCELLED = 6
} SharingPluginInterfaceAccountValidateResult;

SHARING_ACCOUNT_VALIDATE_SUCCESS Setup UI flow succesfully completed.
SHARING_ACCOUNT_VALIDATE_ACCOUNT_NOT_FOUND Account data could not be loaded.
SHARING_ACCOUNT_VALIDATE_FAILED Account information invalid.
SHARING_ACCOUNT_VALIDATE_ERROR_UNKNOWN General error.
SHARING_ACCOUNT_VALIDATE_ERROR_CONNECTION Connection or connection timeout error.
SHARING_ACCOUNT_VALIDATE_NOT_STARTED Validation process not started.
SHARING_ACCOUNT_VALIDATE_CANCELLED Returned when the validation dialog is closed by the user.

enum SharingPluginInterfaceEditAccountResult

typedef enum {
    SHARING_EDIT_ACCOUNT_SUCCESS = 0,
    SHARING_EDIT_ACCOUNT_ERROR_UNKNOWN = 1,
    SHARING_EDIT_ACCOUNT_ERROR_CONNECTION = 2,
    SHARING_EDIT_ACCOUNT_NOT_STARTED = 3,
    SHARING_EDIT_ACCOUNT_DELETE = 4,
    SHARING_EDIT_ACCOUNT_CANCELLED = 5
} SharingPluginInterfaceEditAccountResult;

SHARING_EDIT_ACCOUNT_SUCCESS Account editing succesfully completed.
SHARING_EDIT_ACCOUNT_ERROR_UNKNOWN General error.
SHARING_EDIT_ACCOUNT_ERROR_CONNECTION Connection or connection timeout error.
SHARING_EDIT_ACCOUNT_NOT_STARTED Editing process not started.
SHARING_EDIT_ACCOUNT_DELETE Account is marked for deletion.
SHARING_EDIT_ACCOUNT_CANCELLED Editing cancelled by the user.

enum SharingPluginInterfaceUpdateOptionsResult

typedef enum {
    SHARING_UPDATE_OPTIONS_SUCCESS = 0,
    SHARING_UPDATE_OPTIONS_ERROR_UNKNOWN = 1,
    SHARING_UPDATE_OPTIONS_CANCELLED = 2,
    SHARING_UPDATE_OPTIONS_NO_UPDATE_FUNCTIONALITY = 3,
    SHARING_UPDATE_OPTIONS_ERROR_PARAMETERS = 4
} SharingPluginInterfaceUpdateOptionsResult;

SHARING_UPDATE_OPTIONS_SUCCESS Updating succesfully completed.
SHARING_UPDATE_OPTIONS_ERROR_UNKNOWN General error.
SHARING_UPDATE_OPTIONS_CANCELLED Updating cancelled by the user.
SHARING_UPDATE_OPTIONS_NO_UPDATE_FUNCTIONALITY Does not support update.
SHARING_UPDATE_OPTIONS_ERROR_PARAMETERS Parameters invalid.

SharingPluginInterfaceInit ()

guint               (*SharingPluginInterfaceInit)       (gboolean *dead_mans_switch);

Sharing Service Plugin Interface function for plugin initialization. This function must be implemented in Sharing Plugins. The function is called immediately after the plugin is loaded.

dead_mans_switch : while in this function, this switch should be set to FALSE at least every 30 seconds
Returns : the plugin should return 0 if initialization was successful, or 1 otherwise

SharingPluginInterfaceUninit ()

guint               (*SharingPluginInterfaceUninit)     (gboolean *dead_mans_switch);

Sharing Service Plugin Interface function for SharingEntry sending. This function must be implemented in Sharing Plugins. The function is called before plugin a is unloaded.

dead_mans_switch : while in this function, this switch should be set to FALSE at least every 30 seconds
Returns : the plugin should return 0 if uninitialization was successful, or 1 otherwise

SharingPluginInterfaceSend ()

SharingPluginInterfaceSendResult (*SharingPluginInterfaceSend)
                                                        (SharingTransfer *transfer,
                                                         ConIcConnection *con,
                                                         gboolean *dead_mans_switch);

Sharing Service Plugin Interface function for SharingTransfer sending. This function must be implemented in Sharing Plugins.

transfer : Transfer to be send
con : ConIc connection
dead_mans_switch : while in this function, this switch should be set to FALSE as often as possible. Do NOT use any GTK idle / timeout function to do this!
Returns : the plugin should return a suitable SharingPluginInterfaceSendResult value

SharingPluginInterfaceAccountSetup ()

SharingPluginInterfaceAccountSetupResult (*SharingPluginInterfaceAccountSetup)
                                                        (GtkWindow *parent,
                                                         SharingService *service,
                                                         SharingAccount **worked_on,
                                                         osso_context_t *osso);

Sharing Service Plugin Interface function for SharingAccount setup.

parent : parent window
service : a SharingService
worked_on : a SharingAccount if a suitable one already exists, or NULL otherwise
osso : osso_context_t to be used for the dialog
Returns : the plugin should return a suitable SharingPluginInterfaceAccountSetupResult value

SharingPluginInterfaceAccountValidate ()

SharingPluginInterfaceAccountValidateResult (*SharingPluginInterfaceAccountValidate)
                                                        (SharingAccount *account,
                                                         ConIcConnection *con,
                                                         gboolean *cont,
                                                         gboolean *dead_mans_switch);

Sharing Service Plugin Interface function for validating a SharingAccount. This function must be implemented in Sharing Plugins.

account : a SharingAccount to validate
con : a ConIc connection
cont : whether the validation process should be continued. TRUE in the common case, FALSE if the validation dialog is cancelled, and the validation process should be ended in this case
dead_mans_switch : while in this function, this switch should be set to FALSE at least every 30 seconds
Returns : the plugin should return a suitable SharingPluginInterfaceAccountValidateResult value

SharingPluginInterfaceEditAccount ()

SharingPluginInterfaceEditAccountResult (*SharingPluginInterfaceEditAccount)
                                                        (GtkWindow *parent,
                                                         SharingAccount *account,
                                                         ConIcConnection *con,
                                                         gboolean *dead_mans_switch);

Sharing Service Plugin Interface function to edit a SharingAccount. This function must be implemented in Sharing Plugins.

parent : a parent window
account : a SharingAccount to edit
con : a ConIc connection
dead_mans_switch : while in this function, this switch should be set to FALSE at least every 30 seconds
Returns : the plugin should return a suitable SharingPluginInterfaceEditAccountResult value

SharingPluginInterfaceUpdateOptions ()

gboolean            (*SharingPluginInterfaceUpdateOptions)
                                                        (SharingAccount *account,
                                                         ConIcConnection *con,
                                                         gboolean *cont,
                                                         gboolean *dead_mans_switch,
                                                         UpdateOptionsCallback cb_func,
                                                         gpointer cb_data);

Update options (for example, albums) set on a SharingAccount.

account : SharingAccount that will have the updated options
con : a ConIc connection
dead_mans_switch : while in this function, this switch should be set to FALSE at least every 30 seconds
cb_func : a callback function that is called when the update UI flow is complete
cb_data : data passed to the callback function
Returns : TRUE if start was OK, FALSE otherwise. The callback is called in the TRUE case only

UpdateOptionsCallback ()

void                (*UpdateOptionsCallback)            (SharingPluginInterfaceUpdateOptionsResult result,
                                                         gpointer cb_data);

Callback function to be called when SharingAccount options are updated.

result : Result of plug-in's flow.
cb_data : data to pass to the callback function