From 364bebc9387ddeca8a598a9085f1bb41d4b74222 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Tue, 26 Jun 2007 16:25:34 +0000 Subject: [PATCH] 2007-06-26 Murray Cumming * src/modest-tny-account-store.c: * src/modest-tny-account-store.h: Added modest_tny_account_is_memory_card_account(). * src/maemo/modest-main-window.c: (create_details_widget): Show the same information items for the memory card as we show for the local-folders, to fix projects.maemo.org bug NB#59307. pmo-trunk-r2435 --- ChangeLog | 6 ------ ChangeLog2 | 9 +++++++++ src/maemo/modest-main-window.c | 17 +++++++++++++---- src/modest-tny-account-store.c | 16 ++++++++++++++++ src/modest-tny-account-store.h | 9 +++++++++ 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30ec5c0..acb6b92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1 @@ -2007-06-26 Murray Cumming,,, - - reviewed by: - - * src/modest-tny-account-store.c: (get_password): - * please check the svn log instead diff --git a/ChangeLog2 b/ChangeLog2 index af8d285..2237316 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,5 +1,14 @@ 2007-06-26 Murray Cumming + * src/modest-tny-account-store.c: + * src/modest-tny-account-store.h: + Added modest_tny_account_is_memory_card_account(). + * src/maemo/modest-main-window.c: (create_details_widget): + Show the same information items for the memory card as we show for the + local-folders, to fix projects.maemo.org bug NB#59307. + +2007-06-26 Murray Cumming + * src/modest-tny-account-store.c: (get_password): Added some checks for NULL to maybe prevent crashes, though I think it was Philip's last commit that actually prevented the crash here diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c index e6404d6..845aaee 100644 --- a/src/maemo/modest-main-window.c +++ b/src/maemo/modest-main-window.c @@ -1401,6 +1401,8 @@ create_empty_view (void) static GtkWidget * create_details_widget (GtkWidget *styled_widget, TnyAccount *account) { + /* TODO: Clean up this function. It's a mess, with lots of copy/paste. murrayc. */ + GtkWidget *vbox; GtkWidget *label_w; gchar *label; @@ -1419,14 +1421,20 @@ create_details_widget (GtkWidget *styled_widget, TnyAccount *account) #endif /* Account description: */ - if (modest_tny_account_is_virtual_local_folders (account)) { + if (modest_tny_account_is_virtual_local_folders (account) + || (modest_tny_account_is_memory_card_account (account))) { gchar *tmp; /* Local folders: */ /* Get device name */ - gchar *device_name = modest_conf_get_string (modest_runtime_get_conf(), + gchar *device_name = NULL; + if (modest_tny_account_is_virtual_local_folders (account)) + device_name = modest_conf_get_string (modest_runtime_get_conf(), MODEST_CONF_DEVICE_NAME, NULL); - tmp = g_strdup_printf (_("mcen_fi_localroot_description"), ""); + else + device_name = g_strdup (tny_account_get_name (account)); + + tmp = g_strdup_printf (_("mcen_fi_localroot_description"), ""); //TODO: Why the ""? label = g_markup_printf_escaped ("%s%s", gray_color_markup, tmp, device_name); g_free (tmp); @@ -1486,7 +1494,8 @@ create_details_widget (GtkWidget *styled_widget, TnyAccount *account) g_free (label); /* Size / Date */ - if (modest_tny_account_is_virtual_local_folders (account)) { + if (modest_tny_account_is_virtual_local_folders (account) + || modest_tny_account_is_memory_card_account (account)) { /* FIXME: format size */ label = g_markup_printf_escaped ("%s: %d", gray_color_markup, _("mcen_fi_rootfolder_size"), diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index ee7a922..9e0fee1 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -1346,6 +1346,20 @@ modest_tny_account_is_virtual_local_folders (TnyAccount *self) return MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (self); } + +gboolean +modest_tny_account_is_memory_card_account (TnyAccount *self) +{ + if (!self) + return FALSE; + + const gchar* account_id = tny_account_get_id (self); + if (!account_id) + return FALSE; + + return (strcmp (account_id, MODEST_MMC_ACCOUNT_ID) == 0); +} + TnyAccount* modest_tny_account_store_get_local_folders_account (TnyAccountStore *self) { @@ -1370,3 +1384,5 @@ modest_tny_account_store_get_local_folders_account (TnyAccountStore *self) return account; } + + diff --git a/src/modest-tny-account-store.h b/src/modest-tny-account-store.h index 1c73c27..50dc0b8 100644 --- a/src/modest-tny-account-store.h +++ b/src/modest-tny-account-store.h @@ -174,6 +174,15 @@ TnyAccount * modest_tny_account_store_get_local_folders_account (TnyAccountStore **/ gboolean modest_tny_account_is_virtual_local_folders (TnyAccount *self); +/** modest_tny_account_is_memory_card_account: + * @self A TnyAccount. + * + * A convenience function to identify whether TnyAccount + * is the memory card account. + **/ +gboolean +modest_tny_account_is_memory_card_account (TnyAccount *self); + G_END_DECLS #endif /* __MODEST_TNY_ACCOUNT_STORE_H__ */ -- 1.7.9.5