diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-01-29 23:50:53 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:29 +0800 |
commit | 6af0c53b697c6981c1470c177b2c37e081635258 (patch) | |
tree | 35acd2868077859124e55626ba95f2599f1fdc5c /mail | |
parent | 5c0b316904b9463623e7d8976e7ef43662b55765 (diff) | |
download | gsoc2013-evolution-6af0c53b697c6981c1470c177b2c37e081635258.tar.gz gsoc2013-evolution-6af0c53b697c6981c1470c177b2c37e081635258.tar.zst gsoc2013-evolution-6af0c53b697c6981c1470c177b2c37e081635258.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-backend.c | 6 | ||||
-rw-r--r-- | mail/e-mail-display.c | 12 | ||||
-rw-r--r-- | mail/e-mail-local.c | 2 | ||||
-rw-r--r-- | mail/e-mail-migrate.c | 1 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 70 | ||||
-rw-r--r-- | mail/e-mail-session.c | 70 | ||||
-rw-r--r-- | mail/e-mail-store.c | 5 | ||||
-rw-r--r-- | mail/em-account-editor.c | 4 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 4 | ||||
-rw-r--r-- | mail/em-filter-context.c | 10 | ||||
-rw-r--r-- | mail/em-filter-folder-element.c | 17 | ||||
-rw-r--r-- | mail/em-vfolder-rule.c | 19 | ||||
-rw-r--r-- | mail/importers/mail-importer.c | 12 | ||||
-rw-r--r-- | mail/mail-autofilter.c | 26 | ||||
-rw-r--r-- | mail/mail-config.c | 46 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 3 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 20 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 85 |
18 files changed, 289 insertions, 123 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 3ab7cbda8d..e598c9388d 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -360,8 +360,10 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache, gint folder_type; gint flags = 0; - if (mail_folder_cache_get_folder_from_uri (folder_cache, folder_uri, &folder)) - if (folder && !mail_folder_cache_get_folder_info_flags (folder_cache, folder, &flags)) + if (mail_folder_cache_get_folder_from_uri ( + folder_cache, folder_uri, &folder)) + if (folder && !mail_folder_cache_get_folder_info_flags ( + folder_cache, folder, &flags)) g_return_if_reached (); target = em_event_target_new_folder ( diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 30608748a1..ae340d9571 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -269,11 +269,19 @@ mail_display_link_clicked (GtkHTML *html, } else if (g_ascii_strncasecmp (uri, "mailto:", 7) == 0) { EMFormat *format = EM_FORMAT (priv->formatter); CamelFolder *folder = NULL; + const gchar *folder_uri = NULL; + EShell *shell; - if (format && format->folder) + if (format != NULL && format->folder != NULL) folder = format->folder; - em_utils_compose_new_message_with_mailto (e_shell_get_default (), uri, folder ? camel_folder_get_uri (folder) : NULL); + if (folder != NULL) + folder_uri = camel_folder_get_uri (folder); + + shell = e_shell_get_default (); + em_utils_compose_new_message_with_mailto ( + shell, uri, folder_uri); + } else if (*uri == '#') gtk_html_jump_to_anchor (html, uri + 1); diff --git a/mail/e-mail-local.c b/mail/e-mail-local.c index d2bb42171d..d1938080d2 100644 --- a/mail/e-mail-local.c +++ b/mail/e-mail-local.c @@ -85,7 +85,7 @@ e_mail_local_init (EMailSession *session, /* FIXME camel_store_get_folder() may block. */ default_local_folders[ii].folder_uri = folder_uri; if (!strcmp (display_name, "Inbox")) - default_local_folders [ii].folder = camel_store_get_inbox_folder_sync ( + default_local_folders[ii].folder = camel_store_get_inbox_folder_sync ( CAMEL_STORE (service), NULL, NULL); else default_local_folders[ii].folder = camel_store_get_folder_sync ( diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index 0d650771f7..984cf3558c 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -741,7 +741,6 @@ migrate_to_db (EShellBackend *shell_backend) #endif - static gboolean mbox_to_maildir_migration_needed (EShellBackend *shell_backend) { diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 3f1e40af85..c05b392cda 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -434,7 +434,8 @@ get_message_checksum (CamelFolder *folder, CamelMimeMessage *msg) buffer = camel_stream_mem_get_byte_array (CAMEL_STREAM_MEM (mem)); if (buffer) - digest = g_compute_checksum_for_data (duplicate_csum, buffer->data, buffer->len); + digest = g_compute_checksum_for_data ( + duplicate_csum, buffer->data, buffer->len); g_object_unref (mem); @@ -453,7 +454,10 @@ message_is_duplicated (GHashTable *messages, guint64 id, gchar *digest) } static void -remove_duplicates_got_messages_cb (CamelFolder *folder, GPtrArray *uids, GPtrArray *msgs, gpointer data) +remove_duplicates_got_messages_cb (CamelFolder *folder, + GPtrArray *uids, + GPtrArray *msgs, + gpointer data) { EMailReader *reader = data; GtkWindow *parent; @@ -461,36 +465,46 @@ remove_duplicates_got_messages_cb (CamelFolder *folder, GPtrArray *uids, GPtrArr GPtrArray *dups; gint ii; - g_return_if_fail (folder != NULL); g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); g_return_if_fail (msgs != NULL); g_return_if_fail (msgs->len <= uids->len); - g_return_if_fail (reader != NULL); g_return_if_fail (E_IS_MAIL_READER (reader)); parent = e_mail_reader_get_window (reader); - messages = g_hash_table_new_full (g_int_hash, g_int_equal, g_free, g_free); + messages = g_hash_table_new_full ( + g_int_hash, g_int_equal, g_free, g_free); dups = g_ptr_array_new (); for (ii = 0; ii < msgs->len; ii++) { - CamelMessageInfo *msg_info = camel_folder_get_message_info (folder, uids->pdata[ii]); - const CamelSummaryMessageID *mid = camel_message_info_message_id (msg_info); - guint32 flags = camel_message_info_flags (msg_info); + CamelMessageInfo *msg_info; + const CamelSummaryMessageID *mid; + guint32 flags; + + msg_info = camel_folder_get_message_info ( + folder, uids->pdata[ii]); + mid = camel_message_info_message_id (msg_info); + flags = camel_message_info_flags (msg_info); if (!(flags & CAMEL_MESSAGE_DELETED)) { - gchar *digest = get_message_checksum (folder, msgs->pdata[ii]); + gchar *digest; + + digest = get_message_checksum (folder, msgs->pdata[ii]); - if (digest) { - if (message_is_duplicated (messages, mid->id.id, digest)) { + if (digest != NULL) { + if (message_is_duplicated ( + messages, mid->id.id, digest)) { g_ptr_array_add (dups, uids->pdata[ii]); g_free (digest); } else { guint64 *id; + id = g_new0 (guint64, 1); *id = mid->id.id; - g_hash_table_insert (messages, id, digest); + + g_hash_table_insert ( + messages, id, digest); } } } @@ -499,20 +513,26 @@ remove_duplicates_got_messages_cb (CamelFolder *folder, GPtrArray *uids, GPtrArr } if (dups->len == 0) { - em_utils_prompt_user (parent, NULL, "mail:info-no-remove-duplicates", camel_folder_get_name (folder), NULL); + em_utils_prompt_user ( + parent, NULL, "mail:info-no-remove-duplicates", + camel_folder_get_name (folder), NULL); } else { gchar *msg = g_strdup_printf (ngettext ( /* Translators: %s is replaced with a folder name %d with count of duplicate messages. */ - "Folder '%s' contains %d duplicate message. Are you sure you want to delete it?", - "Folder '%s' contains %d duplicate messages. Are you sure you want to delete them?", + "Folder '%s' contains %d duplicate message. " + "Are you sure you want to delete it?", + "Folder '%s' contains %d duplicate messages. " + "Are you sure you want to delete them?", dups->len), camel_folder_get_name (folder), dups->len); - if (em_utils_prompt_user (parent, NULL, "mail:ask-remove-duplicates", msg, NULL)) { + if (em_utils_prompt_user ( + parent, NULL, "mail:ask-remove-duplicates", msg, NULL)) { camel_folder_freeze (folder); for (ii = 0; ii < dups->len; ii++) - camel_folder_delete_message (folder, g_ptr_array_index (dups, ii)); + camel_folder_delete_message ( + folder, g_ptr_array_index (dups, ii)); camel_folder_thaw (folder); } @@ -539,7 +559,9 @@ action_mail_remove_duplicates (GtkAction *action, EMailReader *reader) em_utils_uids_free (uids); } else { /* the function itself is freeing uids */ - mail_get_messages (folder, uids, remove_duplicates_got_messages_cb, reader); + mail_get_messages ( + folder, uids, + remove_duplicates_got_messages_cb, reader); } } @@ -3012,12 +3034,18 @@ mail_reader_update_actions (EMailReader *reader, MessageList *message_list; gint row = -1, count = -1; ETreeTableAdapter *etta; - ETreePath node; + ETreePath node = NULL; - message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader)); + message_list = MESSAGE_LIST ( + e_mail_reader_get_message_list (reader)); etta = e_tree_get_table_adapter (E_TREE (message_list)); - if (message_list->cursor_uid != NULL && (node = g_hash_table_lookup (message_list->uid_nodemap, message_list->cursor_uid)) != NULL) { + if (message_list->cursor_uid != NULL) + node = g_hash_table_lookup ( + message_list->uid_nodemap, + message_list->cursor_uid); + + if (node != NULL) { row = e_tree_table_adapter_row_of_node (etta, node); count = e_table_model_row_count (E_TABLE_MODEL (etta)); } diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index 706fa2647e..7c9a8e041a 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -313,7 +313,8 @@ main_get_filter_driver (CamelSession *session, if (ms->priv->filter_logfile == NULL) { gchar *filename; - filename = gconf_client_get_string (client, "/apps/evolution/mail/filters/logfile", NULL); + filename = gconf_client_get_string ( + client, "/apps/evolution/mail/filters/logfile", NULL); if (filename) { ms->priv->filter_logfile = g_fopen (filename, "a+"); g_free (filename); @@ -328,10 +329,14 @@ main_get_filter_driver (CamelSession *session, camel_filter_driver_set_play_sound_func (driver, session_play_sound, NULL); camel_filter_driver_set_system_beep_func (driver, session_system_beep, NULL); - if ((!strcmp (type, E_FILTER_SOURCE_INCOMING) || !strcmp (type, E_FILTER_SOURCE_JUNKTEST)) - && camel_session_get_check_junk (session)) { + if ((!strcmp (type, E_FILTER_SOURCE_INCOMING) || + !strcmp (type, E_FILTER_SOURCE_JUNKTEST)) + && camel_session_get_check_junk (session)) { + /* implicit junk check as 1st rule */ - camel_filter_driver_add_rule (driver, "Junk check", "(junk-test)", "(begin (set-system-flag \"junk\"))"); + camel_filter_driver_add_rule ( + driver, "Junk check", "(junk-test)", + "(begin (set-system-flag \"junk\"))"); } if (strcmp (type, E_FILTER_SOURCE_JUNKTEST) != 0) { @@ -397,8 +402,8 @@ ms_forward_to_cb (CamelFolder *folder, client = gconf_client_get_default (); /* do not call mail send immediately, just pile them all in the outbox */ - if (preparing_flush || - gconf_client_get_bool (client, "/apps/evolution/mail/filters/flush-outbox", NULL)) { + if (preparing_flush || gconf_client_get_bool ( + client, "/apps/evolution/mail/filters/flush-outbox", NULL)) { if (preparing_flush) g_source_remove (preparing_flush); @@ -668,12 +673,15 @@ mail_session_get_password (CamelSession *session, eflags |= E_PASSWORDS_PASSPHRASE; /* HACK: breaks abstraction ... - e_account_writable doesn't use the eaccount, it also uses the same writable key for - source and transport */ + * e_account_writable() doesn't use the + * EAccount, it also uses the same writable + * key for source and transport. */ if (!e_account_writable (NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD)) eflags |= E_PASSWORDS_DISABLE_REMEMBER; - ret = e_passwords_ask_password (title, domain, key, prompt, eflags, &remember, NULL); + ret = e_passwords_ask_password ( + title, domain, key, prompt, + eflags, &remember, NULL); if (!ret) e_passwords_forget_password (domain, key); @@ -855,6 +863,8 @@ mail_session_forward_to (CamelSession *session, CamelInternetAddress *addr; CamelFolder *out_folder; CamelMessageInfo *info; + CamelMedium *medium; + const gchar *header_name; struct _camel_header_raw *xev; gchar *subject; @@ -883,25 +893,37 @@ mail_session_forward_to (CamelSession *session, /* make copy of the message, because we are going to modify it */ mem = camel_stream_mem_new (); - camel_data_wrapper_write_to_stream_sync ((CamelDataWrapper *)message, mem, NULL, NULL); + camel_data_wrapper_write_to_stream_sync ( + CAMEL_DATA_WRAPPER (message), mem, NULL, NULL); g_seekable_seek (G_SEEKABLE (mem), 0, G_SEEK_SET, NULL, NULL); - camel_data_wrapper_construct_from_stream_sync ((CamelDataWrapper *)forward, mem, NULL, NULL); + camel_data_wrapper_construct_from_stream_sync ( + CAMEL_DATA_WRAPPER (forward), mem, NULL, NULL); g_object_unref (mem); /* clear previous recipients */ - camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_TO, NULL); - camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_CC, NULL); - camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_BCC, NULL); - camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_RESENT_TO, NULL); - camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_RESENT_CC, NULL); - camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_RESENT_BCC, NULL); + camel_mime_message_set_recipients ( + forward, CAMEL_RECIPIENT_TYPE_TO, NULL); + camel_mime_message_set_recipients ( + forward, CAMEL_RECIPIENT_TYPE_CC, NULL); + camel_mime_message_set_recipients ( + forward, CAMEL_RECIPIENT_TYPE_BCC, NULL); + camel_mime_message_set_recipients ( + forward, CAMEL_RECIPIENT_TYPE_RESENT_TO, NULL); + camel_mime_message_set_recipients ( + forward, CAMEL_RECIPIENT_TYPE_RESENT_CC, NULL); + camel_mime_message_set_recipients ( + forward, CAMEL_RECIPIENT_TYPE_RESENT_BCC, NULL); + + medium = CAMEL_MEDIUM (forward); /* remove all delivery and notification headers */ - while (camel_medium_get_header (CAMEL_MEDIUM (forward), "Disposition-Notification-To")) - camel_medium_remove_header (CAMEL_MEDIUM (forward), "Disposition-Notification-To"); + header_name = "Disposition-Notification-To"; + while (camel_medium_get_header (medium, header_name)) + camel_medium_remove_header (medium, header_name); - while (camel_medium_get_header (CAMEL_MEDIUM (forward), "Delivered-To")) - camel_medium_remove_header (CAMEL_MEDIUM (forward), "Delivered-To"); + header_name = "Delivered-To"; + while (camel_medium_get_header (medium, header_name)) + camel_medium_remove_header (medium, header_name); /* remove any X-Evolution-* headers that may have been set */ xev = mail_tool_remove_xevolution_headers (forward); @@ -909,14 +931,16 @@ mail_session_forward_to (CamelSession *session, /* from */ addr = camel_internet_address_new (); - camel_internet_address_add (addr, account->id->name, account->id->address); + camel_internet_address_add ( + addr, account->id->name, account->id->address); camel_mime_message_set_from (forward, addr); g_object_unref (addr); /* to */ addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (addr), address); - camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_TO, addr); + camel_mime_message_set_recipients ( + forward, CAMEL_RECIPIENT_TYPE_TO, addr); g_object_unref (addr); /* subject */ diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c index af602b1a81..9dfaab693b 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -173,7 +173,10 @@ mail_store_add (EMailSession *session, g_return_if_fail (store_table != NULL); g_return_if_fail (store != NULL); g_return_if_fail (CAMEL_IS_STORE (store)); - g_return_if_fail ((CAMEL_SERVICE (store)->provider->flags & CAMEL_PROVIDER_IS_STORAGE) != 0); + + g_return_if_fail ( + (CAMEL_SERVICE (store)->provider->flags & + CAMEL_PROVIDER_IS_STORAGE) != 0); default_model = em_folder_tree_model_get_default (); folder_cache = e_mail_session_get_folder_cache (session); diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 3c373f444c..cf33586453 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -2368,7 +2368,7 @@ emae_option_checkspin_check_changed (GtkToggleButton *toggle, EMAccountEditorSer } static void -parse_checkspin_format (const char *str, +parse_checkspin_format (const gchar *str, gboolean *on_ret, gdouble *min_ret, gdouble *def_ret, @@ -3784,7 +3784,7 @@ static void set_provider_defaults_on_url (EMAccountEditor *emae, CamelProvider *provider, CamelURL *url) { CamelProviderConfEntry *entries; - int i; + gint i; if (!emae->priv->new_account) return; diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 6929f7069d..1b5b380f76 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1143,8 +1143,8 @@ edit_message (EShell *shell, typedef enum { QUOTING_ATTRIBUTION, QUOTING_FORWARD, QUOTING_ORIGINAL } QuotingTextEnum; static struct { - const gchar* gconf_key; - const gchar* message; + const gchar * gconf_key; + const gchar * message; } conf_messages[] = { [QUOTING_ATTRIBUTION] = { "/apps/evolution/mail/composer/message_attribution", diff --git a/mail/em-filter-context.c b/mail/em-filter-context.c index 2e6d19cc95..52039d9aa8 100644 --- a/mail/em-filter-context.c +++ b/mail/em-filter-context.c @@ -150,8 +150,11 @@ filter_context_rename_uri (ERuleContext *context, element = el->data; if (EM_IS_FILTER_FOLDER_ELEMENT (element) - && cmp (em_filter_folder_element_get_uri (EM_FILTER_FOLDER_ELEMENT (element)), olduri)) { - em_filter_folder_element_set_uri (EM_FILTER_FOLDER_ELEMENT (element), newuri); + && cmp (em_filter_folder_element_get_uri ( + EM_FILTER_FOLDER_ELEMENT (element)), olduri)) { + em_filter_folder_element_set_uri ( + EM_FILTER_FOLDER_ELEMENT ( + element), newuri); rulecount++; } el = el->next; @@ -202,7 +205,8 @@ filter_context_delete_uri (ERuleContext *context, element = el->data; if (EM_IS_FILTER_FOLDER_ELEMENT (element) - && cmp (em_filter_folder_element_get_uri (EM_FILTER_FOLDER_ELEMENT (element)), uri)) { + && cmp (em_filter_folder_element_get_uri ( + EM_FILTER_FOLDER_ELEMENT (element)), uri)) { /* check if last action, if so, remove rule instead? */ l = l->next; em_filter_rule_remove_action ((EMFilterRule *)rule, action); diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c index d5e7bd259a..9ad4cacc39 100644 --- a/mail/em-filter-folder-element.c +++ b/mail/em-filter-folder-element.c @@ -72,7 +72,9 @@ filter_folder_element_set_session (EMFilterFolderElement *element, EMailSession *session) { if (!session) - session = e_mail_backend_get_session (E_MAIL_BACKEND (e_shell_get_backend_by_name (e_shell_get_default(), "mail"))); + session = e_mail_backend_get_session ( + E_MAIL_BACKEND (e_shell_get_backend_by_name ( + e_shell_get_default (), "mail"))); g_return_if_fail (E_IS_MAIL_SESSION (session)); g_return_if_fail (element->priv->session == NULL); @@ -242,8 +244,10 @@ validate (EFilterElement *fe, EAlert **alert) static gint folder_eq (EFilterElement *fe, EFilterElement *cm) { - return E_FILTER_ELEMENT_CLASS (em_filter_folder_element_parent_class)->eq (fe, cm) - && strcmp (((EMFilterFolderElement *)fe)->priv->uri, ((EMFilterFolderElement *)cm)->priv->uri)== 0; + return E_FILTER_ELEMENT_CLASS ( + em_filter_folder_element_parent_class)->eq (fe, cm) && + strcmp (((EMFilterFolderElement *)fe)->priv->uri, + ((EMFilterFolderElement *)cm)->priv->uri)== 0; } static xmlNodePtr @@ -366,8 +370,11 @@ static void emff_copy_value (EFilterElement *de, EFilterElement *se) { if (EM_IS_FILTER_FOLDER_ELEMENT (se)) { - ((EMFilterFolderElement *)de)->store_camel_uri = ((EMFilterFolderElement *)se)->store_camel_uri; - em_filter_folder_element_set_uri ((EMFilterFolderElement *)de, ((EMFilterFolderElement *)se)->priv->uri); + ((EMFilterFolderElement *)de)->store_camel_uri = + ((EMFilterFolderElement *)se)->store_camel_uri; + em_filter_folder_element_set_uri (( + EMFilterFolderElement *) de, + ((EMFilterFolderElement *) se)->priv->uri); } else E_FILTER_ELEMENT_CLASS (em_filter_folder_element_parent_class)->copy_value (de, se); } diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index 1bb7830aec..088c6c761f 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -79,8 +79,17 @@ static void vfolder_rule_set_session (EMVFolderRule *rule, EMailSession *session) { - if (!session) - session = e_mail_backend_get_session (E_MAIL_BACKEND (e_shell_get_backend_by_name (e_shell_get_default(), "mail"))); + if (session == NULL) { + EShell *shell; + EShellBackend *shell_backend; + EMailBackend *backend; + + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + + backend = E_MAIL_BACKEND (shell_backend); + session = e_mail_backend_get_session (backend); + } g_return_if_fail (E_IS_MAIL_SESSION (session)); g_return_if_fail (rule->priv->session == NULL); @@ -376,7 +385,8 @@ xml_decode (EFilterRule *fr, xmlNodePtr node, struct _ERuleContext *f) EMVFolderRule *vr =(EMVFolderRule *)fr; gchar *tmp; - result = E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)->xml_decode (fr, node, f); + result = E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)-> + xml_decode (fr, node, f); if (result != 0) return result; @@ -668,7 +678,8 @@ get_widget (EFilterRule *fr, ERuleContext *rc) GObject *object; gint i; - widget = E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)->get_widget (fr, rc); + widget = E_FILTER_RULE_CLASS (em_vfolder_rule_parent_class)-> + get_widget (fr, rc); data = g_malloc0 (sizeof (*data)); data->rc = rc; diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index 4654956cc2..f6cbbbb82c 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -141,7 +141,8 @@ import_mbox_exec (struct _import_mbox_msg *m, mp = camel_mime_parser_new (); camel_mime_parser_scan_from (mp, TRUE); - if (camel_mime_parser_init_with_fd (mp, fd) == -1) { /* will never happen - 0 is unconditionally returned */ + if (camel_mime_parser_init_with_fd (mp, fd) == -1) { + /* will never happen - 0 is unconditionally returned */ goto fail2; } @@ -195,7 +196,6 @@ import_mbox_exec (struct _import_mbox_msg *m, camel_folder_synchronize_sync (folder, FALSE, NULL, NULL); camel_folder_thaw (folder); camel_operation_pop_message (cancellable); - /* TODO: these api's are a bit weird, registering the old is the same as deregistering */ fail2: g_object_unref (mp); } @@ -342,7 +342,8 @@ import_folders_rec (struct _import_folders_data *m, m->session, filefull, uri, m->cancellable); g_free (uri); - /* This little gem re-uses the stat buffer and filefull to automagically scan mozilla-format folders */ + /* This little gem re-uses the stat buffer and filefull + * to automagically scan mozilla-format folders. */ if (!m->elmfmt) { gchar *tmp = g_strdup_printf("%s.sbd", filefull); @@ -355,7 +356,10 @@ import_folders_rec (struct _import_folders_data *m, } if (S_ISDIR (st.st_mode)) { - foldersub = folderparent?g_strdup_printf("%s/%s", folderparent, folder):g_strdup(folder); + foldersub = folderparent ? + g_strdup_printf ( + "%s/%s", folderparent, folder) : + g_strdup (folder); import_folders_rec (m, filefull, foldersub); g_free (foldersub); } diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index aac7deb49a..2055480ea7 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -50,7 +50,9 @@ #define d(x) static void -rule_match_recipients (ERuleContext *context, EFilterRule *rule, CamelInternetAddress *iaddr) +rule_match_recipients (ERuleContext *context, + EFilterRule *rule, + CamelInternetAddress *iaddr) { EFilterPart *part; EFilterElement *element; @@ -218,7 +220,10 @@ rule_match_mlist (ERuleContext *context, EFilterRule *rule, const gchar *mlist) } static void -rule_from_address (EFilterRule *rule, ERuleContext *context, CamelInternetAddress* addr, gint flags) +rule_from_address (EFilterRule *rule, + ERuleContext *context, + CamelInternetAddress *addr, + gint flags) { rule->grouping = E_FILTER_GROUP_ANY; @@ -241,7 +246,10 @@ rule_from_address (EFilterRule *rule, ERuleContext *context, CamelInternetAddres } static void -rule_from_message (EFilterRule *rule, ERuleContext *context, CamelMimeMessage *msg, gint flags) +rule_from_message (EFilterRule *rule, + ERuleContext *context, + CamelMimeMessage *msg, + gint flags) { CamelInternetAddress *addr; @@ -275,10 +283,14 @@ rule_from_message (EFilterRule *rule, ERuleContext *context, CamelMimeMessage *m } } if (flags & AUTO_TO) { - addr = (CamelInternetAddress *)camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_TO); + addr = (CamelInternetAddress *) + camel_mime_message_get_recipients ( + msg, CAMEL_RECIPIENT_TYPE_TO); if (addr) rule_match_recipients (context, rule, addr); - addr = (CamelInternetAddress *)camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_CC); + addr = (CamelInternetAddress *) + camel_mime_message_get_recipients ( + msg, CAMEL_RECIPIENT_TYPE_CC); if (addr) rule_match_recipients (context, rule, addr); } @@ -409,9 +421,9 @@ mail_filter_rename_uri (EMailBackend *backend, e_rule_context_load ((ERuleContext *)fc, system, user); g_free (system); - changed = e_rule_context_rename_uri ((ERuleContext *)fc, eolduri, enewuri, g_str_equal); + changed = e_rule_context_rename_uri ( + (ERuleContext *)fc, eolduri, enewuri, g_str_equal); if (changed) { - d(printf("Folder rename '%s' -> '%s' changed filters, resaving\n", olduri, newuri)); if (e_rule_context_save ((ERuleContext *)fc, user) == -1) g_warning("Could not write out changed filter rules\n"); e_rule_context_free_uri_list ((ERuleContext *)fc, changed); diff --git a/mail/mail-config.c b/mail/mail-config.c index f5c107ddcc..77204f7830 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -99,7 +99,8 @@ config_write_style (void) fprintf (rc, " GtkHTML::spell_error_color = \"%s\"\n", spell_color); g_free (spell_color); - if (gconf_client_get_bool (client, "/apps/evolution/mail/display/mark_citations", NULL)) + key = "/apps/evolution/mail/display/mark_citations"; + if (gconf_client_get_bool (client, key, NULL)) fprintf (rc, " GtkHTML::cite_color = \"%s\"\n", citation_color); g_free (citation_color); @@ -125,24 +126,31 @@ config_write_style (void) } static void -gconf_style_changed (GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer user_data) +gconf_style_changed (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data) { config_write_style (); } static void -gconf_outlook_filenames_changed (GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer user_data) +gconf_outlook_filenames_changed (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data) { + const gchar *key; + g_return_if_fail (client != NULL); + key = "/apps/evolution/mail/composer/outlook_filenames"; + /* pass option to the camel */ - if (gconf_client_get_bool (client, "/apps/evolution/mail/composer/outlook_filenames", NULL)) { + if (gconf_client_get_bool (client, key, NULL)) camel_header_param_encode_filenames_in_rfc_2047 = 1; - } else { + else camel_header_param_encode_filenames_in_rfc_2047 = 0; - } } static void @@ -450,16 +458,28 @@ mail_config_get_lookup_book_local_only (void) } static void -folder_deleted_cb (MailFolderCache *cache, CamelStore *store, const gchar *uri, gpointer user_data) +folder_deleted_cb (MailFolderCache *cache, + CamelStore *store, + const gchar *uri, + gpointer user_data) { - mail_config_uri_deleted (CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS (store))->compare_folder_name, uri); + CamelStoreClass *class; + + class = CAMEL_STORE_GET_CLASS (store); + mail_config_uri_deleted (class->compare_folder_name, uri); } static void -folder_renamed_cb (MailFolderCache *cache, CamelStore *store, const gchar *olduri, const gchar *newuri, gpointer user_data) +folder_renamed_cb (MailFolderCache *cache, + CamelStore *store, + const gchar *olduri, + const gchar *newuri, + gpointer user_data) { - mail_config_uri_renamed (CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS (store))->compare_folder_name, - olduri, newuri); + CamelStoreClass *class; + + class = CAMEL_STORE_GET_CLASS (store); + mail_config_uri_renamed (class->compare_folder_name, olduri, newuri); } /* Config struct routines */ diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 8b3f3d2c24..876cbb3103 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -295,7 +295,8 @@ update_1folder (MailFolderCache *self, else unread = camel_folder_get_unread_message_count (folder); } - } else if (info && !em_utils_folder_is_drafts (NULL, info->uri) && !em_utils_folder_is_outbox (NULL, info->uri)) + } else if (info && !em_utils_folder_is_drafts (NULL, info->uri) && + !em_utils_folder_is_outbox (NULL, info->uri)) unread = info->unread; d(printf("folder updated: unread %d: '%s'\n", unread, mfi->full_name)); diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index aed6cf59a0..1c17024f39 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -410,7 +410,7 @@ build_dialog (GtkWindow *parent, EAccountList *accounts, CamelFolder *outbox, const gchar *destination, - gboolean allow_send) + gboolean allow_send) { GtkDialog *gd; GtkWidget *table; @@ -1193,14 +1193,20 @@ auto_online (EShell *shell) { EIterator *iter; EAccountList *accounts; + EShellSettings *shell_settings; struct _auto_data *info; gboolean can_update_all; if (!e_shell_get_online (shell)) return; - can_update_all = e_shell_settings_get_boolean (e_shell_get_shell_settings (shell), "mail-check-on-start") - && e_shell_settings_get_boolean (e_shell_get_shell_settings (shell), "mail-check-all-on-start"); + shell_settings = e_shell_get_shell_settings (shell); + + can_update_all = + e_shell_settings_get_boolean ( + shell_settings, "mail-check-on-start") && + e_shell_settings_get_boolean ( + shell_settings, "mail-check-all-on-start"); accounts = e_get_account_list (); for (iter = e_list_get_iterator ((EList *)accounts); @@ -1212,8 +1218,7 @@ auto_online (EShell *shell) continue; info = g_object_get_data ( - G_OBJECT (account), - "mail-autoreceive"); + G_OBJECT (account), "mail-autoreceive"); if (info && (info->timeout_id || can_update_all)) auto_timeout (info); } @@ -1228,6 +1233,7 @@ void mail_autoreceive_init (EMailBackend *backend) { EShellBackend *shell_backend; + EShellSettings *shell_settings; EMailSession *session; EAccountList *accounts; EIterator *iter; @@ -1262,8 +1268,10 @@ mail_autoreceive_init (EMailBackend *backend) shell_backend = E_SHELL_BACKEND (backend); shell = e_shell_backend_get_shell (shell_backend); + shell_settings = e_shell_get_shell_settings (shell); - if (e_shell_settings_get_boolean (e_shell_get_shell_settings (shell), "mail-check-on-start")) { + if (e_shell_settings_get_boolean ( + shell_settings, "mail-check-on-start")) { auto_online (shell); /* also flush outbox on start */ diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 3629de1a4b..9c8b87506f 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -262,7 +262,9 @@ vfolder_adduri_exec (struct _adduri_msg *m, if (!m->remove && !mail_folder_cache_get_folder_from_uri (folder_cache, m->uri, &folder)) { - g_warning("Folder '%s' disappeared while I was adding/remove it to/from my vfolder", m->uri); + g_warning ( + "Folder '%s' disappeared while I was " + "adding/removing it to/from my vfolder", m->uri); return; } @@ -463,10 +465,13 @@ mail_vfolder_add_uri (EMailSession *session, const gchar *source; CamelVeeFolder *vf; GList *folders = NULL, *link; - gint remote = (((CamelService *)store)->provider->flags & CAMEL_PROVIDER_IS_REMOTE) != 0; + gint remote; gint is_ignore; gchar *uri; + remote = (((CamelService *)store)->provider->flags & + CAMEL_PROVIDER_IS_REMOTE) != 0; + uri = em_uri_from_camel (curi); if (uri_is_spethal (store, curi)) { g_free (uri); @@ -518,7 +523,8 @@ mail_vfolder_add_uri (EMailSession *session, d(printf("invalid rule (%p): rule->name is set to NULL\n", rule)); continue; } - /* dont auto-add any sent/drafts folders etc, they must be explictly listed as a source */ + /* Don't auto-add any sent/drafts folders etc, + * they must be explictly listed as a source. */ if (rule->source && !is_ignore && ((((EMVFolderRule *)rule)->with == EM_VFOLDER_RULE_WITH_LOCAL && !remote) @@ -527,7 +533,8 @@ mail_vfolder_add_uri (EMailSession *session, found = TRUE; source = NULL; - while (!found && (source = em_vfolder_rule_next_source ((EMVFolderRule *)rule, source))) { + while (!found && (source = em_vfolder_rule_next_source ( + (EMVFolderRule *)rule, source))) { gchar *csource; csource = em_uri_to_camel (source); found = camel_store_folder_uri_equal (store, curi, csource); @@ -663,8 +670,10 @@ mail_vfolder_delete_uri (EMailBackend *backend, 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); + 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); if (changed_count == 0) { @@ -758,14 +767,15 @@ mail_vfolder_rename_uri (CamelStore *store, const gchar *cfrom, const gchar *cto /* Remove all sources that match, ignore changed events though because the adduri call above does the work async */ if (camel_store_folder_uri_equal (store, cfrom, csource)) { - d(printf("Vfolder '%s' used '%s' ('%s') now uses '%s'\n", rule->name, source, from, to)); 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); + 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, to); g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), vf); @@ -885,11 +895,17 @@ rule_changed (EFilterRule *rule, CamelFolder *folder) &sources_folder, &sources_uri); G_LOCK (vfolder); - if (((EMVFolderRule *)rule)->with == EM_VFOLDER_RULE_WITH_LOCAL || ((EMVFolderRule *)rule)->with == EM_VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE) + if (((EMVFolderRule *)rule)->with == + EM_VFOLDER_RULE_WITH_LOCAL || + ((EMVFolderRule *)rule)->with == + EM_VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE) rule_add_sources ( session, source_folders_local, &sources_folder, &sources_uri); - if (((EMVFolderRule *)rule)->with == EM_VFOLDER_RULE_WITH_REMOTE_ACTIVE || ((EMVFolderRule *)rule)->with == EM_VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE) + if (((EMVFolderRule *)rule)->with == + EM_VFOLDER_RULE_WITH_REMOTE_ACTIVE || + ((EMVFolderRule *)rule)->with == + EM_VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE) rule_add_sources ( session, source_folders_remote, &sources_folder, &sources_uri); @@ -970,9 +986,11 @@ store_folder_deleted_cb (CamelStore *store, if (rule) { const gchar *config_dir; - /* We need to stop listening to removed events, otherwise we'll try and remove it again */ - g_signal_handlers_disconnect_matched (context, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0, - 0, NULL, context_rule_removed, context); + /* We need to stop listening to removed events, + * otherwise we'll try and remove it again. */ + g_signal_handlers_disconnect_matched ( + context, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, + 0, 0, NULL, context_rule_removed, context); e_rule_context_remove_rule ((ERuleContext *)context, rule); g_object_unref (rule); g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context); @@ -1019,8 +1037,9 @@ store_folder_renamed_cb (CamelStore *store, return; } - g_signal_handlers_disconnect_matched (rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0, - 0, NULL, rule_changed, folder); + g_signal_handlers_disconnect_matched ( + rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, + 0, 0, NULL, rule_changed, folder); e_filter_rule_set_name (rule, info->full_name); g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder); @@ -1064,7 +1083,11 @@ folder_deleted_cb (MailFolderCache *cache, } static void -folder_renamed_cb (MailFolderCache *cache, CamelStore *store, const gchar *olduri, const gchar *newuri, gpointer user_data) +folder_renamed_cb (MailFolderCache *cache, + CamelStore *store, + const gchar *olduri, + const gchar *newuri, + gpointer user_data) { mail_vfolder_rename_uri (store, olduri, newuri); } @@ -1075,6 +1098,7 @@ vfolder_load_storage (EMailBackend *backend) /* lock for loading storage, it is safe to call it more than once */ G_LOCK_DEFINE_STATIC (vfolder_hash); + const gchar *key; const gchar *data_dir; const gchar *config_dir; gchar *user, *storeuri; @@ -1154,8 +1178,9 @@ vfolder_load_storage (EMailBackend *backend) /* reenable the feature if required */ client = gconf_client_get_default (); - if (!gconf_client_get_bool (client, "/apps/evolution/mail/display/enable_vfolders", NULL)) - gconf_client_set_bool (client, "/apps/evolution/mail/display/enable_vfolders", TRUE, NULL); + key = "/apps/evolution/mail/display/enable_vfolders"; + if (!gconf_client_get_bool (client, key, NULL)) + gconf_client_set_bool (client, key, TRUE, NULL); g_object_unref (client); folder_cache = e_mail_session_get_folder_cache (session); @@ -1263,7 +1288,8 @@ vfolder_edit_rule (EMailBackend *backend, url = camel_url_new (uri, NULL); if (url && url->fragment - && (rule = e_rule_context_find_rule ((ERuleContext *)context, url->fragment, NULL))) { + && (rule = e_rule_context_find_rule ( + (ERuleContext *) context, url->fragment, NULL))) { g_object_ref (G_OBJECT (rule)); newrule = e_filter_rule_clone (rule); @@ -1285,9 +1311,15 @@ vfolder_edit_rule (EMailBackend *backend, gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500); gtk_box_pack_start (GTK_BOX (container), w, TRUE, TRUE, 0); gtk_widget_show ((GtkWidget *)gd); - g_object_set_data_full(G_OBJECT(gd), "rule", newrule, (GDestroyNotify)g_object_unref); - g_object_set_data_full(G_OBJECT(gd), "orig", rule, (GDestroyNotify)g_object_unref); - g_signal_connect(gd, "response", G_CALLBACK(edit_rule_response), NULL); + g_object_set_data_full ( + G_OBJECT (gd), "rule", newrule, + (GDestroyNotify) g_object_unref); + g_object_set_data_full ( + G_OBJECT (gd), "orig", rule, + (GDestroyNotify) g_object_unref); + g_signal_connect ( + gd, "response", + G_CALLBACK (edit_rule_response), NULL); gtk_widget_show ((GtkWidget *)gd); } else { /* TODO: we should probably just create it ... */ @@ -1315,7 +1347,9 @@ new_rule_clicked (GtkWidget *w, gint button, gpointer data) } if (e_rule_context_find_rule ((ERuleContext *)context, rule->name, rule->source)) { - e_alert_run_dialog_for_args ((GtkWindow *)w, "mail:vfolder-notunique", rule->name, NULL); + e_alert_run_dialog_for_args ( + GTK_WINDOW (w), "mail:vfolder-notunique", + rule->name, NULL); return; } @@ -1345,7 +1379,8 @@ vfolder_create_part (const gchar *name) return e_rule_context_create_part ((ERuleContext *)context, name); } -/* clones a filter/search rule into a matching vfolder rule (assuming the same system definitions) */ +/* clones a filter/search rule into a matching vfolder rule + * (assuming the same system definitions) */ EFilterRule * vfolder_clone_rule (EMailSession *session, EFilterRule *in) { |