diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-06-05 04:53:10 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:42:26 +0800 |
commit | e7954c3f251aabbf95d099159709c8c66dfedc44 (patch) | |
tree | 08b6fbba02f05aa622cd54f45da223ef43066bb3 /mail | |
parent | dcaf6c52082765c2586a7d35b56b3dc417aa988d (diff) | |
download | gsoc2013-evolution-e7954c3f251aabbf95d099159709c8c66dfedc44.tar gsoc2013-evolution-e7954c3f251aabbf95d099159709c8c66dfedc44.tar.gz gsoc2013-evolution-e7954c3f251aabbf95d099159709c8c66dfedc44.tar.bz2 gsoc2013-evolution-e7954c3f251aabbf95d099159709c8c66dfedc44.tar.lz gsoc2013-evolution-e7954c3f251aabbf95d099159709c8c66dfedc44.tar.xz gsoc2013-evolution-e7954c3f251aabbf95d099159709c8c66dfedc44.tar.zst gsoc2013-evolution-e7954c3f251aabbf95d099159709c8c66dfedc44.zip |
Coding style and whitespace cleanups.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-migrate.c | 10 | ||||
-rw-r--r-- | mail/e-mail-notebook-view.c | 19 | ||||
-rw-r--r-- | mail/e-mail-session.c | 12 | ||||
-rw-r--r-- | mail/e-mail-tab-picker.c | 4 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 116 | ||||
-rw-r--r-- | mail/em-filter-rule.c | 4 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 13 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 10 | ||||
-rw-r--r-- | mail/em-format-hook.c | 3 | ||||
-rw-r--r-- | mail/em-format-html.h | 37 | ||||
-rw-r--r-- | mail/em-utils.c | 37 | ||||
-rw-r--r-- | mail/importers/elm-importer.c | 4 | ||||
-rw-r--r-- | mail/importers/evolution-mbox-importer.c | 37 | ||||
-rw-r--r-- | mail/importers/mail-importer.c | 11 | ||||
-rw-r--r-- | mail/mail-autofilter.c | 6 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 4 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 4 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 52 |
18 files changed, 269 insertions, 114 deletions
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index d0b58e7b54..9553c8b62a 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -337,7 +337,11 @@ em_update_accounts_2_11 (void) if (g_str_has_prefix (account->source->url, "spool://")) { if (g_file_test (account->source->url + 8, G_FILE_TEST_IS_DIR)) { - gchar *str = g_strdup_printf ("spooldir://%s", account->source->url + 8); + gchar *str; + + str = g_strdup_printf ( + "spooldir://%s", + account->source->url + 8); g_free (account->source->url); account->source->url = str; @@ -890,7 +894,9 @@ copy_folders (CamelStore *mbox_store, /* sanitize folder names and copy folders */ maildir_folder_name = sanitize_maildir_folder_name (fi->full_name); - copy_folder (mbox_store, maildir_store, fi->full_name, maildir_folder_name); + copy_folder ( + mbox_store, maildir_store, + fi->full_name, maildir_folder_name); g_free (maildir_folder_name); } diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 5a172e78c1..66bf9358f3 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -971,7 +971,8 @@ mail_netbook_view_open_mail (EMailView *view, #endif #if HAVE_CLUTTER - tab = (EMailTab *) e_mail_tab_new_full (camel_message_info_subject (info), NULL, 1); + tab = (EMailTab *) e_mail_tab_new_full ( + camel_message_info_subject (info), NULL, 1); g_object_set_data ((GObject *)tab, "page", pane); g_object_set_data ((GObject *)pane, "tab", tab); @@ -1046,7 +1047,9 @@ build_histogram (GtkWidget *widget, CamelFolder *folder) uids = camel_folder_get_uids (folder); camel_folder_summary_prepare_fetch_all (folder->summary, NULL); for (i = 0; i < uids->len; i++) { - CamelMessageInfo *info = camel_folder_get_message_info (folder, uids->pdata[i]); + CamelMessageInfo *info; + + info = camel_folder_get_message_info (folder, uids->pdata[i]); if (info) { time_t dreceived = now - camel_message_info_date_received (info); gint week; @@ -1451,11 +1454,15 @@ emnv_close_tab (EMailNotebookView *view, gpointer not_used) EMailNotebookViewPrivate *priv = view->priv; #if HAVE_CLUTTER - mnv_tab_closed (g_object_get_data((GObject *)priv->current_view, "tab"), - view); + mnv_tab_closed ( + g_object_get_data ( + G_OBJECT (priv->current_view), "tab"), + view); #else - tab_remove_gtk_cb (g_object_get_data((GObject *)priv->current_view, "close-button"), - view); + tab_remove_gtk_cb ( + g_object_get_data ( + G_OBJECT (priv->current_view), "close-button"), + view); #endif } diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index af66b333f3..061311c820 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -367,8 +367,11 @@ main_get_filter_driver (CamelSession *session, continue; e_filter_rule_build_code (rule, fsearch); - em_filter_rule_build_action ((EMFilterRule *) rule, faction); - camel_filter_driver_add_rule (driver, rule->name, fsearch->str, faction->str); + em_filter_rule_build_action ( + EM_FILTER_RULE (rule), faction); + camel_filter_driver_add_rule ( + driver, rule->name, + fsearch->str, faction->str); } g_string_free (fsearch, TRUE); @@ -442,8 +445,9 @@ set_socks_proxy_from_gconf (CamelSession *session) mode = gconf_client_get_string (client, MODE_PROXY, NULL); if (!g_strcmp0(mode, "manual")) { - host = gconf_client_get_string (client, KEY_SOCKS_HOST, NULL); /* NULL-GError */ - port = gconf_client_get_int (client, KEY_SOCKS_PORT, NULL); /* NULL-GError */ + /* FIXME Pass GErrors */ + host = gconf_client_get_string (client, KEY_SOCKS_HOST, NULL); + port = gconf_client_get_int (client, KEY_SOCKS_PORT, NULL); camel_session_set_socks_proxy (session, host, port); g_free (host); } diff --git a/mail/e-mail-tab-picker.c b/mail/e-mail-tab-picker.c index 5bf173253a..160a03df6a 100644 --- a/mail/e-mail-tab-picker.c +++ b/mail/e-mail-tab-picker.c @@ -111,6 +111,7 @@ e_mail_tab_picker_drop (MxDroppable *droppable, { GList *t; EMailTabPickerProps *tab; + ClutterActor *parent; gint current_position, new_position; EMailTabPicker *picker = E_MAIL_TAB_PICKER (droppable); @@ -123,7 +124,8 @@ e_mail_tab_picker_drop (MxDroppable *droppable, if (!E_MAIL_IS_TAB (draggable)) return; - if (clutter_actor_get_parent (CLUTTER_ACTOR (draggable)) != (ClutterActor *) picker) + parent = clutter_actor_get_parent (CLUTTER_ACTOR (draggable)); + if (parent != (ClutterActor *) picker) return; /* Get current position and property data structure */ diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 1ab739185f..08fa927a67 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1060,7 +1060,10 @@ replace_variables (GSList *clues, CamelMimeMessage *message, gchar **pstr) if (!count1) { if (getenv (out+1)) { g_free (str); - str = g_strconcat (temp_str[0], getenv (out + 1), temp_str[1], NULL); + str = g_strconcat ( + temp_str[0], + getenv (out + 1), + temp_str[1], NULL); count1 = TRUE; string_changed = TRUE; } else @@ -1071,7 +1074,8 @@ replace_variables (GSList *clues, CamelMimeMessage *message, gchar **pstr) CamelInternetAddress *to; const gchar *name, *addr; - to = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); + to = camel_mime_message_get_recipients ( + message, CAMEL_RECIPIENT_TYPE_TO); if (!camel_internet_address_get (to, 0, &name, &addr)) continue; @@ -2314,21 +2318,30 @@ get_reply_sender (CamelMimeMessage *message, CamelNNTPAddress *postto) { CamelInternetAddress *reply_to; - const gchar *name, *addr, *posthdr; - gint i; + CamelMedium *medium; + const gchar *name, *addr; + const gchar *posthdr = NULL; + + medium = CAMEL_MEDIUM (message); /* check whether there is a 'Newsgroups: ' header in there */ - if (postto - && ((posthdr = camel_medium_get_header((CamelMedium *)message, "Followup-To")) - || (posthdr = camel_medium_get_header((CamelMedium *)message, "Newsgroups")))) { - camel_address_decode ((CamelAddress *) postto, posthdr); + if (postto != NULL && posthdr == NULL) + posthdr = camel_medium_get_header (medium, "Followup-To"); + + if (postto != NULL && posthdr == NULL) + posthdr = camel_medium_get_header (medium, "Newsgroups"); + + if (postto != NULL && posthdr != NULL) { + camel_address_decode (CAMEL_ADDRESS (postto), posthdr); return; } reply_to = get_reply_to (message); - if (reply_to) { - for (i = 0; camel_internet_address_get (reply_to, i, &name, &addr); i++) + if (reply_to != NULL) { + gint ii; + + while (camel_internet_address_get (reply_to, ii++, &name, &addr)) camel_internet_address_add (to, name, addr); } } @@ -2347,21 +2360,30 @@ get_reply_from (CamelMimeMessage *message, CamelNNTPAddress *postto) { CamelInternetAddress *from; - const gchar *name, *addr, *posthdr; - gint i; + CamelMedium *medium; + const gchar *name, *addr; + const gchar *posthdr = NULL; + + medium = CAMEL_MEDIUM (message); /* check whether there is a 'Newsgroups: ' header in there */ - if (postto - && ((posthdr = camel_medium_get_header((CamelMedium *)message, "Followup-To")) - || (posthdr = camel_medium_get_header((CamelMedium *)message, "Newsgroups")))) { - camel_address_decode ((CamelAddress *) postto, posthdr); + if (postto != NULL && posthdr == NULL) + posthdr = camel_medium_get_header (medium, "Followup-To"); + + if (postto != NULL && posthdr == NULL) + posthdr = camel_medium_get_header (medium, "Newsgroups"); + + if (postto != NULL && posthdr != NULL) { + camel_address_decode (CAMEL_ADDRESS (postto), posthdr); return; } from = camel_mime_message_get_from (message); - if (from) { - for (i = 0; camel_internet_address_get (from, i, &name, &addr); i++) + if (from != NULL) { + gint ii; + + while (camel_internet_address_get (from, ii++, &name, &addr)) camel_internet_address_add (to, name, addr); } } @@ -2594,48 +2616,63 @@ attribution_format (CamelMimeMessage *message) switch (type) { case ATTRIB_CUSTOM: - attribvars[i].v.formatter (str, attribvars[i].name, message); + attribvars[i].v.formatter ( + str, attribvars[i].name, message); break; case ATTRIB_TIMEZONE: - g_string_append_printf (str, attribvars[i].v.format, tzone); + g_string_append_printf ( + str, attribvars[i].v.format, tzone); break; case ATTRIB_STRFTIME: - e_utf8_strftime (buf, sizeof (buf), attribvars[i].v.format, &tm); + e_utf8_strftime ( + buf, sizeof (buf), attribvars[i].v.format, &tm); g_string_append (str, buf); break; case ATTRIB_TM_SEC: - g_string_append_printf (str, attribvars[i].v.format, tm.tm_sec); + g_string_append_printf ( + str, attribvars[i].v.format, tm.tm_sec); break; case ATTRIB_TM_MIN: - g_string_append_printf (str, attribvars[i].v.format, tm.tm_min); + g_string_append_printf ( + str, attribvars[i].v.format, tm.tm_min); break; case ATTRIB_TM_24HOUR: - g_string_append_printf (str, attribvars[i].v.format, tm.tm_hour); + g_string_append_printf ( + str, attribvars[i].v.format, tm.tm_hour); break; case ATTRIB_TM_12HOUR: - g_string_append_printf (str, attribvars[i].v.format, (tm.tm_hour + 1) % 13); + g_string_append_printf ( + str, attribvars[i].v.format, + (tm.tm_hour + 1) % 13); break; case ATTRIB_TM_MDAY: - g_string_append_printf (str, attribvars[i].v.format, tm.tm_mday); + g_string_append_printf ( + str, attribvars[i].v.format, tm.tm_mday); break; case ATTRIB_TM_MON: - g_string_append_printf (str, attribvars[i].v.format, tm.tm_mon + 1); + g_string_append_printf ( + str, attribvars[i].v.format, tm.tm_mon + 1); break; case ATTRIB_TM_YEAR: - g_string_append_printf (str, attribvars[i].v.format, tm.tm_year + 1900); + g_string_append_printf ( + str, attribvars[i].v.format, tm.tm_year + 1900); break; case ATTRIB_TM_2YEAR: - g_string_append_printf (str, attribvars[i].v.format, tm.tm_year % 100); + g_string_append_printf ( + str, attribvars[i].v.format, tm.tm_year % 100); break; case ATTRIB_TM_WDAY: /* not actually used */ - g_string_append_printf (str, attribvars[i].v.format, tm.tm_wday); + g_string_append_printf ( + str, attribvars[i].v.format, tm.tm_wday); break; case ATTRIB_TM_YDAY: - g_string_append_printf (str, attribvars[i].v.format, tm.tm_yday + 1); + g_string_append_printf ( + str, attribvars[i].v.format, tm.tm_yday + 1); break; default: - /* mis-spelled variable? drop the format argument and continue */ + /* Misspelled variable? Drop the + * format argument and continue. */ break; } } @@ -2704,15 +2741,24 @@ composer_set_body (EMsgComposer *composer, if (has_body_text && start_bottom) { GtkhtmlEditor *editor = GTKHTML_EDITOR (composer); + gboolean move_cursor_to_end; + gboolean top_signature; + const gchar *key; /* If we are placing signature on top, then move cursor to the end, otherwise try to find the signature place and place cursor just before the signature. We added there an empty line already. */ gtkhtml_editor_run_command (editor, "block-selection"); gtkhtml_editor_run_command (editor, "cursor-bod"); - if (gconf_client_get_bool ( - client, "/apps/evolution/mail/composer/top_signature", NULL) - || !gtkhtml_editor_search_by_data (editor, 1, "ClueFlow", "signature", "1")) + + key = "/apps/evolution/mail/composer/top_signature"; + top_signature = gconf_client_get_bool (client, key, NULL); + + move_cursor_to_end = top_signature || + !gtkhtml_editor_search_by_data ( + editor, 1, "ClueFlow", "signature", "1"); + + if (move_cursor_to_end) gtkhtml_editor_run_command (editor, "cursor-eod"); else gtkhtml_editor_run_command (editor, "selection-move-left"); diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c index 77b4d971a9..7fec5abccd 100644 --- a/mail/em-filter-rule.c +++ b/mail/em-filter-rule.c @@ -356,7 +356,9 @@ part_combobox_changed (GtkComboBox *combobox, struct _part_data *data) data->part = newpart; data->partwidget = e_filter_part_get_widget (newpart); if (data->partwidget) - gtk_box_pack_start (GTK_BOX (data->container), data->partwidget, TRUE, TRUE, 0); + gtk_box_pack_start ( + GTK_BOX (data->container), + data->partwidget, TRUE, TRUE, 0); } static GtkWidget * diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index d740e265a4..46f3fc82ba 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -2783,8 +2783,11 @@ em_folder_tree_get_selected_uris (EMFolderTree *folder_tree) selection = gtk_tree_view_get_selection (tree_view); /* at first, add lost uris */ - for (sl = folder_tree->priv->select_uris; sl; sl = g_slist_next (sl)) - list = g_list_append (list, g_strdup (((struct _selected_uri *) sl->data)->uri)); + for (sl = folder_tree->priv->select_uris; sl; sl = g_slist_next (sl)) { + const gchar *uri; + uri = ((struct _selected_uri *) sl->data)->uri; + list = g_list_append (list, g_strdup (uri)); + } rows = gtk_tree_selection_get_selected_rows (selection, &model); for (l=rows; l; l=g_list_next (l)) { @@ -2960,7 +2963,11 @@ em_folder_tree_select_next_path (EMFolderTree *folder_tree, gboolean skip_read_f iter = child; } else { while (1) { - gboolean has_parent = gtk_tree_model_iter_parent (model, &parent, &iter); + gboolean has_parent; + + has_parent = gtk_tree_model_iter_parent ( + model, &parent, &iter); + if (gtk_tree_model_iter_next (model, &iter)) { path = gtk_tree_model_get_path (model, &iter); break; diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 589729bcca..63931fba6d 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -170,9 +170,13 @@ emft_copy_folders__exec (struct _EMCopyFolders *m, pending = g_list_append (pending, info->child); if (m->tobase[0]) - g_string_printf (toname, "%s/%s", m->tobase, info->full_name + fromlen); + g_string_printf ( + toname, "%s/%s", m->tobase, + info->full_name + fromlen); else - g_string_printf (toname, "%s", info->full_name + fromlen); + g_string_printf ( + toname, "%s", + info->full_name + fromlen); d(printf ("Copying from '%s' to '%s'\n", info->full_name, toname->str)); @@ -516,7 +520,7 @@ new_folder_created_cb (CamelStore *store, data = g_object_get_data ( G_OBJECT (context->folder_tree), "select"); expand_only = GPOINTER_TO_INT (data) ? TRUE : FALSE; - + em_folder_tree_set_selected ( context->folder_tree, context->folder_uri, expand_only); diff --git a/mail/em-format-hook.c b/mail/em-format-hook.c index 7d16366c0e..f49c370a6e 100644 --- a/mail/em-format-hook.c +++ b/mail/em-format-hook.c @@ -193,7 +193,8 @@ emfh_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root) em_format_class_add_handler (klass, &item->handler); } } - /* We don't actually need to keep this around once its set on the class */ + /* We don't actually need to keep this + * around once its set on the class. */ emfh->groups = g_slist_append (emfh->groups, group); } } diff --git a/mail/em-format-html.h b/mail/em-format-html.h index 37eace367f..68b5b438eb 100644 --- a/mail/em-format-html.h +++ b/mail/em-format-html.h @@ -90,6 +90,9 @@ typedef enum { typedef struct _EMFormatHTMLJob EMFormatHTMLJob; +typedef void (*EMFormatHTMLJobCallback) (EMFormatHTMLJob *job, + GCancellable *cancellable); + /** * struct _EMFormatHTMLJob - A formatting job. * @@ -120,7 +123,7 @@ struct _EMFormatHTMLJob { GNode *puri_level; CamelURL *base; - void (*callback)(EMFormatHTMLJob *job, GCancellable *cancellable); + EMFormatHTMLJobCallback callback; union { gchar *uri; CamelMedium *msg; @@ -275,7 +278,8 @@ EMFormatHTMLPObject * em_format_html_find_pobject (EMFormatHTML *efh, const gchar *classid); EMFormatHTMLPObject * - em_format_html_find_pobject_func (EMFormatHTML *efh, + em_format_html_find_pobject_func + (EMFormatHTML *efh, CamelMimePart *part, EMFormatHTMLPObjectFunc func); void em_format_html_remove_pobject (EMFormatHTML *efh, @@ -283,22 +287,29 @@ void em_format_html_remove_pobject (EMFormatHTML *efh, void em_format_html_clear_pobject (EMFormatHTML *efh); EMFormatHTMLJob * em_format_html_job_new (EMFormatHTML *efh, - void (*callback)(EMFormatHTMLJob *job, GCancellable *cancellable), + EMFormatHTMLJobCallback callback, gpointer data); void em_format_html_job_queue (EMFormatHTML *efh, EMFormatHTMLJob *job); -gboolean em_format_html_get_show_real_date (EMFormatHTML *efh); -void em_format_html_set_show_real_date (EMFormatHTML *efh, +gboolean em_format_html_get_show_real_date + (EMFormatHTML *efh); +void em_format_html_set_show_real_date + (EMFormatHTML *efh, gboolean show_real_date); EMFormatHTMLHeadersState - em_format_html_get_headers_state (EMFormatHTML *efh); -void em_format_html_set_headers_state (EMFormatHTML *efh, - EMFormatHTMLHeadersState state); -gboolean em_format_html_get_headers_collapsable (EMFormatHTML *efh); -void em_format_html_set_headers_collapsable (EMFormatHTML *efh, - gboolean collapsable); - -gchar * em_format_html_format_cert_infos (CamelCipherCertInfo *first_cinfo); + em_format_html_get_headers_state + (EMFormatHTML *efh); +void em_format_html_set_headers_state + (EMFormatHTML *efh, + EMFormatHTMLHeadersState state); +gboolean em_format_html_get_headers_collapsable + (EMFormatHTML *efh); +void em_format_html_set_headers_collapsable + (EMFormatHTML *efh, + gboolean collapsable); + +gchar * em_format_html_format_cert_infos + (CamelCipherCertInfo *first_cinfo); G_END_DECLS diff --git a/mail/em-utils.c b/mail/em-utils.c index 73c4d9be61..7d11f5e9bf 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1661,16 +1661,24 @@ search_address_in_addressbooks (const gchar *address, book = e_book_new (source, &err); if (book == NULL) { - if (err && g_error_matches (err, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) { + if (err && g_error_matches ( + err, E_BOOK_ERROR, + E_BOOK_ERROR_CANCELLED)) { stop = TRUE; } else if (err) { - gchar *source_uid = g_strdup (e_source_peek_uid (source)); + gchar *source_uid; - g_hash_table_insert (emu_broken_books_hash, source_uid, source_uid); + source_uid = g_strdup ( + e_source_peek_uid (source)); + + g_hash_table_insert ( + emu_broken_books_hash, + source_uid, source_uid); g_warning ( "%s: Unable to create addressbook '%s': %s", - G_STRFUNC, e_source_peek_name (source), + G_STRFUNC, + e_source_peek_name (source), err->message); } g_clear_error (&err); @@ -1678,16 +1686,24 @@ search_address_in_addressbooks (const gchar *address, g_object_unref (book); book = NULL; - if (err && g_error_matches (err, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) { + if (err && g_error_matches ( + err, E_BOOK_ERROR, + E_BOOK_ERROR_CANCELLED)) { stop = TRUE; } else if (err) { - gchar *source_uid = g_strdup (e_source_peek_uid (source)); + gchar *source_uid; + + source_uid = g_strdup ( + e_source_peek_uid (source)); - g_hash_table_insert (emu_broken_books_hash, source_uid, source_uid); + g_hash_table_insert ( + emu_broken_books_hash, + source_uid, source_uid); g_warning ( "%s: Unable to open addressbook '%s': %s", - G_STRFUNC, e_source_peek_name (source), + G_STRFUNC, + e_source_peek_name (source), err->message); } g_clear_error (&err); @@ -1699,7 +1715,10 @@ search_address_in_addressbooks (const gchar *address, if (book && !stop && e_book_get_contacts (book, query, &contacts, &err)) { if (contacts != NULL) { if (!found_any) { - g_hash_table_insert (contact_cache, g_strdup (lowercase_addr), book); + g_hash_table_insert ( + contact_cache, + g_strdup (lowercase_addr), + book); } found_any = TRUE; diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c index 0bf58a7b73..75cf996e14 100644 --- a/mail/importers/elm-importer.c +++ b/mail/importers/elm-importer.c @@ -271,7 +271,9 @@ elm_status_timeout (gpointer data) pc = importer->status_pc; g_mutex_unlock (importer->status_lock); - e_import_status (importer->import, (EImportTarget *) importer->target, what, pc); + e_import_status ( + importer->import, (EImportTarget *) + importer->target, what, pc); } return TRUE; diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index 174c34b7a0..d0697b1850 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -103,22 +103,32 @@ mbox_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) view = e_shell_window_get_active_view (shell_window); if (view && g_str_equal (view, "mail")) { - EShellView *shell_view = e_shell_window_get_shell_view (shell_window, view); + EShellView *shell_view; + EShellSidebar *shell_sidebar; + EMFolderTree *folder_tree = NULL; - if (shell_view) { - EMFolderTree *folder_tree = NULL; - EShellSidebar *shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + shell_view = e_shell_window_get_shell_view ( + shell_window, view); - g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL); + shell_sidebar = + e_shell_view_get_shell_sidebar (shell_view); - if (folder_tree) - select_uri = em_folder_tree_get_selected_uri (folder_tree); - } + g_object_get ( + shell_sidebar, "folder-tree", + &folder_tree, NULL); + + select_uri = + em_folder_tree_get_selected_uri (folder_tree); + + g_object_unref (folder_tree); } } - if (!select_uri) - select_uri = g_strdup (e_mail_local_get_folder_uri (E_MAIL_LOCAL_FOLDER_INBOX)); + if (!select_uri) { + const gchar *uri; + uri = e_mail_local_get_folder_uri (E_MAIL_LOCAL_FOLDER_INBOX); + select_uri = g_strdup (uri); + } hbox = gtk_hbox_new (FALSE, 0); @@ -205,7 +215,9 @@ mbox_status_timeout (gpointer data) pc = importer->status_pc; g_mutex_unlock (importer->status_lock); - e_import_status (importer->import, (EImportTarget *) importer->target, what, pc); + e_import_status ( + importer->import, (EImportTarget *) + importer->target, what, pc); } return TRUE; @@ -255,7 +267,8 @@ mbox_import (EImport *ei, EImportTarget *target, EImportImporter *im) importer->cancellable, "status", G_CALLBACK (mbox_status), importer); - filename = g_filename_from_uri (((EImportTargetURI *) target)->uri_src, NULL, NULL); + filename = g_filename_from_uri ( + ((EImportTargetURI *) target)->uri_src, NULL, NULL); mail_importer_import_mbox ( session, filename, ((EImportTargetURI *) target)->uri_dest, importer->cancellable, mbox_import_done, importer); diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index 1c87afc7da..9f98779938 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -153,7 +153,9 @@ import_mbox_exec (struct _import_mbox_msg *m, cancellable, _("Importing '%s'"), camel_folder_get_full_name (folder)); camel_folder_freeze (folder); - while (camel_mime_parser_step (mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM) { + while (camel_mime_parser_step (mp, NULL, NULL) == + CAMEL_MIME_PARSER_STATE_FROM) { + CamelMimeMessage *msg; const gchar *tmp; gint pc = 0; @@ -337,9 +339,12 @@ import_folders_rec (struct _import_folders_data *m, break; } /* FIXME: need a better way to get default store location */ - uri = g_strdup_printf("mbox:%s/local#%s", data_dir, folder); + uri = g_strdup_printf ( + "mbox:%s/local#%s", data_dir, folder); } else { - uri = g_strdup_printf("mbox:%s/local#%s/%s", data_dir, folderparent, folder); + uri = g_strdup_printf ( + "mbox:%s/local#%s/%s", + data_dir, folderparent, folder); } printf("importing to uri %s\n", uri); diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index aca6ef726e..45b074d6cf 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -273,7 +273,8 @@ rule_from_message (EFilterRule *rule, gchar *namestr; from = camel_mime_message_get_from (msg); - for (i = 0; from && camel_internet_address_get (from, i, &name, &address); i++) { + for (i = 0; from && camel_internet_address_get ( + from, i, &name, &address); i++) { rule_add_sender (context, rule, address); if (name == NULL || name[0] == '\0') name = address; @@ -297,7 +298,8 @@ rule_from_message (EFilterRule *rule, if (flags & AUTO_MLIST) { gchar *name, *mlist; - mlist = camel_header_raw_check_mailing_list (&((CamelMimePart *) msg)->headers); + mlist = camel_header_raw_check_mailing_list ( + &((CamelMimePart *) msg)->headers); if (mlist) { rule_match_mlist (context, rule, mlist); name = g_strdup_printf (_("%s mailing list"), mlist); diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 2107b2c100..4b9d5f500f 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -359,7 +359,8 @@ folder_changed_cb (CamelFolder *folder, /* for each added message, check to see that it is brand new, not junk and not already deleted */ for (i = 0; i < changes->uid_added->len; i++) { - info = camel_folder_get_message_info (folder, changes->uid_added->pdata[i]); + info = camel_folder_get_message_info ( + folder, changes->uid_added->pdata[i]); if (info) { flags = camel_message_info_flags (info); if (((flags & CAMEL_MESSAGE_SEEN) == 0) && @@ -586,7 +587,6 @@ rename_folders (MailFolderCache *self, g_hash_table_insert (si->folders, mfi->full_name, mfi); } else { - d(printf("Rename found a new folder? old '%s' new '%s'\n", old, fi->full_name)); /* Its a new op */ mfi = g_malloc0 (sizeof (*mfi)); mfi->full_name = g_strdup (fi->full_name); diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 61eb302adf..2446c1c92e 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -882,12 +882,12 @@ receive_get_folder (CamelFilterDriver *d, /* and we assume the newer one is the same, but unref the old one anyway */ g_mutex_lock (info->data->lock); - if (g_hash_table_lookup_extended (info->data->folders, uri, &oldkey, &oldinfoptr)) { + if (g_hash_table_lookup_extended ( + info->data->folders, uri, &oldkey, &oldinfoptr)) { oldinfo = (struct _folder_info *) oldinfoptr; g_object_unref (oldinfo->folder); oldinfo->folder = folder; } else { - /*camel_folder_freeze (folder); */ oldinfo = g_malloc0 (sizeof (*oldinfo)); oldinfo->folder = folder; oldinfo->uri = g_strdup (uri); diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index db03ef2ac4..4c46c4d84a 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -566,6 +566,7 @@ mail_vfolder_delete_folder (EMailBackend *backend, CamelStore *store, const gchar *folder_name) { + ERuleContext *rule_context; EFilterRule *rule; EMailSession *session; const gchar *source; @@ -598,31 +599,40 @@ mail_vfolder_delete_folder (EMailBackend *backend, if (context == NULL) goto done; + rule_context = E_RULE_CONTEXT (context); + /* see if any rules directly reference this removed uri */ rule = NULL; - while ((rule = e_rule_context_next_rule ((ERuleContext *) context, rule, NULL))) { + while ((rule = e_rule_context_next_rule (rule_context, rule, NULL))) { + EMVFolderRule *vf_rule = EM_VFOLDER_RULE (rule); - if (!rule->name) { - d(printf("invalid rule (%p): rule->name is set to NULL\n", rule)); + if (!rule->name) continue; - } source = NULL; - while ((source = em_vfolder_rule_next_source ((EMVFolderRule *) rule, source))) { + while ((source = em_vfolder_rule_next_source (vf_rule, source))) { /* Remove all sources that match, ignore changed events though because the adduri call above does the work async */ if (e_mail_folder_uri_equal (CAMEL_SESSION (session), uri, source)) { - vf = g_hash_table_lookup (vfolder_hash, rule->name); + vf = g_hash_table_lookup ( + vfolder_hash, rule->name); + if (!vf) { g_warning ("vf is NULL for %s\n", rule->name); continue; } + g_signal_handlers_disconnect_matched ( rule, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, rule_changed, vf); - em_vfolder_rule_remove_source ((EMVFolderRule *) rule, source); - g_signal_connect (rule, "changed", G_CALLBACK(rule_changed), vf); + + em_vfolder_rule_remove_source (vf_rule, source); + + g_signal_connect ( + rule, "changed", + G_CALLBACK (rule_changed), vf); + if (changed_count == 0) { g_string_append (changed, rule->name); } else { @@ -630,8 +640,11 @@ mail_vfolder_delete_folder (EMailBackend *backend, g_string_prepend (changed, " "); g_string_append (changed, "\n"); } - g_string_append_printf (changed, " %s\n", rule->name); + g_string_append_printf ( + changed, " %s\n", + rule->name); } + changed_count++; source = NULL; } @@ -691,6 +704,7 @@ mail_vfolder_rename_folder (CamelStore *store, const gchar *old_folder_name, const gchar *new_folder_name) { + ERuleContext *rule_context; EFilterRule *rule; const gchar *source; CamelVeeFolder *vf; @@ -719,11 +733,15 @@ mail_vfolder_rename_folder (CamelStore *store, G_LOCK (vfolder); + rule_context = E_RULE_CONTEXT (context); + /* see if any rules directly reference this removed uri */ rule = NULL; - while ((rule = e_rule_context_next_rule ((ERuleContext *) context, rule, NULL))) { + while ((rule = e_rule_context_next_rule (rule_context, rule, NULL))) { + EMVFolderRule *vf_rule = EM_VFOLDER_RULE (rule); + source = NULL; - while ((source = em_vfolder_rule_next_source ((EMVFolderRule *) rule, source))) { + while ((source = em_vfolder_rule_next_source (vf_rule, source))) { /* Remove all sources that match, ignore changed events though because the adduri call above does the work async */ if (e_mail_folder_uri_equal (session, old_uri, source)) { @@ -732,13 +750,19 @@ mail_vfolder_rename_folder (CamelStore *store, g_warning ("vf is NULL for %s\n", rule->name); continue; } + g_signal_handlers_disconnect_matched ( rule, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, rule_changed, vf); - em_vfolder_rule_remove_source ((EMVFolderRule *) rule, source); - em_vfolder_rule_add_source ((EMVFolderRule *) rule, new_uri); - g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), vf); + + em_vfolder_rule_remove_source (vf_rule, source); + em_vfolder_rule_add_source (vf_rule, new_uri); + + g_signal_connect ( + vf_rule, "changed", + G_CALLBACK (rule_changed), vf); + changed++; source = NULL; } |