-modest (1.0-2008.33-1) hardy; urgency=low
+modest (1.0-2008.33-2) hardy; urgency=low
- * Fixes: NB#87366, NB#87102, NB#86719, NB#84725, NB#87350, NB#86828
+ * intermediate build with single bug fix.
+ * Fixes: NB#86984
- -- Dirk-Jan C. Binnema <dirk-jan.binnema@nokia.com> Mon, 11 Aug 2008 12:09:11 +0300
-
-modest (1.0-2008.32-1) hardy; urgency=low
-
- * Fixes: NB#87029, NB#87093, NB#86984, NB#86213, NB#86176, NB#87174
- * Fixes: NB#86564, NB#86137, NB#86112, NB#86408, NB#86199, NB#86637
- * Fixes: NB#87257, NB#87039, NB#87351
-
- -- Dirk-Jan C. Binnema <dirk-jan.binnema@nokia.com> Wed, 06 Aug 2008 09:47:09 +0300
+ -- Dirk-Jan C. Binnema <dirk-jan.binnema@nokia.com> Thu, 14 Aug 2008 15:16:29 +0300
modest (1.0-2008.31-1) hardy; urgency=low
g_object_unref (store_settings);
g_object_unref (transport_settings);
- hildon_banner_show_information(NULL, NULL, _("mcen_ib_advsetup_settings_saved"));
+ if (!self->save_password)
+ hildon_banner_show_information(NULL, NULL, _("mcen_ib_advsetup_settings_saved"));
}
} else {
hildon_banner_show_information (NULL, NULL, _("mail_ib_setting_failed"));
G_CALLBACK (on_response), self);
self->modified = FALSE;
+ self->save_password = FALSE;
/* When this window is shown, hibernation should not be possible,
* because there is no sensible way to save the state: */
}
+void
+modest_account_settings_dialog_save_password (ModestAccountSettingsDialog *dialog)
+{
+ g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
+
+ dialog->save_password = TRUE;
+}
+
+
static void
modest_account_settings_dialog_class_init (ModestAccountSettingsDialogClass *klass)
{
ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (user_data);
- if (widget == ppriv->notebook) {
+ if (widget == user_data) {
if (event->keyval == GDK_Right) {
gtk_notebook_next_page (GTK_NOTEBOOK (ppriv->notebook));
retval = TRUE;
ModestWindowPrivate *parent_priv;
GtkAction *action;
gboolean active;
- GtkTreeSelection *sel;
- GList *rows, *list;
-
+
g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
g_signal_handlers_unblock_by_func (action, modest_ui_actions_toggle_folders_view, self);
}
- /* We need to store the selection because it's lost when the
- widget is reparented */
- sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->header_view));
- rows = gtk_tree_selection_get_selected_rows (sel, NULL);
-
priv->style = style;
switch (style) {
case MODEST_MAIN_WINDOW_STYLE_SIMPLE:
break;
default:
- g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (rows);
g_return_if_reached ();
}
- /* Reselect the previously selected folders. We disable the
- dimming rules execution during that time because there is
- no need to work out it again and it could take a lot of
- time if all the headers are selected */
- list = rows;
- modest_window_disable_dimming (MODEST_WINDOW (self));
- while (list) {
- gtk_tree_selection_select_path (sel, (GtkTreePath *) list->data);
- list = g_list_next (list);
- }
- modest_window_enable_dimming (MODEST_WINDOW (self));
-
- /* Free */
- g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (rows);
-
/* Let header view grab the focus if it's being shown */
if (priv->contents_style == MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS)
gtk_widget_grab_focus (GTK_WIDGET (priv->header_view));
GtkTextIter *iter,
GtkTextMark *mark,
ModestMsgEditWindow *userdata);
-static void vadj_changed (GtkAdjustment *adj,
- ModestMsgEditWindow *window);
+void vadj_changed (GtkAdjustment *adj,
+ ModestMsgEditWindow *window);
static void DEBUG_BUFFER (WPTextBuffer *buffer)
{
}
}
-static void
-vadj_changed (GtkAdjustment *adj,
- ModestMsgEditWindow *window)
+void vadj_changed (GtkAdjustment *adj,
+ ModestMsgEditWindow *window)
{
ModestMsgEditWindowPrivate *priv;
}
static void
-attachment_deleted (ModestAttachmentsView *attachments_view,
- gpointer user_data)
-{
- modest_msg_edit_window_remove_attachments (MODEST_MSG_EDIT_WINDOW (user_data),
- NULL);
-}
-
-static void
connect_signals (ModestMsgEditWindow *obj)
{
ModestMsgEditWindowPrivate *priv;
g_signal_connect (G_OBJECT (priv->msg_body), "cut-clipboard", G_CALLBACK (cut_clipboard_check), NULL);
g_signal_connect (G_OBJECT (priv->msg_body), "copy-clipboard", G_CALLBACK (copy_clipboard_check), NULL);
- g_signal_connect (G_OBJECT (priv->attachments_view), "delete", G_CALLBACK (attachment_deleted), obj);
+
}
static void
modest_maemo_utils_setup_images_filechooser (GTK_FILE_CHOOSER (dialog));
- modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (dialog));
-
response = gtk_dialog_run (GTK_DIALOG (dialog));
switch (response) {
case GTK_RESPONSE_OK:
ModestMsgEditWindowPrivate *priv;
GnomeVFSResult result;
GnomeVFSFileSize size = 0;
+
g_return_val_if_fail (window, 0);
g_return_val_if_fail (uri, 0);
info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) {
size = info->size;
if (size > allowed_size) {
- modest_platform_information_banner (NULL, NULL,
- dgettext("hildon-fm", "sfil_ib_opening_not_allowed"));
+ g_warning ("%s: attachment too big", __FUNCTION__);
+ modest_platform_information_banner (NULL, NULL, dgettext("hildon-fm", "sfil_ib_opening_not_allowed"));
return 0;
}
} else
}
-static void
-save_attachments_response (GtkDialog *dialog,
- gint arg1,
- gpointer user_data)
-{
- TnyList *mime_parts;
- gchar *chooser_uri;
- GList *files_to_save = NULL;
-
- mime_parts = TNY_LIST (user_data);
-
- if (arg1 != GTK_RESPONSE_OK)
- goto end;
-
- chooser_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
-
- if (!modest_utils_folder_writable (chooser_uri)) {
- hildon_banner_show_information
- (NULL, NULL, dgettext("hildon-fm", "sfil_ib_readonly_location"));
- } else {
- TnyIterator *iter;
-
- iter = tny_list_create_iterator (mime_parts);
- while (!tny_iterator_is_done (iter)) {
- TnyMimePart *mime_part = (TnyMimePart *) tny_iterator_get_current (iter);
-
- if ((modest_tny_mime_part_is_attachment_for_modest (mime_part)) &&
- !tny_mime_part_is_purged (mime_part) &&
- (tny_mime_part_get_filename (mime_part) != NULL)) {
- SaveMimePartPair *pair;
-
- pair = g_slice_new0 (SaveMimePartPair);
-
- if (tny_list_get_length (mime_parts) > 1) {
- gchar *escaped =
- gnome_vfs_escape_slashes (tny_mime_part_get_filename (mime_part));
- pair->filename = g_build_filename (chooser_uri, escaped, NULL);
- g_free (escaped);
- } else {
- pair->filename = g_strdup (chooser_uri);
- }
- pair->part = mime_part;
- files_to_save = g_list_prepend (files_to_save, pair);
- }
- tny_iterator_next (iter);
- }
- g_object_unref (iter);
- }
- g_free (chooser_uri);
-
- if (files_to_save != NULL) {
- SaveMimePartInfo *info = g_slice_new0 (SaveMimePartInfo);
- info->pairs = files_to_save;
- info->result = TRUE;
- save_mime_parts_to_file_with_checks (info);
- }
-
- end:
- /* Free and close the dialog */
- g_object_unref (mime_parts);
- gtk_widget_destroy (GTK_WIDGET (dialog));
-}
void
modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *mime_parts)
{
ModestMsgViewWindowPrivate *priv;
+ GList *files_to_save = NULL;
GtkWidget *save_dialog = NULL;
gchar *folder = NULL;
const gchar *filename = NULL;
g_object_set (G_OBJECT (save_dialog), "save-multiple", save_multiple_str, NULL);
gtk_window_set_title (GTK_WINDOW (save_dialog), _FM("sfil_ti_save_objects_files"));
}
+
+ /* show dialog */
+ if (gtk_dialog_run (GTK_DIALOG (save_dialog)) == GTK_RESPONSE_OK) {
+ gchar *chooser_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (save_dialog));
+
+ if (!modest_utils_folder_writable (chooser_uri)) {
+ hildon_banner_show_information
+ (NULL, NULL, dgettext("hildon-fm", "sfil_ib_readonly_location"));
+ } else {
+ TnyIterator *iter;
+
+ iter = tny_list_create_iterator (mime_parts);
+ while (!tny_iterator_is_done (iter)) {
+ TnyMimePart *mime_part = (TnyMimePart *) tny_iterator_get_current (iter);
+
+ if ((modest_tny_mime_part_is_attachment_for_modest (mime_part)) &&
+ !tny_mime_part_is_purged (mime_part) &&
+ (tny_mime_part_get_filename (mime_part) != NULL)) {
+ SaveMimePartPair *pair;
+
+ pair = g_slice_new0 (SaveMimePartPair);
+ if (save_multiple_str) {
+ gchar *escaped = gnome_vfs_escape_slashes (
+ tny_mime_part_get_filename (mime_part));
+ pair->filename = g_build_filename (chooser_uri, escaped, NULL);
+ g_free (escaped);
+ } else {
+ pair->filename = g_strdup (chooser_uri);
+ }
+ pair->part = mime_part;
+ files_to_save = g_list_prepend (files_to_save, pair);
+ }
+ tny_iterator_next (iter);
+ }
+ g_object_unref (iter);
+ }
+ g_free (chooser_uri);
+ }
+
+ gtk_widget_destroy (save_dialog);
- /* We must run this asynchronously, because the hildon dialog
- performs a gtk_dialog_run by itself which leads to gdk
- deadlocks */
- g_signal_connect (save_dialog, "response",
- G_CALLBACK (save_attachments_response), mime_parts);
+ g_object_unref (mime_parts);
- gtk_widget_show_all (save_dialog);
+ if (files_to_save != NULL) {
+ SaveMimePartInfo *info = g_slice_new0 (SaveMimePartInfo);
+ info->pairs = files_to_save;
+ info->result = TRUE;
+ save_mime_parts_to_file_with_checks (info);
+ }
}
static gboolean
const gchar *icon_name,
const gchar *text)
{
- GtkWidget *banner, *banner_parent = NULL;
+ GtkWidget *banner;
ModestWindowMgr *mgr;
mgr = modest_runtime_get_window_mgr ();
- if (parent && GTK_IS_WINDOW (parent)) {
- /* If the window is the active one then show the
- banner on top of this window */
- if (gtk_window_is_active (GTK_WINDOW (parent)))
- banner_parent = parent;
- /* If the window is not the topmost but it's visible
- (it's minimized for example) then show the banner
- with no parent */
- else if (GTK_WIDGET_VISIBLE (parent))
- banner_parent = NULL;
- /* If the window is hidden (like the main window when
- running in the background) then do not show
- anything */
- else
- return;
- }
-
-
- banner = hildon_banner_show_information (banner_parent, icon_name, text);
+ banner = hildon_banner_show_information (parent, icon_name, text);
modest_window_mgr_register_banner (mgr);
g_object_ref (mgr);
static void
modest_default_connection_policy_on_disconnect (TnyConnectionPolicy *self, TnyAccount *account)
{
+ tny_account_cancel (account);
return;
}
static void _insensitive_press_callback (GtkWidget *widget, gpointer user_data);
-static void on_window_destroy (gpointer data,
- GObject *object);
-
static void _add_rule (ModestDimmingRulesGroup *self,
ModestDimmingRule *rule,
ModestWindow *window);
/* Set window to process dimming rules */
priv->window = MODEST_WINDOW (window);
- g_object_weak_ref (G_OBJECT (window), on_window_destroy, self);
/* Add dimming rules */
for (i=0; i < n_elements; i++) {
g_return_if_fail (MODEST_IS_DIMMING_RULES_GROUP(self));
priv = MODEST_DIMMING_RULES_GROUP_GET_PRIVATE(self);
- if (!priv->window)
- return;
-
/* Init dimming rules init data */
state = modest_ui_dimming_rules_define_dimming_state (priv->window);
modest_window_set_dimming_state (priv->window, state);
if (notification != NULL)
g_free(notification);
}
-
-static void
-on_window_destroy (gpointer data,
- GObject *object)
-{
- ModestDimmingRulesGroup *self = MODEST_DIMMING_RULES_GROUP (data);
- ModestDimmingRulesGroupPrivate *priv = MODEST_DIMMING_RULES_GROUP_GET_PRIVATE (self);
-
- priv->window = NULL;
-}
g_return_val_if_fail (address_list, NULL);
- table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ table = g_hash_table_new (g_str_hash, g_str_equal);
addresses = modest_text_utils_split_addresses_list (address_list);
cursor = addresses;
while (cursor) {
const gchar* address = (const gchar*)cursor->data;
- /* We need only the email to just compare it and not
- the full address which would make "a <a@a.com>"
- different from "a@a.com" */
- const gchar *email = get_email_from_address (address);
-
/* ignore the address if already seen */
- if (g_hash_table_lookup (table, email) == 0) {
+ if (g_hash_table_lookup (table, address) == 0) {
gchar *tmp;
- /* Include the full address and not only the
- email in the returned list */
if (!new_list) {
tmp = g_strdup (address);
} else {
}
new_list = tmp;
- g_hash_table_insert (table, (gchar*)email, GINT_TO_POINTER(1));
+ g_hash_table_insert (table, (gchar*)address, GINT_TO_POINTER(1));
}
cursor = g_slist_next (cursor);
}
- g_hash_table_unref (table);
+ g_hash_table_destroy (table);
g_slist_foreach (addresses, (GFunc)g_free, NULL);
g_slist_free (addresses);
gchar *attachments_string = NULL;
q = g_string_new ("\n");
+ if (signature != NULL) {
+ q = g_string_append (q, signature);
+ q = g_string_append_c (q, '\n');
+ }
q = g_string_append (q, cite);
q = g_string_append_c (q, '\n');
q = g_string_append (q, attachments_string);
g_free (attachments_string);
- if (signature != NULL) {
- q = g_string_append (q, "\n--\n");
- q = g_string_append (q, signature);
- q = g_string_append_c (q, '\n');
- }
-
return g_string_free (q, FALSE);
}
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" \
"<html>\n" \
"<body>\n" \
+ "<br/>%s<br/>" \
"<pre>%s<br/>%s<br/>%s</pre>\n" \
- "<br/>--<br/>%s<br/>\n" \
"</body>\n" \
"</html>\n";
gchar *attachments_string = NULL;
q_attachments_string = modest_text_utils_convert_to_html_body (attachments_string, -1, TRUE);
q_cite = modest_text_utils_convert_to_html_body (cite, -1, TRUE);
html_text = modest_text_utils_convert_to_html_body (text, -1, TRUE);
- result = g_strdup_printf (format, q_cite, html_text, q_attachments_string, signature_result);
+ result = g_strdup_printf (format, signature_result, q_cite, html_text, q_attachments_string);
g_free (q_cite);
g_free (html_text);
g_free (attachments_string);
/* Get a reference to myself */
self = MODEST_TNY_ACCOUNT_STORE (g_object_get_data (G_OBJECT(account), "account_store"));
priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
-
+
/* Ensure that we still have this account. It could happen
that a set_online was requested *before* removing an
account, and due to tinymail emits the get_password
priv->session = NULL;
}
+ camel_shutdown ();
+
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
const gchar* server_name = "";
gchar *prompt = NULL;
- gboolean retval = TRUE;
+ gboolean retval;
/* NOTE: account may be NULL in some cases */
g_return_val_if_fail (error, FALSE);
if (error->code == TNY_SERVICE_ERROR_CERTIFICATE)
retval = modest_platform_run_certificate_confirmation_dialog (server_name,
error->message);
- else if (error->code == TNY_SERVICE_ERROR_AUTHENTICATE) {
+ else {
modest_platform_run_information_dialog (NULL, prompt, TRUE);
/* Show the account dialog if it was wrong */
retval = TRUE;
}
- g_debug ("%s: error code %d (%s", __FUNCTION__, error->code, error->message);
if (prompt)
g_free (prompt);
GtkWidget *
modest_tny_account_store_show_account_settings_dialog (ModestTnyAccountStore *self,
- const gchar *account_name)
+ const gchar *account_name)
{
ModestTnyAccountStorePrivate *priv;
gpointer dialog_as_gpointer = NULL;
GtkWidget *dialog;
dialog = (GtkWidget *) modest_account_settings_dialog_new ();
settings = modest_account_mgr_load_account_settings (priv->account_mgr, account_name);
+ modest_account_settings_dialog_save_password (MODEST_ACCOUNT_SETTINGS_DIALOG (dialog));
modest_account_settings_dialog_set_account (MODEST_ACCOUNT_SETTINGS_DIALOG (dialog), settings);
g_object_unref (settings);
modest_account_settings_dialog_switch_to_user_info (MODEST_ACCOUNT_SETTINGS_DIALOG (dialog));
g_free (header_content_type_lower);
g_free (header_content_type);
return NULL;
- }
+ }
g_free (header_content_type_lower);
g_free (header_content_type);
content_type = g_strstrip (content_type);
content_type_lower = g_ascii_strdown (content_type, -1);
g_free (content_type);
- is_text_part =
- g_str_has_prefix (content_type_lower, "text/") ||
- g_str_has_prefix (content_type_lower, "message/rfc822");
+ is_text_part = g_str_has_prefix (content_type_lower, "text/");
g_free (content_type_lower);
/* if this part cannot be a supported body return NULL */
if (!is_text_part) {
signature = modest_account_mgr_get_signature (mgr, account_name, &use_signature);
if (body_str != NULL) {
- body = use_signature ? g_strconcat(body_str, "\n--\n", signature, NULL) : g_strdup(body_str);
+ body = use_signature ? g_strconcat(body_str, "\n", signature, NULL) : g_strdup(body_str);
} else {
- body = use_signature ? g_strconcat("\n--\n", signature, NULL) : g_strdup("");
+ body = use_signature ? g_strconcat("\n", signature, NULL) : g_strdup("");
}
msg = modest_tny_msg_new (to_str, from_str, cc_str, bcc_str, subject_str, body, NULL, NULL);
total_size = 0;
allowed_size = MODEST_MAX_ATTACHMENT_SIZE;
msg_win = modest_msg_edit_window_new (msg, account_name, FALSE);
-
- modest_window_mgr_register_window (modest_runtime_get_window_mgr(), msg_win);
- modest_msg_edit_window_set_modified (MODEST_MSG_EDIT_WINDOW (msg_win), set_as_modified);
- gtk_widget_show_all (GTK_WIDGET (msg_win));
-
while (attachments) {
total_size +=
- modest_msg_edit_window_attach_file_one((ModestMsgEditWindow *)msg_win,
- attachments->data, allowed_size);
+ modest_msg_edit_window_attach_file_one(
+ (ModestMsgEditWindow *)msg_win,
+ attachments->data, allowed_size);
if (total_size > allowed_size) {
g_warning ("%s: total size: %u",
attachments = g_slist_next(attachments);
}
+ modest_window_mgr_register_window (modest_runtime_get_window_mgr(), msg_win);
+ modest_msg_edit_window_set_modified (MODEST_MSG_EDIT_WINDOW (msg_win), set_as_modified);
+
+ gtk_widget_show_all (GTK_WIDGET (msg_win));
cleanup:
g_free (from_str);
gnome_vfs_uri_unref (cache_dir_uri);
if ((error->code == TNY_SYSTEM_ERROR_MEMORY ||
- /* When asking for a mail and no space left on device
- tinymail returns this error */
- error->code == TNY_SERVICE_ERROR_MESSAGE_NOT_AVAILABLE ||
- /* When the folder summary could not be read or
- written */
error->code == TNY_IO_ERROR_WRITE ||
error->code == TNY_IO_ERROR_READ) &&
!enough_free_space) {
if (TNY_IS_FOLDER (folder_store) && selected) {
TnyAccount *account;
const gchar *account_name = NULL;
+ gboolean refresh;
/* Update the active account */
account = modest_tny_folder_get_account (TNY_FOLDER (folder_store));
modest_main_window_set_contents_style (main_window,
MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
+ refresh = !modest_account_mgr_account_is_busy (modest_runtime_get_account_mgr (), account_name);
+
/* Set folder on header view. This function
will call tny_folder_refresh_async so we
pass a callback that will be called when
empty view if there are no messages */
modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view),
TNY_FOLDER (folder_store),
- TRUE,
+ refresh,
folder_refreshed_cb,
main_window);
g_object_unref(edit_window);
}
-static gboolean
-enough_space_for_message (ModestMsgEditWindow *edit_window,
- MsgData *data)
+gboolean
+modest_ui_actions_on_save_to_drafts (GtkWidget *widget, ModestMsgEditWindow *edit_window)
{
- TnyAccountStore *acc_store;
+ TnyTransportAccount *transport_account;
+ ModestMailOperation *mail_operation;
+ MsgData *data;
+ gchar *account_name, *from;
+ ModestAccountMgr *account_mgr;
+/* char *info_text; */
+ gboolean had_error = FALSE;
guint64 available_disk, expected_size;
gint parts_count;
guint64 parts_size;
+ ModestMainWindow *win;
+
+ g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW(edit_window), FALSE);
+
+ data = modest_msg_edit_window_get_msg_data (edit_window);
/* Check size */
- acc_store = TNY_ACCOUNT_STORE (modest_runtime_get_account_store());
- available_disk = modest_utils_get_available_space (NULL);
+ available_disk = modest_folder_available_space (NULL);
modest_msg_edit_window_get_parts_size (edit_window, &parts_count, &parts_size);
expected_size = modest_tny_msg_estimate_size (data->plain_body,
- data->html_body,
- parts_count,
- parts_size);
+ data->html_body,
+ parts_count,
+ parts_size);
- /* Double check: memory full condition or message too big */
- if (available_disk < MIN_FREE_SPACE ||
- expected_size > available_disk) {
+ if ((available_disk != -1) && expected_size > available_disk) {
+ modest_msg_edit_window_free_msg_data (edit_window, data);
- modest_platform_information_banner (NULL, NULL,
- dgettext("ke-recv",
- "cerm_device_memory_full"));
+ modest_platform_information_banner (NULL, NULL, dgettext("ke-recv", "cerm_device_memory_full"));
return FALSE;
}
* MODEST_MAX_LOW_MEMORY_MESSAGE_SIZE (see modest-defs.h) this
* should still allow for sending anything critical...
*/
- if ((expected_size > MODEST_MAX_LOW_MEMORY_MESSAGE_SIZE) &&
- modest_platform_check_memory_low (MODEST_WINDOW(edit_window), TRUE))
- return FALSE;
+ if (expected_size > MODEST_MAX_LOW_MEMORY_MESSAGE_SIZE) {
+
+ if (modest_platform_check_memory_low (MODEST_WINDOW(edit_window), TRUE)) {
+ modest_msg_edit_window_free_msg_data (edit_window, data);
+ return FALSE;
+ }
+ }
/*
* djcb: we also make sure that the attachments are smaller than the max size
GTK_WINDOW(edit_window),
dgettext("ke-recv","memr_ib_operation_disabled"),
TRUE);
- return FALSE;
- }
-
- return TRUE;
-}
-
-gboolean
-modest_ui_actions_on_save_to_drafts (GtkWidget *widget, ModestMsgEditWindow *edit_window)
-{
- TnyTransportAccount *transport_account;
- ModestMailOperation *mail_operation;
- MsgData *data;
- gchar *account_name, *from;
- ModestAccountMgr *account_mgr;
- gboolean had_error = FALSE;
- ModestMainWindow *win;
-
- g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW(edit_window), FALSE);
-
- data = modest_msg_edit_window_get_msg_data (edit_window);
-
- /* Check size */
- if (!enough_space_for_message (edit_window, data)) {
modest_msg_edit_window_free_msg_data (edit_window, data);
return FALSE;
}
transport_account =
TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_server_account
- (modest_runtime_get_account_store (),
+ (modest_runtime_get_account_store(),
account_name,
TNY_ACCOUNT_TYPE_TRANSPORT));
if (!transport_account) {
{
TnyTransportAccount *transport_account = NULL;
gboolean had_error = FALSE;
- MsgData *data;
- ModestAccountMgr *account_mgr;
- gchar *account_name;
- gchar *from;
- ModestMailOperation *mail_operation;
+ guint64 available_disk, expected_size;
+ gint parts_count;
+ guint64 parts_size;
g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW(edit_window), TRUE);
if (!modest_msg_edit_window_check_names (edit_window, TRUE))
return TRUE;
- data = modest_msg_edit_window_get_msg_data (edit_window);
+ MsgData *data = modest_msg_edit_window_get_msg_data (edit_window);
/* Check size */
- if (!enough_space_for_message (edit_window, data)) {
+ available_disk = modest_folder_available_space (NULL);
+ modest_msg_edit_window_get_parts_size (edit_window, &parts_count, &parts_size);
+ expected_size = modest_tny_msg_estimate_size (data->plain_body,
+ data->html_body,
+ parts_count,
+ parts_size);
+
+ if ((available_disk != -1) && expected_size > available_disk) {
modest_msg_edit_window_free_msg_data (edit_window, data);
+
+ modest_platform_information_banner (NULL, NULL, dgettext("ke-recv", "cerm_device_memory_full"));
return FALSE;
}
- account_mgr = modest_runtime_get_account_mgr();
- account_name = g_strdup (data->account_name);
+
+ /*
+ * djcb: if we're in low-memory state, we only allow for sending messages
+ * smaller than MODEST_MAX_LOW_MEMORY_MESSAGE_SIZE (see modest-defs.h)
+ * this should still allow for sending anything critical...
+ */
+ if (expected_size > MODEST_MAX_LOW_MEMORY_MESSAGE_SIZE) {
+ if (modest_platform_check_memory_low (MODEST_WINDOW(edit_window), TRUE)) {
+ modest_msg_edit_window_free_msg_data (edit_window, data);
+ return FALSE;
+ }
+ }
+
+ /*
+ * djcb: we also make sure that the attachments are smaller than the max size
+ * this is for the case where we'd try to forward a message with attachments
+ * bigger than our max allowed size, or sending an message from drafts which
+ * somehow got past our checks when attaching.
+ */
+ if (expected_size > MODEST_MAX_ATTACHMENT_SIZE) {
+ modest_platform_run_information_dialog (
+ GTK_WINDOW(edit_window),
+ dgettext("ke-recv","memr_ib_operation_disabled"),
+ TRUE);
+ modest_msg_edit_window_free_msg_data (edit_window, data);
+ return FALSE;
+ }
+
+ ModestAccountMgr *account_mgr = modest_runtime_get_account_mgr();
+ gchar *account_name = g_strdup (data->account_name);
if (!account_name)
account_name = g_strdup(modest_window_get_active_account (MODEST_WINDOW(edit_window)));
/* Get the currently-active transport account for this modest account: */
if (strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) != 0) {
- transport_account =
- TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_server_account
- (modest_runtime_get_account_store (),
- account_name, TNY_ACCOUNT_TYPE_TRANSPORT));
+ transport_account = TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_server_account
+ (modest_runtime_get_account_store(),
+ account_name, TNY_ACCOUNT_TYPE_TRANSPORT));
}
if (!transport_account) {
return TRUE;
}
+ gchar *from = modest_account_mgr_get_from_string (account_mgr, account_name);
/* Create the mail operation */
- from = modest_account_mgr_get_from_string (account_mgr, account_name);
- mail_operation = modest_mail_operation_new_with_error_handling (NULL, modest_ui_actions_disk_operations_error_handler, NULL, NULL);
+ ModestMailOperation *mail_operation = modest_mail_operation_new_with_error_handling (NULL, modest_ui_actions_disk_operations_error_handler, NULL, NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_operation);
modest_mail_operation_send_new_mail (mail_operation,
/* Clear the headers view */
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_view));
- gtk_tree_selection_unselect_all (sel);
+ gtk_tree_selection_unselect_all (sel);
/* Actually rename the folder */
modest_mail_operation_rename_folder (mail_op,
/* Set focuse on header view */
gtk_widget_grab_focus (header_view);
+
/* Enable window dimming management */
modest_window_enable_dimming (MODEST_WINDOW(window));
- modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (window));
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window));
}
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "modest-debug.h"
#include "modest-ui-dimming-manager.h"
#include "modest-dimming-rules-group-priv.h"
typedef struct _ModestUIDimmingManagerPrivate ModestUIDimmingManagerPrivate;
struct _ModestUIDimmingManagerPrivate {
GHashTable *groups_map;
- GHashTable *delayed_calls;
};
#define MODEST_UI_DIMMING_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
(GEqualFunc) g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) g_object_unref);
- priv->delayed_calls = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- NULL);
}
static void
priv = MODEST_UI_DIMMING_MANAGER_GET_PRIVATE(obj);
if (priv->groups_map != NULL)
- g_hash_table_unref (priv->groups_map);
-
- if (priv->delayed_calls != NULL)
- g_hash_table_unref (priv->delayed_calls);
+ g_hash_table_destroy (priv->groups_map);
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
g_hash_table_foreach (priv->groups_map, _process_all_rules, NULL);
}
-typedef struct
-{
- ModestDimmingRulesGroup *group;
- ModestUIDimmingManager *manager;
- gchar *name;
-} DelayedDimmingRules;
-
-static gboolean
-process_dimming_rules_delayed (gpointer data)
-{
- DelayedDimmingRules *helper = (DelayedDimmingRules *) data;
- gpointer timeout_handler;
- ModestUIDimmingManagerPrivate *priv;
-
- /* We remove the timeout here because the execute action could
- take too much time, and so this will be called again */
- priv = MODEST_UI_DIMMING_MANAGER_GET_PRIVATE(helper->manager);
- timeout_handler = g_hash_table_lookup (priv->delayed_calls, helper->name);
-
- MODEST_DEBUG_BLOCK(g_print ("---------------------HIT %d\n", GPOINTER_TO_INT (timeout_handler)););
-
- if (GPOINTER_TO_INT (timeout_handler) > 0) {
- g_source_remove (GPOINTER_TO_INT (timeout_handler));
- }
-
- modest_dimming_rules_group_execute (helper->group);
-
- return FALSE;
-}
-
-static void
-process_dimming_rules_delayed_destroyer (gpointer data)
-{
- DelayedDimmingRules *helper = (DelayedDimmingRules *) data;
- ModestUIDimmingManagerPrivate *priv;
-
- priv = MODEST_UI_DIMMING_MANAGER_GET_PRIVATE(helper->manager);
- g_hash_table_remove (priv->delayed_calls, helper->name);
- g_free (helper->name);
- g_object_unref (helper->manager);
- g_slice_free (DelayedDimmingRules, helper);
-}
-
void
modest_ui_dimming_manager_process_dimming_rules_group (ModestUIDimmingManager *self,
const gchar *group_name)
{
ModestDimmingRulesGroup *group = NULL;
ModestUIDimmingManagerPrivate *priv;
- guint *handler, new_handler;
- DelayedDimmingRules *helper;
g_return_if_fail (group_name != NULL);
/* Search group by name */
group = MODEST_DIMMING_RULES_GROUP(g_hash_table_lookup (priv->groups_map, group_name));
g_return_if_fail (group != NULL);
-
- /* If there was another pending dimming operation check then ignore this */
- handler = g_hash_table_lookup (priv->delayed_calls, group_name);
- if (!handler) {
- /* Create the helper and start the timeout */
- helper = g_slice_new (DelayedDimmingRules);
- helper->group = group;
- helper->manager = g_object_ref (self);
- helper->name = g_strdup (group_name);
- new_handler = g_timeout_add_full (G_PRIORITY_DEFAULT, 500, process_dimming_rules_delayed,
- helper, process_dimming_rules_delayed_destroyer);
- g_hash_table_insert (priv->delayed_calls, g_strdup (group_name), GINT_TO_POINTER (new_handler));
- MODEST_DEBUG_BLOCK(g_print ("---------------------Adding %d\n", new_handler););
- } else {
- MODEST_DEBUG_BLOCK(g_print ("---------------------Ignoring\n"););
- }
+
+ /* Performs group dimming rules checking */
+ modest_dimming_rules_group_execute (group);
}
gboolean all_seen = TRUE;
gboolean all_cached = TRUE;
gboolean all_has_attach = TRUE;
- TnyFolder *folder = NULL;
g_return_val_if_fail (MODEST_IS_MAIN_WINDOW(window), NULL);
state->any_has_attachments = flags & TNY_HEADER_FLAG_ATTACHMENTS;
/* sent in progress */
- folder = tny_header_get_folder (header);
- if (folder) {
- if (modest_tny_folder_guess_folder_type (folder) == TNY_FOLDER_TYPE_OUTBOX) {
- msg_uid = modest_tny_send_queue_get_msg_id (header);
- if (!state->sent_in_progress) {
- cache_mgr = modest_runtime_get_cache_mgr ();
- send_queue_cache = modest_cache_mgr_get_cache (cache_mgr,
- MODEST_CACHE_MGR_CACHE_TYPE_SEND_QUEUE);
+ msg_uid = modest_tny_send_queue_get_msg_id (header);
+ if (!state->sent_in_progress) {
+ cache_mgr = modest_runtime_get_cache_mgr ();
+ send_queue_cache = modest_cache_mgr_get_cache (cache_mgr,
+ MODEST_CACHE_MGR_CACHE_TYPE_SEND_QUEUE);
- g_hash_table_foreach (send_queue_cache, (GHFunc) fill_list_of_caches, &send_queues);
-
- for (node = send_queues; node != NULL && !found; node = g_slist_next (node)) {
- send_queue = MODEST_TNY_SEND_QUEUE (node->data);
-
- /* Check if msg uid is being processed inside send queue */
- found = modest_tny_send_queue_msg_is_being_sent (send_queue, msg_uid);
- }
- state->sent_in_progress = found;
- }
+ g_hash_table_foreach (send_queue_cache, (GHFunc) fill_list_of_caches, &send_queues);
+
+ for (node = send_queues; node != NULL && !found; node = g_slist_next (node)) {
+ send_queue = MODEST_TNY_SEND_QUEUE (node->data);
+
+ /* Check if msg uid is being processed inside send queue */
+ found = modest_tny_send_queue_msg_is_being_sent (send_queue, msg_uid);
}
- g_object_unref (folder);
+ state->sent_in_progress = found;
}
+
tny_iterator_next (iter);
g_object_unref (header);
}
int len = -1;
sel = gtk_html_get_selection_html (GTK_HTML (focused), &len);
do_check = !((sel == NULL) || (sel[0] == '\0'));
- } else if (MODEST_IS_ATTACHMENTS_VIEW (focused)) {
- do_check = FALSE;
}
- g_warning ("FOCUSED %s", focused?G_OBJECT_TYPE_NAME (focused):"NULL");
if (do_check) {
clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
selection = gtk_clipboard_wait_for_text (clipboard);
}
guint64
-modest_utils_get_available_space (const gchar *maildir_path)
+modest_folder_available_space (const gchar *maildir_path)
{
gchar *folder;
gchar *uri_string;
if (uri) {
if (gnome_vfs_get_volume_free_space (uri, &size) != GNOME_VFS_OK)
- size = 0;
+ size = -1;
gnome_vfs_uri_unref (uri);
} else {
- size = 0;
+ size = -1;
}
return (guint64) size;
gint modest_list_index (TnyList *list, GObject *object);
/**
- * modest_utils_get_available_space:
+ * modest_folder_available_space:
* @maildir_path: the path of the maildir folder, or %NULL to
* get the space available in local folders
*
*
* Returns: a #guint64
*/
-guint64 modest_utils_get_available_space (const gchar *maildir_path);
+guint64 modest_folder_available_space (const gchar *maildir_path);
/**
ModestAccountSettings *settings;
gboolean modified;
+ gboolean save_password;
gchar * account_name; /* This may not change. It is not user visible. */
ModestTransportStoreProtocol incoming_protocol; /* This may not change. */
ModestTransportStoreProtocol outgoing_protocol; /* This may not change. */
/* signals */
enum {
ACTIVATE_SIGNAL,
- DELETE_SIGNAL,
LAST_SIGNAL
};
static void select_range (ModestAttachmentsView *atts_view, ModestAttachmentView *att1, ModestAttachmentView *att2);
static void clipboard_get (GtkClipboard *clipboard, GtkSelectionData *selection_data,
guint info, gpointer userdata);
+static void clipboard_clear (GtkClipboard *clipboard, gpointer userdata);
static void own_clipboard (ModestAttachmentsView *atts_view);
static guint signals[LAST_SIGNAL] = {0};
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
- signals[DELETE_SIGNAL] =
- g_signal_new ("delete",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET(ModestAttachmentsViewClass, delete),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
return;
}
return TRUE;
}
- if (event->keyval == GDK_BackSpace) {
- g_signal_emit (G_OBJECT (widget), signals[DELETE_SIGNAL], 0);
- return TRUE;
- }
-
/* Activates selected item */
if (g_list_length (priv->selected) == 1) {
ModestAttachmentView *att_view = (ModestAttachmentView *) priv->selected->data;
}
}
+static void clipboard_clear (GtkClipboard *clipboard, gpointer userdata)
+{
+ ModestAttachmentsView *atts_view = (ModestAttachmentsView *) userdata;
+
+ unselect_all (atts_view);
+}
+
TnyList *
modest_attachments_view_get_selection (ModestAttachmentsView *atts_view)
{
gtk_clipboard_set_with_owner (gtk_widget_get_clipboard (GTK_WIDGET (atts_view), GDK_SELECTION_PRIMARY),
targets, G_N_ELEMENTS (targets),
- clipboard_get, NULL, G_OBJECT(atts_view));
+ clipboard_get, clipboard_clear, G_OBJECT(atts_view));
}
GtkEventBoxClass parent_class;
void (*activate) (ModestAttachmentsView *attachments_view, TnyMimePart *mime_part);
- void (*delete) (ModestAttachmentsView *attachments_view, TnyMimePart *mime_part);
};
GType modest_attachments_view_get_type (void);
#include <gtkhtml/gtkhtml-search.h>
#include <tny-stream.h>
#include <tny-mime-part-view.h>
-#include "modest-tny-mime-part.h"
#include <modest-stream-text-to-html.h>
#include <modest-text-utils.h>
#include <modest-conf.h>
return;
}
- if (tny_mime_part_content_type_is (part, "text/html")) {
+ if (tny_mime_part_content_type_is (part, "text/html"))
set_html_part (self, part);
- } else {
- if (tny_mime_part_content_type_is (part, "message/rfc822")) {
- gchar *header_content_type, *header_content_type_lower;
- header_content_type = modest_tny_mime_part_get_header_value (part, "Content-Type");
- if (header_content_type) {
- header_content_type = g_strstrip (header_content_type);
- header_content_type_lower = g_ascii_strdown (header_content_type, -1);
-
- if (!g_ascii_strcasecmp (header_content_type_lower, "text/html"))
- set_html_part (self, part);
- else
- set_text_part (self, part);
-
- g_free (header_content_type_lower);
- g_free (header_content_type);
- } else {
- set_text_part (self, part);
- }
- } else {
- set_text_part (self, part);
- }
- }
+ else
+ set_text_part (self, part);
}
GSList *cursor = list, *start = list;
if (!uid)
- return list;
+ return FALSE;
while (cursor) {
GSList *next = g_slist_next (cursor);