2007-06-26 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Tue, 26 Jun 2007 16:25:34 +0000 (16:25 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Tue, 26 Jun 2007 16:25:34 +0000 (16:25 +0000)
* 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
ChangeLog2
src/maemo/modest-main-window.c
src/modest-tny-account-store.c
src/modest-tny-account-store.h

index 30ec5c0..acb6b92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1 @@
-2007-06-26  Murray Cumming,,,  <murrayc@murrayc-desktop>
-
-       reviewed by: <delete if not using a buddy>
-
-       * src/modest-tny-account-store.c: (get_password):
-
 * please check the svn log instead
 * please check the svn log instead
index af8d285..2237316 100644 (file)
@@ -1,5 +1,14 @@
 2007-06-26  Murray Cumming  <murrayc@murrayc.com>
 
 2007-06-26  Murray Cumming  <murrayc@murrayc.com>
 
+       * 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  <murrayc@murrayc.com>
+
        * 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 
        * 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 
index e6404d6..845aaee 100644 (file)
@@ -1401,6 +1401,8 @@ create_empty_view (void)
 static GtkWidget *
 create_details_widget (GtkWidget *styled_widget, TnyAccount *account)
 {
 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;
        GtkWidget *vbox;
        GtkWidget *label_w;
        gchar *label;
@@ -1419,14 +1421,20 @@ create_details_widget (GtkWidget *styled_widget, TnyAccount *account)
 #endif 
        /* Account description: */
        
 #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 *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);
                                                      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 ("<span color='%s'>%s</span>%s",
                                                 gray_color_markup, tmp, device_name);
                g_free (tmp);
                label = g_markup_printf_escaped ("<span color='%s'>%s</span>%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 */
        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 ("<span color='%s'>%s:</span> %d", 
                                                 gray_color_markup, _("mcen_fi_rootfolder_size"), 
                /* FIXME: format size */
                label = g_markup_printf_escaped ("<span color='%s'>%s:</span> %d", 
                                                 gray_color_markup, _("mcen_fi_rootfolder_size"), 
index ee7a922..9e0fee1 100644 (file)
@@ -1346,6 +1346,20 @@ modest_tny_account_is_virtual_local_folders (TnyAccount *self)
        return MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (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)
 {
 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;
 }
        
        return account;
 }
+
+
index 1c73c27..50dc0b8 100644 (file)
@@ -174,6 +174,15 @@ TnyAccount * modest_tny_account_store_get_local_folders_account (TnyAccountStore
  **/
 gboolean modest_tny_account_is_virtual_local_folders (TnyAccount *self);
 
  **/
 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__ */
 G_END_DECLS
 
 #endif /* __MODEST_TNY_ACCOUNT_STORE_H__ */