2007-06-11 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Mon, 11 Jun 2007 07:43:23 +0000 (07:43 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Mon, 11 Jun 2007 07:43:23 +0000 (07:43 +0000)
* src/modest-ui-actions.c:
        (modest_ui_actions_on_password_requested): Check that the server name
        is not NULL, because I just saw a password dialog with (null) as the
        server name.

        * src/modest-tny-folder.[h|c]: Added
        modest_tny_folder_is_memory_card_folder().
        * src/modest-ui-dimming-rules.c:
        (modest_ui_dimming_rules_on_new_folder): Do not dim the new folder context
        menu item for memory cards, as per the UI spec (section 7.4). This should
        fix projects.maemo.org bug NB#59297.

pmo-trunk-r2143

ChangeLog2
src/modest-dimming-rules-group.c
src/modest-tny-folder.c
src/modest-tny-folder.h
src/modest-ui-actions.c
src/modest-ui-dimming-manager.c
src/modest-ui-dimming-rules.c

index aab92e6..d403a86 100644 (file)
@@ -1,3 +1,17 @@
+2007-06-11  Murray Cumming  <murrayc@murrayc.com>
+
+       * src/modest-ui-actions.c:
+       (modest_ui_actions_on_password_requested): Check that the server name 
+       is not NULL, because I just saw a password dialog with (null) as the 
+       server name.
+
+       * src/modest-tny-folder.[h|c]: Added 
+       modest_tny_folder_is_memory_card_folder().
+       * src/modest-ui-dimming-rules.c:
+       (modest_ui_dimming_rules_on_new_folder): Do not dim the new folder context 
+       menu item for memory cards, as per the UI spec (section 7.4). This should 
+       fix projects.maemo.org bug NB#59297.
+
 2007-06-10  Johannes Schmid <johannes.schmid@openismus.com>
 
        * src/maemo/modest-main-window.c: (sync_accounts_cb):
index c3e2d64..84e50a1 100644 (file)
@@ -217,7 +217,7 @@ _execute_dimming_rule (gpointer key, gpointer value, gpointer user_data)
 {
        g_return_if_fail (MODEST_IS_DIMMING_RULE (value));
 
-       /* Process diomming rule */
+       /* Process dimming rule */
        modest_dimming_rule_process (MODEST_DIMMING_RULE(value));
 }
 
index bcf9ffa..4b9c0d7 100644 (file)
@@ -117,7 +117,8 @@ modest_tny_folder_get_rules   (TnyFolder *folder)
 
        g_return_val_if_fail (TNY_IS_FOLDER(folder), -1);
 
-       if (modest_tny_folder_is_local_folder (folder)) {
+       if (modest_tny_folder_is_local_folder (folder) ||
+           modest_tny_folder_is_memory_card_folder (folder)) {
        
                type = modest_tny_folder_get_local_folder_type (folder);
                
@@ -199,6 +200,31 @@ modest_tny_folder_is_local_folder   (TnyFolder *folder)
        g_object_unref (G_OBJECT(account));
        
        return (strcmp (account_id, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) == 0);
+}
+
+gboolean
+modest_tny_folder_is_memory_card_folder   (TnyFolder *folder)
+{
+       g_return_val_if_fail (folder, FALSE);
+       
+       /* The merge folder is a special case, 
+        * used to merge the per-account local outbox folders. 
+        * and can have no get_account() implementation.
+        */
+       if (TNY_IS_MERGE_FOLDER (folder))
+               return FALSE;
+
+       TnyAccount* account = tny_folder_get_account ((TnyFolder*)folder);
+       if (!account)
+               return FALSE;
+
+       const gchar* account_id = tny_account_get_id (account);
+       if (!account_id)
+               return FALSE;
+
+       g_object_unref (G_OBJECT(account));
+       
+       return (strcmp (account_id, MODEST_MMC_ACCOUNT_ID) == 0);
 }      
 
 
index 02d2299..c2c812e 100644 (file)
@@ -95,6 +95,16 @@ TnyFolderType  modest_tny_folder_guess_folder_type_from_name   (const gchar *fol
  */
 gboolean modest_tny_folder_is_local_folder   (TnyFolder *folder);
 
+/**
+ * modest_tny_folder_is_memory_card_folder:
+ * @folder: a valid tnymail folder
+ * 
+ * checks if the folder is part of the memory card account.
+ *  
+ * Returns: TRUE if it's a memory card folder, FALSE otherwise
+ */
+gboolean
+modest_tny_folder_is_memory_card_folder   (TnyFolder *folder);
 
 /**
  * modest_tny_folder_get_local_folder_type:
index 50e8fb2..0d2391e 100644 (file)
@@ -1949,6 +1949,11 @@ modest_ui_actions_on_password_requested (TnyAccountStore *account_store,
        
        gchar *server_name = modest_server_account_get_hostname (
                modest_runtime_get_account_mgr(), server_account_name);
+       if (!server_name) {/* This happened once, though I don't know why. murrayc. */
+               g_warning("%s: Could not get server name for server account '%s'", __FUNCTION__, server_account_name);
+               *cancel = TRUE;
+               return;
+       }
        
        /* This causes a warning because the logical ID has no %s in it, 
         * though the translation does, but there is not much we can do about that: */
@@ -2078,7 +2083,7 @@ modest_ui_actions_on_password_requested (TnyAccountStore *account_store,
 
        gtk_widget_destroy (dialog);
        
-       printf ("DEBUG: %s: cancel=%d\n", __FUNCTION__, *cancel);
+       /* printf ("DEBUG: %s: cancel=%d\n", __FUNCTION__, *cancel); */
 }
 
 void
index c2a5427..27384c6 100644 (file)
@@ -170,7 +170,7 @@ modest_ui_dimming_manager_process_dimming_rules_group (ModestUIDimmingManager *s
 
        priv = MODEST_UI_DIMMING_MANAGER_GET_PRIVATE(self);
 
-       /* Serach group by name */
+       /* Search group by name */
        group = MODEST_DIMMING_RULES_GROUP(g_hash_table_lookup (priv->groups_map, group_name));
        g_return_if_fail (group != NULL);
        
index 6e45a6d..96635ce 100644 (file)
@@ -89,15 +89,10 @@ modest_ui_dimming_rules_on_new_folder (ModestWindow *win, gpointer user_data)
                        TNY_ACCOUNT (parent_folder)))
                        return FALSE;
                else {
-                       /* 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 dim */
-                               dimmed = (modest_protocol_info_get_transport_store_protocol (proto_str) == 
-                                         MODEST_PROTOCOL_STORE_POP) ? TRUE : FALSE;
-                       }
+                       const gchar *proto_str = tny_account_get_proto (TNY_ACCOUNT (parent_folder));
+                       /* If it's POP then dim */
+                       dimmed = (modest_protocol_info_get_transport_store_protocol (proto_str) == 
+                                 MODEST_PROTOCOL_STORE_POP) ? TRUE : FALSE;
                }
        } else {
                /* TODO: the specs say that only one level of subfolder is allowed, is this true ? */