diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-08-29 22:44:16 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-08-29 23:22:28 +0800 |
commit | 4c05b9e925764a6035e3d0fcbfc1f0458d36f5d9 (patch) | |
tree | ce1154c5d7487fbd566c5b68df90fb8259b4604e /mail | |
parent | e6c42ecc596fb16247e8d1d591a5d244a61d0e24 (diff) | |
download | gsoc2013-evolution-4c05b9e925764a6035e3d0fcbfc1f0458d36f5d9.tar.gz gsoc2013-evolution-4c05b9e925764a6035e3d0fcbfc1f0458d36f5d9.tar.zst gsoc2013-evolution-4c05b9e925764a6035e3d0fcbfc1f0458d36f5d9.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-folder-tree-model.h | 36 | ||||
-rw-r--r-- | mail/importers/evolution-mbox-importer.c | 53 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 111 |
3 files changed, 134 insertions, 66 deletions
diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h index 25ed2d8188..cc83aba990 100644 --- a/mail/em-folder-tree-model.h +++ b/mail/em-folder-tree-model.h @@ -54,28 +54,32 @@ typedef struct _EMFolderTreeModelPrivate EMFolderTreeModelPrivate; typedef struct _EMFolderTreeModelStoreInfo EMFolderTreeModelStoreInfo; enum { - COL_STRING_DISPLAY_NAME, /* string that appears in the tree */ - COL_POINTER_CAMEL_STORE, /* CamelStore object */ - COL_STRING_FULL_NAME, /* if node is a folder, the full path name of the folder, no leading / */ - COL_STRING_ICON_NAME, /* icon name for the folder */ - COL_STRING_URI, /* the uri to get the store or folder object */ - COL_UINT_UNREAD, /* unread count */ - COL_UINT_FLAGS, /* FolderInfo.flags */ - - COL_BOOL_IS_STORE, /* toplevel store node? */ - COL_BOOL_IS_FOLDER, /* folder (not a store) */ - COL_BOOL_LOAD_SUBDIRS, /* %TRUE only if the store/folder - * has subfolders which have not yet - * been added to the tree */ - COL_UINT_UNREAD_LAST_SEL, /* last known unread count */ - COL_BOOL_IS_DRAFT, /* %TRUE for a draft folder */ + COL_STRING_DISPLAY_NAME, /* string that appears in the tree */ + COL_POINTER_CAMEL_STORE, /* CamelStore object */ + COL_STRING_FULL_NAME, /* if node is a folder, the full path + * name of the folder, no leading / */ + COL_STRING_ICON_NAME, /* icon name for the folder */ + COL_STRING_URI, /* the uri to get the store or + * folder object */ + COL_UINT_UNREAD, /* unread count */ + COL_UINT_FLAGS, /* FolderInfo.flags */ + + COL_BOOL_IS_STORE, /* toplevel store node? */ + COL_BOOL_IS_FOLDER, /* folder (not a store) */ + COL_BOOL_LOAD_SUBDIRS, /* %TRUE only if the store/folder + * has subfolders which have not yet + * been added to the tree */ + COL_UINT_UNREAD_LAST_SEL, /* last known unread count */ + COL_BOOL_IS_DRAFT, /* %TRUE for a draft folder */ NUM_COLUMNS }; struct _EMFolderTreeModelStoreInfo { CamelStore *store; GtkTreeRowReference *row; - GHashTable *full_hash; /* maps CamelFolderInfo::full_name's to GtkTreeRowReferences */ + + /* CamelFolderInfo::full_name -> GtkTreeRowReference */ + GHashTable *full_hash; EAccount *account; gchar *display_name; diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index 8467f2c47f..2d18bf62db 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -253,7 +253,8 @@ static MboxImporterCreatePreviewFunc create_preview_func = NULL; static MboxImporterFillPreviewFunc fill_preview_func = NULL; void -mbox_importer_set_preview_funcs (MboxImporterCreatePreviewFunc create_func, MboxImporterFillPreviewFunc fill_func) +mbox_importer_set_preview_funcs (MboxImporterCreatePreviewFunc create_func, + MboxImporterFillPreviewFunc fill_func) { create_preview_func = create_func; fill_preview_func = fill_func; @@ -311,7 +312,9 @@ mbox_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im) fd = g_open (filename, O_RDONLY|O_BINARY, 0); if (fd == -1) { - g_warning ("Cannot find source file to import '%s': %s", filename, g_strerror (errno)); + g_warning ( + "Cannot find source file to import '%s': %s", + filename, g_strerror (errno)); g_free (filename); return NULL; } @@ -330,24 +333,28 @@ mbox_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im) gchar *from; msg = camel_mime_message_new(); - if (camel_mime_part_construct_from_parser ((CamelMimePart *)msg, mp, NULL) == -1) { + if (camel_mime_part_construct_from_parser ( + (CamelMimePart *)msg, mp, NULL) == -1) { g_object_unref (msg); break; } if (!store) - store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, CAMEL_TYPE_MIME_MESSAGE); + store = gtk_list_store_new ( + 3, G_TYPE_STRING, G_TYPE_STRING, + CAMEL_TYPE_MIME_MESSAGE); from = NULL; if (camel_mime_message_get_from (msg)) - from = camel_address_encode (CAMEL_ADDRESS (camel_mime_message_get_from (msg))); + from = camel_address_encode ( + CAMEL_ADDRESS ( + camel_mime_message_get_from (msg))); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, - 0, camel_mime_message_get_subject (msg) ? camel_mime_message_get_subject (msg) : "", - 1, from ? from : "", - 2, msg, - -1); + 0, camel_mime_message_get_subject (msg) ? + camel_mime_message_get_subject (msg) : "", + 1, from ? from : "", 2, msg, -1); g_object_unref (msg); g_free (from); @@ -358,39 +365,51 @@ mbox_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im) if (store) { GtkTreeView *tree_view; GtkTreeSelection *selection; + gboolean valid; preview = e_web_view_preview_new (); gtk_widget_show (preview); - tree_view = e_web_view_preview_get_tree_view (E_WEB_VIEW_PREVIEW (preview)); + tree_view = e_web_view_preview_get_tree_view ( + E_WEB_VIEW_PREVIEW (preview)); g_return_val_if_fail (tree_view != NULL, NULL); gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (store)); g_object_unref (store); /* Translators: Column header for a message subject */ - gtk_tree_view_insert_column_with_attributes (tree_view, -1, C_("mboxImp", "Subject"), + gtk_tree_view_insert_column_with_attributes ( + tree_view, -1, C_("mboxImp", "Subject"), gtk_cell_renderer_text_new (), "text", 0, NULL); /* Translators: Column header for a message From address */ - gtk_tree_view_insert_column_with_attributes (tree_view, -1, C_("mboxImp", "From"), + gtk_tree_view_insert_column_with_attributes ( + tree_view, -1, C_("mboxImp", "From"), gtk_cell_renderer_text_new (), "text", 1, NULL); if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) > 1) - e_web_view_preview_show_tree_view (E_WEB_VIEW_PREVIEW (preview)); + e_web_view_preview_show_tree_view ( + E_WEB_VIEW_PREVIEW (preview)); create_preview_func (G_OBJECT (preview), &preview_widget); g_return_val_if_fail (preview_widget != NULL, NULL); - e_web_view_preview_set_preview (E_WEB_VIEW_PREVIEW (preview), preview_widget); + e_web_view_preview_set_preview ( + E_WEB_VIEW_PREVIEW (preview), preview_widget); gtk_widget_show (preview_widget); selection = gtk_tree_view_get_selection (tree_view); - g_return_val_if_fail (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter), NULL); + valid = gtk_tree_model_get_iter_first ( + GTK_TREE_MODEL (store), &iter); + g_return_val_if_fail (valid, NULL); gtk_tree_selection_select_iter (selection, &iter); - g_signal_connect (selection, "changed", G_CALLBACK (preview_selection_changed_cb), preview); - preview_selection_changed_cb (selection, E_WEB_VIEW_PREVIEW (preview)); + g_signal_connect ( + selection, "changed", + G_CALLBACK (preview_selection_changed_cb), preview); + + preview_selection_changed_cb ( + selection, E_WEB_VIEW_PREVIEW (preview)); } return preview; diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 651692530a..d03e9f3354 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -122,7 +122,11 @@ struct _send_info { struct _send_data *data; }; -static CamelFolder *receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, GError **error); +static CamelFolder * + receive_get_folder (CamelFilterDriver *d, + const gchar *uri, + gpointer data, + GError **error); static struct _send_data *send_data = NULL; static GtkWidget *send_recv_dialog = NULL; @@ -344,28 +348,40 @@ format_url (const gchar *internal_url, const gchar *account_name) CamelURL *url; gchar *pretty_url = NULL; - url = camel_url_new(internal_url, NULL); + url = camel_url_new (internal_url, NULL); + if (account_name) { if (url->host && *url->host) - pretty_url = g_strdup_printf("<b>%s (%s)</b>: %s", account_name, url->protocol, url->host); + pretty_url = g_strdup_printf ( + "<b>%s (%s)</b>: %s", + account_name, url->protocol, url->host); else if (url->path) - pretty_url = g_strdup_printf("<b>%s (%s)</b>: %s", account_name, url->protocol, url->path); + pretty_url = g_strdup_printf ( + "<b>%s (%s)</b>: %s", + account_name, url->protocol, url->path); else - pretty_url = g_strdup_printf("<b>%s (%s)</b>", account_name, url->protocol); - } - else if (url) { + pretty_url = g_strdup_printf ( + "<b>%s (%s)</b>", + account_name, url->protocol); + + } else if (url) { if (url->host && *url->host) - pretty_url = g_strdup_printf("<b>%s</b>: %s", url->protocol, url->host); + pretty_url = g_strdup_printf ( + "<b>%s</b>: %s", + url->protocol, url->host); else if (url->path) - pretty_url = g_strdup_printf("<b>%s</b>: %s", url->protocol, url->path); + pretty_url = g_strdup_printf ( + "<b>%s</b>: %s", + url->protocol, url->path); else - pretty_url = g_strdup_printf("<b>%s</b>", url->protocol); + pretty_url = g_strdup_printf ( + "<b>%s</b>", url->protocol); } if (url) - camel_url_free(url); + camel_url_free (url); - return pretty_url; + return pretty_url; } static send_info_t @@ -462,9 +478,11 @@ build_dialog (GtkWindow *parent, g_object_unref (iter); - /* Check to see if we have to send any mails --- if we don't, don't display the SMTP row in the table */ + /* Check to see if we have to send any mails. + * If we don't, don't display the SMTP row in the table. */ if (outbox && destination - && (camel_folder_get_message_count(outbox) - camel_folder_get_deleted_message_count(outbox)) == 0) + && (camel_folder_get_message_count(outbox) - + camel_folder_get_deleted_message_count(outbox)) == 0) num_sources--; table = gtk_table_new (num_sources, 4, FALSE); @@ -588,13 +606,16 @@ build_dialog (GtkWindow *parent, /* we also need gd during emition to be able to catch Cancel All */ data->gd = gd; - /* Hook: If some one wants to hook on to the sendreceive dialog, this is the way to go. */ - target = em_event_target_new_send_receive (em_event_peek(), table, data, row, EM_EVENT_SEND_RECEIVE); - e_event_emit ((EEvent *)em_event_peek (), "mail.sendreceive", (EEventTarget *) target); + target = em_event_target_new_send_receive ( + em_event_peek(), table, data, row, EM_EVENT_SEND_RECEIVE); + e_event_emit ( + (EEvent *) em_event_peek (), "mail.sendreceive", + (EEventTarget *) target); /* Skip displaying the SMTP row if we've got no outbox, destination or unsent mails */ if (outbox && destination - && (camel_folder_get_message_count(outbox) - camel_folder_get_deleted_message_count(outbox)) != 0) { + && (camel_folder_get_message_count(outbox) - + camel_folder_get_deleted_message_count(outbox)) != 0) { info = g_hash_table_lookup (data->active, SEND_URI_KEY); if (info == NULL) { info = g_malloc0 (sizeof (*info)); @@ -692,7 +713,11 @@ update_folders(gchar *uri, struct _folder_info *info, gpointer data) } static void -receive_status (CamelFilterDriver *driver, enum camel_filter_status_t status, gint pc, const gchar *desc, gpointer data) +receive_status (CamelFilterDriver *driver, + enum camel_filter_status_t status, + gint pc, + const gchar *desc, + gpointer data) { struct _send_info *info = data; time_t now = time(NULL); @@ -789,7 +814,10 @@ receive_done (const gchar *uri, gpointer data) This can also be used to hook into which folders are being updated, and occasionally let them refresh */ static CamelFolder * -receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, GError **error) +receive_get_folder (CamelFilterDriver *d, + const gchar *uri, + gpointer data, + GError **error) { struct _send_info *info = data; CamelFolder *folder; @@ -839,7 +867,9 @@ get_folders (CamelStore *store, GPtrArray *folders, CamelFolderInfo *info) if (camel_store_can_refresh_folder (store, info, NULL)) { CamelURL *url = camel_url_new (info->uri, NULL); - if (url && (!camel_url_get_param (url, "noselect") || !g_str_equal (camel_url_get_param (url, "noselect"), "yes"))) + if (url && (!camel_url_get_param (url, "noselect") || + !g_str_equal (camel_url_get_param ( + url, "noselect"), "yes"))) g_ptr_array_add (folders, g_strdup (info->uri)); if (url) @@ -1097,8 +1127,10 @@ auto_account_added(EAccountList *eal, EAccount *ea, gpointer dummy) info = g_malloc0(sizeof(*info)); info->account = ea; - g_object_set_data_full((GObject *)ea, "mail-autoreceive", info, (GDestroyNotify)auto_account_finalised); - auto_account_commit(info); + g_object_set_data_full ( + G_OBJECT (ea), "mail-autoreceive", info, + (GDestroyNotify) auto_account_finalised); + auto_account_commit (info); } static void @@ -1122,8 +1154,12 @@ auto_online (EShell *shell) return; accounts = e_get_account_list (); - for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter)) { - info = g_object_get_data((GObject *)e_iterator_get(iter), "mail-autoreceive"); + for (iter = e_list_get_iterator ((EList *)accounts); + e_iterator_is_valid (iter); + e_iterator_next (iter)) { + info = g_object_get_data ( + G_OBJECT (e_iterator_get (iter)), + "mail-autoreceive"); if (info && info->timeout_id) auto_timeout(info); } @@ -1146,14 +1182,23 @@ mail_autoreceive_init (EShellBackend *shell_backend, return; accounts = e_get_account_list (); - auto_active = g_hash_table_new(g_str_hash, g_str_equal); + auto_active = g_hash_table_new (g_str_hash, g_str_equal); - g_signal_connect(accounts, "account-added", G_CALLBACK(auto_account_added), NULL); - g_signal_connect(accounts, "account-removed", G_CALLBACK(auto_account_removed), NULL); - g_signal_connect(accounts, "account-changed", G_CALLBACK(auto_account_changed), NULL); + g_signal_connect ( + accounts, "account-added", + G_CALLBACK (auto_account_added), NULL); + g_signal_connect ( + accounts, "account-removed", + G_CALLBACK (auto_account_removed), NULL); + g_signal_connect ( + accounts, "account-changed", + G_CALLBACK (auto_account_changed), NULL); - for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter)) - auto_account_added(accounts, (EAccount *)e_iterator_get(iter), NULL); + for (iter = e_list_get_iterator ((EList *)accounts); + e_iterator_is_valid(iter); + e_iterator_next(iter)) + auto_account_added ( + accounts, (EAccount *) e_iterator_get (iter), NULL); shell = e_shell_backend_get_shell (shell_backend); @@ -1164,8 +1209,8 @@ mail_autoreceive_init (EShellBackend *shell_backend, G_CALLBACK (auto_online), NULL); } -/* we setup the download info's in a hashtable, if we later need to build the gui, we insert - them in to add them. */ +/* We setup the download info's in a hashtable, if we later + * need to build the gui, we insert them in to add them. */ void mail_receive_uri (const gchar *uri, gboolean keep_on_server) { |