1 /* Copyright (c) 2008, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <tny-simple-list.h>
31 #include "modest-account-protocol.h"
32 #include "modest-account-mgr-helpers.h"
33 #include "widgets/modest-default-account-settings-dialog.h"
34 #include "modest-runtime.h"
35 #include "modest-marshal.h"
44 typedef struct _ModestAccountProtocolPrivate ModestAccountProtocolPrivate;
45 struct _ModestAccountProtocolPrivate {
48 TnyList *account_options;
49 GHashTable *custom_auth_mechs;
52 GHashTable *account_dialogs;
55 /* 'private'/'protected' functions */
56 static void modest_account_protocol_class_init (ModestAccountProtocolClass *klass);
57 static void modest_account_protocol_finalize (GObject *obj);
58 static void modest_account_protocol_get_property (GObject *obj,
62 static void modest_account_protocol_set_property (GObject *obj,
66 static void modest_account_protocol_instance_init (ModestAccountProtocol *obj);
68 #define MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
69 MODEST_TYPE_ACCOUNT_PROTOCOL, \
70 ModestAccountProtocolPrivate))
72 static TnyAccount *modest_account_protocol_create_account_default (ModestAccountProtocol *self);
74 static ModestAccountSettingsDialog *modest_account_protocol_create_account_settings_dialog_default (ModestAccountProtocol *self);
76 static ModestPairList* modest_account_protocol_get_easysetupwizard_tabs_default (ModestAccountProtocol *self);
78 static void modest_account_protocol_save_settings_default (ModestAccountProtocol *self,
79 ModestAccountSettingsDialog *dialog,
80 ModestAccountSettings *settings);
82 static void modest_account_protocol_save_wizard_settings_default (ModestAccountProtocol *self,
84 ModestAccountSettings *settings);
86 static ModestWizardDialogResponseOverrideFunc
87 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self);
89 static void modest_account_protocol_check_support_default (ModestAccountProtocol *self,
90 ModestAccountProtocolCheckSupportFunc func,
92 static void modest_account_protocol_cancel_check_support_default (ModestAccountProtocol *self);
93 static void modest_account_protocol_wizard_finished_default (ModestAccountProtocol *self);
94 static gboolean modest_account_protocol_decode_part_to_stream_default (ModestAccountProtocol *protocol,
98 static gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
99 static gchar *modest_account_protocol_get_from_default (ModestAccountProtocol *self,
100 const gchar *account_id,
101 const gchar *mailbox);
102 static ModestPairList *modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
103 const gchar *account_id);
104 static gchar *modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
105 const gchar *account_id,
106 const gchar *mailbox,
107 gboolean *has_signature);
108 static const GdkPixbuf *modest_account_protocol_get_icon_default (ModestAccountProtocol *self,
109 ModestAccountProtocolIconType icon_type,
113 static gchar *modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
114 const gchar *account_id,
115 const gchar *mailbox);
117 static const GdkPixbuf *modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
118 const gchar *account_id,
119 const gchar *mailbox,
121 static void modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
122 const gchar *account_id,
125 ModestAccountProtocolSaveRemoteDraftCallback callback,
129 static GObjectClass *parent_class = NULL;
132 modest_account_protocol_get_type (void)
134 static GType my_type = 0;
137 static const GTypeInfo my_info = {
138 sizeof(ModestAccountProtocolClass),
139 NULL, /* base init */
140 NULL, /* base finalize */
141 (GClassInitFunc) modest_account_protocol_class_init,
142 NULL, /* class finalize */
143 NULL, /* class data */
144 sizeof(ModestAccountProtocol),
146 (GInstanceInitFunc) modest_account_protocol_instance_init,
150 my_type = g_type_register_static (MODEST_TYPE_PROTOCOL,
151 "ModestAccountProtocol",
158 modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
160 GObjectClass *object_class;
161 ModestAccountProtocolClass *account_class;
163 object_class = (GObjectClass *) klass;
164 account_class = MODEST_ACCOUNT_PROTOCOL_CLASS (klass);
165 parent_class = g_type_class_peek_parent (klass);
166 object_class->finalize = modest_account_protocol_finalize;
167 object_class->set_property = modest_account_protocol_set_property;
168 object_class->get_property = modest_account_protocol_get_property;
170 g_object_class_install_property (object_class,
172 g_param_spec_uint ("port",
174 _("The standard port for the protocol"),
176 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
178 g_object_class_install_property (object_class,
180 g_param_spec_uint ("alternate-port",
182 _("The alternate port for the protocol (usually used in SSL)"),
184 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
186 g_object_class_install_property (object_class,
188 g_param_spec_gtype ("account-g-type",
189 _("Account factory GType"),
190 _("Account factory GType used for creating new instances."),
192 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
194 g_type_class_add_private (object_class,
195 sizeof(ModestAccountProtocolPrivate));
197 /* Virtual methods */
198 account_class->create_account_settings_dialog =
199 modest_account_protocol_create_account_settings_dialog_default;
200 account_class->get_easysetupwizard_tabs =
201 modest_account_protocol_get_easysetupwizard_tabs_default;
202 account_class->save_settings =
203 modest_account_protocol_save_settings_default;
204 account_class->save_wizard_settings =
205 modest_account_protocol_save_wizard_settings_default;
206 account_class->create_account =
207 modest_account_protocol_create_account_default;
208 account_class->get_wizard_response_override =
209 modest_account_protocol_get_wizard_response_override_default;
210 account_class->is_supported =
211 modest_account_protocol_is_supported_default;
212 account_class->check_support =
213 modest_account_protocol_check_support_default;
214 account_class->cancel_check_support =
215 modest_account_protocol_cancel_check_support_default;
216 account_class->wizard_finished =
217 modest_account_protocol_wizard_finished_default;
218 account_class->decode_part_to_stream =
219 modest_account_protocol_decode_part_to_stream_default;
220 account_class->get_from =
221 modest_account_protocol_get_from_default;
222 account_class->get_from_list =
223 modest_account_protocol_get_from_list_default;
224 account_class->get_signature =
225 modest_account_protocol_get_signature_default;
226 account_class->get_icon =
227 modest_account_protocol_get_icon_default;
228 account_class->get_service_name =
229 modest_account_protocol_get_service_name_default;
230 account_class->get_service_icon =
231 modest_account_protocol_get_service_icon_default;
232 account_class->save_remote_draft =
233 modest_account_protocol_save_remote_draft_default;
238 modest_account_protocol_instance_init (ModestAccountProtocol *obj)
240 ModestAccountProtocolPrivate *priv;
242 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (obj);
245 priv->alternate_port = 0;
246 priv->account_g_type = 0;
247 priv->account_options = tny_simple_list_new ();
248 priv->custom_auth_mechs = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
250 priv->account_dialogs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
254 remove_account (const gchar *account_name, GObject *account, GObject *account_to_remove)
256 return (account == account_to_remove);
260 account_dialog_weak_handler (ModestAccountProtocol *self, GObject *where_the_object_was)
262 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
264 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) remove_account, where_the_object_was);
268 dialogs_remove (const gchar *account_name, GObject *account_dialog, ModestAccountProtocol *self)
270 g_object_weak_unref (account_dialog, (GWeakNotify) account_dialog_weak_handler, self);
276 modest_account_protocol_finalize (GObject *obj)
278 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
279 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
281 if (priv->account_dialogs) {
282 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) dialogs_remove, obj);
283 g_hash_table_destroy (priv->account_dialogs);
286 if (priv->account_options)
287 g_object_unref (priv->account_options);
288 priv->account_options = NULL;
290 if (priv->custom_auth_mechs)
291 g_hash_table_destroy (priv->custom_auth_mechs);
292 priv->custom_auth_mechs = NULL;
294 G_OBJECT_CLASS (parent_class)->finalize (obj);
298 modest_account_protocol_get_property (GObject *obj,
303 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
304 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
306 switch (property_id) {
308 g_value_set_uint (value, priv->port);
310 case PROP_ALTERNATE_PORT:
311 g_value_set_uint (value, priv->alternate_port);
313 case PROP_ACCOUNT_G_TYPE:
314 g_value_set_gtype (value, priv->account_g_type);
317 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
323 modest_account_protocol_set_property (GObject *obj,
328 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
330 switch (property_id) {
332 modest_account_protocol_set_port (protocol, g_value_get_uint (value));
334 case PROP_ALTERNATE_PORT:
335 modest_account_protocol_set_alternate_port (protocol, g_value_get_uint (value));
337 case PROP_ACCOUNT_G_TYPE:
338 modest_account_protocol_set_account_g_type (protocol, g_value_get_gtype (value));
341 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
348 modest_account_protocol_new (const gchar *name, const gchar *display_name,
349 guint port, guint alternate_port,
350 GType account_g_type)
352 return g_object_new (MODEST_TYPE_ACCOUNT_PROTOCOL,
353 "display-name", display_name, "name", name,
354 "port", port, "alternate-port", alternate_port,
355 "account-g-type", account_g_type,
360 modest_account_protocol_get_port (ModestAccountProtocol *self)
362 ModestAccountProtocolPrivate *priv;
364 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
366 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
371 modest_account_protocol_set_port (ModestAccountProtocol *self,
374 ModestAccountProtocolPrivate *priv;
376 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
378 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
384 modest_account_protocol_get_alternate_port (ModestAccountProtocol *self)
386 ModestAccountProtocolPrivate *priv;
388 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
390 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
391 return priv->alternate_port;
395 modest_account_protocol_set_alternate_port (ModestAccountProtocol *self,
396 guint alternate_port)
398 ModestAccountProtocolPrivate *priv;
400 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
402 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
403 priv->alternate_port = alternate_port;
407 modest_account_protocol_get_account_g_type (ModestAccountProtocol *self)
409 ModestAccountProtocolPrivate *priv;
411 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
413 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
414 return priv->account_g_type;
418 modest_account_protocol_get_account_options (ModestAccountProtocol *self)
421 ModestAccountProtocolPrivate *priv;
423 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
424 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
426 result = tny_list_copy (priv->account_options);
432 modest_account_protocol_set_account_options (ModestAccountProtocol *self,
435 ModestAccountProtocolPrivate *priv;
437 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
438 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
440 if (priv->account_options) {
441 g_object_unref (priv->account_options);
442 priv->account_options = NULL;
444 priv->account_options = tny_list_copy (list);
448 modest_account_protocol_has_custom_secure_auth_mech (ModestAccountProtocol *self,
449 ModestProtocolType auth_protocol_type)
451 ModestAccountProtocolPrivate *priv;
453 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), FALSE);
454 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
456 return g_hash_table_lookup_extended (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), NULL, NULL);
460 modest_account_protocol_get_custom_secure_auth_mech (ModestAccountProtocol *self,
461 ModestProtocolType auth_protocol_type)
463 ModestAccountProtocolPrivate *priv;
465 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
466 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
468 return (const gchar *) g_hash_table_lookup (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
472 modest_account_protocol_set_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type, const gchar *secure_auth_mech)
474 ModestAccountProtocolPrivate *priv;
476 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
477 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
479 g_hash_table_replace (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), g_strdup (secure_auth_mech));
483 modest_account_protocol_unset_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type)
485 ModestAccountProtocolPrivate *priv;
487 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
488 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
490 g_hash_table_remove (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
495 modest_account_protocol_set_account_g_type (ModestAccountProtocol *self,
496 GType account_g_type)
498 ModestAccountProtocolPrivate *priv;
500 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
502 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
503 priv->account_g_type = account_g_type;
507 modest_account_protocol_create_account_default (ModestAccountProtocol *self)
509 ModestAccountProtocolPrivate *priv;
511 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
513 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
514 if (priv->account_g_type > 0) {
515 return g_object_new (priv->account_g_type, NULL);
522 modest_account_protocol_create_account (ModestAccountProtocol *self)
524 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
526 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account (self);
529 /* This is a template method for getting the account settings
530 dialog. It calls create_account_settings that must be implemented
531 by subclasses and then perform several common operations with the
533 ModestAccountSettingsDialog *
534 modest_account_protocol_get_account_settings_dialog (ModestAccountProtocol *self,
535 const gchar *account_name)
537 ModestAccountSettingsDialog *dialog;
538 ModestAccountSettings *settings;
539 ModestAccountProtocolPrivate *priv;
541 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
542 dialog = g_hash_table_lookup (priv->account_dialogs, account_name);
544 if (dialog == NULL) {
546 dialog = MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account_settings_dialog (self);
549 settings = modest_account_mgr_load_account_settings (modest_runtime_get_account_mgr (),
551 modest_account_settings_dialog_load_settings (dialog, settings);
553 /* Close dialog on response */
554 g_signal_connect_swapped (dialog,
556 G_CALLBACK (gtk_widget_destroy),
559 g_hash_table_insert (priv->account_dialogs, g_strdup (account_name), dialog);
560 g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) account_dialog_weak_handler, self);
567 modest_account_protocol_get_easysetupwizard_tabs (ModestAccountProtocol *self)
569 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_easysetupwizard_tabs (self);
574 modest_account_protocol_save_settings (ModestAccountProtocol *self,
575 ModestAccountSettingsDialog *dialog,
576 ModestAccountSettings *settings)
578 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_settings (self, dialog, settings);
582 modest_account_protocol_save_wizard_settings (ModestAccountProtocol *self,
584 ModestAccountSettings *settings)
586 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_wizard_settings (self, wizard_pages, settings);
589 /* Default implementations */
590 static ModestAccountSettingsDialog *
591 modest_account_protocol_create_account_settings_dialog_default (ModestAccountProtocol *self)
593 return modest_default_account_settings_dialog_new ();
596 static ModestPairList*
597 modest_account_protocol_get_easysetupwizard_tabs_default (ModestAccountProtocol *self)
599 g_warning ("You must implement get_easysetupwizard_tabs");
604 modest_account_protocol_save_settings_default (ModestAccountProtocol *self,
605 ModestAccountSettingsDialog *dialog,
606 ModestAccountSettings *settings)
608 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
609 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
610 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
612 g_warning ("You must implement save_settings");
616 modest_account_protocol_save_wizard_settings_default (ModestAccountProtocol *self,
618 ModestAccountSettings *settings)
620 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
621 g_return_if_fail (wizard_pages);
622 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
624 g_warning ("You must implement save_wizard_settings");
627 static ModestWizardDialogResponseOverrideFunc
628 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self)
630 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
635 ModestWizardDialogResponseOverrideFunc
636 modest_account_protocol_get_wizard_response_override (ModestAccountProtocol *self)
638 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
640 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_wizard_response_override (self);
644 modest_account_protocol_is_supported_default (ModestAccountProtocol *self)
650 modest_account_protocol_is_supported (ModestAccountProtocol *self)
652 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->is_supported (self);
656 modest_account_protocol_check_support_default (ModestAccountProtocol *self,
657 ModestAccountProtocolCheckSupportFunc func,
661 func (self, TRUE, userdata);
665 modest_account_protocol_check_support (ModestAccountProtocol *self,
666 ModestAccountProtocolCheckSupportFunc func,
669 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
673 modest_account_protocol_cancel_check_support_default (ModestAccountProtocol *self)
679 modest_account_protocol_cancel_check_support (ModestAccountProtocol *self)
681 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->cancel_check_support (self);
685 modest_account_protocol_wizard_finished_default (ModestAccountProtocol *self)
691 modest_account_protocol_wizard_finished (ModestAccountProtocol *self)
693 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->wizard_finished (self);
697 modest_account_protocol_decode_part_to_stream_default (ModestAccountProtocol *self,
702 /* By default account protocols do not handle themselves the transfer */
707 modest_account_protocol_decode_part_to_stream (ModestAccountProtocol *self,
712 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->decode_part_to_stream (self,
719 modest_account_protocol_get_from (ModestAccountProtocol *self,
720 const gchar *account_id,
721 const gchar *mailbox)
723 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from (self, account_id, mailbox);
726 modest_account_protocol_get_from_default (ModestAccountProtocol *self,
727 const gchar *account_id,
728 const gchar *mailbox)
730 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
736 modest_account_protocol_get_from_list (ModestAccountProtocol *self,
737 const gchar *account_id)
739 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from_list (self, account_id);
741 static ModestPairList *
742 modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
743 const gchar *account_id)
745 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
751 modest_account_protocol_get_signature (ModestAccountProtocol *self,
752 const gchar *account_id,
753 const gchar *mailbox,
754 gboolean *has_signature)
756 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_signature (self, account_id, mailbox, has_signature);
760 modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
761 const gchar *account_id,
762 const gchar *mailbox,
763 gboolean *has_signature)
765 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
767 *has_signature = FALSE;
773 modest_account_protocol_get_icon (ModestAccountProtocol *self,
774 ModestAccountProtocolIconType icon_type,
778 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_icon (self, icon_type, object, icon_size);
781 static const GdkPixbuf *
782 modest_account_protocol_get_icon_default (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type,
783 GObject *object, guint icon_size)
785 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
791 modest_account_protocol_get_service_name (ModestAccountProtocol *self,
792 const gchar *account_id,
793 const gchar *mailbox)
795 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_name (self, account_id, mailbox);
799 modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
800 const gchar *account_id,
801 const gchar *mailbox)
803 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
809 modest_account_protocol_get_service_icon (ModestAccountProtocol *self,
810 const gchar *account_id,
811 const gchar *mailbox,
814 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_icon (self, account_id, mailbox, icon_size);
817 static const GdkPixbuf *
818 modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
819 const gchar *account_id,
820 const gchar *mailbox,
823 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
829 modest_account_protocol_save_remote_draft (ModestAccountProtocol *self,
830 const gchar *account_id,
833 ModestAccountProtocolSaveRemoteDraftCallback callback,
836 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_remote_draft (self, account_id,
842 modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
843 const gchar *account_id,
846 ModestAccountProtocolSaveRemoteDraftCallback callback,
850 callback (self, NULL, account_id, NULL, new_msg, old_msg, userdata);