LibSharing Manual | ||||
---|---|---|---|---|
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);
SharingPluginInterface defines the interface that the Sharing framework uses when calling a sharing plugin.
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;
typedef enum { SHARING_ACCOUNT_SETUP_SUCCESS = 0, SHARING_ACCOUNT_SETUP_ERROR_UNKNOWN = 1, SHARING_ACCOUNT_SETUP_ERROR_CONNECTION = 2 } SharingPluginInterfaceAccountSetupResult;
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;
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;
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;
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |