+2007-05-30 Murray Cumming <murrayc@murrayc.com>
+
+ * src/modest-tny-account.c:
+ (modest_tny_account_new_for_local_folders):
+ Use hildon_file_system_info_async_new() to get a better name for
+ the memory card account, setting it as the account name.
+ The timing seems to work, but this is probably
+ not the best place to do this. See the TODO comment.
+ * src/maemo/modest-main-window.c: (create_details_widget):
+ * src/widgets/modest-folder-view.c: (text_cell_data):
+ Use the tny account name instead of hardcoding a name.
+
2007-05-30 Christian Kellner <ckellner@openismus.com>
* src/modest-search.c: (modest_search):
TnyAccount *account = TNY_ACCOUNT(folder_store);
if(!strcmp (tny_account_get_id (account), MODEST_MMC_ACCOUNT_ID)) {
- /* TODO: MMC ? */
- gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("FIXME: MMC ?"), FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox),
+ gtk_label_new (tny_account_get_name (account)),
+ FALSE, FALSE, 0);
} else {
/* Other accounts, such as IMAP and POP: */
TnyAccount *account = TNY_ACCOUNT(folder_store);
if (!strcmp (tny_account_get_id (account), MODEST_MMC_ACCOUNT_ID)) {
- gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("FIXME: MMC ?"), FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox),
+ gtk_label_new (tny_account_get_name (account)),
+ FALSE, FALSE, 0);
} else {
time_t last_updated;
gchar *last_updated_string;
#include <tny-camel-imap-store-account.h>
#include <tny-camel-pop-store-account.h>
#include <tny-folder-stats.h>
+#include <hildon-widgets/hildon-file-system-info.h>
#include <string.h>
return tny_account;
}
-#if 0
+/* TODO: Notify the treemodel somehow that the display name
+ * is now available. We should probably request this from the cell_data_func
+ * so we can provide a treerowreference. */
static void
on_modest_file_system_info(HildonFileSystemInfoHandle *handle,
HildonFileSystemInfo *info,
const GError *error, gpointer data)
{
- if (info) {
- printf("DEBUG: %s: display name=%s\n", __FUNCTION__,
- hildon_file_system_info_get_display_name(info));
+ TnyAccount *account = TNY_ACCOUNT (data);
+
+ if (error) {
+ printf (" DEBUG: %s: error=%s\n", __FUNCTION__, error->message);
}
- else {
- printf("DEBUG: %s: info is NULL.\n", __FUNCTION__);
+
+ const gchar *display_name = NULL;
+ if (!error && info) {
+ display_name = hildon_file_system_info_get_display_name(info);
}
- if (error) {
- printf (" DEBUG: error=%s\n", error->message);
+ if (display_name) {
+ /* printf ("DEBUG: %s: display name=%s\n", __FUNCTION__, display_name); */
+ tny_account_set_name (account, display_name);
}
}
-#endif
TnyAccount*
location_filepath &&
(strcmp (location_filepath, MODEST_MCC1_VOLUMEPATH) == 0);
- /* TODO: Use hildon_file_system_info_async_new() to get the display name? */
-#if 0
- const gchar *uri = "file:///media/mmc1";
- /* HildonFileSystemInfoHandle *async_handle = */
- hildon_file_system_info_async_new(uri,
- on_modest_file_system_info, NULL /* user_data */);
-#endif
-
+ /* The name of memory card locations will be updated asynchronously.
+ * This is just a default: */
const gchar *name = is_mmc ? _("Memory Card") :
MODEST_LOCAL_FOLDERS_DEFAULT_DISPLAY_NAME;
tny_account_set_name (TNY_ACCOUNT(tny_account), name);
+ /* Get the correct display name for memory cards, asynchronously: */
+ if (location_filepath) {
+ GError *error = NULL;
+ gchar *uri = g_filename_to_uri(location_filepath, NULL, &error);
+ if (error) {
+ g_warning ("%s: g_filename_to_uri(%s) failed: %s", __FUNCTION__,
+ location_filepath, error->message);
+ g_error_free (error);
+ error = NULL;
+ } else if (uri) {
+ /* TODO: gnome_vfs_volume_get_display_name() does not return
+ * the same string. But why not? Why does hildon needs its own
+ * function for this?
+ */
+ hildon_file_system_info_async_new(uri,
+ on_modest_file_system_info, tny_account /* user_data */);
+
+ g_free (uri);
+ uri = NULL;
+ }
+ }
+
+
const gchar* id = is_mmc ? MODEST_MMC_ACCOUNT_ID :
MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID;
- tny_account_set_id (TNY_ACCOUNT(tny_account), id);
+ tny_account_set_id (TNY_ACCOUNT(tny_account), id);
tny_account_set_forget_pass_func (TNY_ACCOUNT(tny_account), forget_pass_dummy);
tny_account_set_pass_func (TNY_ACCOUNT(tny_account), get_pass_dummy);
if (!parent_folder)
return TRUE;
- /* If it's the local account do not dimm */
+ /* If it's the local account do not dim */
if (modest_tny_folder_store_is_virtual_local_folders (parent_folder)) {
return FALSE;
} else if (TNY_IS_ACCOUNT (parent_folder)) {
- /* If it's the MMC root folder then dimm it */
+ /* If it's the MMC root folder then dim it */
if (!strcmp (tny_account_get_id (TNY_ACCOUNT (parent_folder)), MODEST_MMC_ACCOUNT_ID)) {
dimmed = TRUE;
} else {
const gchar *proto_str = tny_account_get_proto (TNY_ACCOUNT (parent_folder));
- /* If it's POP then dimm */
+ /* If it's POP then dim */
dimmed = (modest_protocol_info_get_transport_store_protocol (proto_str) ==
MODEST_PROTOCOL_STORE_POP) ? TRUE : FALSE;
}