- cursor = account_names = modest_account_mgr_account_names (account_mgr, TRUE /*only enabled*/);
- while (cursor) {
- gchar *account_name;
- ModestAccountSettings *settings;
- ModestServerAccountSettings *store_settings;
+ if (store == NULL) {
+ g_object_set_data (G_OBJECT (button), FOLDER_PICKER_CURRENT_FOLDER, NULL);
+ } else {
+ GdkPixbuf *pixbuf;
+ const gchar *icon_name = NULL;
+
+ g_object_ref (store);
+ g_object_set_data_full (G_OBJECT (button), FOLDER_PICKER_CURRENT_FOLDER,
+ store, (GDestroyNotify) g_object_unref);
+ name = folder_store_get_display_name (store);
+ hildon_button_set_value (HILDON_BUTTON (button), name);
+ g_free (name);
+
+ /* Select icon */
+ if (TNY_IS_ACCOUNT (store)) {
+ if (modest_tny_account_is_virtual_local_folders (TNY_ACCOUNT (store)))
+ icon_name = MODEST_FOLDER_ICON_LOCAL_FOLDERS;
+ else if (modest_tny_account_is_memory_card_account (TNY_ACCOUNT (store)))
+ icon_name = MODEST_FOLDER_ICON_MMC;
+ else
+ icon_name = MODEST_FOLDER_ICON_ACCOUNT;
+ } else {
+ if (modest_tny_folder_is_remote_folder (TNY_FOLDER (store))) {
+ TnyFolderType type = modest_tny_folder_guess_folder_type (TNY_FOLDER (store));
+ switch (type) {
+ case TNY_FOLDER_TYPE_INBOX:
+ icon_name = MODEST_FOLDER_ICON_INBOX;
+ break;
+ default:
+ icon_name = MODEST_FOLDER_ICON_ACCOUNT;
+ }
+ } else if (modest_tny_folder_is_local_folder (TNY_FOLDER (store)))
+ icon_name = MODEST_FOLDER_ICON_NORMAL;
+ else if (modest_tny_folder_is_memory_card_folder (TNY_FOLDER (store)))
+ icon_name = MODEST_FOLDER_ICON_MMC_FOLDER;
+ }