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 gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
94 static gchar *modest_account_protocol_get_from_default (ModestAccountProtocol *self,
95 const gchar *account_id,
96 const gchar *mailbox);
97 static ModestPairList *modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
98 const gchar *account_id);
99 static gchar *modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
100 const gchar *account_id,
101 const gchar *mailbox,
102 gboolean *has_signature);
103 static const GdkPixbuf *modest_account_protocol_get_icon_default (ModestAccountProtocol *self,
104 ModestAccountProtocolIconType icon_type,
108 static gchar *modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
109 const gchar *account_id,
110 const gchar *mailbox);
112 static const GdkPixbuf *modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
113 const gchar *account_id,
114 const gchar *mailbox,
116 static void modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
117 const gchar *account_id,
120 ModestAccountProtocolSaveRemoteDraftCallback callback,
124 static GObjectClass *parent_class = NULL;
127 modest_account_protocol_get_type (void)
129 static GType my_type = 0;
132 static const GTypeInfo my_info = {
133 sizeof(ModestAccountProtocolClass),
134 NULL, /* base init */
135 NULL, /* base finalize */
136 (GClassInitFunc) modest_account_protocol_class_init,
137 NULL, /* class finalize */
138 NULL, /* class data */
139 sizeof(ModestAccountProtocol),
141 (GInstanceInitFunc) modest_account_protocol_instance_init,
145 my_type = g_type_register_static (MODEST_TYPE_PROTOCOL,
146 "ModestAccountProtocol",
153 modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
155 GObjectClass *object_class;
156 ModestAccountProtocolClass *account_class;
158 object_class = (GObjectClass *) klass;
159 account_class = MODEST_ACCOUNT_PROTOCOL_CLASS (klass);
160 parent_class = g_type_class_peek_parent (klass);
161 object_class->finalize = modest_account_protocol_finalize;
162 object_class->set_property = modest_account_protocol_set_property;
163 object_class->get_property = modest_account_protocol_get_property;
165 g_object_class_install_property (object_class,
167 g_param_spec_uint ("port",
169 _("The standard port for the protocol"),
171 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
173 g_object_class_install_property (object_class,
175 g_param_spec_uint ("alternate-port",
177 _("The alternate port for the protocol (usually used in SSL)"),
179 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
181 g_object_class_install_property (object_class,
183 g_param_spec_gtype ("account-g-type",
184 _("Account factory GType"),
185 _("Account factory GType used for creating new instances."),
187 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
189 g_type_class_add_private (object_class,
190 sizeof(ModestAccountProtocolPrivate));
192 /* Virtual methods */
193 account_class->create_account_settings_dialog =
194 modest_account_protocol_create_account_settings_dialog_default;
195 account_class->get_easysetupwizard_tabs =
196 modest_account_protocol_get_easysetupwizard_tabs_default;
197 account_class->save_settings =
198 modest_account_protocol_save_settings_default;
199 account_class->save_wizard_settings =
200 modest_account_protocol_save_wizard_settings_default;
201 account_class->create_account =
202 modest_account_protocol_create_account_default;
203 account_class->get_wizard_response_override =
204 modest_account_protocol_get_wizard_response_override_default;
205 account_class->is_supported =
206 modest_account_protocol_is_supported_default;
207 account_class->check_support =
208 modest_account_protocol_check_support_default;
209 account_class->cancel_check_support =
210 modest_account_protocol_cancel_check_support_default;
211 account_class->get_from =
212 modest_account_protocol_get_from_default;
213 account_class->get_from_list =
214 modest_account_protocol_get_from_list_default;
215 account_class->get_signature =
216 modest_account_protocol_get_signature_default;
217 account_class->get_icon =
218 modest_account_protocol_get_icon_default;
219 account_class->get_service_name =
220 modest_account_protocol_get_service_name_default;
221 account_class->get_service_icon =
222 modest_account_protocol_get_service_icon_default;
223 account_class->save_remote_draft =
224 modest_account_protocol_save_remote_draft_default;
229 modest_account_protocol_instance_init (ModestAccountProtocol *obj)
231 ModestAccountProtocolPrivate *priv;
233 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (obj);
236 priv->alternate_port = 0;
237 priv->account_g_type = 0;
238 priv->account_options = tny_simple_list_new ();
239 priv->custom_auth_mechs = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
241 priv->account_dialogs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
245 remove_account (const gchar *account_name, GObject *account, GObject *account_to_remove)
247 return (account == account_to_remove);
251 account_dialog_weak_handler (ModestAccountProtocol *self, GObject *where_the_object_was)
253 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
255 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) remove_account, where_the_object_was);
259 dialogs_remove (const gchar *account_name, GObject *account_dialog, ModestAccountProtocol *self)
261 g_object_weak_unref (account_dialog, (GWeakNotify) account_dialog_weak_handler, self);
267 modest_account_protocol_finalize (GObject *obj)
269 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
270 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
272 if (priv->account_dialogs) {
273 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) dialogs_remove, obj);
274 g_hash_table_destroy (priv->account_dialogs);
277 if (priv->account_options)
278 g_object_unref (priv->account_options);
279 priv->account_options = NULL;
281 if (priv->custom_auth_mechs)
282 g_hash_table_destroy (priv->custom_auth_mechs);
283 priv->custom_auth_mechs = NULL;
285 G_OBJECT_CLASS (parent_class)->finalize (obj);
289 modest_account_protocol_get_property (GObject *obj,
294 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
295 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
297 switch (property_id) {
299 g_value_set_uint (value, priv->port);
301 case PROP_ALTERNATE_PORT:
302 g_value_set_uint (value, priv->alternate_port);
304 case PROP_ACCOUNT_G_TYPE:
305 g_value_set_gtype (value, priv->account_g_type);
308 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
314 modest_account_protocol_set_property (GObject *obj,
319 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
321 switch (property_id) {
323 modest_account_protocol_set_port (protocol, g_value_get_uint (value));
325 case PROP_ALTERNATE_PORT:
326 modest_account_protocol_set_alternate_port (protocol, g_value_get_uint (value));
328 case PROP_ACCOUNT_G_TYPE:
329 modest_account_protocol_set_account_g_type (protocol, g_value_get_gtype (value));
332 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
339 modest_account_protocol_new (const gchar *name, const gchar *display_name,
340 guint port, guint alternate_port,
341 GType account_g_type)
343 return g_object_new (MODEST_TYPE_ACCOUNT_PROTOCOL,
344 "display-name", display_name, "name", name,
345 "port", port, "alternate-port", alternate_port,
346 "account-g-type", account_g_type,
351 modest_account_protocol_get_port (ModestAccountProtocol *self)
353 ModestAccountProtocolPrivate *priv;
355 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
357 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
362 modest_account_protocol_set_port (ModestAccountProtocol *self,
365 ModestAccountProtocolPrivate *priv;
367 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
369 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
375 modest_account_protocol_get_alternate_port (ModestAccountProtocol *self)
377 ModestAccountProtocolPrivate *priv;
379 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
381 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
382 return priv->alternate_port;
386 modest_account_protocol_set_alternate_port (ModestAccountProtocol *self,
387 guint alternate_port)
389 ModestAccountProtocolPrivate *priv;
391 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
393 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
394 priv->alternate_port = alternate_port;
398 modest_account_protocol_get_account_g_type (ModestAccountProtocol *self)
400 ModestAccountProtocolPrivate *priv;
402 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
404 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
405 return priv->account_g_type;
409 modest_account_protocol_get_account_options (ModestAccountProtocol *self)
412 ModestAccountProtocolPrivate *priv;
414 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
415 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
417 result = tny_list_copy (priv->account_options);
423 modest_account_protocol_set_account_options (ModestAccountProtocol *self,
426 ModestAccountProtocolPrivate *priv;
428 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
429 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
431 if (priv->account_options) {
432 g_object_unref (priv->account_options);
433 priv->account_options = NULL;
435 priv->account_options = tny_list_copy (list);
439 modest_account_protocol_has_custom_secure_auth_mech (ModestAccountProtocol *self,
440 ModestProtocolType auth_protocol_type)
442 ModestAccountProtocolPrivate *priv;
444 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), FALSE);
445 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
447 return g_hash_table_lookup_extended (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), NULL, NULL);
451 modest_account_protocol_get_custom_secure_auth_mech (ModestAccountProtocol *self,
452 ModestProtocolType auth_protocol_type)
454 ModestAccountProtocolPrivate *priv;
456 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
457 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
459 return (const gchar *) g_hash_table_lookup (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
463 modest_account_protocol_set_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type, const gchar *secure_auth_mech)
465 ModestAccountProtocolPrivate *priv;
467 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
468 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
470 g_hash_table_replace (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), g_strdup (secure_auth_mech));
474 modest_account_protocol_unset_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type)
476 ModestAccountProtocolPrivate *priv;
478 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
479 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
481 g_hash_table_remove (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
486 modest_account_protocol_set_account_g_type (ModestAccountProtocol *self,
487 GType account_g_type)
489 ModestAccountProtocolPrivate *priv;
491 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
493 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
494 priv->account_g_type = account_g_type;
498 modest_account_protocol_create_account_default (ModestAccountProtocol *self)
500 ModestAccountProtocolPrivate *priv;
502 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
504 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
505 if (priv->account_g_type > 0) {
506 return g_object_new (priv->account_g_type, NULL);
513 modest_account_protocol_create_account (ModestAccountProtocol *self)
515 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
517 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account (self);
520 /* This is a template method for getting the account settings
521 dialog. It calls create_account_settings that must be implemented
522 by subclasses and then perform several common operations with the
524 ModestAccountSettingsDialog *
525 modest_account_protocol_get_account_settings_dialog (ModestAccountProtocol *self,
526 const gchar *account_name)
528 ModestAccountSettingsDialog *dialog;
529 ModestAccountSettings *settings;
530 ModestAccountProtocolPrivate *priv;
532 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
533 dialog = g_hash_table_lookup (priv->account_dialogs, account_name);
535 if (dialog == NULL) {
537 dialog = MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account_settings_dialog (self);
540 settings = modest_account_mgr_load_account_settings (modest_runtime_get_account_mgr (),
542 modest_account_settings_dialog_load_settings (dialog, settings);
544 /* Close dialog on response */
545 g_signal_connect_swapped (dialog,
547 G_CALLBACK (gtk_widget_destroy),
550 g_hash_table_insert (priv->account_dialogs, g_strdup (account_name), dialog);
551 g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) account_dialog_weak_handler, self);
558 modest_account_protocol_get_easysetupwizard_tabs (ModestAccountProtocol *self)
560 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_easysetupwizard_tabs (self);
565 modest_account_protocol_save_settings (ModestAccountProtocol *self,
566 ModestAccountSettingsDialog *dialog,
567 ModestAccountSettings *settings)
569 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_settings (self, dialog, settings);
573 modest_account_protocol_save_wizard_settings (ModestAccountProtocol *self,
575 ModestAccountSettings *settings)
577 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_wizard_settings (self, wizard_pages, settings);
580 /* Default implementations */
581 static ModestAccountSettingsDialog *
582 modest_account_protocol_create_account_settings_dialog_default (ModestAccountProtocol *self)
584 return modest_default_account_settings_dialog_new ();
587 static ModestPairList*
588 modest_account_protocol_get_easysetupwizard_tabs_default (ModestAccountProtocol *self)
590 g_warning ("You must implement get_easysetupwizard_tabs");
595 modest_account_protocol_save_settings_default (ModestAccountProtocol *self,
596 ModestAccountSettingsDialog *dialog,
597 ModestAccountSettings *settings)
599 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
600 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
601 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
603 g_warning ("You must implement save_settings");
607 modest_account_protocol_save_wizard_settings_default (ModestAccountProtocol *self,
609 ModestAccountSettings *settings)
611 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
612 g_return_if_fail (wizard_pages);
613 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
615 g_warning ("You must implement save_wizard_settings");
618 static ModestWizardDialogResponseOverrideFunc
619 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self)
621 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
626 ModestWizardDialogResponseOverrideFunc
627 modest_account_protocol_get_wizard_response_override (ModestAccountProtocol *self)
629 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
631 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_wizard_response_override (self);
635 modest_account_protocol_is_supported_default (ModestAccountProtocol *self)
641 modest_account_protocol_is_supported (ModestAccountProtocol *self)
643 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->is_supported (self);
647 modest_account_protocol_check_support_default (ModestAccountProtocol *self,
648 ModestAccountProtocolCheckSupportFunc func,
652 func (self, TRUE, userdata);
656 modest_account_protocol_check_support (ModestAccountProtocol *self,
657 ModestAccountProtocolCheckSupportFunc func,
660 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
664 modest_account_protocol_cancel_check_support_default (ModestAccountProtocol *self)
670 modest_account_protocol_cancel_check_support (ModestAccountProtocol *self)
672 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->cancel_check_support (self);
676 modest_account_protocol_get_from (ModestAccountProtocol *self,
677 const gchar *account_id,
678 const gchar *mailbox)
680 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from (self, account_id, mailbox);
683 modest_account_protocol_get_from_default (ModestAccountProtocol *self,
684 const gchar *account_id,
685 const gchar *mailbox)
687 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
693 modest_account_protocol_get_from_list (ModestAccountProtocol *self,
694 const gchar *account_id)
696 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from_list (self, account_id);
698 static ModestPairList *
699 modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
700 const gchar *account_id)
702 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
708 modest_account_protocol_get_signature (ModestAccountProtocol *self,
709 const gchar *account_id,
710 const gchar *mailbox,
711 gboolean *has_signature)
713 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_signature (self, account_id, mailbox, has_signature);
717 modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
718 const gchar *account_id,
719 const gchar *mailbox,
720 gboolean *has_signature)
722 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
724 *has_signature = FALSE;
730 modest_account_protocol_get_icon (ModestAccountProtocol *self,
731 ModestAccountProtocolIconType icon_type,
735 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_icon (self, icon_type, object, icon_size);
738 static const GdkPixbuf *
739 modest_account_protocol_get_icon_default (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type,
740 GObject *object, guint icon_size)
742 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
748 modest_account_protocol_get_service_name (ModestAccountProtocol *self,
749 const gchar *account_id,
750 const gchar *mailbox)
752 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_name (self, account_id, mailbox);
756 modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
757 const gchar *account_id,
758 const gchar *mailbox)
760 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
766 modest_account_protocol_get_service_icon (ModestAccountProtocol *self,
767 const gchar *account_id,
768 const gchar *mailbox,
771 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_icon (self, account_id, mailbox, icon_size);
774 static const GdkPixbuf *
775 modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
776 const gchar *account_id,
777 const gchar *mailbox,
780 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
786 modest_account_protocol_save_remote_draft (ModestAccountProtocol *self,
787 const gchar *account_id,
790 ModestAccountProtocolSaveRemoteDraftCallback callback,
793 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_remote_draft (self, account_id,
799 modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
800 const gchar *account_id,
803 ModestAccountProtocolSaveRemoteDraftCallback callback,
807 callback (self, NULL, account_id, NULL, new_msg, old_msg, userdata);