+
+gboolean
+modest_tny_folder_store_is_remote (TnyFolderStore *folder_store)
+{
+ TnyAccount *account = NULL;
+ gboolean result = TRUE;
+
+ g_return_val_if_fail(TNY_IS_FOLDER_STORE(folder_store), FALSE);
+
+ if (TNY_IS_FOLDER (folder_store)) {
+ /* Get the folder's parent account: */
+ account = tny_folder_get_account(TNY_FOLDER(folder_store));
+ } else if (TNY_IS_ACCOUNT (folder_store)) {
+ account = TNY_ACCOUNT(folder_store);
+ g_object_ref(account);
+ }
+
+ if (account != NULL) {
+ if (tny_account_get_account_type (account) == TNY_ACCOUNT_TYPE_STORE) {
+ ModestProtocolType proto_type;
+ const gchar *tag;
+ ModestProtocolRegistry *registry;
+
+ proto_type = modest_tny_account_get_protocol_type (account);
+ registry = modest_runtime_get_protocol_registry ();
+ tag = MODEST_PROTOCOL_REGISTRY_REMOTE_STORE_PROTOCOLS;
+ if (modest_protocol_registry_protocol_type_has_tag (registry,
+ proto_type,
+ tag)) {
+ result = TRUE;
+ } else {
+ result = FALSE;
+ }
+ }
+ g_object_unref (account);
+ } else {
+ result = FALSE;
+ }
+
+ return result;
+}
+
+ModestProtocolType
+modest_tny_account_get_protocol_type (TnyAccount *self)
+{
+ ModestProtocolRegistry *protocol_registry;
+ ModestProtocol *protocol;
+ ModestProtocolType result;
+
+ protocol_registry = modest_runtime_get_protocol_registry ();
+ protocol = modest_protocol_registry_get_protocol_by_name (protocol_registry,
+ MODEST_PROTOCOL_REGISTRY_TRANSPORT_STORE_PROTOCOLS,
+ tny_account_get_proto (self));
+ result = protocol?modest_protocol_get_type_id (protocol):MODEST_PROTOCOL_REGISTRY_TYPE_INVALID;
+
+ return result;
+}