X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-tny-account-store.c;h=e46ca556f239c49a04e24b71eddf85a1faf24f69;hp=566815c135a92e4dc6796f9df8a28cb369752012;hb=9ab3f9d0057226978b1ad756f37f84f8bff2fc5e;hpb=545d63a1cde3b96fcf3e84e1d2165bff120af885 diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 566815c..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,18 +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) { - printf ("%s: gnome_vfs_volume_monitor_get_volume_for_path(%s) returned something.\n", - __FUNCTION__, MODEST_MCC1_VOLUMEPATH); - #if 0 /* Commented out because gnome_vfs_volume_monitor_get_volume_for_path() seems - to report it as mounted even when the card is not inserted. */ + 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. */); - #endif - gnome_vfs_volume_unref(volume); } return MODEST_TNY_ACCOUNT_STORE(obj); @@ -1370,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);