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 gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
93 static gchar *modest_account_protocol_get_from_default (ModestAccountProtocol *self,
94 const gchar *account_id,
95 const gchar *mailbox);
96 static ModestPairList *modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
97 const gchar *account_id);
98 static gchar *modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
99 const gchar *account_id,
100 const gchar *mailbox,
101 gboolean *has_signature);
102 static const GdkPixbuf *modest_account_protocol_get_icon_default (ModestAccountProtocol *self,
103 ModestAccountProtocolIconType icon_type,
107 static gchar *modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
108 const gchar *account_id,
109 const gchar *mailbox);
111 static const GdkPixbuf *modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
112 const gchar *account_id,
113 const gchar *mailbox,
115 static void modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
116 const gchar *account_id,
119 ModestAccountProtocolSaveRemoteDraftCallback callback,
123 static GObjectClass *parent_class = NULL;
126 modest_account_protocol_get_type (void)
128 static GType my_type = 0;
131 static const GTypeInfo my_info = {
132 sizeof(ModestAccountProtocolClass),
133 NULL, /* base init */
134 NULL, /* base finalize */
135 (GClassInitFunc) modest_account_protocol_class_init,
136 NULL, /* class finalize */
137 NULL, /* class data */
138 sizeof(ModestAccountProtocol),
140 (GInstanceInitFunc) modest_account_protocol_instance_init,
144 my_type = g_type_register_static (MODEST_TYPE_PROTOCOL,
145 "ModestAccountProtocol",
152 modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
154 GObjectClass *object_class;
155 ModestAccountProtocolClass *account_class;
157 object_class = (GObjectClass *) klass;
158 account_class = MODEST_ACCOUNT_PROTOCOL_CLASS (klass);
159 parent_class = g_type_class_peek_parent (klass);
160 object_class->finalize = modest_account_protocol_finalize;
161 object_class->set_property = modest_account_protocol_set_property;
162 object_class->get_property = modest_account_protocol_get_property;
164 g_object_class_install_property (object_class,
166 g_param_spec_uint ("port",
168 _("The standard port for the protocol"),
170 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
172 g_object_class_install_property (object_class,
174 g_param_spec_uint ("alternate-port",
176 _("The alternate port for the protocol (usually used in SSL)"),
178 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
180 g_object_class_install_property (object_class,
182 g_param_spec_gtype ("account-g-type",
183 _("Account factory GType"),
184 _("Account factory GType used for creating new instances."),
186 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
188 g_type_class_add_private (object_class,
189 sizeof(ModestAccountProtocolPrivate));
191 /* Virtual methods */
192 account_class->create_account_settings_dialog =
193 modest_account_protocol_create_account_settings_dialog_default;
194 account_class->get_easysetupwizard_tabs =
195 modest_account_protocol_get_easysetupwizard_tabs_default;
196 account_class->save_settings =
197 modest_account_protocol_save_settings_default;
198 account_class->save_wizard_settings =
199 modest_account_protocol_save_wizard_settings_default;
200 account_class->create_account =
201 modest_account_protocol_create_account_default;
202 account_class->get_wizard_response_override =
203 modest_account_protocol_get_wizard_response_override_default;
204 account_class->is_supported =
205 modest_account_protocol_is_supported_default;
206 account_class->check_support =
207 modest_account_protocol_check_support_default;
208 account_class->get_from =
209 modest_account_protocol_get_from_default;
210 account_class->get_from_list =
211 modest_account_protocol_get_from_list_default;
212 account_class->get_signature =
213 modest_account_protocol_get_signature_default;
214 account_class->get_icon =
215 modest_account_protocol_get_icon_default;
216 account_class->get_service_name =
217 modest_account_protocol_get_service_name_default;
218 account_class->get_service_icon =
219 modest_account_protocol_get_service_icon_default;
220 account_class->save_remote_draft =
221 modest_account_protocol_save_remote_draft_default;
226 modest_account_protocol_instance_init (ModestAccountProtocol *obj)
228 ModestAccountProtocolPrivate *priv;
230 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (obj);
233 priv->alternate_port = 0;
234 priv->account_g_type = 0;
235 priv->account_options = tny_simple_list_new ();
236 priv->custom_auth_mechs = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
238 priv->account_dialogs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
242 remove_account (const gchar *account_name, GObject *account, GObject *account_to_remove)
244 return (account == account_to_remove);
248 account_dialog_weak_handler (ModestAccountProtocol *self, GObject *where_the_object_was)
250 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
252 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) remove_account, where_the_object_was);
256 dialogs_remove (const gchar *account_name, GObject *account_dialog, ModestAccountProtocol *self)
258 g_object_weak_unref (account_dialog, (GWeakNotify) account_dialog_weak_handler, self);
264 modest_account_protocol_finalize (GObject *obj)
266 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
267 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
269 if (priv->account_dialogs) {
270 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) dialogs_remove, obj);
271 g_hash_table_destroy (priv->account_dialogs);
274 if (priv->account_options)
275 g_object_unref (priv->account_options);
276 priv->account_options = NULL;
278 if (priv->custom_auth_mechs)
279 g_hash_table_destroy (priv->custom_auth_mechs);
280 priv->custom_auth_mechs = NULL;
282 G_OBJECT_CLASS (parent_class)->finalize (obj);
286 modest_account_protocol_get_property (GObject *obj,
291 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
292 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
294 switch (property_id) {
296 g_value_set_uint (value, priv->port);
298 case PROP_ALTERNATE_PORT:
299 g_value_set_uint (value, priv->alternate_port);
301 case PROP_ACCOUNT_G_TYPE:
302 g_value_set_gtype (value, priv->account_g_type);
305 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
311 modest_account_protocol_set_property (GObject *obj,
316 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
318 switch (property_id) {
320 modest_account_protocol_set_port (protocol, g_value_get_uint (value));
322 case PROP_ALTERNATE_PORT:
323 modest_account_protocol_set_alternate_port (protocol, g_value_get_uint (value));
325 case PROP_ACCOUNT_G_TYPE:
326 modest_account_protocol_set_account_g_type (protocol, g_value_get_gtype (value));
329 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
336 modest_account_protocol_new (const gchar *name, const gchar *display_name,
337 guint port, guint alternate_port,
338 GType account_g_type)
340 return g_object_new (MODEST_TYPE_ACCOUNT_PROTOCOL,
341 "display-name", display_name, "name", name,
342 "port", port, "alternate-port", alternate_port,
343 "account-g-type", account_g_type,
348 modest_account_protocol_get_port (ModestAccountProtocol *self)
350 ModestAccountProtocolPrivate *priv;
352 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
354 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
359 modest_account_protocol_set_port (ModestAccountProtocol *self,
362 ModestAccountProtocolPrivate *priv;
364 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
366 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
372 modest_account_protocol_get_alternate_port (ModestAccountProtocol *self)
374 ModestAccountProtocolPrivate *priv;
376 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
378 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
379 return priv->alternate_port;
383 modest_account_protocol_set_alternate_port (ModestAccountProtocol *self,
384 guint alternate_port)
386 ModestAccountProtocolPrivate *priv;
388 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
390 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
391 priv->alternate_port = alternate_port;
395 modest_account_protocol_get_account_g_type (ModestAccountProtocol *self)
397 ModestAccountProtocolPrivate *priv;
399 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
401 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
402 return priv->account_g_type;
406 modest_account_protocol_get_account_options (ModestAccountProtocol *self)
409 ModestAccountProtocolPrivate *priv;
411 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
412 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
414 result = tny_list_copy (priv->account_options);
420 modest_account_protocol_set_account_options (ModestAccountProtocol *self,
423 ModestAccountProtocolPrivate *priv;
425 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
426 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
428 if (priv->account_options) {
429 g_object_unref (priv->account_options);
430 priv->account_options = NULL;
432 priv->account_options = tny_list_copy (list);
436 modest_account_protocol_has_custom_secure_auth_mech (ModestAccountProtocol *self,
437 ModestProtocolType auth_protocol_type)
439 ModestAccountProtocolPrivate *priv;
441 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), FALSE);
442 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
444 return g_hash_table_lookup_extended (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), NULL, NULL);
448 modest_account_protocol_get_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), NULL);
454 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
456 return (const gchar *) g_hash_table_lookup (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
460 modest_account_protocol_set_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type, const gchar *secure_auth_mech)
462 ModestAccountProtocolPrivate *priv;
464 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
465 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
467 g_hash_table_replace (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), g_strdup (secure_auth_mech));
471 modest_account_protocol_unset_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type)
473 ModestAccountProtocolPrivate *priv;
475 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
476 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
478 g_hash_table_remove (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
483 modest_account_protocol_set_account_g_type (ModestAccountProtocol *self,
484 GType account_g_type)
486 ModestAccountProtocolPrivate *priv;
488 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
490 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
491 priv->account_g_type = account_g_type;
495 modest_account_protocol_create_account_default (ModestAccountProtocol *self)
497 ModestAccountProtocolPrivate *priv;
499 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
501 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
502 if (priv->account_g_type > 0) {
503 return g_object_new (priv->account_g_type, NULL);
510 modest_account_protocol_create_account (ModestAccountProtocol *self)
512 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
514 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account (self);
517 /* This is a template method for getting the account settings
518 dialog. It calls create_account_settings that must be implemented
519 by subclasses and then perform several common operations with the
521 ModestAccountSettingsDialog *
522 modest_account_protocol_get_account_settings_dialog (ModestAccountProtocol *self,
523 const gchar *account_name)
525 ModestAccountSettingsDialog *dialog;
526 ModestAccountSettings *settings;
527 ModestAccountProtocolPrivate *priv;
529 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
530 dialog = g_hash_table_lookup (priv->account_dialogs, account_name);
532 if (dialog == NULL) {
534 dialog = MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account_settings_dialog (self);
537 settings = modest_account_mgr_load_account_settings (modest_runtime_get_account_mgr (),
539 modest_account_settings_dialog_load_settings (dialog, settings);
541 /* Close dialog on response */
542 g_signal_connect_swapped (dialog,
544 G_CALLBACK (gtk_widget_destroy),
547 g_hash_table_insert (priv->account_dialogs, g_strdup (account_name), dialog);
548 g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) account_dialog_weak_handler, self);
555 modest_account_protocol_get_easysetupwizard_tabs (ModestAccountProtocol *self)
557 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_easysetupwizard_tabs (self);
562 modest_account_protocol_save_settings (ModestAccountProtocol *self,
563 ModestAccountSettingsDialog *dialog,
564 ModestAccountSettings *settings)
566 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_settings (self, dialog, settings);
570 modest_account_protocol_save_wizard_settings (ModestAccountProtocol *self,
572 ModestAccountSettings *settings)
574 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_wizard_settings (self, wizard_pages, settings);
577 /* Default implementations */
578 static ModestAccountSettingsDialog *
579 modest_account_protocol_create_account_settings_dialog_default (ModestAccountProtocol *self)
581 return modest_default_account_settings_dialog_new ();
584 static ModestPairList*
585 modest_account_protocol_get_easysetupwizard_tabs_default (ModestAccountProtocol *self)
587 g_warning ("You must implement get_easysetupwizard_tabs");
592 modest_account_protocol_save_settings_default (ModestAccountProtocol *self,
593 ModestAccountSettingsDialog *dialog,
594 ModestAccountSettings *settings)
596 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
597 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
598 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
600 g_warning ("You must implement save_settings");
604 modest_account_protocol_save_wizard_settings_default (ModestAccountProtocol *self,
606 ModestAccountSettings *settings)
608 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
609 g_return_if_fail (wizard_pages);
610 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
612 g_warning ("You must implement save_wizard_settings");
615 static ModestWizardDialogResponseOverrideFunc
616 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self)
618 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
623 ModestWizardDialogResponseOverrideFunc
624 modest_account_protocol_get_wizard_response_override (ModestAccountProtocol *self)
626 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
628 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_wizard_response_override (self);
632 modest_account_protocol_is_supported_default (ModestAccountProtocol *self)
638 modest_account_protocol_is_supported (ModestAccountProtocol *self)
640 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->is_supported (self);
644 modest_account_protocol_check_support_default (ModestAccountProtocol *self,
645 ModestAccountProtocolCheckSupportFunc func,
649 func (self, TRUE, userdata);
653 modest_account_protocol_check_support (ModestAccountProtocol *self,
654 ModestAccountProtocolCheckSupportFunc func,
657 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
661 modest_account_protocol_get_from (ModestAccountProtocol *self,
662 const gchar *account_id,
663 const gchar *mailbox)
665 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from (self, account_id, mailbox);
668 modest_account_protocol_get_from_default (ModestAccountProtocol *self,
669 const gchar *account_id,
670 const gchar *mailbox)
672 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
678 modest_account_protocol_get_from_list (ModestAccountProtocol *self,
679 const gchar *account_id)
681 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from_list (self, account_id);
683 static ModestPairList *
684 modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
685 const gchar *account_id)
687 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
693 modest_account_protocol_get_signature (ModestAccountProtocol *self,
694 const gchar *account_id,
695 const gchar *mailbox,
696 gboolean *has_signature)
698 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_signature (self, account_id, mailbox, has_signature);
702 modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
703 const gchar *account_id,
704 const gchar *mailbox,
705 gboolean *has_signature)
707 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
709 *has_signature = FALSE;
715 modest_account_protocol_get_icon (ModestAccountProtocol *self,
716 ModestAccountProtocolIconType icon_type,
720 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_icon (self, icon_type, object, icon_size);
723 static const GdkPixbuf *
724 modest_account_protocol_get_icon_default (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type,
725 GObject *object, guint icon_size)
727 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
733 modest_account_protocol_get_service_name (ModestAccountProtocol *self,
734 const gchar *account_id,
735 const gchar *mailbox)
737 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_name (self, account_id, mailbox);
741 modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
742 const gchar *account_id,
743 const gchar *mailbox)
745 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
751 modest_account_protocol_get_service_icon (ModestAccountProtocol *self,
752 const gchar *account_id,
753 const gchar *mailbox,
756 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_icon (self, account_id, mailbox, icon_size);
759 static const GdkPixbuf *
760 modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
761 const gchar *account_id,
762 const gchar *mailbox,
765 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
771 modest_account_protocol_save_remote_draft (ModestAccountProtocol *self,
772 const gchar *account_id,
775 ModestAccountProtocolSaveRemoteDraftCallback callback,
778 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_remote_draft (self, account_id,
784 modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
785 const gchar *account_id,
788 ModestAccountProtocolSaveRemoteDraftCallback callback,
792 callback (self, NULL, account_id, NULL, new_msg, old_msg, userdata);