X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-tny-account-store.c;h=e46ca556f239c49a04e24b71eddf85a1faf24f69;hp=18f08add0ae0d2f5c980b6a50e177ff0cb69d76e;hb=71163813c23c885ddadee8ed169d7445bd2f30d1;hpb=014ca992015a18bc968223980043120cda3fd185 diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 18f08ad..e46ca55 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -850,6 +850,58 @@ modest_tny_account_store_finalize (GObject *obj) G_OBJECT_CLASS(parent_class)->finalize (obj); } +gboolean volume_path_is_mounted (const gchar* path) +{ + g_return_val_if_fail (path, FALSE); + + gboolean result = FALSE; + gchar * path_as_uri = g_filename_to_uri (path, NULL, NULL); + g_return_val_if_fail (path_as_uri, FALSE); + + /* Get the monitor singleton: */ + GnomeVFSVolumeMonitor *monitor = gnome_vfs_get_volume_monitor(); + + /* This seems like a simpler way to do this, but it returns a + * GnomeVFSVolume even if the drive is not mounted: */ + /* + GnomeVFSVolume *volume = gnome_vfs_volume_monitor_get_volume_for_path (monitor, + MODEST_MCC1_VOLUMEPATH); + if (volume) { + gnome_vfs_volume_unref(volume); + } + */ + + /* Get the mounted volumes from the monitor: */ + GList *list = gnome_vfs_volume_monitor_get_mounted_volumes (monitor); + GList *iter = list; + for (iter = list; iter; iter = g_list_next (iter)) { + GnomeVFSVolume *volume = (GnomeVFSVolume*)iter->data; + if (volume) { + /* + char *display_name = + gnome_vfs_volume_get_display_name (volume); + printf ("volume display name=%s\n", display_name); + g_free (display_name); + */ + + char *uri = + gnome_vfs_volume_get_activation_uri (volume); + /* printf (" uri=%s\n", uri); */ + if (uri && (strcmp (uri, path_as_uri) == 0)) + result = TRUE; + + g_free (uri); + + gnome_vfs_volume_unref (volume); + } + } + + g_list_free (list); + + g_free (path_as_uri); + + return result; +} ModestTnyAccountStore* modest_tny_account_store_new (ModestAccountMgr *account_mgr, @@ -905,13 +957,9 @@ modest_tny_account_store_new (ModestAccountMgr *account_mgr, /* Create the memory card account if the card is mounted: */ /* This is a singleton, so it does not need to be unrefed. */ - GnomeVFSVolumeMonitor* monitor = gnome_vfs_get_volume_monitor(); - GnomeVFSVolume *volume = gnome_vfs_volume_monitor_get_volume_for_path (monitor, - MODEST_MCC1_VOLUMEPATH); - if (volume) { + if (volume_path_is_mounted (MODEST_MCC1_VOLUMEPATH)) { /* It is mounted: */ add_mmc_account (MODEST_TNY_ACCOUNT_STORE (obj), FALSE /* don't emit the insert signal. */); - gnome_vfs_volume_unref(volume); } return MODEST_TNY_ACCOUNT_STORE(obj); @@ -1365,6 +1413,12 @@ get_smtp_specific_transport_account_for_open_connection (ModestTnyAccountStore * /* Get the connection-specific transport acccount, if any: */ ModestAccountMgr *account_manager = modest_runtime_get_account_mgr (); + + /* Check if this account has connection-specific SMTP enabled */ + if (!modest_account_mgr_get_use_connection_specific_smtp (account_manager, account_name)) { + return NULL; + } + gchar* server_account_name = modest_account_mgr_get_connection_specific_smtp (account_manager, account_name, connection_name);