2007-07-10 Murray Cumming <murrayc@murrayc.com>
+ * src/modest-ui-dimming-rules.c:
+ (modest_ui_dimming_rules_on_new_msg),
+ (modest_ui_dimming_rules_on_reply_msg),
+ (modest_ui_dimming_rules_on_delete_msg),
+ (modest_ui_dimming_rules_on_details),
+ (modest_ui_dimming_rules_on_view_window_move_to),
+ (modest_ui_dimming_rules_on_view_previous),
+ (modest_ui_dimming_rules_on_view_next),
+ (_invalid_folder_for_purge): Added checks before
+ casting the window. This looks like an actual
+ logic error in _invalid_folder_for_purge(), because it
+ tries to use a ModestMainWindow as a message window.
+
+2007-07-10 Murray Cumming <murrayc@murrayc.com>
+
* src/maemo/modest-account-settings-dialog.c:
(show_error): Use the same implementation as in
modest-easysetup-wizard.c:
/* Check dimmed rule */
if (!dimmed) {
- dimmed = _msg_download_in_progress (MODEST_MSG_VIEW_WINDOW(win));
+ if (MODEST_IS_MSG_VIEW_WINDOW (win))
+ dimmed = _msg_download_in_progress (MODEST_MSG_VIEW_WINDOW(win));
if (dimmed)
modest_dimming_rule_set_notification (rule, "");
}
modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading"));
}
if (!dimmed) {
- dimmed = _msg_download_in_progress (MODEST_MSG_VIEW_WINDOW(win));
+ if (MODEST_IS_MSG_VIEW_WINDOW (win))
+ dimmed = _msg_download_in_progress (MODEST_MSG_VIEW_WINDOW (win));
if (dimmed)
modest_dimming_rule_set_notification (rule, "");
}
modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading"));
}
if (!dimmed) {
- dimmed = !modest_msg_view_window_has_headers_model (MODEST_MSG_VIEW_WINDOW(win));
+ if (MODEST_IS_MSG_VIEW_WINDOW (win))
+ dimmed = !modest_msg_view_window_has_headers_model (MODEST_MSG_VIEW_WINDOW (win));
if (dimmed) {
gchar *num = g_strdup("1");
gchar *message = g_strdup_printf(_("mcen_nc_unable_to_delete_n_messages"), num);
/* Check dimmed rule */
if (!dimmed) {
- dimmed = _msg_download_in_progress (MODEST_MSG_VIEW_WINDOW(win));
+ if (MODEST_IS_MSG_VIEW_WINDOW (win))
+ dimmed = _msg_download_in_progress (MODEST_MSG_VIEW_WINDOW (win));
if (dimmed)
modest_dimming_rule_set_notification (rule, "");
}
modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading"));
}
if (!dimmed) {
- dimmed = !modest_msg_view_window_has_headers_model (MODEST_MSG_VIEW_WINDOW(win));
+ if (MODEST_IS_MSG_VIEW_WINDOW (win))
+ dimmed = !modest_msg_view_window_has_headers_model (MODEST_MSG_VIEW_WINDOW (win));
if (dimmed)
modest_dimming_rule_set_notification (rule, _("mcen_ib_unable_to_move_mail_attachment"));
}
modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading"));
}
if (!dimmed) {
- dimmed = modest_msg_view_window_first_message_selected (MODEST_MSG_VIEW_WINDOW(win));
+ if (MODEST_IS_MSG_VIEW_WINDOW (win))
+ dimmed = modest_msg_view_window_first_message_selected (MODEST_MSG_VIEW_WINDOW(win));
/* if (dimmed) */
/* modest_dimming_rule_set_notification (rule, ""); */
}
modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading"));
}
if (!dimmed) {
- dimmed = modest_msg_view_window_last_message_selected (MODEST_MSG_VIEW_WINDOW(win));
+ if (MODEST_IS_MSG_VIEW_WINDOW (win))
+ dimmed = modest_msg_view_window_last_message_selected (MODEST_MSG_VIEW_WINDOW (win));
/* if (dimmed) */
/* modest_dimming_rule_set_notification (rule, ""); */
}
/* If it's POP then dim */
if (modest_protocol_info_get_transport_store_protocol (proto_str) ==
MODEST_PROTOCOL_STORE_POP) {
- GList *attachments;
- gint n_selected;
+ GList *attachments = NULL;
+ gint n_selected = 0;
result = TRUE;
- attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win));
- n_selected = g_list_length (attachments);
- g_list_free (attachments);
+
+ /* TODO: This check is here to prevent a gwarning, but this looks like a logic error.
+ * murrayc */
+ if (MODEST_IS_MSG_VIEW_WINDOW (win)) {
+ attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win));
+ n_selected = g_list_length (attachments);
+ g_list_free (attachments);
+ }
modest_dimming_rule_set_notification (rule,
ngettext ("mail_ib_unable_to_pure_attach_pop_mail_singular",