X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-account-protocol.h;h=651ea0ff460160aa102a73d1e531fed4c48ad2b2;hp=eca9b0ff26c3db522b169a5a07460ce249a93df8;hb=77279a928905bb344342d4d12bc5c0275c1ced27;hpb=627c4af6ac85444cc3256fa568baf4a8d62178ae diff --git a/src/modest-account-protocol.h b/src/modest-account-protocol.h index eca9b0f..651ea0f 100644 --- a/src/modest-account-protocol.h +++ b/src/modest-account-protocol.h @@ -35,6 +35,7 @@ #include "widgets/modest-account-settings-dialog.h" #include "modest-protocol.h" +#include "widgets/modest-wizard-dialog.h" #include "modest-pair.h" #include #include @@ -52,6 +53,23 @@ G_BEGIN_DECLS typedef struct _ModestAccountProtocol ModestAccountProtocol; typedef struct _ModestAccountProtocolClass ModestAccountProtocolClass; +typedef enum { + MODEST_ACCOUNT_PROTOCOL_ICON_MAILBOX = 0, + MODEST_ACCOUNT_PROTOCOL_ICON_PROTOCOL, + MODEST_ACCOUNT_PROTOCOL_ICON_ACCOUNT, + MODEST_ACCOUNT_PROTOCOL_ICON_FOLDER, +} ModestAccountProtocolIconType; + +typedef void (*ModestAccountProtocolCheckSupportFunc) (ModestAccountProtocol *self, + gboolean supported, gpointer userdata); +typedef void (*ModestAccountProtocolSaveRemoteDraftCallback) (ModestAccountProtocol *self, + GError *error, + const gchar *account_id, + TnyMsg *new_remote_msg, + TnyMsg *new_msg, + TnyMsg *old_msg, + gpointer userdata); + struct _ModestAccountProtocol { ModestProtocol parent; @@ -64,8 +82,37 @@ struct _ModestAccountProtocolClass { TnyAccount * (*create_account) (ModestAccountProtocol *self); ModestAccountSettingsDialog* (*create_account_settings_dialog) (ModestAccountProtocol* self); ModestPairList* (*get_easysetupwizard_tabs) (ModestAccountProtocol* self); + ModestWizardDialogResponseOverrideFunc (*get_wizard_response_override) (ModestAccountProtocol *self); void (*save_settings) (ModestAccountProtocol *self, ModestAccountSettingsDialog *dialog, ModestAccountSettings *settings); void (*save_wizard_settings) (ModestAccountProtocol *self, GList *wizard_pages, ModestAccountSettings *settings); + gboolean (*is_supported) (ModestAccountProtocol *self); + void (*check_support) (ModestAccountProtocol *self, ModestAccountProtocolCheckSupportFunc func, gpointer userdata); + gchar * (*get_from) (ModestAccountProtocol *self, const gchar *account_id, const gchar *mailbox); + ModestPairList * (*get_from_list) (ModestAccountProtocol *self, const gchar *account_id); + gchar * (*get_signature) (ModestAccountProtocol *self, const gchar *account_id, const gchar *mailbox, gboolean *has_signature); + const GdkPixbuf * (*get_icon) (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type, + GObject *object, guint icon_size); + gchar * (*get_service_name) (ModestAccountProtocol *self, const gchar *account_id, const gchar *mailbox); + const GdkPixbuf * (*get_service_icon) (ModestAccountProtocol *self, const gchar *account_id, const gchar *mailbox, guint icon_size); + void (*save_remote_draft) (ModestAccountProtocol *self, + const gchar *account_id, TnyMsg *new_msg, TnyMsg *old_msg, + ModestAccountProtocolSaveRemoteDraftCallback callback, + gpointer userdata); + void (*cancel_check_support) (ModestAccountProtocol *self); + + /* Padding for future expansions */ + void (*_reserved5) (void); + void (*_reserved6) (void); + void (*_reserved7) (void); + void (*_reserved8) (void); + void (*_reserved9) (void); + void (*_reserved10) (void); + void (*_reserved11) (void); + void (*_reserved12) (void); + void (*_reserved13) (void); + void (*_reserved14) (void); + void (*_reserved15) (void); + void (*_reserved16) (void); }; /** @@ -272,6 +319,161 @@ void modest_account_protocol_save_wizard_settings (ModestAccountProtocol *self, GList *wizard_pages, ModestAccountSettings *settings); +/** + * modest_account_protocol_get_wizard_response_override: + * @self: a #ModestAccountProtocol + * + * obtains the method that should be used to override wizard response behavior when the + * wizard is setting up this account type. + * + * Returns: a #ModestWizardDialogResponseOverrideFunc + */ +ModestWizardDialogResponseOverrideFunc modest_account_protocol_get_wizard_response_override (ModestAccountProtocol *self); + + +/** + * modest_account_protocol_check_support: + * @self: a #ModestAccountProtocol + * @func: a #ModestAccountProtocolCheckSupportFunc + * @userdata: a gpointer + * + * This method checks asynchronously if the account protocol @self is + * supported. Once checked, @func will be called with the result in the + * mainloop. + * + * modest_account_protocol_is_supported() should return the cached response + * from this method. + */ +void modest_account_protocol_check_support (ModestAccountProtocol *self, + ModestAccountProtocolCheckSupportFunc func, + gpointer userdata); + +/** + * modest_account_protocol_cancel_check_support: + * @self: a #ModestAccountProtocol + * + * This method requests that the check support requests running should be + * immediately cancelled. Once this happens, is_supported should return %FALSE + * until a new succesful check_support request is finished. + */ +void modest_account_protocol_cancel_check_support (ModestAccountProtocol *self); + +/** + * modest_account_protocol_is_supported: + * @self: a #ModestAccountProtocol + * + * Determines if the account protocol is supported on this device. + * + * Returns: %TRUE if the protocol is supported, %FALSE otherwise + */ +gboolean modest_account_protocol_is_supported (ModestAccountProtocol *self); + +/** + * modest_account_protocol_get_from: + * @self: a #ModestAccountProtocol + * @account_id: a transport account name + * @mailbox: a mailbox + * + * Obtain the From: string for the account and mailbox. Should be used only + * with transports with multi mailbox support. + * + * Returns: a newly allocated string + */ +gchar *modest_account_protocol_get_from (ModestAccountProtocol *self, + const gchar *account_id, + const gchar *mailbox); + +/** + * modest_account_protocol_get_from_list: + * @self: a #ModestAccountProtocol + * @account_id: a transport account name + * + * Obtain a list of pairs (mailbox - From: string) for filling the From picker. + * + * Returns: a ModestPairList + */ +ModestPairList *modest_account_protocol_get_from_list (ModestAccountProtocol *self, + const gchar *account_id); + +/** + * modest_account_protocol_get_signature: + * @self: a #ModestAccountProtocol + * @account_id: a transport account name + * @mailbox: a mailbox + * + * Obtain the signature string for the account and mailbox. Should be used only + * with transports with multi mailbox support. + * + * Returns: a newly allocated string + */ +gchar *modest_account_protocol_get_signature (ModestAccountProtocol *self, + const gchar *account_id, + const gchar *mailbox, + gboolean *has_signature); + +/** + * modest_account_protocol_get_icon: + * @self: a #ModestAccountProtocl + * @icon_type: a #ModestAccountProtocolIconType + * @object: a #GObject + * @icon_size: the icon size to get + * + * Returns a @self owned #GdkPixbuf with the icon for @icon_type and @object. @object type + * should match @icon_type. + * + * Returns: a #GdkPixbuf (don't free or manipulate this, just copy) + */ +const GdkPixbuf * modest_account_protocol_get_icon (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type, + GObject *object, guint icon_size); + +/** + * modest_account_protocol_get_service_name: + * @self: a #ModestAccountProtocol + * @account_id: a transport account name + * @mailbox: a mailbox + * + * Obtain the service name string for the account and mailbox. + * + * Returns: a newly allocated string + */ +gchar *modest_account_protocol_get_service_name (ModestAccountProtocol *self, + const gchar *account_id, + const gchar *mailbox); + +/** + * modest_account_protocol_get_service_icon: + * @self: a #ModestAccountProtocol + * @account_id: a transport account name + * @mailbox: a mailbox + * + * Obtain the service icon for the account and mailbox. + * + * Returns: a protocol owned #GdkPixbuf + */ +const GdkPixbuf *modest_account_protocol_get_service_icon (ModestAccountProtocol *self, + const gchar *account_id, + const gchar *mailbox, + guint icon_size); + +/** + * modest_account_protocol_save_remote_draft: + * @self: a #ModestAccountProtocol + * @account_id: a transport account_name + * @new_msg: the newly created message in local storage. + * @old_msg: the old message + * @callback: the code that should be executed on finishing the remote message saving + * @userdata: a #gpointer + * + * Saves the just-saved to local draft, into a remote storage. + */ +void modest_account_protocol_save_remote_draft (ModestAccountProtocol *self, + const gchar *account_id, + TnyMsg *new_msg, + TnyMsg *old_msg, + ModestAccountProtocolSaveRemoteDraftCallback callback, + gpointer userdata); + + G_END_DECLS #endif /* __MODEST_ACCOUNT_PROTOCOL_H__ */