Notify account protocol plugins when the wizard has finished.
authorJose Dapena Paz <jdapena@igalia.com>
Fri, 21 Aug 2009 18:11:34 +0000 (20:11 +0200)
committerJose Dapena Paz <jdapena@igalia.com>
Fri, 21 Aug 2009 18:11:34 +0000 (20:11 +0200)
src/hildon2/modest-easysetup-wizard-dialog.c
src/modest-account-protocol.c
src/modest-account-protocol.h

index e866c15..3527552 100644 (file)
@@ -201,6 +201,26 @@ modest_easysetup_wizard_dialog_finalize (GObject *object)
 {
        ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (object);
        ModestEasysetupWizardDialogPrivate *priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
+       ModestProtocolRegistry *registry;
+       GSList *provider_protos, *node;
+
+       registry = modest_runtime_get_protocol_registry ();
+       provider_protos = modest_protocol_registry_get_by_tag (registry,
+                                                              MODEST_PROTOCOL_REGISTRY_PROVIDER_PROTOCOLS);
+
+       for (node = provider_protos; node != NULL; node = g_slist_next (node)) {
+               ModestProtocol *proto = MODEST_PROTOCOL (node->data);
+
+               if (!modest_protocol_registry_protocol_type_has_tag (registry,
+                                                                    modest_protocol_get_type_id (proto),
+                                                                    MODEST_PROTOCOL_REGISTRY_STORE_PROTOCOLS))
+                       continue;
+
+               if (MODEST_ACCOUNT_PROTOCOL (proto)) {
+                       modest_account_protocol_wizard_finished (MODEST_ACCOUNT_PROTOCOL (proto));
+               }
+       }
+       g_slist_free (provider_protos);
 
        if (priv->account_manager)
                g_object_unref (G_OBJECT (priv->account_manager));
index c9cdbb8..c527d43 100644 (file)
@@ -90,6 +90,7 @@ static void modest_account_protocol_check_support_default (ModestAccountProtocol
                                                           ModestAccountProtocolCheckSupportFunc func,
                                                           gpointer userdata);
 static void modest_account_protocol_cancel_check_support_default (ModestAccountProtocol *self);
+static void modest_account_protocol_wizard_finished_default (ModestAccountProtocol *self);
 static gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
 static gchar *modest_account_protocol_get_from_default (ModestAccountProtocol *self,
                                                        const gchar *account_id,
@@ -208,6 +209,8 @@ modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
                modest_account_protocol_check_support_default;
        account_class->cancel_check_support =
                modest_account_protocol_cancel_check_support_default;
+       account_class->wizard_finished =
+               modest_account_protocol_wizard_finished_default;
        account_class->get_from =
                modest_account_protocol_get_from_default;
        account_class->get_from_list =
@@ -672,6 +675,18 @@ modest_account_protocol_cancel_check_support (ModestAccountProtocol *self)
        MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->cancel_check_support (self);
 }
 
+static void
+modest_account_protocol_wizard_finished_default (ModestAccountProtocol *self)
+{
+       return;
+}
+
+void
+modest_account_protocol_wizard_finished (ModestAccountProtocol *self)
+{
+       MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->wizard_finished (self);
+}
+
 gchar *
 modest_account_protocol_get_from (ModestAccountProtocol *self,
                                  const gchar *account_id,
index 651ea0f..e021753 100644 (file)
@@ -99,9 +99,9 @@ struct _ModestAccountProtocolClass {
                                   ModestAccountProtocolSaveRemoteDraftCallback callback,
                                   gpointer userdata);
        void (*cancel_check_support) (ModestAccountProtocol *self);
+       void (*wizard_finished) (ModestAccountProtocol *self);
 
        /* Padding for future expansions */
-       void (*_reserved5) (void);
        void (*_reserved6) (void);
        void (*_reserved7) (void);
        void (*_reserved8) (void);
@@ -359,6 +359,15 @@ void modest_account_protocol_check_support (ModestAccountProtocol *self,
 void modest_account_protocol_cancel_check_support (ModestAccountProtocol *self);
 
 /**
+ * modest_account_protocol_wizard_finished:
+ * @self: a #ModestAccountProtocol
+ *
+ * Method that let protocol know if the wizard has finished, for the case it's
+ * needed to do some stuff after check_support.
+ */
+void modest_account_protocol_wizard_finished (ModestAccountProtocol *self);
+
+/**
  * modest_account_protocol_is_supported:
  * @self: a #ModestAccountProtocol
  *