* remove some annoying debug warnings
[modest] / src / modest-ui-dimming-rules.c
index f19faec..c5ad4b9 100644 (file)
@@ -321,15 +321,24 @@ modest_ui_dimming_rules_on_new_msg (ModestWindow *win, gpointer user_data)
        ModestDimmingRule *rule = NULL;
        gboolean dimmed = FALSE;
 
-       g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW(win), FALSE);
+       g_return_val_if_fail (MODEST_IS_WINDOW(win), FALSE);
        g_return_val_if_fail (MODEST_IS_DIMMING_RULE (user_data), FALSE);
        rule = MODEST_DIMMING_RULE (user_data);
                
        /* Check dimmed rule */ 
-       if (!dimmed) {
-               dimmed = _msg_download_in_progress (MODEST_MSG_VIEW_WINDOW(win));
-               if (dimmed)
-                       modest_dimming_rule_set_notification (rule, "");
+       if (MODEST_IS_MSG_VIEW_WINDOW(win)) {
+               if (!dimmed) {
+                       dimmed = _msg_download_in_progress (MODEST_MSG_VIEW_WINDOW(win));
+                       if (dimmed)
+                               modest_dimming_rule_set_notification (rule, "");
+               }
+       } else if (MODEST_IS_MAIN_WINDOW(win)) {
+               if (!dimmed) {
+                       dimmed = !modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), 
+                                                                 TRUE);        
+                       if (dimmed)
+                               modest_dimming_rule_set_notification (rule, _("mcen_nc_no_email_acnts_defined"));
+               }
        }
 
        return dimmed;
@@ -360,11 +369,13 @@ modest_ui_dimming_rules_on_new_folder (ModestWindow *win, gpointer user_data)
                        dimmed = FALSE;
                } 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;
-                       if (dimmed)
-                               modest_dimming_rule_set_notification (rule, _("mail_in_ui_folder_create_error"));
+                       if (proto_str != NULL) {
+                               /* If it's POP then dim */                      
+                               dimmed = (modest_protocol_info_get_transport_store_protocol (proto_str) == 
+                                         MODEST_PROTOCOL_STORE_POP) ? TRUE : FALSE;
+                               if (dimmed)
+                                       modest_dimming_rule_set_notification (rule, _("mail_in_ui_folder_create_error"));
+                       }
                }
        } else {
                /* TODO: the specs say that only one level of subfolder is allowed, is this true ? */
@@ -1053,7 +1064,7 @@ modest_ui_dimming_rules_on_paste (ModestWindow *win, gpointer user_data)
                if (dimmed)
                        modest_dimming_rule_set_notification (rule, _("mcen_ib_unable_to_copy_samefolder"));
        }
-
+       
        return dimmed;
 }