2007-05-30 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Wed, 30 May 2007 16:35:53 +0000 (16:35 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Wed, 30 May 2007 16:35:53 +0000 (16:35 +0000)
* 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.

pmo-trunk-r2000

ChangeLog2
src/maemo/easysetup/modest-wizard-dialog.c
src/maemo/modest-main-window.c
src/modest-tny-account.c
src/modest-ui-dimming-rules.c
src/widgets/modest-folder-view.c

index 6570e9e..a117ac1 100644 (file)
@@ -1,3 +1,15 @@
+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):
index d205f46..8103fd0 100644 (file)
@@ -481,7 +481,7 @@ create_title (ModestWizardDialog *wizard_dialog)
 /*
  * Response signal handler. This function is needed because GtkDialog's 
  * handler for this signal closes the dialog and we don't want that, we 
- * want to change pages and, dimm certain response buttons. Overriding the 
+ * want to change pages and, dim certain response buttons. Overriding the 
  * virtual function would not work because that would be called after the 
  * signal handler implemented by GtkDialog.
  * FIXME: There is a much saner way to do that [MDK]
index fa0f079..cc2cff8 100644 (file)
@@ -1217,8 +1217,9 @@ create_details_widget (TnyFolderStore *folder_store)
                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: */
                        
@@ -1262,7 +1263,9 @@ create_details_widget (TnyFolderStore *folder_store)
                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;
index 0db9025..fdb3881 100644 (file)
@@ -40,6 +40,7 @@
 #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>
 
 
@@ -401,25 +402,30 @@ modest_tny_account_new_from_account (ModestAccountMgr *account_mgr, const gchar
        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*
@@ -461,21 +467,38 @@ modest_tny_account_new_for_local_folders (ModestAccountMgr *account_mgr, TnySess
                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);
index d9819b7..d9b6959 100644 (file)
@@ -78,16 +78,16 @@ modest_ui_dimming_rules_on_new_folder (ModestWindow *win, gpointer user_data)
        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;
                }
index 3b36370..120725b 100644 (file)
@@ -302,12 +302,7 @@ text_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer,
                if (!strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
                        item_name = g_strdup (priv->local_account_name);
                } else {
-                       if (!strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
-                               /* TODO: get MMC card name */
-                               item_name = g_strdup (_("FIXME: MMC"));
-                       } else {
-                               item_name = g_strdup (fname);
-                       }
+                       item_name = g_strdup (fname);
                }
 
                item_weight = 800;