Added method modest_account_protocol_check_support
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 25 Feb 2009 11:00:51 +0000 (11:00 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 25 Feb 2009 11:00:51 +0000 (11:00 +0000)
pmo-trunk-r7678

src/modest-account-protocol.c
src/modest-account-protocol.h

index 0db2e41..8644d39 100644 (file)
@@ -85,6 +85,9 @@ static void modest_account_protocol_save_wizard_settings_default (ModestAccountP
 static ModestWizardDialogResponseOverrideFunc 
 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self);
 
+static void modest_account_protocol_check_support_default (ModestAccountProtocol *self,
+                                                          ModestAccountProtocolCheckSupportFunc func,
+                                                          gpointer userdata);
 static gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
 
 /* globals */
@@ -171,6 +174,8 @@ modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
                modest_account_protocol_get_wizard_response_override_default;
        account_class->is_supported =
                modest_account_protocol_is_supported_default;
+       account_class->check_support =
+               modest_account_protocol_check_support_default;
 }
 
 static void
@@ -590,3 +595,20 @@ modest_account_protocol_is_supported (ModestAccountProtocol *self)
 {
        return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->is_supported (self);
 }
+
+static void
+modest_account_protocol_check_support_default (ModestAccountProtocol *self,
+                                              ModestAccountProtocolCheckSupportFunc func,
+                                              gpointer userdata)
+{
+       if (func)
+               func (self, TRUE, userdata);
+}
+
+void
+modest_account_protocol_check_support (ModestAccountProtocol *self,
+                                      ModestAccountProtocolCheckSupportFunc func,
+                                      gpointer userdata)
+{
+       MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
+}
index ef7ac27..78a606b 100644 (file)
@@ -53,6 +53,9 @@ G_BEGIN_DECLS
 typedef struct _ModestAccountProtocol      ModestAccountProtocol;
 typedef struct _ModestAccountProtocolClass ModestAccountProtocolClass;
 
+typedef void (*ModestAccountProtocolCheckSupportFunc) (ModestAccountProtocol *self, 
+                                                      gboolean supported, gpointer userdata);
+
 
 struct _ModestAccountProtocol {
        ModestProtocol parent;
@@ -69,6 +72,7 @@ struct _ModestAccountProtocolClass {
        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);
 };
 
 /**
@@ -286,6 +290,23 @@ void modest_account_protocol_save_wizard_settings (ModestAccountProtocol *self,
  */
 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_is_supported:
  * @self: a #ModestAccountProtocol