Add methods to account protocol to fetch the from list and signatures
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 4 Mar 2009 16:32:08 +0000 (16:32 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 4 Mar 2009 16:32:08 +0000 (16:32 +0000)
pmo-trunk-r7789

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

index 8644d39..ef8c3ee 100644 (file)
@@ -89,6 +89,15 @@ static void modest_account_protocol_check_support_default (ModestAccountProtocol
                                                           ModestAccountProtocolCheckSupportFunc func,
                                                           gpointer userdata);
 static gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
                                                           ModestAccountProtocolCheckSupportFunc func,
                                                           gpointer userdata);
 static gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
+static gchar *modest_account_protocol_get_from_default (ModestAccountProtocol *self,
+                                                       const gchar *account_id,
+                                                       const gchar *mailbox);
+static ModestPairList *modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
+                                                                     const gchar *account_id);
+static gchar *modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
+                                                            const gchar *account_id,
+                                                            const gchar *mailbox);
+
 
 /* globals */
 static GObjectClass *parent_class = NULL;
 
 /* globals */
 static GObjectClass *parent_class = NULL;
@@ -176,6 +185,12 @@ modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
                modest_account_protocol_is_supported_default;
        account_class->check_support =
                modest_account_protocol_check_support_default;
                modest_account_protocol_is_supported_default;
        account_class->check_support =
                modest_account_protocol_check_support_default;
+       account_class->get_from =
+               modest_account_protocol_get_from_default;
+       account_class->get_from_list =
+               modest_account_protocol_get_from_list_default;
+       account_class->get_signature =
+               modest_account_protocol_get_signature_default;
 }
 
 static void
 }
 
 static void
@@ -612,3 +627,53 @@ modest_account_protocol_check_support (ModestAccountProtocol *self,
 {
        MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
 }
 {
        MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
 }
+
+gchar *
+modest_account_protocol_get_from (ModestAccountProtocol *self,
+                                 const gchar *account_id,
+                                 const gchar *mailbox)
+{
+       return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from (self, account_id, mailbox);
+}
+static gchar *
+modest_account_protocol_get_from_default (ModestAccountProtocol *self,
+                                         const gchar *account_id,
+                                         const gchar *mailbox)
+{
+       g_return_val_if_fail (MODEST_ACCOUNT_PROTOCOL (self), NULL);
+
+       return NULL;
+}
+
+ModestPairList *
+modest_account_protocol_get_from_list (ModestAccountProtocol *self,
+                                      const gchar *account_id)
+{
+       return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from_list (self, account_id);
+}
+static ModestPairList *
+modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
+                                              const gchar *account_id)
+{
+       g_return_val_if_fail (MODEST_ACCOUNT_PROTOCOL (self), NULL);
+
+       return NULL;
+}
+
+gchar *
+modest_account_protocol_get_signature (ModestAccountProtocol *self,
+                                      const gchar *account_id,
+                                      const gchar *mailbox)
+{
+       return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_signature (self, account_id, mailbox);
+}
+static gchar *
+modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
+                                              const gchar *account_id,
+                                              const gchar *mailbox)
+{
+       g_return_val_if_fail (MODEST_ACCOUNT_PROTOCOL (self), NULL);
+
+       return NULL;
+}
+
index 78a606b..18ae25a 100644 (file)
@@ -73,6 +73,9 @@ struct _ModestAccountProtocolClass {
        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);
        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);
 };
 
 /**
 };
 
 /**
@@ -317,6 +320,48 @@ void modest_account_protocol_check_support (ModestAccountProtocol *self,
  */
 gboolean modest_account_protocol_is_supported (ModestAccountProtocol *self);
 
  */
 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);
+
 G_END_DECLS
 
 #endif /* __MODEST_ACCOUNT_PROTOCOL_H__ */
 G_END_DECLS
 
 #endif /* __MODEST_ACCOUNT_PROTOCOL_H__ */