diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-09-12 02:56:28 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-09-13 20:28:58 +0800 |
commit | cd53ba990035bdb4861d9660917d457533d4ecb2 (patch) | |
tree | d9c9da2208f4a921c514497ea92d27e3d88481d1 /mail | |
parent | b2b27cfa1bfcd6efdac30d2745a6e8cd4e6de134 (diff) | |
download | gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.gz gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.bz2 gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.lz gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.xz gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.zst gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.zip |
Coding style cleanups.
Diffstat (limited to 'mail')
62 files changed, 2717 insertions, 2717 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 5b5c8d0bab..3bc822cf0b 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -278,7 +278,7 @@ mail_backend_quit_requested_cb (EShell *shell, return; /* In express mode, don't raise mail request in non mail window. */ - if (e_shell_get_express_mode(shell) && + if (e_shell_get_express_mode (shell) && strcmp(e_shell_window_get_active_view((EShellWindow *)window), "mail") != 0) return; diff --git a/mail/e-mail-browser.h b/mail/e-mail-browser.h index e097691bef..4b1c3ebe87 100644 --- a/mail/e-mail-browser.h +++ b/mail/e-mail-browser.h @@ -66,7 +66,7 @@ void e_mail_browser_close (EMailBrowser *browser); gboolean e_mail_browser_get_show_deleted (EMailBrowser *browser); void e_mail_browser_set_show_deleted (EMailBrowser *browser, gboolean show_deleted); -EFocusTracker * e_mail_browser_get_focus_tracker(EMailBrowser *browser); +EFocusTracker * e_mail_browser_get_focus_tracker (EMailBrowser *browser); GtkUIManager * e_mail_browser_get_ui_manager (EMailBrowser *browser); G_END_DECLS diff --git a/mail/e-mail-message-pane.c b/mail/e-mail-message-pane.c index 5936cd8240..1c1ccf2c12 100644 --- a/mail/e-mail-message-pane.c +++ b/mail/e-mail-message-pane.c @@ -48,8 +48,8 @@ mail_message_pane_constructed (GObject *object) /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_mail_message_pane_parent_class)->constructed (object); - gtk_widget_hide (e_mail_reader_get_message_list (E_MAIL_READER(object))); - e_mail_paned_view_hide_message_list_pane (E_MAIL_PANED_VIEW(object), FALSE); + gtk_widget_hide (e_mail_reader_get_message_list (E_MAIL_READER (object))); + e_mail_paned_view_hide_message_list_pane (E_MAIL_PANED_VIEW (object), FALSE); } static gboolean @@ -98,7 +98,7 @@ e_mail_message_pane_new (EShellView *shell_view) E_TYPE_MAIL_MESSAGE_PANE, "shell-view", shell_view, NULL); - e_mail_paned_view_set_enable_show_folder (E_MAIL_PANED_VIEW(widget), TRUE); + e_mail_paned_view_set_enable_show_folder (E_MAIL_PANED_VIEW (widget), TRUE); return widget; } diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index 03b441b577..4208b380aa 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -353,7 +353,7 @@ em_update_accounts_2_11 (void) #endif /* !G_OS_WIN32 */ static gboolean -emm_setup_initial(const gchar *data_dir) +emm_setup_initial (const gchar *data_dir) { GDir *dir; const gchar *d; @@ -366,8 +366,8 @@ emm_setup_initial(const gchar *data_dir) d(printf("Setting up initial mail tree\n")); base = g_build_filename(data_dir, "local", NULL); - if (g_mkdir_with_parents(base, 0700) == -1 && errno != EEXIST) { - g_free(base); + if (g_mkdir_with_parents (base, 0700) == -1 && errno != EEXIST) { + g_free (base); return FALSE; } @@ -386,23 +386,23 @@ emm_setup_initial(const gchar *data_dir) /* Make sure we found one. */ g_return_val_if_fail (*language_names != NULL, FALSE); - dir = g_dir_open(local, 0, NULL); + dir = g_dir_open (local, 0, NULL); if (dir) { - while ((d = g_dir_read_name(dir))) { + while ((d = g_dir_read_name (dir))) { gchar *src, *dest; - src = g_build_filename(local, d, NULL); - dest = g_build_filename(base, d, NULL); + src = g_build_filename (local, d, NULL); + dest = g_build_filename (base, d, NULL); - cp(src, dest, FALSE, CP_UNIQUE); - g_free(dest); - g_free(src); + cp (src, dest, FALSE, CP_UNIQUE); + g_free (dest); + g_free (src); } - g_dir_close(dir); + g_dir_close (dir); } - g_free(local); - g_free(base); + g_free (local); + g_free (base); return TRUE; } @@ -562,7 +562,7 @@ migrate_folders (CamelStore *store, if (folder != NULL) camel_folder_summary_migrate_infos (folder->summary); - migrate_folders(store, is_local, fi->child, acc, done, nth_folder, total_folders); + migrate_folders (store, is_local, fi->child, acc, done, nth_folder, total_folders); fi = fi->next; } @@ -595,11 +595,11 @@ setup_local_store (EShellBackend *shell_backend, url = camel_url_new("mbox:", NULL); data_dir = e_shell_backend_get_data_dir (shell_backend); tmp = g_build_filename (data_dir, "local", NULL); - camel_url_set_path(url, tmp); - g_free(tmp); - tmp = camel_url_to_string(url, 0); - store = (CamelStore *)camel_session_get_service(CAMEL_SESSION (session), tmp, CAMEL_PROVIDER_STORE, NULL); - g_free(tmp); + camel_url_set_path (url, tmp); + g_free (tmp); + tmp = camel_url_to_string (url, 0); + store = (CamelStore *)camel_session_get_service (CAMEL_SESSION (session), tmp, CAMEL_PROVIDER_STORE, NULL); + g_free (tmp); return store; } diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 41cab950bc..1bab909ef2 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -174,8 +174,8 @@ fix_height_cb (ClutterActor *actor, GtkWidget *embed = (GtkWidget *)g_object_get_data ((GObject *)actor, "embed"); ClutterActor *stage = g_object_get_data ((GObject *)actor, "stage"); - clutter_actor_set_height (stage, clutter_actor_get_height(actor)); - gtk_widget_set_size_request (embed, -1, (gint) clutter_actor_get_height(actor)); + clutter_actor_set_height (stage, clutter_actor_get_height (actor)); + gtk_widget_set_size_request (embed, -1, (gint) clutter_actor_get_height (actor)); } static void @@ -262,7 +262,7 @@ mnv_tab_closed_cb (ClutterTimeline *timeline, struct _tab_data *data) { EMailView *page = g_object_get_data ((GObject *)data->tab, "page"); - const gchar *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER(page)); + const gchar *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER (page)); EMailView *prev; gint num; @@ -333,11 +333,11 @@ tab_remove_gtk_cb (GtkWidget *button, EMailNotebookView *view) { EMailView *page = g_object_get_data ((GObject *)button, "page"); - const gchar *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER(page)); + const gchar *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER (page)); EMailView *prev; gint num; - if (gtk_notebook_get_n_pages(view->priv->book) == 1) + if (gtk_notebook_get_n_pages (view->priv->book) == 1) return; if (E_IS_MAIL_FOLDER_PANE (page)) @@ -366,7 +366,7 @@ create_tab_label (EMailNotebookView *view, widget = gtk_label_new (str); gtk_widget_show (widget); - gtk_box_pack_start (GTK_BOX(container), widget, TRUE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, FALSE, 0); widget = gtk_button_new (); gtk_button_set_relief (GTK_BUTTON (widget), GTK_RELIEF_NONE); @@ -374,7 +374,7 @@ create_tab_label (EMailNotebookView *view, GTK_BUTTON (widget), gtk_image_new_from_stock ( "gtk-close", GTK_ICON_SIZE_MENU)); gtk_widget_show_all (widget); - gtk_box_pack_end (GTK_BOX(container), widget, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0); g_object_set_data ((GObject *)widget, "page", page); g_object_set_data ((GObject *)page, "close-button", widget); @@ -399,7 +399,7 @@ create_gtk_actor (GtkWidget *vbox) gtk_container_add (GTK_CONTAINER (bin), vbox); gtk_widget_show (bin); - gtk_widget_show(vbox); + gtk_widget_show (vbox); return gtk_actor; } @@ -438,7 +438,7 @@ create_under_clutter (GtkWidget *widget, GtkWidget *paned) g_signal_connect ( paned, "size-allocate", G_CALLBACK (fix_clutter_embed_width), actor); - clutter_actor_show(stage); + clutter_actor_show (stage); return embed; } @@ -460,15 +460,15 @@ mail_notebook_view_constructed (GObject *object) priv = E_MAIL_NOTEBOOK_VIEW (object)->priv; - container = GTK_WIDGET(object); + container = GTK_WIDGET (object); #if HAVE_CLUTTER widget = gtk_clutter_embed_new (); gtk_widget_show (widget); - gtk_box_pack_start (GTK_BOX(container), widget, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); stage = gtk_clutter_embed_get_stage ((GtkClutterEmbed *)widget); - clutter_actor_show(stage); + clutter_actor_show (stage); clutter_actor_set_reactive (stage, TRUE); priv->tab_picker = (EMailTabPicker *)e_mail_tab_picker_new (); @@ -484,7 +484,7 @@ mail_notebook_view_constructed (GObject *object) G_CALLBACK (tab_picker_preview_mode_notify), object); g_signal_connect ( priv->tab_picker, "notify::height", - G_CALLBACK(fix_height_cb), widget); + G_CALLBACK (fix_height_cb), widget); clutter_container_add_actor ( (ClutterContainer *) stage, @@ -497,7 +497,7 @@ mail_notebook_view_constructed (GObject *object) g_signal_connect ( object, "size-allocate", - G_CALLBACK(fix_tab_picker_width), priv->tab_picker); + G_CALLBACK (fix_tab_picker_width), priv->tab_picker); clutter_actor_set_height ( stage, clutter_actor_get_height ( @@ -517,7 +517,7 @@ mail_notebook_view_constructed (GObject *object) e_mail_tab_set_can_close (tab, TRUE); e_mail_tab_picker_add_tab (priv->tab_picker, tab, -1); - clutter_actor_show((ClutterActor *)tab); + clutter_actor_show ((ClutterActor *)tab); e_mail_tab_picker_set_current_tab (priv->tab_picker, 0); e_mail_tab_enable_drag (tab, TRUE); @@ -541,7 +541,7 @@ mail_notebook_view_constructed (GObject *object) priv->actor = g_object_get_data((GObject *)priv->embed, "actor"); priv->stage = g_object_get_data((GObject *)priv->actor, "stage"); #else - gtk_box_pack_start (GTK_BOX(container), widget, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); #endif #if HAVE_CLUTTER @@ -576,7 +576,7 @@ mail_notebook_view_set_property (GObject *object, switch (property_id) { case PROP_GROUP_BY_THREADS: e_mail_reader_set_group_by_threads ( - E_MAIL_READER(E_MAIL_NOTEBOOK_VIEW(object)->priv->current_view), + E_MAIL_READER (E_MAIL_NOTEBOOK_VIEW (object)->priv->current_view), g_value_get_boolean (value)); return; } @@ -595,7 +595,7 @@ mail_notebook_view_get_property (GObject *object, g_value_set_boolean ( value, e_mail_reader_get_group_by_threads ( - E_MAIL_READER(E_MAIL_NOTEBOOK_VIEW(object)->priv->current_view))); + E_MAIL_READER (E_MAIL_NOTEBOOK_VIEW (object)->priv->current_view))); return; } @@ -745,7 +745,7 @@ mail_notebook_view_get_formatter (EMailReader *reader) if (priv->current_view == NULL) return NULL; - return e_mail_reader_get_formatter (E_MAIL_READER(priv->current_view)); + return e_mail_reader_get_formatter (E_MAIL_READER (priv->current_view)); } static gboolean @@ -866,15 +866,15 @@ mail_netbook_view_open_mail (EMailView *view, pos = emnv_get_page_num (nview, GTK_WIDGET (priv->current_view)); pane = e_mail_message_pane_new (shell_view); e_mail_view_set_previous_view (pane, priv->current_view); - E_MAIL_MESSAGE_PANE(pane)->parent_folder_view = priv->current_view; + E_MAIL_MESSAGE_PANE (pane)->parent_folder_view = priv->current_view; priv->current_view = pane; gtk_widget_show (GTK_WIDGET (pane)); - preview = e_mail_paned_view_get_preview (E_MAIL_PANED_VIEW(pane)); + preview = e_mail_paned_view_get_preview (E_MAIL_PANED_VIEW (pane)); - folder = e_mail_reader_get_folder (E_MAIL_READER(view)); - folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER(view)); + folder = e_mail_reader_get_folder (E_MAIL_READER (view)); + folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER (view)); info = camel_folder_get_message_info (folder, uid); @@ -884,7 +884,7 @@ mail_netbook_view_open_mail (EMailView *view, camel_message_info_subject (info)), pos + 1); #if HAVE_CLUTTER - mlist = e_mail_reader_get_message_list (E_MAIL_READER(pane)); + mlist = e_mail_reader_get_message_list (E_MAIL_READER (pane)); mnv_set_current_tab (nview, page); g_object_set_data ((GObject *)priv->current_view, "stage", priv->stage); g_object_set_data ((GObject *)mlist, "stage", priv->stage); @@ -894,13 +894,13 @@ 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); - clutter_actor_show((ClutterActor *)tab); + clutter_actor_show ((ClutterActor *)tab); - clone = e_mail_tab_new_full (camel_message_info_subject(info), NULL, 200); + clone = e_mail_tab_new_full (camel_message_info_subject (info), NULL, 200); clutter_actor_set_reactive (clone, FALSE); clutter_actor_show (clone); @@ -936,9 +936,9 @@ mail_netbook_view_open_mail (EMailView *view, E_MAIL_READER (pane), folder, folder_uri); e_mail_reader_set_group_by_threads ( E_MAIL_READER (pane), - e_mail_reader_get_group_by_threads (E_MAIL_READER(view))); + e_mail_reader_get_group_by_threads (E_MAIL_READER (view))); - e_mail_reader_enable_show_folder (E_MAIL_READER(pane)); + e_mail_reader_enable_show_folder (E_MAIL_READER (pane)); e_mail_reader_set_message (E_MAIL_READER (pane), uid); camel_message_info_free (info); } @@ -956,7 +956,7 @@ build_histogram (GtkWidget *widget, CamelFolder *folder) cairo_t *cr; gfloat ratio; gint x = 0; - time_t now = time(NULL); + time_t now = time (NULL); GtkStyle *style; GdkColor *color; @@ -1022,7 +1022,7 @@ build_histogram (GtkWidget *widget, CamelFolder *folder) cairo_fill (cr); cairo_restore (cr); - cairo_destroy(cr); + cairo_destroy (cr); return texture; } @@ -1062,7 +1062,7 @@ mail_notebook_view_set_folder (EMailReader *reader, priv->current_view = (EMailView *)new_view; #if HAVE_CLUTTER - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW(reader), curr); + mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (reader), curr); #else gtk_notebook_set_current_page (priv->book, curr); #endif @@ -1094,7 +1094,7 @@ mail_notebook_view_set_folder (EMailReader *reader, priv->current_view, camel_folder_get_full_name (folder))); #if HAVE_CLUTTER - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW(reader), page); + mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (reader), page); #else gtk_notebook_set_current_page (priv->book, page); #endif @@ -1107,12 +1107,12 @@ mail_notebook_view_set_folder (EMailReader *reader, priv->tab_picker)), FALSE); - tab = (EMailTab *)e_mail_tab_new_full (camel_folder_get_full_name(folder), NULL, 1); + tab = (EMailTab *)e_mail_tab_new_full (camel_folder_get_full_name (folder), NULL, 1); g_object_set_data ((GObject *)tab, "page", priv->current_view); g_object_set_data ((GObject *)priv->current_view, "page", tab); g_object_set_data ((GObject *)priv->current_view, "tab", tab); - clutter_actor_show((ClutterActor *)tab); + clutter_actor_show ((ClutterActor *)tab); clone = build_histogram ((GtkWidget *)reader, folder); clutter_actor_set_reactive (clone, FALSE); @@ -1142,18 +1142,18 @@ mail_notebook_view_set_folder (EMailReader *reader, } else { priv->inited = TRUE; gtk_notebook_set_tab_label (priv->book, (GtkWidget *)priv->current_view, - create_tab_label (E_MAIL_NOTEBOOK_VIEW(reader), + create_tab_label (E_MAIL_NOTEBOOK_VIEW (reader), priv->current_view, camel_folder_get_full_name (folder))); #if HAVE_CLUTTER - tab = e_mail_tab_picker_get_tab(priv->tab_picker, + tab = e_mail_tab_picker_get_tab (priv->tab_picker, e_mail_tab_picker_get_current_tab (priv->tab_picker)); g_object_set_data ((GObject *)tab, "page", priv->current_view); g_object_set_data ((GObject *)priv->current_view, "page", tab); g_object_set_data ((GObject *)priv->current_view, "tab", tab); - e_mail_tab_set_text (tab, camel_folder_get_full_name(folder)); + e_mail_tab_set_text (tab, camel_folder_get_full_name (folder)); clone = build_histogram ((GtkWidget *)reader, folder); clutter_actor_set_reactive (clone, FALSE); clutter_actor_show (clone); @@ -1161,7 +1161,7 @@ mail_notebook_view_set_folder (EMailReader *reader, #endif } - list = e_mail_reader_get_message_list (E_MAIL_READER(priv->current_view)); + list = e_mail_reader_get_message_list (E_MAIL_READER (priv->current_view)); #if HAVE_CLUTTER g_signal_connect (tab , "closed", G_CALLBACK (mnv_tab_closed), reader); @@ -1170,8 +1170,8 @@ mail_notebook_view_set_folder (EMailReader *reader, g_object_set_data ((GObject *)list, "actor", priv->actor); #endif - e_mail_reader_set_folder (E_MAIL_READER(priv->current_view), folder, folder_uri); - g_hash_table_insert (priv->views, g_strdup(folder_uri), priv->current_view); + e_mail_reader_set_folder (E_MAIL_READER (priv->current_view), folder, folder_uri); + g_hash_table_insert (priv->views, g_strdup (folder_uri), priv->current_view); g_signal_connect ( priv->current_view, "changed", G_CALLBACK (reconnect_changed_event), reader); @@ -1207,7 +1207,7 @@ mail_notebook_view_enable_show_folder (EMailReader *reader) if (!priv->current_view) return FALSE; - return e_mail_reader_get_enable_show_folder (E_MAIL_READER(priv->current_view)); + return e_mail_reader_get_enable_show_folder (E_MAIL_READER (priv->current_view)); } static guint @@ -1293,7 +1293,7 @@ emnv_show_folder (EMailNotebookView *view, gpointer not_used) #if HAVE_CLUTTER e_mail_tab_picker_set_current_tab (priv->tab_picker, pos); - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW(view), pos); + mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos); #else gtk_notebook_set_current_page (priv->book, pos); #endif @@ -1314,7 +1314,7 @@ emnv_show_prevtab (EMailNotebookView *view, gpointer not_used) pos = e_mail_tab_picker_get_current_tab (priv->tab_picker); if (pos > 0) { e_mail_tab_picker_set_current_tab (priv->tab_picker, pos-1); - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW(view), pos-1); + mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos-1); } #else pos = gtk_notebook_get_current_page (priv->book); @@ -1335,7 +1335,7 @@ emnv_show_nexttab (EMailNotebookView *view, gpointer not_used) if (pos < (gtk_notebook_get_n_pages (priv->book)-1)) { e_mail_tab_picker_set_current_tab (priv->tab_picker, pos+1); - mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW(view), pos+1); + mnv_set_current_tab (E_MAIL_NOTEBOOK_VIEW (view), pos+1); } #else pos = gtk_notebook_get_current_page (priv->book); diff --git a/mail/e-mail-pane.c b/mail/e-mail-pane.c index e58a645eec..ca25d817cd 100644 --- a/mail/e-mail-pane.c +++ b/mail/e-mail-pane.c @@ -40,7 +40,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; static void e_mail_pane_init (EMailPane *shell) { - shell->priv = g_new0(EMailPanePrivate, 1); + shell->priv = g_new0 (EMailPanePrivate, 1); } static void diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index a7bddfebd2..8317898dd6 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -391,7 +391,7 @@ e_mail_reader_reply_to_message (EMailReader *reader, uid = MESSAGE_LIST (message_list)->cursor_uid; g_return_if_fail (uid != NULL); - if (!gtk_widget_get_mapped (GTK_WIDGET(web_view))) + if (!gtk_widget_get_mapped (GTK_WIDGET (web_view))) goto whole_message; if (src_message == NULL) { @@ -710,7 +710,7 @@ headers_changed_cb (GConfClient *client, client, "/apps/evolution/mail/display/headers", GCONF_VALUE_STRING, NULL); em_format_clear_headers (EM_FORMAT (formatter)); - for (p = header_config_list; p; p = g_slist_next(p)) { + for (p = header_config_list; p; p = g_slist_next (p)) { EMailReaderHeader *h; gchar *xml = (gchar *)p->data; diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index dbd47e10e7..b93b411f98 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -123,7 +123,7 @@ GtkActionGroup * EMFormatHTML * e_mail_reader_get_formatter (EMailReader *reader); gboolean e_mail_reader_get_hide_deleted (EMailReader *reader); GtkWidget * e_mail_reader_get_message_list (EMailReader *reader); -guint e_mail_reader_open_selected_mail(EMailReader *reader); +guint e_mail_reader_open_selected_mail (EMailReader *reader); GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader); GPtrArray * e_mail_reader_get_selected_uids (EMailReader *reader); EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader); @@ -149,7 +149,7 @@ void e_mail_reader_create_charset_menu void e_mail_reader_show_search_bar (EMailReader *reader); gboolean e_mail_reader_get_enable_show_folder (EMailReader *reader); -void e_mail_reader_enable_show_folder(EMailReader *reader); +void e_mail_reader_enable_show_folder (EMailReader *reader); G_END_DECLS diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c index 6fd0c7ea82..a8c3afe6ec 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -55,7 +55,7 @@ struct _StoreInfo { guint removed : 1; }; -CamelStore *vfolder_store; /* XXX write a get() function for this */ +CamelStore *vfolder_store; /* XXX write a get () function for this */ static GHashTable *store_table; static MailAsyncEvent *async_event; diff --git a/mail/e-mail-view.h b/mail/e-mail-view.h index 6c697bda44..af3f6c4eee 100644 --- a/mail/e-mail-view.h +++ b/mail/e-mail-view.h @@ -85,7 +85,7 @@ struct _EMailViewClass { GType e_mail_view_get_type (void); EShellView * e_mail_view_get_shell_view (EMailView *view); -void e_mail_view_update_view_instance(EMailView *view); +void e_mail_view_update_view_instance (EMailView *view); GalViewInstance * e_mail_view_get_view_instance (EMailView *view); void e_mail_view_set_search_strings (EMailView *view, diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 923e1b0c87..3a3368c631 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -584,7 +584,7 @@ emae_load_text (GtkTextView *view, const gchar *filename) gtk_text_buffer_insert (buffer, &iter, filebuf, count); } - gtk_text_view_set_buffer (GTK_TEXT_VIEW (view), GTK_TEXT_BUFFER(buffer)); + gtk_text_view_set_buffer (GTK_TEXT_VIEW (view), GTK_TEXT_BUFFER (buffer)); fclose (fd); } @@ -1139,7 +1139,7 @@ emae_account_spinint_widget (EMAccountEditor *emae, GtkSpinButton *spin, gint it g_signal_connect ( spin, "value-changed", - G_CALLBACK(emae_account_spinint_changed), emae); + G_CALLBACK (emae_account_spinint_changed), emae); } #if 0 @@ -1332,17 +1332,17 @@ struct _provider_host_info { }; static struct _provider_host_info emae_source_host_info[] = { - { CAMEL_URL_PART_HOST, emae_url_set_hostport, { G_STRUCT_OFFSET(EMAccountEditorService, hostname), G_STRUCT_OFFSET(EMAccountEditorService, hostlabel), }, }, - { CAMEL_URL_PART_USER, camel_url_set_user, { G_STRUCT_OFFSET(EMAccountEditorService, username), G_STRUCT_OFFSET(EMAccountEditorService, userlabel), } }, - { CAMEL_URL_PART_PATH, camel_url_set_path, { G_STRUCT_OFFSET(EMAccountEditorService, path), G_STRUCT_OFFSET(EMAccountEditorService, pathlabel), G_STRUCT_OFFSET(EMAccountEditorService, pathentry) }, }, - { CAMEL_URL_PART_AUTH, NULL, { 0, G_STRUCT_OFFSET(EMAccountEditorService, auth_frame), }, }, + { CAMEL_URL_PART_HOST, emae_url_set_hostport, { G_STRUCT_OFFSET (EMAccountEditorService, hostname), G_STRUCT_OFFSET (EMAccountEditorService, hostlabel), }, }, + { CAMEL_URL_PART_USER, camel_url_set_user, { G_STRUCT_OFFSET (EMAccountEditorService, username), G_STRUCT_OFFSET (EMAccountEditorService, userlabel), } }, + { CAMEL_URL_PART_PATH, camel_url_set_path, { G_STRUCT_OFFSET (EMAccountEditorService, path), G_STRUCT_OFFSET (EMAccountEditorService, pathlabel), G_STRUCT_OFFSET (EMAccountEditorService, pathentry) }, }, + { CAMEL_URL_PART_AUTH, NULL, { 0, G_STRUCT_OFFSET (EMAccountEditorService, auth_frame), }, }, { 0 }, }; static struct _provider_host_info emae_transport_host_info[] = { - { CAMEL_URL_PART_HOST, emae_url_set_hostport, { G_STRUCT_OFFSET(EMAccountEditorService, hostname), G_STRUCT_OFFSET(EMAccountEditorService, hostlabel), }, }, - { CAMEL_URL_PART_USER, camel_url_set_user, { G_STRUCT_OFFSET(EMAccountEditorService, username), G_STRUCT_OFFSET(EMAccountEditorService, userlabel), } }, - { CAMEL_URL_PART_AUTH, NULL, { 0, G_STRUCT_OFFSET(EMAccountEditorService, auth_frame), }, }, + { CAMEL_URL_PART_HOST, emae_url_set_hostport, { G_STRUCT_OFFSET (EMAccountEditorService, hostname), G_STRUCT_OFFSET (EMAccountEditorService, hostlabel), }, }, + { CAMEL_URL_PART_USER, camel_url_set_user, { G_STRUCT_OFFSET (EMAccountEditorService, username), G_STRUCT_OFFSET (EMAccountEditorService, userlabel), } }, + { CAMEL_URL_PART_AUTH, NULL, { 0, G_STRUCT_OFFSET (EMAccountEditorService, auth_frame), }, }, { 0 }, }; @@ -1415,7 +1415,7 @@ emae_uri_changed (EMAccountEditorService *service, CamelURL *url) /* small hack for providers which are store and transport - copy settings across */ if (service->type == CAMEL_PROVIDER_STORE && service->provider - && CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT(service->provider)) + && CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (service->provider)) e_account_set_string (account, E_ACCOUNT_TRANSPORT_URL, uri); g_free (uri); @@ -1577,12 +1577,12 @@ emae_service_provider_changed (EMAccountEditorService *service) gint hide; struct _provider_host_info *info = &emae_service_info[service->type].host_info[i]; - enable = CAMEL_PROVIDER_ALLOWS(service->provider, info->flag); - hide = CAMEL_PROVIDER_HIDDEN(service->provider, info->flag); + enable = CAMEL_PROVIDER_ALLOWS (service->provider, info->flag); + hide = CAMEL_PROVIDER_HIDDEN (service->provider, info->flag); show = (enable && !hide)?gtk_widget_show:gtk_widget_hide; for (j=0; j < G_N_ELEMENTS (info->widgets); j++) { - if (info->widgets[j] && (w = G_STRUCT_MEMBER(GtkWidget *, service, info->widgets[j]))) { + if (info->widgets[j] && (w = G_STRUCT_MEMBER (GtkWidget *, service, info->widgets[j]))) { show (w); if (j == 0) { if (dwidget == NULL && enable) @@ -1598,7 +1598,7 @@ emae_service_provider_changed (EMAccountEditorService *service) if (dwidget) gtk_widget_grab_focus (dwidget); - if (CAMEL_PROVIDER_ALLOWS(service->provider, CAMEL_URL_PART_AUTH)) { + if (CAMEL_PROVIDER_ALLOWS (service->provider, CAMEL_URL_PART_AUTH)) { GList *ll; /* try to keep the authmech from the current url, or clear it */ @@ -1615,7 +1615,7 @@ emae_service_provider_changed (EMAccountEditorService *service) } emae_refresh_authtype (service->emae, service); - if (service->needs_auth && !CAMEL_PROVIDER_NEEDS(service->provider, CAMEL_URL_PART_AUTH)) + if (service->needs_auth && !CAMEL_PROVIDER_NEEDS (service->provider, CAMEL_URL_PART_AUTH)) gtk_widget_show ((GtkWidget *)service->needs_auth); } else { if (service->needs_auth) @@ -2535,7 +2535,7 @@ emae_receive_options_item (EConfig *ec, EConfigItem *item, GtkWidget *parent, Gt if (emae->type == EMAE_PAGES) { GtkWidget *box = gtk_hbox_new (FALSE, 12); gtk_widget_reparent (old, box); - gtk_widget_show(box); + gtk_widget_show (box); gtk_box_set_child_packing ((GtkBox *)box, old, TRUE, TRUE, 12, GTK_PACK_START); gtk_box_pack_end ((GtkBox *)emae->pages[2], box, FALSE, FALSE, 0); } @@ -2545,7 +2545,7 @@ emae_receive_options_item (EConfig *ec, EConfigItem *item, GtkWidget *parent, Gt if (emae->type == EMAE_PAGES) { GtkWidget *box = gtk_hbox_new (FALSE, 12); gtk_widget_reparent (parent, box); - gtk_widget_show(box); + gtk_widget_show (box); gtk_box_set_child_packing ((GtkBox *)box, parent, TRUE, TRUE, 12, GTK_PACK_START); gtk_box_pack_start ((GtkBox *)emae->pages[2], box, FALSE, FALSE, 0); } @@ -2594,7 +2594,7 @@ emae_receive_options_extra_item (EConfig *ec, EConfigItem *eitem, GtkWidget *par if (emae->type == EMAE_PAGES) { GtkWidget *box = gtk_hbox_new (FALSE, 12); gtk_widget_reparent (parent, box); - gtk_widget_show(box); + gtk_widget_show (box); gtk_box_set_child_packing ((GtkBox *)box, parent, TRUE, TRUE, 12, GTK_PACK_START); gtk_box_pack_start ((GtkBox *)emae->pages[2], box, FALSE, FALSE, 0); } @@ -2718,7 +2718,7 @@ emae_send_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *ol GtkBuilder *builder; /* no transport options page at all for these types of providers */ - if (priv->source.provider && CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT(priv->source.provider)) { + if (priv->source.provider && CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (priv->source.provider)) { memset (&priv->transport.frame, 0, ((gchar *)&priv->transport.check_dialog)-((gchar *)&priv->transport.frame)); return NULL; } @@ -3261,7 +3261,7 @@ emae_free_auto (EConfig *ec, GSList *items, gpointer data) if (item->extra_table) g_hash_table_destroy (item->extra_table); g_free (item); - g_slist_free_1(l); + g_slist_free_1 (l); l = n; } } @@ -3283,21 +3283,21 @@ emae_service_complete (EMAccountEditor *emae, EMAccountEditorService *service) if (uri == NULL || (url = camel_url_new (uri, NULL)) == NULL) return FALSE; - if (CAMEL_PROVIDER_NEEDS(service->provider, CAMEL_URL_PART_HOST)) { + if (CAMEL_PROVIDER_NEEDS (service->provider, CAMEL_URL_PART_HOST)) { if (url->host == NULL || url->host[0] == 0) ok = FALSE; } /* We only need the user if the service needs auth as well, i think */ if (ok && (service->needs_auth == NULL - || CAMEL_PROVIDER_NEEDS(service->provider, CAMEL_URL_PART_AUTH) + || CAMEL_PROVIDER_NEEDS (service->provider, CAMEL_URL_PART_AUTH) || gtk_toggle_button_get_active (service->needs_auth)) - && CAMEL_PROVIDER_NEEDS(service->provider, CAMEL_URL_PART_USER) + && CAMEL_PROVIDER_NEEDS (service->provider, CAMEL_URL_PART_USER) && (url->user == NULL || url->user[0] == 0)) ok = FALSE; if (ok - && CAMEL_PROVIDER_NEEDS(service->provider, CAMEL_URL_PART_PATH) + && CAMEL_PROVIDER_NEEDS (service->provider, CAMEL_URL_PART_PATH) && (url->path == NULL || url->path[0] == 0)) ok = FALSE; @@ -3315,7 +3315,7 @@ enum { static ServerData * emae_check_servers (const gchar *email) { - gint len = G_N_ELEMENTS(mail_servers), i; + gint len = G_N_ELEMENTS (mail_servers), i; gchar *server = strchr (email, '@'); server++; @@ -3377,7 +3377,7 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) emae->priv->identity_set = 1; #ifndef G_OS_WIN32 - uname = g_locale_to_utf8(g_get_real_name (), -1, NULL, NULL, NULL); + uname = g_locale_to_utf8 (g_get_real_name (), -1, NULL, NULL, NULL); #else uname = g_strdup (g_get_real_name ()); #endif @@ -3418,7 +3418,7 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) camel_url_set_param (url, "use_ssl", sdata->ssl); camel_url_set_host (url, sdata->recv); if (sdata->recv_port && *sdata->recv_port) - camel_url_set_port (url, atoi(sdata->recv_port)); + camel_url_set_port (url, atoi (sdata->recv_port)); gtk_entry_set_text (emae->priv->source.hostname, sdata->recv); gtk_entry_set_text (emae->priv->transport.hostname, sdata->send); } else { @@ -3460,7 +3460,7 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) camel_url_set_param (url, "use_ssl", sdata->ssl); camel_url_set_host (url, sdata->send); if (sdata->send_port && *sdata->send_port) - camel_url_set_port (url, atoi(sdata->send_port)); + camel_url_set_port (url, atoi (sdata->send_port)); if (sdata->send_user && *sdata->send_user) camel_url_set_user (url, sdata->send_user); @@ -3474,7 +3474,7 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) if (sdata->send_auth && *sdata->send_auth) emae_check_set_authtype (emae->priv->transport.authtype, sdata->send_auth); else - emae_authtype_changed(emae->priv->transport.authtype, &emae->priv->transport); + emae_authtype_changed (emae->priv->transport.authtype, &emae->priv->transport); uri = (gchar *)e_account_get_string (account, E_ACCOUNT_TRANSPORT_URL); } } @@ -3687,14 +3687,14 @@ em_account_editor_construct (EMAccountEditor *emae, EMAccountEditorType type, co if (name && !strcmp (name, "mailcheck")) myindex = 10; - item = g_malloc0(sizeof (*item)); + item = g_malloc0 (sizeof (*item)); item->item.type = E_CONFIG_SECTION_TABLE; item->item.path = g_strdup_printf ("20.receive_options/%02d.%s", myindex, name?name:"unnamed"); item->item.label = g_strdup (entries[i].text); l = g_slist_prepend (l, item); - item = g_malloc0(sizeof (*item)); + item = g_malloc0 (sizeof (*item)); item->item.type = E_CONFIG_ITEM_TABLE; item->item.path = g_strdup_printf ("20.receive_options/%02d.%s/80.camelitem", myindex, name?name:"unnamed"); item->item.factory = emae_receive_options_extra_item; diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 82ba4bcd5c..52d3c7e99a 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -186,7 +186,7 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip else res = TRUE; - g_string_free(str, TRUE); + g_string_free (str, TRUE); return res; } @@ -457,7 +457,7 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data) * Since the e-plugin framework doesn't provide a way to return a value from the plugin, * use 'presend_check_status' to set whether the check passed / failed. */ - eme = em_event_peek(); + eme = em_event_peek (); target = em_event_target_new_composer (eme, composer, 0); g_object_set_data (G_OBJECT (composer), "presend_check_status", GINT_TO_POINTER(0)); @@ -624,7 +624,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i g_object_unref (sdi->composer); if (sdi->emcs) emcs_unref (sdi->emcs); - camel_message_info_free(info); + camel_message_info_free (info); g_free (sdi); } @@ -685,7 +685,7 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer) table = e_msg_composer_get_header_table (composer); account = e_composer_header_table_get_account (table); - sdi = g_malloc (sizeof(struct _save_draft_info)); + sdi = g_malloc (sizeof (struct _save_draft_info)); sdi->composer = g_object_ref (composer); sdi->emcs = g_object_get_data (G_OBJECT (composer), "emcs"); if (sdi->emcs) @@ -700,11 +700,11 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer) if (!folder || !account->enabled) { if (e_alert_run_dialog_for_args ((GtkWindow *)composer, "mail:ask-default-drafts", NULL) != GTK_RESPONSE_YES) { - g_object_unref(composer); + g_object_unref (composer); g_object_unref (msg); if (sdi->emcs) - emcs_unref(sdi->emcs); - g_free(sdi); + emcs_unref (sdi->emcs); + g_free (sdi); return; } @@ -716,8 +716,8 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer) g_object_ref (folder); } - info = camel_message_info_new(NULL); - camel_message_info_set_flags(info, CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN, ~0); + info = camel_message_info_new (NULL); + camel_message_info_set_flags (info, CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN, ~0); mail_append_mail (folder, msg, info, save_draft_done, sdi); g_object_unref (folder); @@ -756,7 +756,7 @@ create_new_composer (EShell *shell, if (from_uri != NULL) { GList *list; - account = mail_config_get_account_by_source_url(from_uri); + account = mail_config_get_account_by_source_url (from_uri); list = g_list_prepend (NULL, (gpointer) from_uri); e_composer_header_table_set_post_to_list (table, list); @@ -821,7 +821,7 @@ em_utils_compose_new_message_with_mailto (EShell *shell, table = e_msg_composer_get_header_table (composer); if (from_uri - && (account = mail_config_get_account_by_source_url(from_uri))) + && (account = mail_config_get_account_by_source_url (from_uri))) e_composer_header_table_set_account_name (table, account->name); composer_set_no_change (composer); @@ -868,7 +868,7 @@ replace_variables (GSList *clues, CamelMimeMessage *message, gchar **pstr) string_changed = TRUE; } else count1 = FALSE; - g_strfreev(temp); + g_strfreev (temp); } if (!count1) { @@ -1299,8 +1299,8 @@ forward_non_attached (EShell *shell, composer = create_new_composer (shell, subject, from_uri); if (composer) { - if (CAMEL_IS_MULTIPART(camel_medium_get_content ((CamelMedium *)message))) - e_msg_composer_add_message_attachments(composer, message, FALSE); + if (CAMEL_IS_MULTIPART (camel_medium_get_content ((CamelMedium *)message))) + e_msg_composer_add_message_attachments (composer, message, FALSE); e_msg_composer_set_body_text (composer, text, len); @@ -1604,10 +1604,10 @@ em_utils_redirect_message_by_uid (EShell *shell, } static void -emu_handle_receipt_message(CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, GError **error) +emu_handle_receipt_message (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, GError **error) { if (msg) - em_utils_handle_receipt(folder, uid, msg); + em_utils_handle_receipt (folder, uid, msg); /* we dont care really if we can't get the message */ g_clear_error (error); @@ -1621,7 +1621,7 @@ em_utils_handle_receipt (CamelFolder *folder, const gchar *uid, CamelMimeMessage const gchar *addr; CamelMessageInfo *info; - info = camel_folder_get_message_info(folder, uid); + info = camel_folder_get_message_info (folder, uid); if (info == NULL) return; @@ -1631,7 +1631,7 @@ em_utils_handle_receipt (CamelFolder *folder, const gchar *uid, CamelMimeMessage } if (msg == NULL) { - mail_get_messagex(folder, uid, emu_handle_receipt_message, NULL, mail_msg_unordered_push); + mail_get_messagex (folder, uid, emu_handle_receipt_message, NULL, mail_msg_unordered_push); camel_folder_free_message_info (folder, info); return; } @@ -1650,13 +1650,13 @@ em_utils_handle_receipt (CamelFolder *folder, const gchar *uid, CamelMimeMessage if (addr == NULL) { addr = ""; } else { - while (camel_mime_is_lwsp(*addr)) + while (camel_mime_is_lwsp (*addr)) addr++; } if (account && (account->receipt_policy == E_ACCOUNT_RECEIPT_ALWAYS || account->receipt_policy == E_ACCOUNT_RECEIPT_ASK) && e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), "mail:ask-receipt", addr, camel_mime_message_get_subject(msg), NULL) == GTK_RESPONSE_YES) - em_utils_send_receipt(folder, msg); + em_utils_send_receipt (folder, msg); } static void @@ -1887,7 +1887,7 @@ reply_get_composer (EShell *shell, g_free (subject); /* add post-to, if nessecary */ - if (postto && camel_address_length((CamelAddress *)postto)) { + if (postto && camel_address_length ((CamelAddress *)postto)) { gchar *store_url = NULL; gchar *post; @@ -1902,10 +1902,10 @@ reply_get_composer (EShell *shell, store_url[strlen (store_url)-1] = '\0'; } - post = camel_address_encode((CamelAddress *)postto); + post = camel_address_encode ((CamelAddress *)postto); e_composer_header_table_set_post_to_base ( table, store_url ? store_url : "", post); - g_free(post); + g_free (post); g_free (store_url); } @@ -1965,14 +1965,14 @@ get_reply_list (CamelMimeMessage *message, CamelInternetAddress *to) p++; addr = g_strndup (header, p - header); - camel_internet_address_add(to, NULL, addr); + camel_internet_address_add (to, NULL, addr); g_free (addr); return TRUE; } gboolean -em_utils_is_munged_list_message(CamelMimeMessage *message) +em_utils_is_munged_list_message (CamelMimeMessage *message) { CamelInternetAddress *reply_to, *list; gboolean result = FALSE; @@ -1982,12 +1982,12 @@ em_utils_is_munged_list_message(CamelMimeMessage *message) list = camel_internet_address_new (); if (get_reply_list (message, list) && - camel_address_length (CAMEL_ADDRESS(list)) == camel_address_length (CAMEL_ADDRESS(reply_to))) { + camel_address_length (CAMEL_ADDRESS (list)) == camel_address_length (CAMEL_ADDRESS (reply_to))) { gint i; const gchar *r_name, *r_addr; const gchar *l_name, *l_addr; - for (i = 0; i < camel_address_length (CAMEL_ADDRESS(list)); i++) { + for (i = 0; i < camel_address_length (CAMEL_ADDRESS (list)); i++) { if (!camel_internet_address_get (reply_to, i, &r_name, &r_addr)) break; if (!camel_internet_address_get (list, i, &l_name, &l_addr)) @@ -1995,7 +1995,7 @@ em_utils_is_munged_list_message(CamelMimeMessage *message) if (strcmp (l_addr, r_addr)) break; } - if (i == camel_address_length (CAMEL_ADDRESS(list))) + if (i == camel_address_length (CAMEL_ADDRESS (list))) result = TRUE; } g_object_unref (list); @@ -2037,7 +2037,7 @@ get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTP 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); + camel_address_decode ((CamelAddress *)postto, posthdr); return; } @@ -2066,7 +2066,7 @@ get_reply_from (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAd 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); + camel_address_decode ((CamelAddress *)postto, posthdr); return; } @@ -2103,14 +2103,14 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne /* check whether there is a 'Newsgroups: ' header in there */ if (postto) { if ((posthdr = camel_medium_get_header((CamelMedium *)message, "Followup-To"))) - camel_address_decode((CamelAddress *)postto, posthdr); + camel_address_decode ((CamelAddress *)postto, posthdr); if ((posthdr = camel_medium_get_header((CamelMedium *)message, "Newsgroups"))) - camel_address_decode((CamelAddress *)postto, posthdr); + camel_address_decode ((CamelAddress *)postto, posthdr); } rcpt_hash = em_utils_generate_account_hash (); - reply_to = get_reply_to(message); + reply_to = get_reply_to (message); to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); @@ -2139,10 +2139,10 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne } /* if To: is still empty, may we removed duplicates (i.e. ourself), so add the original To if it was set */ - if (camel_address_length((CamelAddress *)to) == 0 - && (camel_internet_address_get(to_addrs, 0, &name, &addr) - || camel_internet_address_get(cc_addrs, 0, &name, &addr))) { - camel_internet_address_add(to, name, addr); + if (camel_address_length ((CamelAddress *)to) == 0 + && (camel_internet_address_get (to_addrs, 0, &name, &addr) + || camel_internet_address_get (cc_addrs, 0, &name, &addr))) { + camel_internet_address_add (to, name, addr); } g_hash_table_destroy (rcpt_hash); @@ -2375,7 +2375,7 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat * break; case MAIL_CONFIG_REPLY_OUTLOOK: text = em_utils_message_to_html (message, _("-----Original Message-----"), EM_FORMAT_QUOTE_HEADERS, &len, source, start_bottom ? "<BR>" : NULL, &validity_found); - e_msg_composer_set_body_text(composer, text, len); + e_msg_composer_set_body_text (composer, text, len); g_free (text); emu_update_composers_security (composer, validity_found); break; @@ -2386,7 +2386,7 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat * credits = attribution_format (ATTRIBUTION, message); text = em_utils_message_to_html (message, credits, EM_FORMAT_QUOTE_CITE, &len, source, start_bottom ? "<BR>" : NULL, &validity_found); g_free (credits); - e_msg_composer_set_body_text(composer, text, len); + e_msg_composer_set_body_text (composer, text, len); g_free (text); emu_update_composers_security (composer, validity_found); break; @@ -2439,8 +2439,8 @@ reply_to_message (CamelFolder *folder, if (message != NULL) { /* get_message_free() will also unref the message, so we need - an extra ref for em_utils_reply_to_message() to drop. */ - g_object_ref(message); + an extra ref for em_utils_reply_to_message () to drop. */ + g_object_ref (message); em_utils_reply_to_message ( rd->shell, folder, uid, message, rd->mode, rd->source); } @@ -2490,13 +2490,13 @@ em_utils_reply_to_message (EShell *shell, g_return_val_if_fail (E_IS_SHELL (shell), NULL); if (folder && uid && message == NULL) { - struct _reply_data *rd = g_malloc0(sizeof(*rd)); + struct _reply_data *rd = g_malloc0 (sizeof (*rd)); rd->shell = g_object_ref (shell); rd->mode = mode; rd->source = source; if (rd->source) - g_object_ref(rd->source); + g_object_ref (rd->source); mail_get_message ( folder, uid, reply_to_message, rd, mail_msg_unordered_push); @@ -2504,10 +2504,10 @@ em_utils_reply_to_message (EShell *shell, return NULL; } - g_return_val_if_fail(message != NULL, NULL); + g_return_val_if_fail (message != NULL, NULL); - to = camel_internet_address_new(); - cc = camel_internet_address_new(); + to = camel_internet_address_new (); + cc = camel_internet_address_new (); account = em_utils_guess_account_with_recipients (message, folder); flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_SEEN; @@ -2515,13 +2515,13 @@ em_utils_reply_to_message (EShell *shell, switch (mode) { case REPLY_MODE_FROM: if (folder) - postto = camel_nntp_address_new(); + postto = camel_nntp_address_new (); get_reply_from (message, to, postto); break; case REPLY_MODE_SENDER: if (folder) - postto = camel_nntp_address_new(); + postto = camel_nntp_address_new (); get_reply_sender (message, to, postto); break; @@ -2533,9 +2533,9 @@ em_utils_reply_to_message (EShell *shell, case REPLY_MODE_ALL: flags |= CAMEL_MESSAGE_ANSWERED_ALL; if (folder) - postto = camel_nntp_address_new(); + postto = camel_nntp_address_new (); - get_reply_all(message, to, cc, postto); + get_reply_all (message, to, cc, postto); break; } @@ -2550,7 +2550,7 @@ em_utils_reply_to_message (EShell *shell, composer_set_body (composer, message, source); - g_object_unref(message); + g_object_unref (message); emcs = g_object_get_data (G_OBJECT (composer), "emcs"); emcs_set_folder_info (emcs, folder, uid, flags, flags); diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h index 5bf6924898..f1bee560d4 100644 --- a/mail/em-composer-utils.h +++ b/mail/em-composer-utils.h @@ -63,7 +63,7 @@ void em_utils_forward_messages (EShell *shell, const gchar *from_uri); void em_utils_redirect_message (EShell *shell, CamelMimeMessage *message); -void em_utils_redirect_message_by_uid(EShell *shell, +void em_utils_redirect_message_by_uid (EShell *shell, CamelFolder *folder, const gchar *uid); void em_utils_forward_message_raw (CamelFolder *folder, diff --git a/mail/em-config.c b/mail/em-config.c index 4e9d52ce61..2ac286b85a 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -45,15 +45,15 @@ struct _EMConfigPrivate { }; static void -emp_init(GObject *o) +emp_init (GObject *o) { EMConfig *emp = (EMConfig *)o; - emp->priv = g_malloc0(sizeof(*emp->priv)); + emp->priv = g_malloc0 (sizeof (*emp->priv)); } static void -emp_finalise(GObject *o) +emp_finalise (GObject *o) { struct _EMConfigPrivate *p = ((EMConfig *)o)->priv; @@ -61,13 +61,13 @@ emp_finalise(GObject *o) * will need to be freed first which will clean up any * listeners */ - g_free(p); + g_free (p); - ((GObjectClass *)emp_parent)->finalize(o); + ((GObjectClass *)emp_parent)->finalize (o); } static void -emp_target_free(EConfig *ep, EConfigTarget *t) +emp_target_free (EConfig *ep, EConfigTarget *t) { if (ep->target == t) { switch (t->type) { @@ -81,7 +81,7 @@ emp_target_free(EConfig *ep, EConfigTarget *t) EMConfigTargetAccount *s = (EMConfigTargetAccount *)t; if (((EMConfig *)ep)->priv->account_changed_id) { - g_signal_handler_disconnect(s->account, ((EMConfig *)ep)->priv->account_changed_id); + g_signal_handler_disconnect (s->account, ((EMConfig *)ep)->priv->account_changed_id); ((EMConfig *)ep)->priv->account_changed_id = 0; } break; } @@ -92,35 +92,35 @@ emp_target_free(EConfig *ep, EConfigTarget *t) case EM_CONFIG_TARGET_FOLDER: { EMConfigTargetFolder *s = (EMConfigTargetFolder *)t; - g_free(s->uri); + g_free (s->uri); g_object_unref (s->folder); break; } case EM_CONFIG_TARGET_PREFS: { EMConfigTargetPrefs *s = (EMConfigTargetPrefs *)t; if (s->gconf) - g_object_unref(s->gconf); + g_object_unref (s->gconf); break; } case EM_CONFIG_TARGET_ACCOUNT: { EMConfigTargetAccount *s = (EMConfigTargetAccount *)t; - g_object_unref(s->account); + g_object_unref (s->account); break; } } - ((EConfigClass *)emp_parent)->target_free(ep, t); + ((EConfigClass *)emp_parent)->target_free (ep, t); } static void -emp_account_changed(struct _EAccount *ea, gint id, EMConfig *emc) +emp_account_changed (struct _EAccount *ea, gint id, EMConfig *emc) { - e_config_target_changed((EConfig *)emc, E_CONFIG_TARGET_CHANGED_STATE); + e_config_target_changed ((EConfig *)emc, E_CONFIG_TARGET_CHANGED_STATE); } static void -emp_set_target(EConfig *ep, EConfigTarget *t) +emp_set_target (EConfig *ep, EConfigTarget *t) { - ((EConfigClass *)emp_parent)->set_target(ep, t); + ((EConfigClass *)emp_parent)->set_target (ep, t); if (t) { switch (t->type) { @@ -140,7 +140,7 @@ emp_set_target(EConfig *ep, EConfigTarget *t) } static void -emp_class_init(GObjectClass *klass) +emp_class_init (GObjectClass *klass) { klass->finalize = emp_finalise; ((EConfigClass *)klass)->set_target = emp_set_target; @@ -148,41 +148,41 @@ emp_class_init(GObjectClass *klass) } GType -em_config_get_type(void) +em_config_get_type (void) { static GType type = 0; if (type == 0) { static const GTypeInfo info = { - sizeof(EMConfigClass), + sizeof (EMConfigClass), NULL, NULL, (GClassInitFunc)emp_class_init, NULL, NULL, - sizeof(EMConfig), 0, + sizeof (EMConfig), 0, (GInstanceInitFunc)emp_init }; - emp_parent = g_type_class_ref(e_config_get_type()); + emp_parent = g_type_class_ref (e_config_get_type ()); type = g_type_register_static(e_config_get_type(), "EMConfig", &info, 0); } return type; } -EMConfig *em_config_new(gint type, const gchar *menuid) +EMConfig *em_config_new (gint type, const gchar *menuid) { - EMConfig *emp = g_object_new(em_config_get_type(), NULL); + EMConfig *emp = g_object_new (em_config_get_type (), NULL); - e_config_construct(&emp->config, type, menuid); + e_config_construct (&emp->config, type, menuid); return emp; } EMConfigTargetFolder * -em_config_target_new_folder(EMConfig *emp, CamelFolder *folder, const gchar *uri) +em_config_target_new_folder (EMConfig *emp, CamelFolder *folder, const gchar *uri) { - EMConfigTargetFolder *t = e_config_target_new(&emp->config, EM_CONFIG_TARGET_FOLDER, sizeof(*t)); + EMConfigTargetFolder *t = e_config_target_new (&emp->config, EM_CONFIG_TARGET_FOLDER, sizeof (*t)); - t->uri = g_strdup(uri); + t->uri = g_strdup (uri); t->folder = folder; g_object_ref (folder); @@ -190,24 +190,24 @@ em_config_target_new_folder(EMConfig *emp, CamelFolder *folder, const gchar *uri } EMConfigTargetPrefs * -em_config_target_new_prefs(EMConfig *emp, struct _GConfClient *gconf) +em_config_target_new_prefs (EMConfig *emp, struct _GConfClient *gconf) { - EMConfigTargetPrefs *t = e_config_target_new(&emp->config, EM_CONFIG_TARGET_PREFS, sizeof(*t)); + EMConfigTargetPrefs *t = e_config_target_new (&emp->config, EM_CONFIG_TARGET_PREFS, sizeof (*t)); t->gconf = gconf; if (gconf) - g_object_ref(gconf); + g_object_ref (gconf); return t; } EMConfigTargetAccount * -em_config_target_new_account(EMConfig *emp, struct _EAccount *account) +em_config_target_new_account (EMConfig *emp, struct _EAccount *account) { - EMConfigTargetAccount *t = e_config_target_new(&emp->config, EM_CONFIG_TARGET_ACCOUNT, sizeof(*t)); + EMConfigTargetAccount *t = e_config_target_new (&emp->config, EM_CONFIG_TARGET_ACCOUNT, sizeof (*t)); t->account = account; - g_object_ref(account); + g_object_ref (account); return t; } diff --git a/mail/em-config.h b/mail/em-config.h index 003498d2f6..b0493cd9cf 100644 --- a/mail/em-config.h +++ b/mail/em-config.h @@ -82,13 +82,13 @@ struct _EMConfigClass { EConfigClass config_class; }; -GType em_config_get_type(void); +GType em_config_get_type (void); -EMConfig *em_config_new(gint type, const gchar *menuid); +EMConfig *em_config_new (gint type, const gchar *menuid); -EMConfigTargetFolder *em_config_target_new_folder(EMConfig *emp, CamelFolder *folder, const gchar *uri); -EMConfigTargetPrefs *em_config_target_new_prefs(EMConfig *emp, GConfClient *gconf); -EMConfigTargetAccount *em_config_target_new_account(EMConfig *emp, EAccount *account); +EMConfigTargetFolder *em_config_target_new_folder (EMConfig *emp, CamelFolder *folder, const gchar *uri); +EMConfigTargetPrefs *em_config_target_new_prefs (EMConfig *emp, GConfClient *gconf); +EMConfigTargetAccount *em_config_target_new_account (EMConfig *emp, EAccount *account); G_END_DECLS diff --git a/mail/em-event.c b/mail/em-event.c index a84eb92264..187a1cb894 100644 --- a/mail/em-event.c +++ b/mail/em-event.c @@ -36,19 +36,19 @@ static GObjectClass *eme_parent; static EMEvent *em_event; static void -eme_init(GObject *o) +eme_init (GObject *o) { /*EMEvent *eme = (EMEvent *)o; */ } static void -eme_finalise(GObject *o) +eme_finalise (GObject *o) { - ((GObjectClass *)eme_parent)->finalize(o); + ((GObjectClass *)eme_parent)->finalize (o); } static void -eme_target_free(EEvent *ep, EEventTarget *t) +eme_target_free (EEvent *ep, EEventTarget *t) { switch (t->type) { case EM_EVENT_TARGET_FOLDER: { @@ -66,7 +66,7 @@ eme_target_free(EEvent *ep, EEventTarget *t) g_object_unref (s->folder); if (s->message) g_object_unref (s->message); - g_free(s->uid); + g_free (s->uid); if (s->composer) g_object_unref (s->composer); break; } @@ -78,31 +78,31 @@ eme_target_free(EEvent *ep, EEventTarget *t) break; } } - ((EEventClass *)eme_parent)->target_free(ep, t); + ((EEventClass *)eme_parent)->target_free (ep, t); } static void -eme_class_init(GObjectClass *klass) +eme_class_init (GObjectClass *klass) { klass->finalize = eme_finalise; ((EEventClass *)klass)->target_free = eme_target_free; } GType -em_event_get_type(void) +em_event_get_type (void) { static GType type = 0; if (type == 0) { static const GTypeInfo info = { - sizeof(EMEventClass), + sizeof (EMEventClass), NULL, NULL, (GClassInitFunc)eme_class_init, NULL, NULL, - sizeof(EMEvent), 0, + sizeof (EMEvent), 0, (GInstanceInitFunc)eme_init }; - eme_parent = g_type_class_ref(e_event_get_type()); + eme_parent = g_type_class_ref (e_event_get_type ()); type = g_type_register_static(e_event_get_type(), "EMEvent", &info, 0); } @@ -117,10 +117,10 @@ em_event_get_type(void) * * Return value: **/ -EMEvent *em_event_peek(void) +EMEvent *em_event_peek (void) { if (em_event == NULL) { - em_event = g_object_new(em_event_get_type(), NULL); + em_event = g_object_new (em_event_get_type (), NULL); e_event_construct(&em_event->popup, "org.gnome.evolution.mail.events"); } @@ -130,7 +130,7 @@ EMEvent *em_event_peek(void) EMEventTargetFolder * em_event_target_new_folder (EMEvent *eme, const gchar *uri, guint new, const gchar *msg_uid, const gchar *msg_sender, const gchar *msg_subject) { - EMEventTargetFolder *t = e_event_target_new(&eme->popup, EM_EVENT_TARGET_FOLDER, sizeof(*t)); + EMEventTargetFolder *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_FOLDER, sizeof (*t)); guint32 flags = new ? EM_EVENT_FOLDER_NEWMAIL : 0; t->uri = g_strdup (uri); @@ -146,18 +146,18 @@ em_event_target_new_folder (EMEvent *eme, const gchar *uri, guint new, const gch EMEventTargetComposer * em_event_target_new_composer (EMEvent *eme, const EMsgComposer *composer, guint32 flags) { - EMEventTargetComposer *t = e_event_target_new(&eme->popup, EM_EVENT_TARGET_COMPOSER, sizeof(*t)); + EMEventTargetComposer *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_COMPOSER, sizeof (*t)); - t->composer = g_object_ref(G_OBJECT(composer)); + t->composer = g_object_ref (G_OBJECT (composer)); t->target.mask = ~flags; return t; } EMEventTargetMessage * -em_event_target_new_message(EMEvent *eme, CamelFolder *folder, CamelMimeMessage *message, const gchar *uid, guint32 flags, EMsgComposer *composer) +em_event_target_new_message (EMEvent *eme, CamelFolder *folder, CamelMimeMessage *message, const gchar *uid, guint32 flags, EMsgComposer *composer) { - EMEventTargetMessage *t = e_event_target_new(&eme->popup, EM_EVENT_TARGET_MESSAGE, sizeof(*t)); + EMEventTargetMessage *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_MESSAGE, sizeof (*t)); t->uid = g_strdup (uid); t->folder = folder; @@ -168,15 +168,15 @@ em_event_target_new_message(EMEvent *eme, CamelFolder *folder, CamelMimeMessage g_object_ref (message); t->target.mask = ~flags; if (composer) - t->composer = g_object_ref(G_OBJECT(composer)); + t->composer = g_object_ref (G_OBJECT (composer)); return t; } EMEventTargetSendReceive * -em_event_target_new_send_receive(EMEvent *eme, GtkWidget *table, gpointer data, gint row, guint32 flags) +em_event_target_new_send_receive (EMEvent *eme, GtkWidget *table, gpointer data, gint row, guint32 flags) { - EMEventTargetSendReceive *t = e_event_target_new(&eme->popup, EM_EVENT_TARGET_SEND_RECEIVE, sizeof(*t)); + EMEventTargetSendReceive *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_SEND_RECEIVE, sizeof (*t)); t->table = table; t->data = data; @@ -187,9 +187,9 @@ em_event_target_new_send_receive(EMEvent *eme, GtkWidget *table, gpointer data, } EMEventTargetCustomIcon * -em_event_target_new_custom_icon(EMEvent *eme, GtkTreeStore *store, GtkTreeIter *iter, const gchar *folder_name, guint32 flags) +em_event_target_new_custom_icon (EMEvent *eme, GtkTreeStore *store, GtkTreeIter *iter, const gchar *folder_name, guint32 flags) { - EMEventTargetCustomIcon *t = e_event_target_new(&eme->popup, EM_EVENT_TARGET_CUSTOM_ICON, sizeof(*t)); + EMEventTargetCustomIcon *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_CUSTOM_ICON, sizeof (*t)); t->store = store; t->iter = iter; diff --git a/mail/em-event.h b/mail/em-event.h index de58d26bde..8f5a87f032 100644 --- a/mail/em-event.h +++ b/mail/em-event.h @@ -135,16 +135,16 @@ struct _EMEventClass { EEventClass popup_class; }; -GType em_event_get_type(void); +GType em_event_get_type (void); -EMEvent *em_event_peek(void); +EMEvent *em_event_peek (void); EMEventTargetFolder *em_event_target_new_folder (EMEvent *emp, const gchar *uri, guint32 count_new_msgs, const gchar *msg_uid, const gchar *msg_sender, const gchar *msg_subject); -EMEventTargetComposer *em_event_target_new_composer(EMEvent *emp, const EMsgComposer *composer, guint32 flags); -EMEventTargetMessage *em_event_target_new_message(EMEvent *emp, CamelFolder *folder, CamelMimeMessage *message, const gchar *uid, guint32 flags, +EMEventTargetComposer *em_event_target_new_composer (EMEvent *emp, const EMsgComposer *composer, guint32 flags); +EMEventTargetMessage *em_event_target_new_message (EMEvent *emp, CamelFolder *folder, CamelMimeMessage *message, const gchar *uid, guint32 flags, EMsgComposer *composer); -EMEventTargetSendReceive * em_event_target_new_send_receive(EMEvent *eme, GtkWidget *table, gpointer data, gint row, guint32 flags); -EMEventTargetCustomIcon * em_event_target_new_custom_icon(EMEvent *eme, GtkTreeStore *store, GtkTreeIter *iter, const gchar *uri, guint32 flags); +EMEventTargetSendReceive * em_event_target_new_send_receive (EMEvent *eme, GtkWidget *table, gpointer data, gint row, guint32 flags); +EMEventTargetCustomIcon * em_event_target_new_custom_icon (EMEvent *eme, GtkTreeStore *store, GtkTreeIter *iter, const gchar *uri, guint32 flags); G_END_DECLS diff --git a/mail/em-filter-context.c b/mail/em-filter-context.c index 7c17e694e8..6f6b634254 100644 --- a/mail/em-filter-context.c +++ b/mail/em-filter-context.c @@ -38,30 +38,30 @@ #define d(x) -static void em_filter_context_class_init(EMFilterContextClass *klass); -static void em_filter_context_init(EMFilterContext *fc); -static void em_filter_context_finalise(GObject *obj); +static void em_filter_context_class_init (EMFilterContextClass *klass); +static void em_filter_context_init (EMFilterContext *fc); +static void em_filter_context_finalise (GObject *obj); -static GList *filter_rename_uri(ERuleContext *rc, const gchar *olduri, const gchar *newuri, GCompareFunc cmp); -static GList *filter_delete_uri(ERuleContext *rc, const gchar *uri, GCompareFunc cmp); -static EFilterElement *filter_new_element(ERuleContext *rc, const gchar *name); +static GList *filter_rename_uri (ERuleContext *rc, const gchar *olduri, const gchar *newuri, GCompareFunc cmp); +static GList *filter_delete_uri (ERuleContext *rc, const gchar *uri, GCompareFunc cmp); +static EFilterElement *filter_new_element (ERuleContext *rc, const gchar *name); static ERuleContextClass *parent_class = NULL; GType -em_filter_context_get_type(void) +em_filter_context_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { - sizeof(EMFilterContextClass), + sizeof (EMFilterContextClass), NULL, /* base_class_init */ NULL, /* base_class_finalize */ (GClassInitFunc) em_filter_context_class_init, NULL, /* class_finalize */ NULL, /* class_data */ - sizeof(EMFilterContext), + sizeof (EMFilterContext), 0, /* n_preallocs */ (GInstanceInitFunc) em_filter_context_init, }; @@ -73,12 +73,12 @@ em_filter_context_get_type(void) } static void -em_filter_context_class_init(EMFilterContextClass *klass) +em_filter_context_class_init (EMFilterContextClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS(klass); - ERuleContextClass *rc_class = E_RULE_CONTEXT_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + ERuleContextClass *rc_class = E_RULE_CONTEXT_CLASS (klass); - parent_class = g_type_class_ref(E_TYPE_RULE_CONTEXT); + parent_class = g_type_class_ref (E_TYPE_RULE_CONTEXT); object_class->finalize = em_filter_context_finalise; @@ -89,7 +89,7 @@ em_filter_context_class_init(EMFilterContextClass *klass) } static void -em_filter_context_init(EMFilterContext *fc) +em_filter_context_init (EMFilterContext *fc) { e_rule_context_add_part_set((ERuleContext *) fc, "partset", e_filter_part_get_type(), e_rule_context_add_part, e_rule_context_next_part); @@ -102,14 +102,14 @@ em_filter_context_init(EMFilterContext *fc) } static void -em_filter_context_finalise(GObject *obj) +em_filter_context_finalise (GObject *obj) { EMFilterContext *fc = (EMFilterContext *)obj; - g_list_foreach(fc->actions, (GFunc)g_object_unref, NULL); - g_list_free(fc->actions); + g_list_foreach (fc->actions, (GFunc)g_object_unref, NULL); + g_list_free (fc->actions); - G_OBJECT_CLASS(parent_class)->finalize(obj); + G_OBJECT_CLASS (parent_class)->finalize (obj); } /** @@ -120,45 +120,45 @@ em_filter_context_finalise(GObject *obj) * Return value: A new #EMFilterContext object. **/ EMFilterContext * -em_filter_context_new(void) +em_filter_context_new (void) { - return (EMFilterContext *) g_object_new(em_filter_context_get_type(), NULL, NULL); + return (EMFilterContext *) g_object_new (em_filter_context_get_type (), NULL, NULL); } void -em_filter_context_add_action(EMFilterContext *fc, EFilterPart *action) +em_filter_context_add_action (EMFilterContext *fc, EFilterPart *action) { d(printf("find action : ")); - fc->actions = g_list_append(fc->actions, action); + fc->actions = g_list_append (fc->actions, action); } EFilterPart * -em_filter_context_find_action(EMFilterContext *fc, const gchar *name) +em_filter_context_find_action (EMFilterContext *fc, const gchar *name) { d(printf("find action : ")); - return e_filter_part_find_list(fc->actions, name); + return e_filter_part_find_list (fc->actions, name); } EFilterPart * -em_filter_context_create_action(EMFilterContext *fc, const gchar *name) +em_filter_context_create_action (EMFilterContext *fc, const gchar *name) { EFilterPart *part; - if ((part = em_filter_context_find_action(fc, name))) - return e_filter_part_clone(part); + if ((part = em_filter_context_find_action (fc, name))) + return e_filter_part_clone (part); return NULL; } EFilterPart * -em_filter_context_next_action(EMFilterContext *fc, EFilterPart *last) +em_filter_context_next_action (EMFilterContext *fc, EFilterPart *last) { - return e_filter_part_next_list(fc->actions, last); + return e_filter_part_next_list (fc->actions, last); } /* We search for any folders in our actions list that need updating, update them */ static GList * -filter_rename_uri(ERuleContext *rc, const gchar *olduri, const gchar *newuri, GCompareFunc cmp) +filter_rename_uri (ERuleContext *rc, const gchar *olduri, const gchar *newuri, GCompareFunc cmp) { EFilterRule *rule; GList *l, *el; @@ -172,12 +172,12 @@ filter_rename_uri(ERuleContext *rc, const gchar *olduri, const gchar *newuri, GC /* For all rules, for all actions, for all elements, rename any folder elements */ /* Yes we could do this inside each part itself, but not today */ rule = NULL; - while ((rule = e_rule_context_next_rule(rc, rule, NULL))) { + while ((rule = e_rule_context_next_rule (rc, rule, NULL))) { gint rulecount = 0; d(printf("checking rule '%s'\n", rule->name)); - l = EM_FILTER_RULE(rule)->actions; + l = EM_FILTER_RULE (rule)->actions; while (l) { action = l->data; @@ -188,15 +188,15 @@ filter_rename_uri(ERuleContext *rc, const gchar *olduri, const gchar *newuri, GC element = el->data; d(printf("checking element '%s'\n", element->name)); - if (EM_IS_FILTER_FOLDER_ELEMENT(element)) { + if (EM_IS_FILTER_FOLDER_ELEMENT (element)) { d(printf(" is folder, existing uri = '%s'\n", - FILTER_FOLDER(element)->uri)); + FILTER_FOLDER (element)->uri)); } - if (EM_IS_FILTER_FOLDER_ELEMENT(element) - && cmp(((EMFilterFolderElement *)element)->uri, olduri)) { + if (EM_IS_FILTER_FOLDER_ELEMENT (element) + && cmp (((EMFilterFolderElement *)element)->uri, olduri)) { d(printf(" Changed!\n")); - em_filter_folder_element_set_value((EMFilterFolderElement *)element, newuri); + em_filter_folder_element_set_value ((EMFilterFolderElement *)element, newuri); rulecount++; } el = el->next; @@ -205,8 +205,8 @@ filter_rename_uri(ERuleContext *rc, const gchar *olduri, const gchar *newuri, GC } if (rulecount) { - changed = g_list_append(changed, g_strdup(rule->name)); - e_filter_rule_emit_changed(rule); + changed = g_list_append (changed, g_strdup (rule->name)); + e_filter_rule_emit_changed (rule); } count += rulecount; @@ -218,7 +218,7 @@ filter_rename_uri(ERuleContext *rc, const gchar *olduri, const gchar *newuri, GC } static GList * -filter_delete_uri(ERuleContext *rc, const gchar *uri, GCompareFunc cmp) +filter_delete_uri (ERuleContext *rc, const gchar *uri, GCompareFunc cmp) { /* We basically do similar to above, but when we find it, Remove the action, and if thats the last action, this might create an empty rule? remove the rule? */ @@ -235,12 +235,12 @@ filter_delete_uri(ERuleContext *rc, const gchar *uri, GCompareFunc cmp) /* For all rules, for all actions, for all elements, check deleted folder elements */ /* Yes we could do this inside each part itself, but not today */ rule = NULL; - while ((rule = e_rule_context_next_rule(rc, rule, NULL))) { + while ((rule = e_rule_context_next_rule (rc, rule, NULL))) { gint recorded = 0; d(printf("checking rule '%s'\n", rule->name)); - l = EM_FILTER_RULE(rule)->actions; + l = EM_FILTER_RULE (rule)->actions; while (l) { action = l->data; @@ -251,21 +251,21 @@ filter_delete_uri(ERuleContext *rc, const gchar *uri, GCompareFunc cmp) element = el->data; d(printf("checking element '%s'\n", element->name)); - if (EM_IS_FILTER_FOLDER_ELEMENT(element)) { + if (EM_IS_FILTER_FOLDER_ELEMENT (element)) { d(printf(" is folder, existing uri = '%s'\n", - FILTER_FOLDER(element)->uri)); + FILTER_FOLDER (element)->uri)); } - if (EM_IS_FILTER_FOLDER_ELEMENT(element) - && cmp(((EMFilterFolderElement *)element)->uri, uri)) { + if (EM_IS_FILTER_FOLDER_ELEMENT (element) + && cmp (((EMFilterFolderElement *)element)->uri, uri)) { d(printf(" Deleted!\n")); /* check if last action, if so, remove rule instead? */ l = l->next; - em_filter_rule_remove_action((EMFilterRule *)rule, action); - g_object_unref(action); + em_filter_rule_remove_action ((EMFilterRule *)rule, action); + g_object_unref (action); count++; if (!recorded) - deleted = g_list_append(deleted, g_strdup(rule->name)); + deleted = g_list_append (deleted, g_strdup (rule->name)); goto next_action; } el = el->next; @@ -282,17 +282,17 @@ filter_delete_uri(ERuleContext *rc, const gchar *uri, GCompareFunc cmp) } static EFilterElement * -filter_new_element(ERuleContext *rc, const gchar *type) +filter_new_element (ERuleContext *rc, const gchar *type) { if (!strcmp(type, "folder")) { - return (EFilterElement *) em_filter_folder_element_new(); + return (EFilterElement *) em_filter_folder_element_new (); } else if (!strcmp(type, "system-flag")) { - return (EFilterElement *) e_filter_option_new(); + return (EFilterElement *) e_filter_option_new (); } else if (!strcmp(type, "score")) { return (EFilterElement *) e_filter_int_new_type("score", -3, 3); } else if (!strcmp(type, "source")) { - return (EFilterElement *) em_filter_source_element_new(); + return (EFilterElement *) em_filter_source_element_new (); } else { - return parent_class->new_element(rc, type); + return parent_class->new_element (rc, type); } } diff --git a/mail/em-filter-editor.c b/mail/em-filter-editor.c index 4a0527d934..705d972b2f 100644 --- a/mail/em-filter-editor.c +++ b/mail/em-filter-editor.c @@ -176,7 +176,7 @@ em_filter_editor_construct (EMFilterEditor *fe, for (i = 0; source_names[i].source; i++) { gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), source_names[i].name); - sources = g_slist_append (sources, g_strdup(source_names[i].source)); + sources = g_slist_append (sources, g_strdup (source_names[i].source)); } gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0); diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c index f4584c65b1..509284918a 100644 --- a/mail/em-filter-folder-element.c +++ b/mail/em-filter-folder-element.c @@ -40,36 +40,36 @@ #define d(x) -static gboolean validate(EFilterElement *fe, EAlert **alert); -static gint folder_eq(EFilterElement *fe, EFilterElement *cm); -static void xml_create(EFilterElement *fe, xmlNodePtr node); -static xmlNodePtr xml_encode(EFilterElement *fe); -static gint xml_decode(EFilterElement *fe, xmlNodePtr node); -static GtkWidget *get_widget(EFilterElement *fe); -static void build_code(EFilterElement *fe, GString *out, EFilterPart *ff); -static void format_sexp(EFilterElement *, GString *); -static void emff_copy_value(EFilterElement *de, EFilterElement *se); - -static void em_filter_folder_element_class_init(EMFilterFolderElementClass *class); -static void em_filter_folder_element_init(EMFilterFolderElement *ff); -static void em_filter_folder_element_finalise(GObject *obj); +static gboolean validate (EFilterElement *fe, EAlert **alert); +static gint folder_eq (EFilterElement *fe, EFilterElement *cm); +static void xml_create (EFilterElement *fe, xmlNodePtr node); +static xmlNodePtr xml_encode (EFilterElement *fe); +static gint xml_decode (EFilterElement *fe, xmlNodePtr node); +static GtkWidget *get_widget (EFilterElement *fe); +static void build_code (EFilterElement *fe, GString *out, EFilterPart *ff); +static void format_sexp (EFilterElement *, GString *); +static void emff_copy_value (EFilterElement *de, EFilterElement *se); + +static void em_filter_folder_element_class_init (EMFilterFolderElementClass *class); +static void em_filter_folder_element_init (EMFilterFolderElement *ff); +static void em_filter_folder_element_finalise (GObject *obj); static EFilterElementClass *parent_class = NULL; GType -em_filter_folder_element_get_type(void) +em_filter_folder_element_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { - sizeof(EMFilterFolderElementClass), + sizeof (EMFilterFolderElementClass), NULL, /* base_class_init */ NULL, /* base_class_finalize */ (GClassInitFunc)em_filter_folder_element_class_init, NULL, /* class_finalize */ NULL, /* class_data */ - sizeof(EMFilterFolderElement), + sizeof (EMFilterFolderElement), 0, /* n_preallocs */ (GInstanceInitFunc)em_filter_folder_element_init, }; @@ -81,12 +81,12 @@ em_filter_folder_element_get_type(void) } static void -em_filter_folder_element_class_init(EMFilterFolderElementClass *klass) +em_filter_folder_element_class_init (EMFilterFolderElementClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS(klass); - EFilterElementClass *fe_class = E_FILTER_ELEMENT_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + EFilterElementClass *fe_class = E_FILTER_ELEMENT_CLASS (klass); - parent_class = g_type_class_ref(E_TYPE_FILTER_ELEMENT); + parent_class = g_type_class_ref (E_TYPE_FILTER_ELEMENT); object_class->finalize = em_filter_folder_element_finalise; @@ -103,19 +103,19 @@ em_filter_folder_element_class_init(EMFilterFolderElementClass *klass) } static void -em_filter_folder_element_init(EMFilterFolderElement *ff) +em_filter_folder_element_init (EMFilterFolderElement *ff) { ; } static void -em_filter_folder_element_finalise(GObject *obj) +em_filter_folder_element_finalise (GObject *obj) { EMFilterFolderElement *ff = (EMFilterFolderElement *)obj; - g_free(ff->uri); + g_free (ff->uri); - G_OBJECT_CLASS(parent_class)->finalize(obj); + G_OBJECT_CLASS (parent_class)->finalize (obj); } /** @@ -126,20 +126,20 @@ em_filter_folder_element_finalise(GObject *obj) * Return value: A new #EMFilterFolderElement object. **/ EMFilterFolderElement * -em_filter_folder_element_new(void) +em_filter_folder_element_new (void) { - return(EMFilterFolderElement *)g_object_new(em_filter_folder_element_get_type(), NULL, NULL); + return (EMFilterFolderElement *)g_object_new (em_filter_folder_element_get_type (), NULL, NULL); } void -em_filter_folder_element_set_value(EMFilterFolderElement *ff, const gchar *uri) +em_filter_folder_element_set_value (EMFilterFolderElement *ff, const gchar *uri) { - g_free(ff->uri); - ff->uri = g_strdup(uri); + g_free (ff->uri); + ff->uri = g_strdup (uri); } static gboolean -validate(EFilterElement *fe, EAlert **alert) +validate (EFilterElement *fe, EAlert **alert) { EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; @@ -156,21 +156,21 @@ validate(EFilterElement *fe, EAlert **alert) } static gint -folder_eq(EFilterElement *fe, EFilterElement *cm) +folder_eq (EFilterElement *fe, EFilterElement *cm) { - return E_FILTER_ELEMENT_CLASS(parent_class)->eq(fe, cm) - && strcmp(((EMFilterFolderElement *)fe)->uri, ((EMFilterFolderElement *)cm)->uri)== 0; + return E_FILTER_ELEMENT_CLASS (parent_class)->eq (fe, cm) + && strcmp (((EMFilterFolderElement *)fe)->uri, ((EMFilterFolderElement *)cm)->uri)== 0; } static void -xml_create(EFilterElement *fe, xmlNodePtr node) +xml_create (EFilterElement *fe, xmlNodePtr node) { /* parent implementation */ - E_FILTER_ELEMENT_CLASS(parent_class)->xml_create(fe, node); + E_FILTER_ELEMENT_CLASS (parent_class)->xml_create (fe, node); } static xmlNodePtr -xml_encode(EFilterElement *fe) +xml_encode (EFilterElement *fe) { xmlNodePtr value, work; EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; @@ -191,7 +191,7 @@ xml_encode(EFilterElement *fe) } static gint -xml_decode(EFilterElement *fe, xmlNodePtr node) +xml_decode (EFilterElement *fe, xmlNodePtr node) { EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; xmlNodePtr n; @@ -199,7 +199,7 @@ xml_decode(EFilterElement *fe, xmlNodePtr node) d(printf("Decoding folder from xml %p\n", fe)); - xmlFree(fe->name); + xmlFree (fe->name); fe->name = (gchar *)xmlGetProp(node, (const guchar *)"name"); type = xmlGetProp (node, (const guchar *)"type"); @@ -216,9 +216,9 @@ xml_decode(EFilterElement *fe, xmlNodePtr node) gchar *uri; uri = (gchar *)xmlGetProp(n, (const guchar *)"uri"); - g_free(ff->uri); - ff->uri = g_strdup(uri); - xmlFree(uri); + g_free (ff->uri); + ff->uri = g_strdup (uri); + xmlFree (uri); break; } n = n->next; @@ -228,13 +228,13 @@ xml_decode(EFilterElement *fe, xmlNodePtr node) } static void -folder_selected(EMFolderSelectionButton *button, EMFilterFolderElement *ff) +folder_selected (EMFolderSelectionButton *button, EMFilterFolderElement *ff) { GtkWidget *toplevel; const gchar *uri; - uri = em_folder_selection_button_get_selection(button); - g_free(ff->uri); + uri = em_folder_selection_button_get_selection (button); + g_free (ff->uri); if (ff->store_camel_uri) ff->uri = g_strdup (uri); @@ -246,7 +246,7 @@ folder_selected(EMFolderSelectionButton *button, EMFilterFolderElement *ff) } static GtkWidget * -get_widget(EFilterElement *fe) +get_widget (EFilterElement *fe) { EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; GtkWidget *button; @@ -259,38 +259,38 @@ get_widget(EFilterElement *fe) button = em_folder_selection_button_new (_("Select Folder"), NULL); - em_folder_selection_button_set_selection( + em_folder_selection_button_set_selection ( EM_FOLDER_SELECTION_BUTTON (button), uri); if (!ff->store_camel_uri) - g_free(uri); + g_free (uri); - gtk_widget_show(button); + gtk_widget_show (button); g_signal_connect(button, "selected", G_CALLBACK(folder_selected), ff); return button; } static void -build_code(EFilterElement *fe, GString *out, EFilterPart *ff) +build_code (EFilterElement *fe, GString *out, EFilterPart *ff) { return; } static void -format_sexp(EFilterElement *fe, GString *out) +format_sexp (EFilterElement *fe, GString *out) { EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; - e_sexp_encode_string(out, ff->uri); + e_sexp_encode_string (out, ff->uri); } static void -emff_copy_value(EFilterElement *de, EFilterElement *se) +emff_copy_value (EFilterElement *de, EFilterElement *se) { - if (EM_IS_FILTER_FOLDER_ELEMENT(se)) { + if (EM_IS_FILTER_FOLDER_ELEMENT (se)) { ((EMFilterFolderElement *)de)->store_camel_uri = ((EMFilterFolderElement *)se)->store_camel_uri; - em_filter_folder_element_set_value((EMFilterFolderElement *)de, ((EMFilterFolderElement *)se)->uri); + em_filter_folder_element_set_value ((EMFilterFolderElement *)de, ((EMFilterFolderElement *)se)->uri); } else - parent_class->copy_value(de, se); + parent_class->copy_value (de, se); } diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c index b8ae4d66d7..47faf57c91 100644 --- a/mail/em-filter-rule.c +++ b/mail/em-filter-rule.c @@ -35,34 +35,34 @@ #define d(x) -static gint validate(EFilterRule *fr, EAlert **alert); -static gint filter_eq(EFilterRule *fr, EFilterRule *cm); -static xmlNodePtr xml_encode(EFilterRule *fr); -static gint xml_decode(EFilterRule *fr, xmlNodePtr, ERuleContext *rc); -static void rule_copy(EFilterRule *dest, EFilterRule *src); +static gint validate (EFilterRule *fr, EAlert **alert); +static gint filter_eq (EFilterRule *fr, EFilterRule *cm); +static xmlNodePtr xml_encode (EFilterRule *fr); +static gint xml_decode (EFilterRule *fr, xmlNodePtr, ERuleContext *rc); +static void rule_copy (EFilterRule *dest, EFilterRule *src); /*static void build_code(EFilterRule *, GString *out);*/ -static GtkWidget *get_widget(EFilterRule *fr, ERuleContext *rc); +static GtkWidget *get_widget (EFilterRule *fr, ERuleContext *rc); -static void em_filter_rule_class_init(EMFilterRuleClass *klass); -static void em_filter_rule_init(EMFilterRule *ff); -static void em_filter_rule_finalise(GObject *obj); +static void em_filter_rule_class_init (EMFilterRuleClass *klass); +static void em_filter_rule_init (EMFilterRule *ff); +static void em_filter_rule_finalise (GObject *obj); static EFilterRuleClass *parent_class = NULL; GType -em_filter_rule_get_type(void) +em_filter_rule_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { - sizeof(EMFilterRuleClass), + sizeof (EMFilterRuleClass), NULL, /* base_class_init */ NULL, /* base_class_finalize */ (GClassInitFunc) em_filter_rule_class_init, NULL, /* class_finalize */ NULL, /* class_data */ - sizeof(EMFilterRule), + sizeof (EMFilterRule), 0, /* n_preallocs */ (GInstanceInitFunc)em_filter_rule_init, }; @@ -74,12 +74,12 @@ em_filter_rule_get_type(void) } static void -em_filter_rule_class_init(EMFilterRuleClass *klass) +em_filter_rule_class_init (EMFilterRuleClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); EFilterRuleClass *fr_class =(EFilterRuleClass *)klass; - parent_class = g_type_class_ref(E_TYPE_FILTER_RULE); + parent_class = g_type_class_ref (E_TYPE_FILTER_RULE); object_class->finalize = em_filter_rule_finalise; @@ -94,29 +94,29 @@ em_filter_rule_class_init(EMFilterRuleClass *klass) } static void -em_filter_rule_init(EMFilterRule *ff) +em_filter_rule_init (EMFilterRule *ff) { ; } static void -unref_list(GList *l) +unref_list (GList *l) { while (l) { - g_object_unref(l->data); + g_object_unref (l->data); l = l->next; } } static void -em_filter_rule_finalise(GObject *obj) +em_filter_rule_finalise (GObject *obj) { EMFilterRule *ff =(EMFilterRule *) obj; - unref_list(ff->actions); - g_list_free(ff->actions); + unref_list (ff->actions); + g_list_free (ff->actions); - G_OBJECT_CLASS(parent_class)->finalize(obj); + G_OBJECT_CLASS (parent_class)->finalize (obj); } /** @@ -127,58 +127,58 @@ em_filter_rule_finalise(GObject *obj) * Return value: A new #EMFilterRule object. **/ EMFilterRule * -em_filter_rule_new(void) +em_filter_rule_new (void) { - return (EMFilterRule *)g_object_new(em_filter_rule_get_type(), NULL, NULL); + return (EMFilterRule *)g_object_new (em_filter_rule_get_type (), NULL, NULL); } void -em_filter_rule_add_action(EMFilterRule *fr, EFilterPart *fp) +em_filter_rule_add_action (EMFilterRule *fr, EFilterPart *fp) { - fr->actions = g_list_append(fr->actions, fp); + fr->actions = g_list_append (fr->actions, fp); - e_filter_rule_emit_changed((EFilterRule *)fr); + e_filter_rule_emit_changed ((EFilterRule *)fr); } void -em_filter_rule_remove_action(EMFilterRule *fr, EFilterPart *fp) +em_filter_rule_remove_action (EMFilterRule *fr, EFilterPart *fp) { - fr->actions = g_list_remove(fr->actions, fp); + fr->actions = g_list_remove (fr->actions, fp); - e_filter_rule_emit_changed((EFilterRule *)fr); + e_filter_rule_emit_changed ((EFilterRule *)fr); } void -em_filter_rule_replace_action(EMFilterRule *fr, EFilterPart *fp, EFilterPart *new) +em_filter_rule_replace_action (EMFilterRule *fr, EFilterPart *fp, EFilterPart *new) { GList *l; - l = g_list_find(fr->actions, fp); + l = g_list_find (fr->actions, fp); if (l) { l->data = new; } else { - fr->actions = g_list_append(fr->actions, new); + fr->actions = g_list_append (fr->actions, new); } - e_filter_rule_emit_changed((EFilterRule *)fr); + e_filter_rule_emit_changed ((EFilterRule *)fr); } void -em_filter_rule_build_action(EMFilterRule *fr, GString *out) +em_filter_rule_build_action (EMFilterRule *fr, GString *out) { g_string_append(out, "(begin\n"); - e_filter_part_build_code_list(fr->actions, out); + e_filter_part_build_code_list (fr->actions, out); g_string_append(out, ")\n"); } static gint -validate(EFilterRule *fr, EAlert **alert) +validate (EFilterRule *fr, EAlert **alert) { EMFilterRule *ff =(EMFilterRule *)fr; GList *parts; gint valid; - valid = E_FILTER_RULE_CLASS(parent_class)->validate (fr, alert); + valid = E_FILTER_RULE_CLASS (parent_class)->validate (fr, alert); /* validate rule actions */ parts = ff->actions; @@ -191,14 +191,14 @@ validate(EFilterRule *fr, EAlert **alert) } static gint -list_eq(GList *al, GList *bl) +list_eq (GList *al, GList *bl) { gint truth = TRUE; while (truth && al && bl) { EFilterPart *a = al->data, *b = bl->data; - truth = e_filter_part_eq(a, b); + truth = e_filter_part_eq (a, b); al = al->next; bl = bl->next; } @@ -207,27 +207,27 @@ list_eq(GList *al, GList *bl) } static gint -filter_eq(EFilterRule *fr, EFilterRule *cm) +filter_eq (EFilterRule *fr, EFilterRule *cm) { - return E_FILTER_RULE_CLASS(parent_class)->eq(fr, cm) - && list_eq(((EMFilterRule *)fr)->actions,((EMFilterRule *)cm)->actions); + return E_FILTER_RULE_CLASS (parent_class)->eq (fr, cm) + && list_eq (((EMFilterRule *)fr)->actions,((EMFilterRule *)cm)->actions); } static xmlNodePtr -xml_encode(EFilterRule *fr) +xml_encode (EFilterRule *fr) { EMFilterRule *ff =(EMFilterRule *)fr; xmlNodePtr node, set, work; GList *l; - node = E_FILTER_RULE_CLASS(parent_class)->xml_encode(fr); + node = E_FILTER_RULE_CLASS (parent_class)->xml_encode (fr); g_return_val_if_fail (node != NULL, NULL); set = xmlNewNode(NULL, (const guchar *)"actionset"); - xmlAddChild(node, set); + xmlAddChild (node, set); l = ff->actions; while (l) { - work = e_filter_part_xml_encode((EFilterPart *)l->data); - xmlAddChild(set, work); + work = e_filter_part_xml_encode ((EFilterPart *)l->data); + xmlAddChild (set, work); l = l->next; } @@ -236,7 +236,7 @@ xml_encode(EFilterRule *fr) } static void -load_set(xmlNodePtr node, EMFilterRule *ff, ERuleContext *rc) +load_set (xmlNodePtr node, EMFilterRule *ff, ERuleContext *rc) { xmlNodePtr work; gchar *rulename; @@ -246,15 +246,15 @@ load_set(xmlNodePtr node, EMFilterRule *ff, ERuleContext *rc) while (work) { if (!strcmp((gchar *)work->name, "part")) { rulename = (gchar *)xmlGetProp(work, (const guchar *)"name"); - part = em_filter_context_find_action((EMFilterContext *)rc, rulename); + part = em_filter_context_find_action ((EMFilterContext *)rc, rulename); if (part) { - part = e_filter_part_clone(part); - e_filter_part_xml_decode(part, work); - em_filter_rule_add_action(ff, part); + part = e_filter_part_clone (part); + e_filter_part_xml_decode (part, work); + em_filter_rule_add_action (ff, part); } else { g_warning("cannot find rule part '%s'\n", rulename); } - xmlFree(rulename); + xmlFree (rulename); } else if (work->type == XML_ELEMENT_NODE) { g_warning("Unknown xml node in part: %s", work->name); } @@ -263,20 +263,20 @@ load_set(xmlNodePtr node, EMFilterRule *ff, ERuleContext *rc) } static gint -xml_decode(EFilterRule *fr, xmlNodePtr node, ERuleContext *rc) +xml_decode (EFilterRule *fr, xmlNodePtr node, ERuleContext *rc) { EMFilterRule *ff =(EMFilterRule *)fr; xmlNodePtr work; gint result; - result = E_FILTER_RULE_CLASS(parent_class)->xml_decode(fr, node, rc); + result = E_FILTER_RULE_CLASS (parent_class)->xml_decode (fr, node, rc); if (result != 0) return result; work = node->children; while (work) { if (!strcmp((gchar *)work->name, "actionset")) { - load_set(work, ff, rc); + load_set (work, ff, rc); } work = work->next; } @@ -285,7 +285,7 @@ xml_decode(EFilterRule *fr, xmlNodePtr node, ERuleContext *rc) } static void -rule_copy(EFilterRule *dest, EFilterRule *src) +rule_copy (EFilterRule *dest, EFilterRule *src) { EMFilterRule *fdest, *fsrc; GList *node; @@ -294,8 +294,8 @@ rule_copy(EFilterRule *dest, EFilterRule *src) fsrc =(EMFilterRule *)src; if (fdest->actions) { - g_list_foreach(fdest->actions, (GFunc)g_object_unref, NULL); - g_list_free(fdest->actions); + g_list_foreach (fdest->actions, (GFunc)g_object_unref, NULL); + g_list_free (fdest->actions); fdest->actions = NULL; } @@ -303,17 +303,17 @@ rule_copy(EFilterRule *dest, EFilterRule *src) while (node) { EFilterPart *part = node->data; - g_object_ref(part); - fdest->actions = g_list_append(fdest->actions, part); + g_object_ref (part); + fdest->actions = g_list_append (fdest->actions, part); node = node->next; } - E_FILTER_RULE_CLASS(parent_class)->copy(dest, src); + E_FILTER_RULE_CLASS (parent_class)->copy (dest, src); } /*static void build_code(EFilterRule *fr, GString *out) { - return FILTER_RULE_CLASS(parent_class)->build_code(fr, out); + return FILTER_RULE_CLASS (parent_class)->build_code (fr, out); }*/ struct _part_data { @@ -360,7 +360,7 @@ part_combobox_changed (GtkComboBox *combobox, struct _part_data *data) } static GtkWidget * -get_rule_part_widget(EMFilterContext *f, EFilterPart *newpart, EFilterRule *fr) +get_rule_part_widget (EMFilterContext *f, EFilterPart *newpart, EFilterRule *fr) { EFilterPart *part = NULL; GtkWidget *combobox; @@ -369,25 +369,25 @@ get_rule_part_widget(EMFilterContext *f, EFilterPart *newpart, EFilterRule *fr) gint index = 0, current = 0; struct _part_data *data; - data = g_malloc0(sizeof(*data)); + data = g_malloc0 (sizeof (*data)); data->fr = fr; data->f = f; data->part = newpart; - hbox = gtk_hbox_new(FALSE, 0); + hbox = gtk_hbox_new (FALSE, 0); /* only set to automatically clean up the memory and for less_parts */ g_object_set_data_full ((GObject *) hbox, "data", data, g_free); - p = e_filter_part_get_widget(newpart); + p = e_filter_part_get_widget (newpart); data->partwidget = p; data->container = hbox; combobox = gtk_combo_box_new_text (); - while ((part = em_filter_context_next_action(f, part))) { + while ((part = em_filter_context_next_action (f, part))) { gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _(part->title)); - if (!strcmp(newpart->title, part->title)) + if (!strcmp (newpart->title, part->title)) current = index; index++; @@ -397,11 +397,11 @@ get_rule_part_widget(EMFilterContext *f, EFilterPart *newpart, EFilterRule *fr) g_signal_connect (combobox, "changed", G_CALLBACK (part_combobox_changed), data); gtk_widget_show (combobox); - gtk_box_pack_start(GTK_BOX(hbox), combobox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), combobox, FALSE, FALSE, 0); if (p) - gtk_box_pack_start(GTK_BOX(hbox), p, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), p, TRUE, TRUE, 0); - gtk_widget_show_all(hbox); + gtk_widget_show_all (hbox); return hbox; } @@ -413,7 +413,7 @@ struct _rule_data { }; static void -less_parts(GtkWidget *button, struct _rule_data *data) +less_parts (GtkWidget *button, struct _rule_data *data) { EFilterPart *part; GtkWidget *rule; @@ -421,7 +421,7 @@ less_parts(GtkWidget *button, struct _rule_data *data) GList *l; l =((EMFilterRule *)data->fr)->actions; - if (g_list_length(l) < 2) + if (g_list_length (l) < 2) return; rule = g_object_get_data((GObject *)button, "rule"); @@ -432,29 +432,29 @@ less_parts(GtkWidget *button, struct _rule_data *data) part = part_data->part; /* remove the part from the list */ - em_filter_rule_remove_action((EMFilterRule *)data->fr, part); - g_object_unref(part); + em_filter_rule_remove_action ((EMFilterRule *)data->fr, part); + g_object_unref (part); /* and from the display */ - gtk_container_remove(GTK_CONTAINER(data->parts), rule); - gtk_container_remove(GTK_CONTAINER(data->parts), button); + gtk_container_remove (GTK_CONTAINER (data->parts), rule); + gtk_container_remove (GTK_CONTAINER (data->parts), button); } static void -attach_rule(GtkWidget *rule, struct _rule_data *data, EFilterPart *part, gint row) +attach_rule (GtkWidget *rule, struct _rule_data *data, EFilterPart *part, gint row) { GtkWidget *remove; - gtk_table_attach(GTK_TABLE(data->parts), rule, 0, 1, row, row + 1, + gtk_table_attach (GTK_TABLE (data->parts), rule, 0, 1, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - remove = gtk_button_new_from_stock(GTK_STOCK_REMOVE); + remove = gtk_button_new_from_stock (GTK_STOCK_REMOVE); g_object_set_data((GObject *)remove, "rule", rule); /*gtk_button_set_relief(GTK_BUTTON(remove), GTK_RELIEF_NONE);*/ g_signal_connect(remove, "clicked", G_CALLBACK(less_parts), data); - gtk_table_attach(GTK_TABLE(data->parts), remove, 1, 2, row, row + 1, + gtk_table_attach (GTK_TABLE (data->parts), remove, 1, 2, row, row + 1, 0, 0, 0, 0); - gtk_widget_show(remove); + gtk_widget_show (remove); } static void @@ -472,23 +472,23 @@ do_grab_focus_cb (GtkWidget *widget, gpointer data) } static void -more_parts(GtkWidget *button, struct _rule_data *data) +more_parts (GtkWidget *button, struct _rule_data *data) { EFilterPart *new; /* create a new rule entry, use the first type of rule */ - new = em_filter_context_next_action((EMFilterContext *)data->f, NULL); + new = em_filter_context_next_action ((EMFilterContext *)data->f, NULL); if (new) { GtkWidget *w; guint rows; - new = e_filter_part_clone(new); - em_filter_rule_add_action((EMFilterRule *)data->fr, new); - w = get_rule_part_widget(data->f, new, data->fr); + new = e_filter_part_clone (new); + em_filter_rule_add_action ((EMFilterRule *)data->fr, new); + w = get_rule_part_widget (data->f, new, data->fr); g_object_get (data->parts, "n-rows", &rows, NULL); - gtk_table_resize(GTK_TABLE(data->parts), rows + 1, 2); - attach_rule(w, data, new, rows); + gtk_table_resize (GTK_TABLE (data->parts), rows + 1, 2); + attach_rule (w, data, new, rows); if (GTK_IS_CONTAINER (w)) { gboolean done = FALSE; @@ -514,7 +514,7 @@ more_parts(GtkWidget *button, struct _rule_data *data) } static GtkWidget * -get_widget(EFilterRule *fr, ERuleContext *rc) +get_widget (EFilterRule *fr, ERuleContext *rc) { GtkWidget *widget, *hbox, *add, *label; GtkWidget *parts, *inframe, *w; @@ -527,31 +527,31 @@ get_widget(EFilterRule *fr, ERuleContext *rc) gint rows, i = 0; gchar *msg; - widget = E_FILTER_RULE_CLASS(parent_class)->get_widget(fr, rc); + widget = E_FILTER_RULE_CLASS (parent_class)->get_widget (fr, rc); /* and now for the action area */ msg = g_strdup_printf("<b>%s</b>", _("Then")); - label = gtk_label_new(msg); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - gtk_box_pack_start(GTK_BOX(widget), label, FALSE, FALSE, 0); - gtk_widget_show(label); - g_free(msg); + label = gtk_label_new (msg); + gtk_label_set_use_markup (GTK_LABEL (label), TRUE); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + gtk_box_pack_start (GTK_BOX (widget), label, FALSE, FALSE, 0); + gtk_widget_show (label); + g_free (msg); - hbox = gtk_hbox_new(FALSE, 12); - gtk_box_pack_start(GTK_BOX(widget), hbox, TRUE, TRUE, 0); - gtk_widget_show(hbox); + hbox = gtk_hbox_new (FALSE, 12); + gtk_box_pack_start (GTK_BOX (widget), hbox, TRUE, TRUE, 0); + gtk_widget_show (hbox); label = gtk_label_new(""); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_widget_show (label); - inframe = gtk_vbox_new(FALSE, 6); - gtk_box_pack_start(GTK_BOX(hbox), inframe, TRUE, TRUE, 0); + inframe = gtk_vbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (hbox), inframe, TRUE, TRUE, 0); - rows = g_list_length(ff->actions); - parts = gtk_table_new(rows, 2, FALSE); - data = g_malloc0(sizeof(*data)); + rows = g_list_length (ff->actions); + parts = gtk_table_new (rows, 2, FALSE); + data = g_malloc0 (sizeof (*data)); data->f =(EMFilterContext *)rc; data->fr = fr; data->parts = parts; @@ -559,41 +559,41 @@ get_widget(EFilterRule *fr, ERuleContext *rc) /* only set to automatically clean up the memory */ g_object_set_data_full ((GObject *) hbox, "data", data, g_free); - hbox = gtk_hbox_new(FALSE, 3); + hbox = gtk_hbox_new (FALSE, 3); add = gtk_button_new_with_mnemonic (_("Add Ac_tion")); gtk_button_set_image ( GTK_BUTTON (add), gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON)); g_signal_connect(add, "clicked", G_CALLBACK(more_parts), data); - gtk_box_pack_start(GTK_BOX(hbox), add, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), add, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(inframe), hbox, FALSE, FALSE, 3); + gtk_box_pack_start (GTK_BOX (inframe), hbox, FALSE, FALSE, 3); l = ff->actions; while (l) { part = l->data; d(printf("adding action %s\n", part->title)); - w = get_rule_part_widget((EMFilterContext *)rc, part, fr); - attach_rule(w, data, part, i++); + w = get_rule_part_widget ((EMFilterContext *)rc, part, fr); + attach_rule (w, data, part, i++); l = l->next; } - hadj = gtk_adjustment_new(0.0, 0.0, 1.0, 1.0 ,1.0, 1.0); - vadj = gtk_adjustment_new(0.0, 0.0, 1.0, 1.0 ,1.0, 1.0); - scrolledwindow = gtk_scrolled_window_new(GTK_ADJUSTMENT(hadj), GTK_ADJUSTMENT(vadj)); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), + hadj = gtk_adjustment_new (0.0, 0.0, 1.0, 1.0 ,1.0, 1.0); + vadj = gtk_adjustment_new (0.0, 0.0, 1.0, 1.0 ,1.0, 1.0); + scrolledwindow = gtk_scrolled_window_new (GTK_ADJUSTMENT (hadj), GTK_ADJUSTMENT (vadj)); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), parts); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwindow), parts); - gtk_box_pack_start(GTK_BOX(inframe), scrolledwindow, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (inframe), scrolledwindow, TRUE, TRUE, 0); /*gtk_box_pack_start(GTK_BOX(inframe), parts, FALSE, FALSE, 3);*/ g_object_set_data (G_OBJECT (add), "scrolled-window", scrolledwindow); - gtk_widget_show_all(widget); + gtk_widget_show_all (widget); return widget; } diff --git a/mail/em-filter-source-element.c b/mail/em-filter-source-element.c index bf185ce60f..9b30722f9a 100644 --- a/mail/em-filter-source-element.c +++ b/mail/em-filter-source-element.c @@ -36,22 +36,22 @@ #include "filter/e-filter-part.h" -static void em_filter_source_element_class_init(EMFilterSourceElementClass *klass); -static void em_filter_source_element_init(EMFilterSourceElement *fs); -static void em_filter_source_element_finalize(GObject *obj); - -static gint source_eq(EFilterElement *fe, EFilterElement *cm); -static void xml_create(EFilterElement *fe, xmlNodePtr node); -static xmlNodePtr xml_encode(EFilterElement *fe); -static gint xml_decode(EFilterElement *fe, xmlNodePtr node); -static EFilterElement *filter_clone(EFilterElement *fe); -static GtkWidget *get_widget(EFilterElement *fe); -static void build_code(EFilterElement *fe, GString *out, EFilterPart *ff); -static void format_sexp(EFilterElement *, GString *); +static void em_filter_source_element_class_init (EMFilterSourceElementClass *klass); +static void em_filter_source_element_init (EMFilterSourceElement *fs); +static void em_filter_source_element_finalize (GObject *obj); + +static gint source_eq (EFilterElement *fe, EFilterElement *cm); +static void xml_create (EFilterElement *fe, xmlNodePtr node); +static xmlNodePtr xml_encode (EFilterElement *fe); +static gint xml_decode (EFilterElement *fe, xmlNodePtr node); +static EFilterElement *filter_clone (EFilterElement *fe); +static GtkWidget *get_widget (EFilterElement *fe); +static void build_code (EFilterElement *fe, GString *out, EFilterPart *ff); +static void format_sexp (EFilterElement *, GString *); static void em_filter_source_element_add_source (EMFilterSourceElement *fs, const gchar *account_name, const gchar *name, const gchar *addr, const gchar *url); -static void em_filter_source_element_get_sources(EMFilterSourceElement *fs); +static void em_filter_source_element_get_sources (EMFilterSourceElement *fs); typedef struct _SourceInfo { gchar *account_name; @@ -68,19 +68,19 @@ struct _EMFilterSourceElementPrivate { static EFilterElementClass *parent_class = NULL; GType -em_filter_source_element_get_type(void) +em_filter_source_element_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { - sizeof(EMFilterSourceElementClass), + sizeof (EMFilterSourceElementClass), NULL, /* base_class_init */ NULL, /* base_class_finalize */ (GClassInitFunc)em_filter_source_element_class_init, NULL, /* class_finalize */ NULL, /* class_data */ - sizeof(EMFilterSourceElement), + sizeof (EMFilterSourceElement), 0, /* n_preallocs */ (GInstanceInitFunc)em_filter_source_element_init, }; @@ -92,12 +92,12 @@ em_filter_source_element_get_type(void) } static void -em_filter_source_element_class_init(EMFilterSourceElementClass *klass) +em_filter_source_element_class_init (EMFilterSourceElementClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS(klass); - EFilterElementClass *fe_class = E_FILTER_ELEMENT_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + EFilterElementClass *fe_class = E_FILTER_ELEMENT_CLASS (klass); - parent_class = g_type_class_ref(E_TYPE_FILTER_ELEMENT); + parent_class = g_type_class_ref (E_TYPE_FILTER_ELEMENT); object_class->finalize = em_filter_source_element_finalize; @@ -113,63 +113,63 @@ em_filter_source_element_class_init(EMFilterSourceElementClass *klass) } static void -em_filter_source_element_init(EMFilterSourceElement *fs) +em_filter_source_element_init (EMFilterSourceElement *fs) { - fs->priv = g_new(struct _EMFilterSourceElementPrivate, 1); + fs->priv = g_new (struct _EMFilterSourceElementPrivate, 1); fs->priv->sources = NULL; fs->priv->current_url = NULL; } static void -em_filter_source_element_finalize(GObject *obj) +em_filter_source_element_finalize (GObject *obj) { EMFilterSourceElement *fs = (EMFilterSourceElement *)obj; GList *i = fs->priv->sources; while (i) { SourceInfo *info = i->data; - g_free(info->account_name); - g_free(info->name); - g_free(info->address); - g_free(info->url); - g_free(info); - i = g_list_next(i); + g_free (info->account_name); + g_free (info->name); + g_free (info->address); + g_free (info->url); + g_free (info); + i = g_list_next (i); } - g_list_free(fs->priv->sources); - g_free(fs->priv->current_url); + g_list_free (fs->priv->sources); + g_free (fs->priv->current_url); - g_free(fs->priv); + g_free (fs->priv); - G_OBJECT_CLASS(parent_class)->finalize(obj); + G_OBJECT_CLASS (parent_class)->finalize (obj); } EMFilterSourceElement * -em_filter_source_element_new(void) +em_filter_source_element_new (void) { - return (EMFilterSourceElement *)g_object_new(em_filter_source_element_get_type(), NULL, NULL); + return (EMFilterSourceElement *)g_object_new (em_filter_source_element_get_type (), NULL, NULL); } static gint -source_eq(EFilterElement *fe, EFilterElement *cm) +source_eq (EFilterElement *fe, EFilterElement *cm) { EMFilterSourceElement *fs = (EMFilterSourceElement *)fe, *cs = (EMFilterSourceElement *)cm; - return E_FILTER_ELEMENT_CLASS(parent_class)->eq(fe, cm) + return E_FILTER_ELEMENT_CLASS (parent_class)->eq (fe, cm) &&((fs->priv->current_url && cs->priv->current_url - && strcmp(fs->priv->current_url, cs->priv->current_url)== 0) + && strcmp (fs->priv->current_url, cs->priv->current_url)== 0) ||(fs->priv->current_url == NULL && cs->priv->current_url == NULL)); } static void -xml_create(EFilterElement *fe, xmlNodePtr node) +xml_create (EFilterElement *fe, xmlNodePtr node) { /* Call parent implementation */ - E_FILTER_ELEMENT_CLASS(parent_class)->xml_create(fe, node); + E_FILTER_ELEMENT_CLASS (parent_class)->xml_create (fe, node); } static xmlNodePtr -xml_encode(EFilterElement *fe) +xml_encode (EFilterElement *fe) { xmlNodePtr value; @@ -186,7 +186,7 @@ xml_encode(EFilterElement *fe) } static gint -xml_decode(EFilterElement *fe, xmlNodePtr node) +xml_decode (EFilterElement *fe, xmlNodePtr node) { EMFilterSourceElement *fs = (EMFilterSourceElement *)fe; CamelURL *url; @@ -195,13 +195,13 @@ xml_decode(EFilterElement *fe, xmlNodePtr node) node = node->children; while (node != NULL) { if (!strcmp((gchar *)node->name, "uri")) { - uri = (gchar *)xmlNodeGetContent(node); - url = camel_url_new(uri, NULL); - xmlFree(uri); + uri = (gchar *)xmlNodeGetContent (node); + url = camel_url_new (uri, NULL); + xmlFree (uri); - g_free(fs->priv->current_url); - fs->priv->current_url = camel_url_to_string(url, CAMEL_URL_HIDE_ALL); - camel_url_free(url); + g_free (fs->priv->current_url); + fs->priv->current_url = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); + camel_url_free (url); break; } @@ -212,26 +212,26 @@ xml_decode(EFilterElement *fe, xmlNodePtr node) } static EFilterElement * -filter_clone(EFilterElement *fe) +filter_clone (EFilterElement *fe) { EMFilterSourceElement *fs = (EMFilterSourceElement *)fe; - EMFilterSourceElement *cpy = em_filter_source_element_new(); + EMFilterSourceElement *cpy = em_filter_source_element_new (); GList *i; - ((EFilterElement *)cpy)->name = (gchar *)xmlStrdup((guchar *)fe->name); + ((EFilterElement *)cpy)->name = (gchar *)xmlStrdup ((guchar *)fe->name); - cpy->priv->current_url = g_strdup(fs->priv->current_url); + cpy->priv->current_url = g_strdup (fs->priv->current_url); - for (i = fs->priv->sources; i != NULL; i = g_list_next(i)) { + for (i = fs->priv->sources; i != NULL; i = g_list_next (i)) { SourceInfo *info = (SourceInfo *)i->data; - em_filter_source_element_add_source(cpy, info->account_name, info->name, info->address, info->url); + em_filter_source_element_add_source (cpy, info->account_name, info->name, info->address, info->url); } return (EFilterElement *)cpy; } static void -source_changed(GtkComboBox *combobox, EMFilterSourceElement *fs) +source_changed (GtkComboBox *combobox, EMFilterSourceElement *fs) { SourceInfo *info; gint idx; @@ -247,7 +247,7 @@ source_changed(GtkComboBox *combobox, EMFilterSourceElement *fs) } static GtkWidget * -get_widget(EFilterElement *fe) +get_widget (EFilterElement *fe) { EMFilterSourceElement *fs = (EMFilterSourceElement *)fe; GtkWidget *combobox; @@ -256,14 +256,14 @@ get_widget(EFilterElement *fe) gint index, current_index; if (fs->priv->sources == NULL) - em_filter_source_element_get_sources(fs); + em_filter_source_element_get_sources (fs); combobox = gtk_combo_box_new_text (); index = 0; current_index = -1; - for (i = fs->priv->sources; i != NULL; i = g_list_next(i)) { + for (i = fs->priv->sources; i != NULL; i = g_list_next (i)) { SourceInfo *info = (SourceInfo *)i->data; gchar *label; @@ -271,16 +271,16 @@ get_widget(EFilterElement *fe) if (first == NULL) first = info; - if (info->account_name && strcmp(info->account_name, info->address)) + if (info->account_name && strcmp (info->account_name, info->address)) label = g_strdup_printf("%s <%s>(%s)", info->name, info->address, info->account_name); else label = g_strdup_printf("%s <%s>", info->name, info->address); gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), label); - g_free(label); + g_free (label); - if (fs->priv->current_url && !strcmp(info->url, fs->priv->current_url)) + if (fs->priv->current_url && !strcmp (info->url, fs->priv->current_url)) current_index = index; index++; @@ -291,10 +291,10 @@ get_widget(EFilterElement *fe) gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), current_index); } else { gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0); - g_free(fs->priv->current_url); + g_free (fs->priv->current_url); if (first) - fs->priv->current_url = g_strdup(first->url); + fs->priv->current_url = g_strdup (first->url); else fs->priv->current_url = NULL; } @@ -305,38 +305,38 @@ get_widget(EFilterElement *fe) } static void -build_code(EFilterElement *fe, GString *out, EFilterPart *ff) +build_code (EFilterElement *fe, GString *out, EFilterPart *ff) { /* We are doing nothing on purpose. */ } static void -format_sexp(EFilterElement *fe, GString *out) +format_sexp (EFilterElement *fe, GString *out) { EMFilterSourceElement *fs = (EMFilterSourceElement *)fe; - e_sexp_encode_string(out, fs->priv->current_url); + e_sexp_encode_string (out, fs->priv->current_url); } static void -em_filter_source_element_add_source(EMFilterSourceElement *fs, const gchar *account_name, const gchar *name, +em_filter_source_element_add_source (EMFilterSourceElement *fs, const gchar *account_name, const gchar *name, const gchar *addr, const gchar *url) { SourceInfo *info; - g_return_if_fail(EM_IS_FILTER_SOURCE_ELEMENT(fs)); + g_return_if_fail (EM_IS_FILTER_SOURCE_ELEMENT (fs)); - info = g_new0(SourceInfo, 1); - info->account_name = g_strdup(account_name); - info->name = g_strdup(name); - info->address = g_strdup(addr); - info->url = g_strdup(url); + info = g_new0 (SourceInfo, 1); + info->account_name = g_strdup (account_name); + info->name = g_strdup (name); + info->address = g_strdup (addr); + info->url = g_strdup (url); - fs->priv->sources = g_list_append(fs->priv->sources, info); + fs->priv->sources = g_list_append (fs->priv->sources, info); } static void -em_filter_source_element_get_sources(EMFilterSourceElement *fs) +em_filter_source_element_get_sources (EMFilterSourceElement *fs) { EAccountList *accounts; const EAccount *account; @@ -346,27 +346,27 @@ em_filter_source_element_get_sources(EMFilterSourceElement *fs) CamelURL *url; /* should this get the global object from mail? */ - gconf = gconf_client_get_default(); - accounts = e_account_list_new(gconf); - g_object_unref(gconf); + gconf = gconf_client_get_default (); + accounts = e_account_list_new (gconf); + g_object_unref (gconf); - for (it = e_list_get_iterator((EList *)accounts); - e_iterator_is_valid(it); - e_iterator_next(it)) { - account = (const EAccount *)e_iterator_get(it); + for (it = e_list_get_iterator ((EList *)accounts); + e_iterator_is_valid (it); + e_iterator_next (it)) { + account = (const EAccount *)e_iterator_get (it); if (account->source == NULL || account->source->url == NULL || account->source->url[0] == 0) continue; - url = camel_url_new(account->source->url, NULL); + url = camel_url_new (account->source->url, NULL); if (url) { /* hide secret stuff */ - uri = camel_url_to_string(url, CAMEL_URL_HIDE_ALL); - camel_url_free(url); - em_filter_source_element_add_source(fs, account->name, account->id->name, account->id->address, uri); - g_free(uri); + uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); + camel_url_free (url); + em_filter_source_element_add_source (fs, account->name, account->id->name, account->id->address, uri); + g_free (uri); } } - g_object_unref(it); - g_object_unref(accounts); + g_object_unref (it); + g_object_unref (accounts); } diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c index 529472b47a..d79e3f7c7f 100644 --- a/mail/em-folder-properties.c +++ b/mail/em-folder-properties.c @@ -54,19 +54,19 @@ static void emfp_dialog_response (GtkWidget *dialog, gint response, struct _prop_data *prop_data) { if (response == GTK_RESPONSE_OK) - e_config_commit((EConfig *)prop_data->config); + e_config_commit ((EConfig *)prop_data->config); else - e_config_abort((EConfig *)prop_data->config); + e_config_abort ((EConfig *)prop_data->config); gtk_widget_destroy (dialog); } static void -emfp_free(EConfig *ec, GSList *items, gpointer data) +emfp_free (EConfig *ec, GSList *items, gpointer data) { struct _prop_data *prop_data = data; - g_slist_free(items); + g_slist_free (items); camel_object_state_write (prop_data->object); g_object_unref (prop_data->object); @@ -104,7 +104,7 @@ add_numbered_row (GtkTable *table, gint row, const gchar *description, const gch } static GtkWidget * -emfp_get_folder_item(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) +emfp_get_folder_item (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { GObjectClass *class; GParamSpec **properties; @@ -253,7 +253,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, Do the calculation only for those accounts that support VTRASHes */ if (parent_store->flags & CAMEL_STORE_VTRASH) { - if (CAMEL_IS_VTRASH_FOLDER(folder)) + if (CAMEL_IS_VTRASH_FOLDER (folder)) prop_data->total += deleted; else if (!hide_deleted && deleted > 0) prop_data->total += deleted; @@ -307,12 +307,12 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, prop_data->config = ec; l = NULL; for (i = 0; i < G_N_ELEMENTS (emfp_items); i++) - l = g_slist_prepend(l, &emfp_items[i]); - e_config_add_items((EConfig *)ec, l, NULL, NULL, emfp_free, prop_data); + l = g_slist_prepend (l, &emfp_items[i]); + e_config_add_items ((EConfig *)ec, l, NULL, NULL, emfp_free, prop_data); - target = em_config_target_new_folder(ec, folder, folder_uri); - e_config_set_target((EConfig *)ec, (EConfigTarget *)target); - w = e_config_create_widget((EConfig *)ec); + target = em_config_target_new_folder (ec, folder, folder_uri); + e_config_set_target ((EConfig *)ec, (EConfigTarget *)target); + w = e_config_create_widget ((EConfig *)ec); gtk_box_pack_start (GTK_BOX (content_area), w, TRUE, TRUE, 0); @@ -357,7 +357,7 @@ em_folder_properties_show (EShellView *shell_view, /* MORE HACK: UNMATCHED is a special folder which you can't modify, so check for it here */ if (url == NULL || url->fragment == NULL - || strcmp(url->fragment, CAMEL_UNMATCHED_NAME) != 0) { + || strcmp (url->fragment, CAMEL_UNMATCHED_NAME) != 0) { if (url) camel_url_free (url); vfolder_edit_rule (uri); @@ -368,7 +368,7 @@ em_folder_properties_show (EShellView *shell_view, } if (folder == NULL) - mail_get_folder(uri, 0, emfp_dialog_got_folder, shell_view, mail_msg_unordered_push); + mail_get_folder (uri, 0, emfp_dialog_got_folder, shell_view, mail_msg_unordered_push); else - emfp_dialog_got_folder((gchar *)uri, folder, shell_view); + emfp_dialog_got_folder ((gchar *)uri, folder, shell_view); } diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index 089daf4d44..e20b9f711b 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -134,9 +134,9 @@ emfs_create_name_changed (GtkEntry *entry, EMFolderSelector *emfs) if (gtk_entry_get_text_length (emfs->name_entry) > 0) text = gtk_entry_get_text (emfs->name_entry); - path = em_folder_tree_get_selected_uri(emfs->emft); + path = em_folder_tree_get_selected_uri (emfs->emft); active = text && path && !strchr (text, '/'); - g_free(path); + g_free (path); gtk_dialog_set_response_sensitive ((GtkDialog *) emfs, GTK_RESPONSE_OK, active); } @@ -235,11 +235,11 @@ emfs_create_name_activate (GtkEntry *entry, EMFolderSelector *emfs) const gchar *text; text = gtk_entry_get_text (emfs->name_entry); - path = em_folder_tree_get_selected_uri(emfs->emft); + path = em_folder_tree_get_selected_uri (emfs->emft); if (text && path && !strchr (text, '/')) g_signal_emit_by_name (emfs, "response", GTK_RESPONSE_OK); - g_free(path); + g_free (path); } } @@ -262,7 +262,7 @@ em_folder_selector_create_new (GtkWindow *parent, EM_TYPE_FOLDER_SELECTOR, "transient-for", parent, NULL); em_folder_selector_construct (emfs, emft, flags, title, text, _("C_reate")); - em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOINFERIORS); + em_folder_tree_set_excluded (emft, EMFT_EXCLUDE_NOINFERIORS); hbox = gtk_hbox_new (FALSE, 0); w = gtk_label_new_with_mnemonic (_("Folder _name:")); @@ -310,7 +310,7 @@ em_folder_selector_get_selected_uri (EMFolderSelector *emfs) CamelURL *url; gchar *newpath; - provider = camel_provider_get(uri, NULL); + provider = camel_provider_get (uri, NULL); name = gtk_entry_get_text (emfs->name_entry); @@ -326,10 +326,10 @@ em_folder_selector_get_selected_uri (EMFolderSelector *emfs) gchar *path; path = g_strdup_printf("%s/%s", (url->path == NULL || strcmp(url->path, "/") == 0) ? "":url->path, name); - camel_url_set_path(url, path); + camel_url_set_path (url, path); if (path[0] == '/') { - newpath = g_strdup(path+1); - g_free(path); + newpath = g_strdup (path+1); + g_free (path); } else newpath = path; } @@ -369,13 +369,13 @@ em_folder_selector_get_selected_path (EMFolderSelector *emfs) return emfs->selected_path; } - if ((uri = em_folder_tree_get_selected_uri(emfs->emft)) == NULL) { + if ((uri = em_folder_tree_get_selected_uri (emfs->emft)) == NULL) { d(printf ("no selected folder?\n")); return NULL; } - g_free(uri); + g_free (uri); - path = em_folder_tree_get_selected_path(emfs->emft); + path = em_folder_tree_get_selected_path (emfs->emft); if (emfs->name_entry) { const gchar *name; gchar *newpath; @@ -383,10 +383,10 @@ em_folder_selector_get_selected_path (EMFolderSelector *emfs) name = gtk_entry_get_text (emfs->name_entry); newpath = g_strdup_printf ("%s/%s", path?path:"", name); - g_free(path); + g_free (path); emfs->selected_path = g_strdup (newpath); } else { - g_free(emfs->selected_path); + g_free (emfs->selected_path); emfs->selected_path = path?path:g_strdup(""); } diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 82620f76ab..62e8e1b468 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -218,7 +218,7 @@ account_changed_cb (EAccountList *accounts, if (!account->enabled ||!(uri = account->source->url)) return; - if (!(provider = camel_provider_get(uri, NULL))) + if (!(provider = camel_provider_get (uri, NULL))) return; /* make sure the new store belongs in the tree */ @@ -717,7 +717,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, if (camel_store_folder_uri_equal (si->store, fi->uri, curi)) { add_flags = CAMEL_FOLDER_TYPE_SENT; } - g_free(curi); + g_free (curi); } } @@ -832,9 +832,9 @@ folder_subscribed (CamelStore *store, goto done; /* Get our parent folder's path. */ - dirname = g_alloca(strlen(fi->full_name)+1); - strcpy(dirname, fi->full_name); - p = strrchr(dirname, '/'); + dirname = g_alloca (strlen (fi->full_name)+1); + strcpy (dirname, fi->full_name); + p = strrchr (dirname, '/'); if (p == NULL) { /* User subscribed to a toplevel folder. */ reference = si->row; @@ -998,7 +998,7 @@ folder_renamed (CamelStore *store, em_folder_tree_model_remove_folders (model, si, &iter); parent = g_strdup (info->new->full_name); - p = strrchr(parent, '/'); + p = strrchr (parent, '/'); if (p) *p = 0; if (p == NULL || parent == p) diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h index cc83aba990..f64f02dd09 100644 --- a/mail/em-folder-tree-model.h +++ b/mail/em-folder-tree-model.h @@ -117,7 +117,7 @@ GType em_folder_tree_model_get_type (void); EMFolderTreeModel * em_folder_tree_model_new (void); EMFolderTreeModel * - em_folder_tree_model_get_default(void); + em_folder_tree_model_get_default (void); GtkTreeSelection * em_folder_tree_model_get_selection (EMFolderTreeModel *model); diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index fb373d0c18..4fb1615a96 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -187,9 +187,9 @@ folder_tree_get_folder_info__desc (struct _EMFolderTreeGetFolderInfo *m) { gchar *ret, *name; - name = camel_service_get_name((CamelService *)m->store, TRUE); + name = camel_service_get_name ((CamelService *)m->store, TRUE); ret = g_strdup_printf(_("Scanning folders in \"%s\""), name); - g_free(name); + g_free (name); return ret; } @@ -243,7 +243,7 @@ folder_tree_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m) /* If we had an error, then we need to re-set the * load subdirs state and collapse the node. */ if (!m->fi && m->base.error != NULL) { - gtk_tree_store_set( + gtk_tree_store_set ( GTK_TREE_STORE (model), &root, COL_BOOL_LOAD_SUBDIRS, TRUE, -1); gtk_tree_view_collapse_row (tree_view, path); @@ -335,7 +335,7 @@ folder_tree_get_folder_info__free (struct _EMFolderTreeGetFolderInfo *m) camel_store_free_folder_info (m->store, m->fi); gtk_tree_row_reference_free (m->root); - g_object_unref(m->folder_tree); + g_object_unref (m->folder_tree); g_object_unref (m->store); g_free (m->top); } @@ -392,7 +392,7 @@ folder_tree_select_func (GtkTreeSelection *selection, return TRUE; if (priv->excluded_func != NULL) - return priv->excluded_func( + return priv->excluded_func ( EM_FOLDER_TREE (tree_view), model, &iter, priv->excluded_data); @@ -418,15 +418,15 @@ folder_tree_select_uri (EMFolderTree *folder_tree, tree_view = GTK_TREE_VIEW (folder_tree); selection = gtk_tree_view_get_selection (tree_view); - gtk_tree_selection_select_path(selection, path); + gtk_tree_selection_select_path (selection, path); if (!priv->cursor_set) { gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE); priv->cursor_set = TRUE; } gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.8f, 0.0f); - g_hash_table_remove(priv->select_uris_table, u->key); - priv->select_uris = g_slist_remove(priv->select_uris, u); - folder_tree_free_select_uri(u); + g_hash_table_remove (priv->select_uris_table, u->key); + priv->select_uris = g_slist_remove (priv->select_uris, u); + folder_tree_free_select_uri (u); } static void @@ -496,9 +496,9 @@ folder_tree_expand_node (const gchar *key, path = gtk_tree_row_reference_get_path (row); gtk_tree_view_expand_to_path (tree_view, path); - u = g_hash_table_lookup(folder_tree->priv->select_uris_table, key); + u = g_hash_table_lookup (folder_tree->priv->select_uris_table, key); if (u) - folder_tree_select_uri(folder_tree, path, u); + folder_tree_select_uri (folder_tree, path, u); gtk_tree_path_free (path); } @@ -535,14 +535,14 @@ folder_tree_maybe_expand_row (EMFolderTreeModel *model, key = g_strdup_printf ("local/%s", full_name ? full_name : ""); } - u = g_hash_table_lookup(priv->select_uris_table, key); + u = g_hash_table_lookup (priv->select_uris_table, key); if (u) { gchar *c = strrchr (key, '/'); *c = '\0'; folder_tree_expand_node (key, folder_tree); - folder_tree_select_uri(folder_tree, tree_path, u); + folder_tree_select_uri (folder_tree, tree_path, u); } g_free (full_name); @@ -550,15 +550,15 @@ folder_tree_maybe_expand_row (EMFolderTreeModel *model, } static void -folder_tree_clear_selected_list(EMFolderTree *folder_tree) +folder_tree_clear_selected_list (EMFolderTree *folder_tree) { EMFolderTreePrivate *priv = folder_tree->priv; - g_slist_foreach(priv->select_uris, (GFunc) folder_tree_free_select_uri, NULL); - g_slist_free(priv->select_uris); - g_hash_table_destroy(priv->select_uris_table); + g_slist_foreach (priv->select_uris, (GFunc) folder_tree_free_select_uri, NULL); + g_slist_free (priv->select_uris); + g_hash_table_destroy (priv->select_uris_table); priv->select_uris = NULL; - priv->select_uris_table = g_hash_table_new(g_str_hash, g_str_equal); + priv->select_uris_table = g_hash_table_new (g_str_hash, g_str_equal); priv->cursor_set = FALSE; } @@ -1239,7 +1239,7 @@ folder_tree_new (EMFolderTree *folder_tree) folder_tree_select_func, NULL, NULL); gtk_tree_view_set_headers_visible ((GtkTreeView *) tree, FALSE); - gtk_tree_view_set_search_column((GtkTreeView *)tree, COL_STRING_DISPLAY_NAME); + gtk_tree_view_set_search_column ((GtkTreeView *)tree, COL_STRING_DISPLAY_NAME); return (GtkTreeView *) tree; } @@ -1526,10 +1526,10 @@ tree_drag_data_delete (GtkWidget *widget, if (is_store) goto fail; - camel_store_delete_folder(store, full_name, NULL); + camel_store_delete_folder (store, full_name, NULL); fail: - gtk_tree_path_free(src_path); + gtk_tree_path_free (src_path); g_free (full_name); } @@ -1549,7 +1549,7 @@ tree_drag_data_get (GtkWidget *widget, CamelStore *store; GtkTreeIter iter; - if (!priv->drag_row || !(src_path = gtk_tree_row_reference_get_path(priv->drag_row))) + if (!priv->drag_row || !(src_path = gtk_tree_row_reference_get_path (priv->drag_row))) return; model = gtk_tree_view_get_model (GTK_TREE_VIEW (folder_tree)); @@ -1576,20 +1576,20 @@ tree_drag_data_get (GtkWidget *widget, break; case DND_DRAG_TYPE_TEXT_URI_LIST: /* dragging to nautilus or something, probably */ - if ((folder = camel_store_get_folder(store, full_name, 0, NULL))) { - GPtrArray *uids = camel_folder_get_uids(folder); + if ((folder = camel_store_get_folder (store, full_name, 0, NULL))) { + GPtrArray *uids = camel_folder_get_uids (folder); - em_utils_selection_set_urilist(selection, folder, uids); - camel_folder_free_uids(folder, uids); + em_utils_selection_set_urilist (selection, folder, uids); + camel_folder_free_uids (folder, uids); g_object_unref (folder); } break; default: - abort(); + abort (); } fail: - gtk_tree_path_free(src_path); + gtk_tree_path_free (src_path); g_free (full_name); g_free (uri); } @@ -1615,7 +1615,7 @@ struct _DragDataReceivedAsync { }; static void -folder_tree_drop_folder(struct _DragDataReceivedAsync *m) +folder_tree_drop_folder (struct _DragDataReceivedAsync *m) { CamelFolder *folder; CamelStore *parent_store; @@ -1626,7 +1626,7 @@ folder_tree_drop_folder(struct _DragDataReceivedAsync *m) d(printf(" * Drop folder '%s' onto '%s'\n", data, m->full_name)); - if (!(folder = mail_tool_uri_to_folder((gchar *)data, 0, &m->base.error))) + if (!(folder = mail_tool_uri_to_folder ((gchar *)data, 0, &m->base.error))) return; full_name = camel_folder_get_full_name (folder); @@ -1683,7 +1683,7 @@ folder_tree_drop_async__exec (struct _DragDataReceivedAsync *m) /* for types other than folder, we can't drop to the root path */ if (m->info == DND_DROP_TYPE_FOLDER) { /* copy or move (aka rename) a folder */ - folder_tree_drop_folder(m); + folder_tree_drop_folder (m); } else if (m->full_name == NULL) { g_set_error ( &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, @@ -1693,19 +1693,19 @@ folder_tree_drop_async__exec (struct _DragDataReceivedAsync *m) switch (m->info) { case DND_DROP_TYPE_UID_LIST: /* import a list of uids from another evo folder */ - em_utils_selection_get_uidlist(m->selection, folder, m->move, &m->base.error); + em_utils_selection_get_uidlist (m->selection, folder, m->move, &m->base.error); m->moved = m->move && (m->base.error == NULL); break; case DND_DROP_TYPE_MESSAGE_RFC822: /* import a message/rfc822 stream */ - em_utils_selection_get_message(m->selection, folder); + em_utils_selection_get_message (m->selection, folder); break; case DND_DROP_TYPE_TEXT_URI_LIST: /* import an mbox, maildir, or mh folder? */ - em_utils_selection_get_urilist(m->selection, folder); + em_utils_selection_get_urilist (m->selection, folder); break; default: - abort(); + abort (); } g_object_unref (folder); } @@ -1714,9 +1714,9 @@ folder_tree_drop_async__exec (struct _DragDataReceivedAsync *m) static void folder_tree_drop_async__free (struct _DragDataReceivedAsync *m) { - g_object_unref(m->context); + g_object_unref (m->context); g_object_unref (m->store); - g_free(m->full_name); + g_free (m->full_name); gtk_selection_data_free (m->selection); } @@ -1729,7 +1729,7 @@ static MailMsgInfo folder_tree_drop_async_info = { }; static void -tree_drag_data_action(struct _DragDataReceivedAsync *m) +tree_drag_data_action (struct _DragDataReceivedAsync *m) { m->move = m->action == GDK_ACTION_MOVE; mail_msg_unordered_push (m); @@ -1763,17 +1763,17 @@ tree_drag_data_received (GtkWidget *widget, /* this means we are receiving no data */ if (gtk_selection_data_get_data (selection) == NULL) { - gtk_drag_finish(context, FALSE, FALSE, GDK_CURRENT_TIME); + gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME); return; } if (gtk_selection_data_get_length (selection) == -1) { - gtk_drag_finish(context, FALSE, FALSE, GDK_CURRENT_TIME); + gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME); return; } if (!gtk_tree_model_get_iter (model, &iter, dest_path)) { - gtk_drag_finish(context, FALSE, FALSE, GDK_CURRENT_TIME); + gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME); return; } @@ -1791,7 +1791,7 @@ tree_drag_data_received (GtkWidget *widget, m = mail_msg_new (&folder_tree_drop_async_info); m->context = context; - g_object_ref(context); + g_object_ref (context); m->store = store; g_object_ref (store); m->full_name = full_name; @@ -1801,7 +1801,7 @@ tree_drag_data_received (GtkWidget *widget, /* need to copy, goes away once we exit */ m->selection = gtk_selection_data_copy (selection); - tree_drag_data_action(m); + tree_drag_data_action (m); } static gboolean @@ -1870,7 +1870,7 @@ folder_tree_drop_target (EMFolderTree *folder_tree, } if (p->drag_row) { - GtkTreePath *src_path = gtk_tree_row_reference_get_path(p->drag_row); + GtkTreePath *src_path = gtk_tree_row_reference_get_path (p->drag_row); if (src_path) { guint32 src_flags = 0; @@ -1884,15 +1884,15 @@ folder_tree_drop_target (EMFolderTree *folder_tree, /* can't dnd onto itself or below itself - bad things happen, no point dragging to where we were either */ - if (gtk_tree_path_compare(path, src_path) == 0 - || gtk_tree_path_is_descendant(path, src_path) - || (gtk_tree_path_is_ancestor(path, src_path) - && gtk_tree_path_get_depth(path) == gtk_tree_path_get_depth(src_path)-1)) { - gtk_tree_path_free(src_path); + if (gtk_tree_path_compare (path, src_path) == 0 + || gtk_tree_path_is_descendant (path, src_path) + || (gtk_tree_path_is_ancestor (path, src_path) + && gtk_tree_path_get_depth (path) == gtk_tree_path_get_depth (src_path)-1)) { + gtk_tree_path_free (src_path); goto done; } - gtk_tree_path_free(src_path); + gtk_tree_path_free (src_path); if ((src_flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX || (src_flags & CAMEL_FOLDER_SYSTEM) != 0) { @@ -1924,7 +1924,7 @@ folder_tree_drop_target (EMFolderTree *folder_tree, /* FIXME: this is a total hack, but i think all we can do at present */ /* Check for dragging from special folders which can't be moved/copied */ - url = camel_url_new(src_uri, NULL); + url = camel_url_new (src_uri, NULL); url_path = url->fragment?url->fragment:url->path; if (url_path && url_path[0]) { /* don't allow moving any of the the local special folders */ @@ -1958,15 +1958,15 @@ folder_tree_drop_target (EMFolderTree *folder_tree, /* Don't allow copying/moving any vTrash/vJunk * folder nor maildir 'inbox'. */ - if (strcmp(url_path, CAMEL_VTRASH_NAME) == 0 - || strcmp(url_path, CAMEL_VJUNK_NAME) == 0 + if (strcmp (url_path, CAMEL_VTRASH_NAME) == 0 + || strcmp (url_path, CAMEL_VJUNK_NAME) == 0 /* Dont allow drag from maildir 'inbox' */ || strcmp(url_path, ".") == 0) { - camel_url_free(url); + camel_url_free (url); goto done; } } - camel_url_free(url); + camel_url_free (url); /* Search Folders can only be dropped into other Search Folders */ if (strncmp(src_uri, "vfolder:", 8) == 0) { @@ -2270,7 +2270,7 @@ tree_drag_motion (GtkWidget *widget, break; } - gdk_drag_status(context, chosen_action, time); + gdk_drag_status (context, chosen_action, time); return chosen_action != 0; } @@ -2288,10 +2288,10 @@ em_folder_tree_enable_drag_and_drop (EMFolderTree *folder_tree) if (!setup) { for (i=0; i<NUM_DRAG_TYPES; i++) - drag_atoms[i] = gdk_atom_intern(drag_types[i].target, FALSE); + drag_atoms[i] = gdk_atom_intern (drag_types[i].target, FALSE); for (i=0; i<NUM_DROP_TYPES; i++) - drop_atoms[i] = gdk_atom_intern(drop_types[i].target, FALSE); + drop_atoms[i] = gdk_atom_intern (drop_types[i].target, FALSE); setup = 1; } @@ -2362,23 +2362,23 @@ 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)) + 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)); - rows = gtk_tree_selection_get_selected_rows(selection, &model); - for (l=rows; l; l=g_list_next(l)) { + rows = gtk_tree_selection_get_selected_rows (selection, &model); + for (l=rows; l; l=g_list_next (l)) { GtkTreeIter iter; GtkTreePath *path = l->data; - if (gtk_tree_model_get_iter(model, &iter, path)) { + if (gtk_tree_model_get_iter (model, &iter, path)) { gchar *uri; - gtk_tree_model_get(model, &iter, COL_STRING_URI, &uri, -1); + gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, -1); list = g_list_prepend (list, uri); } - gtk_tree_path_free(path); + gtk_tree_path_free (path); } - g_list_free(rows); + g_list_free (rows); return g_list_reverse (list); } @@ -2422,22 +2422,22 @@ em_folder_tree_set_selected_list (EMFolderTree *folder_tree, /* FIXME: need to remove any currently selected stuff? */ if (!expand_only) - folder_tree_clear_selected_list(folder_tree); + folder_tree_clear_selected_list (folder_tree); for (;list;list = list->next) { - struct _selected_uri *u = g_malloc0(sizeof(*u)); + struct _selected_uri *u = g_malloc0 (sizeof (*u)); CamelURL *url; - u->uri = g_strdup(list->data); + u->uri = g_strdup (list->data); u->store = (CamelStore *) camel_session_get_service ( session, u->uri, CAMEL_PROVIDER_STORE, NULL); - url = camel_url_new(u->uri, NULL); + url = camel_url_new (u->uri, NULL); if (u->store == NULL || url == NULL) { if (!expand_only) { u->key = g_strdup_printf("dummy-%d:%s", id++, u->uri); - g_hash_table_insert(priv->select_uris_table, u->key, u); - priv->select_uris = g_slist_append(priv->select_uris, u); + g_hash_table_insert (priv->select_uris_table, u->key, u); + priv->select_uris = g_slist_append (priv->select_uris, u); } } else { const gchar *path; @@ -2454,7 +2454,7 @@ em_folder_tree_set_selected_list (EMFolderTree *folder_tree, /* This makes sure all our parents up to the root are * expanded. FIXME: Why does the expanded state store * this made up path rather than the euri? */ - if ((account = mail_config_get_account_by_source_url(u->uri))) + if ((account = mail_config_get_account_by_source_url (u->uri))) expand_key = g_strdup_printf ("%s/%s", account->uid, path); else if (CAMEL_IS_VEE_STORE (u->store)) expand_key = g_strdup_printf ("vfolder/%s", path); @@ -2462,23 +2462,23 @@ em_folder_tree_set_selected_list (EMFolderTree *folder_tree, expand_key = g_strdup_printf ("local/%s", path); if (!expand_only) { - u->key = g_strdup(expand_key); + u->key = g_strdup (expand_key); - g_hash_table_insert(priv->select_uris_table, u->key, u); - priv->select_uris = g_slist_append(priv->select_uris, u); + g_hash_table_insert (priv->select_uris_table, u->key, u); + priv->select_uris = g_slist_append (priv->select_uris, u); } - end = strrchr(expand_key, '/'); + end = strrchr (expand_key, '/'); do { - folder_tree_expand_node(expand_key, folder_tree); + folder_tree_expand_node (expand_key, folder_tree); *end = 0; - end = strrchr(expand_key, '/'); + end = strrchr (expand_key, '/'); } while (end); - g_free(expand_key); + g_free (expand_key); } if (url) - camel_url_free(url); + camel_url_free (url); } } @@ -2512,10 +2512,10 @@ em_folder_tree_set_selected (EMFolderTree *folder_tree, g_return_if_fail (EM_IS_FOLDER_TREE (folder_tree)); if (uri && uri[0]) - l = g_list_append(l, (gpointer)uri); + l = g_list_append (l, (gpointer)uri); - em_folder_tree_set_selected_list(folder_tree, l, expand_only); - g_list_free(l); + em_folder_tree_set_selected_list (folder_tree, l, expand_only); + g_list_free (l); } void @@ -2532,8 +2532,8 @@ em_folder_tree_select_next_path (EMFolderTree *folder_tree, gboolean skip_read_f g_return_if_fail (EM_IS_FOLDER_TREE (folder_tree)); tree_view = GTK_TREE_VIEW (folder_tree); - selection = gtk_tree_view_get_selection(tree_view); - if (gtk_tree_selection_get_selected(selection, &model, &iter)) { + selection = gtk_tree_view_get_selection (tree_view); + if (gtk_tree_selection_get_selected (selection, &model, &iter)) { current_path = gtk_tree_model_get_path (model, &iter); @@ -2571,7 +2571,7 @@ em_folder_tree_select_next_path (EMFolderTree *folder_tree, gboolean skip_read_f if (!gtk_tree_view_row_expanded (tree_view, path)) gtk_tree_view_expand_to_path (tree_view, path); - gtk_tree_selection_select_path(selection, path); + gtk_tree_selection_select_path (selection, path); if (!priv->cursor_set) { gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE); @@ -2792,7 +2792,7 @@ em_folder_tree_get_selected_folder (EMFolderTree *folder_tree) tree_view = GTK_TREE_VIEW (folder_tree); selection = gtk_tree_view_get_selection (tree_view); - if (gtk_tree_selection_get_selected(selection, &model, &iter)) + if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store, COL_STRING_FULL_NAME, &full_name, -1); @@ -2821,7 +2821,7 @@ em_folder_tree_get_selected_folder_info (EMFolderTree *folder_tree) tree_view = GTK_TREE_VIEW (folder_tree); selection = gtk_tree_view_get_selection (tree_view); - if (gtk_tree_selection_get_selected(selection, &model, &iter)) + if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store, COL_STRING_FULL_NAME, &full_name, COL_STRING_DISPLAY_NAME, &name, diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h index 0da27d3926..18c644bfda 100644 --- a/mail/em-folder-tree.h +++ b/mail/em-folder-tree.h @@ -94,13 +94,13 @@ void em_folder_tree_enable_drag_and_drop (EMFolderTree *folder_tree); void em_folder_tree_set_excluded (EMFolderTree *folder_tree, guint32 flags); -void em_folder_tree_set_excluded_func(EMFolderTree *folder_tree, +void em_folder_tree_set_excluded_func (EMFolderTree *folder_tree, EMFTExcludeFunc exclude, gpointer data); -void em_folder_tree_set_selected_list(EMFolderTree *folder_tree, +void em_folder_tree_set_selected_list (EMFolderTree *folder_tree, GList *list, gboolean expand_only); -GList * em_folder_tree_get_selected_uris(EMFolderTree *folder_tree); +GList * em_folder_tree_get_selected_uris (EMFolderTree *folder_tree); GList * em_folder_tree_get_selected_paths (EMFolderTree *folder_tree); void em_folder_tree_set_selected (EMFolderTree *folder_tree, @@ -112,7 +112,7 @@ void em_folder_tree_select_prev_path (EMFolderTree *folder_tree, gboolean skip_read_folders); void em_folder_tree_edit_selected (EMFolderTree *folder_tree); gchar * em_folder_tree_get_selected_uri (EMFolderTree *folder_tree); -gchar * em_folder_tree_get_selected_path(EMFolderTree *folder_tree); +gchar * em_folder_tree_get_selected_path (EMFolderTree *folder_tree); CamelFolder * em_folder_tree_get_selected_folder (EMFolderTree *folder_tree); CamelFolderInfo * diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index c7fee4b27c..5bcc0326b6 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -180,7 +180,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m) camel_folder_free_uids (fromfolder, uids); if (m->delete && m->base.error == NULL) - camel_folder_sync(fromfolder, TRUE, NULL); + camel_folder_sync (fromfolder, TRUE, NULL); g_object_unref (fromfolder); g_object_unref (tofolder); @@ -246,7 +246,7 @@ static MailMsgInfo copy_folders_info = { }; gint -em_folder_utils_copy_folders(CamelStore *fromstore, const gchar *frombase, CamelStore *tostore, const gchar *tobase, gint delete) +em_folder_utils_copy_folders (CamelStore *fromstore, const gchar *frombase, CamelStore *tostore, const gchar *tobase, gint delete) { struct _EMCopyFolders *m; gint seq; @@ -329,7 +329,7 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data) if (tobase == NULL) tobase = ""; - em_folder_utils_copy_folders(fromstore, cfd->fi->full_name, tostore, tobase, cfd->delete); + em_folder_utils_copy_folders (fromstore, cfd->fi->full_name, tostore, tobase, cfd->delete); camel_url_free (url); fail: @@ -345,7 +345,7 @@ fail: /* tree here is the 'destination' selector, not 'self' */ static gboolean -emfu_copy_folder_exclude(EMFolderTree *tree, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) +emfu_copy_folder_exclude (EMFolderTree *tree, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { struct _copy_folder_data *cfd = data; gint fromvfolder, tovfolder; @@ -356,9 +356,9 @@ emfu_copy_folder_exclude(EMFolderTree *tree, GtkTreeModel *model, GtkTreeIter *i /* handles moving to/from vfolders */ fromvfolder = strncmp(cfd->fi->uri, "vfolder:", 8) == 0; - gtk_tree_model_get(model, iter, COL_STRING_URI, &touri, COL_UINT_FLAGS, &flags, COL_BOOL_IS_STORE, &is_store, -1); + gtk_tree_model_get (model, iter, COL_STRING_URI, &touri, COL_UINT_FLAGS, &flags, COL_BOOL_IS_STORE, &is_store, -1); tovfolder = strncmp(touri, "vfolder:", 8) == 0; - g_free(touri); + g_free (touri); /* moving from vfolder to normal- not allowed */ if (fromvfolder && !tovfolder && cfd->delete) @@ -650,23 +650,23 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer EM_FOLDER_TREE_MODEL (model), store); if (si == NULL) { g_object_unref (store); - g_return_if_reached(); + g_return_if_reached (); } /* HACK: we need to create vfolders using the vfolder editor */ - if (CAMEL_IS_VEE_STORE(store)) { + if (CAMEL_IS_VEE_STORE (store)) { EMVFolderRule *rule; /* ensures vfolder is running */ vfolder_load_storage (); - rule = em_vfolder_rule_new(); - e_filter_rule_set_name((EFilterRule *)rule, path); - vfolder_gui_add_rule(rule); - gtk_widget_destroy((GtkWidget *)emfs); + rule = em_vfolder_rule_new (); + e_filter_rule_set_name ((EFilterRule *)rule, path); + vfolder_gui_add_rule (rule); + gtk_widget_destroy ((GtkWidget *)emfs); } else { /* Temp data to pass to create_folder_real function */ - emcftd = (struct _EMCreateFolderTempData *) g_malloc(sizeof(struct _EMCreateFolderTempData)); + emcftd = (struct _EMCreateFolderTempData *) g_malloc (sizeof (struct _EMCreateFolderTempData)); emcftd->emfs = emfs; emcftd->uri = g_strdup (uri); emcftd->emft = (EMFolderTree *) data; diff --git a/mail/em-format-hook.c b/mail/em-format-hook.c index cab253f24a..5bc81aa2b4 100644 --- a/mail/em-format-hook.c +++ b/mail/em-format-hook.c @@ -76,39 +76,39 @@ emfh_format_format (EMFormat *md, md, stream, part, item }; - e_plugin_invoke(item->hook->hook.plugin, item->format, &target); + e_plugin_invoke (item->hook->hook.plugin, item->format, &target); } else if (info->old) { - info->old->handler(md, stream, part, info->old, FALSE); + info->old->handler (md, stream, part, info->old, FALSE); } } static void -emfh_free_item(struct _EMFormatHookItem *item) +emfh_free_item (struct _EMFormatHookItem *item) { /* FIXME: remove from formatter class */ - g_free(item->handler.mime_type); - g_free(item->format); - g_free(item); + g_free (item->handler.mime_type); + g_free (item->format); + g_free (item); } static void -emfh_free_group(struct _EMFormatHookGroup *group) +emfh_free_group (struct _EMFormatHookGroup *group) { - g_slist_foreach(group->items, (GFunc)emfh_free_item, NULL); - g_slist_free(group->items); + g_slist_foreach (group->items, (GFunc)emfh_free_item, NULL); + g_slist_free (group->items); - g_free(group->id); - g_free(group); + g_free (group->id); + g_free (group); } static struct _EMFormatHookItem * -emfh_construct_item(EPluginHook *eph, EMFormatHookGroup *group, xmlNodePtr root) +emfh_construct_item (EPluginHook *eph, EMFormatHookGroup *group, xmlNodePtr root) { struct _EMFormatHookItem *item; d(printf(" loading group item\n")); - item = g_malloc0(sizeof(*item)); + item = g_malloc0 (sizeof (*item)); item->handler.mime_type = e_plugin_xml_prop(root, "mime_type"); item->handler.flags = e_plugin_hook_mask(root, emfh_flag_map, "flags"); @@ -125,18 +125,18 @@ emfh_construct_item(EPluginHook *eph, EMFormatHookGroup *group, xmlNodePtr root) return item; error: d(printf("error!\n")); - emfh_free_item(item); + emfh_free_item (item); return NULL; } static struct _EMFormatHookGroup * -emfh_construct_group(EPluginHook *eph, xmlNodePtr root) +emfh_construct_group (EPluginHook *eph, xmlNodePtr root) { struct _EMFormatHookGroup *group; xmlNodePtr node; d(printf(" loading group\n")); - group = g_malloc0(sizeof(*group)); + group = g_malloc0 (sizeof (*group)); group->id = e_plugin_xml_prop(root, "id"); if (group->id == NULL) @@ -147,27 +147,27 @@ emfh_construct_group(EPluginHook *eph, xmlNodePtr root) if (0 == strcmp((gchar *)node->name, "item")) { struct _EMFormatHookItem *item; - item = emfh_construct_item(eph, group, node); + item = emfh_construct_item (eph, group, node); if (item) - group->items = g_slist_append(group->items, item); + group->items = g_slist_append (group->items, item); } node = node->next; } return group; error: - emfh_free_group(group); + emfh_free_group (group); return NULL; } static gint -emfh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) +emfh_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root) { xmlNodePtr node; d(printf("loading format hook\n")); - if (((EPluginHookClass *)emfh_parent_class)->construct(eph, ep, root) == -1) + if (((EPluginHookClass *)emfh_parent_class)->construct (eph, ep, root) == -1) return -1; node = root->children; @@ -175,26 +175,26 @@ emfh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) if (strcmp((gchar *)node->name, "group") == 0) { struct _EMFormatHookGroup *group; - group = emfh_construct_group(eph, node); + group = emfh_construct_group (eph, node); if (group) { EMFormatClass *klass; if (emfh_types - && (klass = g_hash_table_lookup(emfh_types, group->id))) { + && (klass = g_hash_table_lookup (emfh_types, group->id))) { GSList *l = group->items; - for (;l;l=g_slist_next(l)) { + for (;l;l=g_slist_next (l)) { EMFormatHookItem *item = l->data; /* TODO: only add handlers if enabled? */ /* Well, disabling is handled by the callback, * if we leave as is, then we can enable the * plugin after startup and it will start * working automagically */ - em_format_class_add_handler(klass, &item->handler); + em_format_class_add_handler (klass, &item->handler); } } /* We don't actually need to keep this around once its set on the class */ - emfh->groups = g_slist_append(emfh->groups, group); + emfh->groups = g_slist_append (emfh->groups, group); } } node = node->next; @@ -203,12 +203,12 @@ emfh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) eph->plugin = ep; /* Load the plugin as it does a few thing in the formatter thread. */ - ((EPluginClass *)G_OBJECT_GET_CLASS(ep))->enable (ep, 1); + ((EPluginClass *)G_OBJECT_GET_CLASS (ep))->enable (ep, 1); return 0; } static void -emfh_enable(EPluginHook *eph, gint state) +emfh_enable (EPluginHook *eph, gint state) { GSList *g, *l; EMFormatClass *klass; @@ -217,34 +217,34 @@ emfh_enable(EPluginHook *eph, gint state) if (emfh_types == NULL) return; - for (;g;g=g_slist_next(g)) { + for (;g;g=g_slist_next (g)) { struct _EMFormatHookGroup *group = g->data; - klass = g_hash_table_lookup(emfh_types, group->id); - for (l=group->items;l;l=g_slist_next(l)) { + klass = g_hash_table_lookup (emfh_types, group->id); + for (l=group->items;l;l=g_slist_next (l)) { EMFormatHookItem *item = l->data; if (state) - em_format_class_add_handler(klass, &item->handler); + em_format_class_add_handler (klass, &item->handler); else - em_format_class_remove_handler(klass, &item->handler); + em_format_class_remove_handler (klass, &item->handler); } } } static void -emfh_finalise(GObject *o) +emfh_finalise (GObject *o) { EPluginHook *eph = (EPluginHook *)o; - g_slist_foreach(emfh->groups, (GFunc)emfh_free_group, NULL); - g_slist_free(emfh->groups); + g_slist_foreach (emfh->groups, (GFunc)emfh_free_group, NULL); + g_slist_free (emfh->groups); - ((GObjectClass *)emfh_parent_class)->finalize(o); + ((GObjectClass *)emfh_parent_class)->finalize (o); } static void -emfh_class_init(EPluginHookClass *klass) +emfh_class_init (EPluginHookClass *klass) { ((GObjectClass *)klass)->finalize = emfh_finalise; klass->construct = emfh_construct; @@ -253,32 +253,32 @@ emfh_class_init(EPluginHookClass *klass) } GType -em_format_hook_get_type(void) +em_format_hook_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { - sizeof(EMFormatHookClass), NULL, NULL, (GClassInitFunc) emfh_class_init, NULL, NULL, - sizeof(EMFormatHook), 0, (GInstanceInitFunc) NULL, + sizeof (EMFormatHookClass), NULL, NULL, (GClassInitFunc) emfh_class_init, NULL, NULL, + sizeof (EMFormatHook), 0, (GInstanceInitFunc) NULL, }; - emfh_parent_class = g_type_class_ref(e_plugin_hook_get_type()); + emfh_parent_class = g_type_class_ref (e_plugin_hook_get_type ()); type = g_type_register_static(e_plugin_hook_get_type(), "EMFormatHook", &info, 0); } return type; } -void em_format_hook_register_type(GType type) +void em_format_hook_register_type (GType type) { EMFormatClass *klass; if (emfh_types == NULL) - emfh_types = g_hash_table_new(g_str_hash, g_str_equal); + emfh_types = g_hash_table_new (g_str_hash, g_str_equal); d(printf("registering formatter type '%s'\n", g_type_name(type))); - klass = g_type_class_ref(type); - g_hash_table_insert(emfh_types, (gpointer)g_type_name(type), klass); + klass = g_type_class_ref (type); + g_hash_table_insert (emfh_types, (gpointer)g_type_name (type), klass); } diff --git a/mail/em-format-hook.h b/mail/em-format-hook.h index c03a826731..ad0745bc2e 100644 --- a/mail/em-format-hook.h +++ b/mail/em-format-hook.h @@ -80,10 +80,10 @@ struct _EMFormatHookClass { GHashTable *format_classes; }; -GType em_format_hook_get_type(void); +GType em_format_hook_get_type (void); /* register a type as a possible formatter hook point */ -void em_format_hook_register_type(GType type); +void em_format_hook_register_type (GType type); G_END_DECLS diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index b2661b67c0..aab7ef84c2 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -108,8 +108,8 @@ static const gchar *smime_sign_colour[5] = { "", " bgcolor=\"#88bb88\"", " bgcolor=\"#bb8888\"", " bgcolor=\"#e8d122\"","" }; -static void efhd_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri); -static void efhd_message_add_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info); +static void efhd_attachment_frame (EMFormat *emf, CamelStream *stream, EMFormatPURI *puri); +static void efhd_message_add_bar (EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info); static gboolean efhd_attachment_button (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject); static gboolean efhd_attachment_optional (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *object); @@ -146,9 +146,9 @@ struct _attach_puri { camel_cipher_validity_encrypt_t encrypt; }; -static void efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info); +static void efhd_message_prefix (EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info); -static void efhd_builtin_init(EMFormatHTMLDisplayClass *efhc); +static void efhd_builtin_init (EMFormatHTMLDisplayClass *efhc); static gpointer parent_class; @@ -158,8 +158,8 @@ efhd_xpkcs7mime_free (EMFormatHTMLPObject *o) struct _smime_pobject *po = (struct _smime_pobject *)o; if (po->widget) - gtk_widget_destroy(po->widget); - camel_cipher_validity_free(po->valid); + gtk_widget_destroy (po->widget); + camel_cipher_validity_free (po->valid); } static void @@ -183,16 +183,16 @@ efhd_xpkcs7mime_viewcert_clicked (GtkWidget *button, ec = e_cert_new (CERT_DupCertificate (info->cert_data)); if (ec != NULL) { - GtkWidget *w = certificate_viewer_show(ec); + GtkWidget *w = certificate_viewer_show (ec); /* oddly enough certificate_viewer_show doesn't ... */ - gtk_widget_show(w); + gtk_widget_show (w); g_signal_connect(w, "response", G_CALLBACK(gtk_widget_destroy), NULL); if (w && po->widget) gtk_window_set_transient_for ((GtkWindow *)w, (GtkWindow *)po->widget); - g_object_unref(ec); + g_object_unref (ec); } else { g_warning("can't find certificate for %s <%s>", info->name?info->name:"", info->email?info->email:""); } @@ -205,7 +205,7 @@ efhd_xpkcs7mime_add_cert_table (GtkWidget *vbox, struct _smime_pobject *po) { CamelCipherCertInfo *info = (CamelCipherCertInfo *)certlist->head; - GtkTable *table = (GtkTable *)gtk_table_new(camel_dlist_length(certlist), 2, FALSE); + GtkTable *table = (GtkTable *)gtk_table_new (camel_dlist_length (certlist), 2, FALSE); gint n = 0; while (info->next) { @@ -213,7 +213,7 @@ efhd_xpkcs7mime_add_cert_table (GtkWidget *vbox, const gchar *l = NULL; if (info->name) { - if (info->email && strcmp(info->name, info->email) != 0) + if (info->email && strcmp (info->name, info->email) != 0) l = la = g_strdup_printf("%s <%s>", info->name, info->email); else l = info->name; @@ -227,13 +227,13 @@ efhd_xpkcs7mime_add_cert_table (GtkWidget *vbox, #if defined(HAVE_NSS) ECert *ec = NULL; #endif - w = gtk_label_new(l); - gtk_misc_set_alignment((GtkMisc *)w, 0.0, 0.5); - g_free(la); - gtk_table_attach(table, w, 0, 1, n, n+1, GTK_FILL, GTK_FILL, 3, 3); + w = gtk_label_new (l); + gtk_misc_set_alignment ((GtkMisc *)w, 0.0, 0.5); + g_free (la); + gtk_table_attach (table, w, 0, 1, n, n+1, GTK_FILL, GTK_FILL, 3, 3); #if defined(HAVE_NSS) w = gtk_button_new_with_mnemonic(_("_View Certificate")); - gtk_table_attach(table, w, 1, 2, n, n+1, 0, 0, 3, 3); + gtk_table_attach (table, w, 1, 2, n, n+1, 0, 0, 3, 3); g_object_set_data((GObject *)w, "e-cert-info", info); g_signal_connect(w, "clicked", G_CALLBACK(efhd_xpkcs7mime_viewcert_clicked), po); @@ -241,12 +241,12 @@ efhd_xpkcs7mime_add_cert_table (GtkWidget *vbox, ec = e_cert_new (CERT_DupCertificate (info->cert_data)); if (ec == NULL) - gtk_widget_set_sensitive(w, FALSE); + gtk_widget_set_sensitive (w, FALSE); else - g_object_unref(ec); + g_object_unref (ec); #else w = gtk_label_new (_("This certificate is not viewable")); - gtk_table_attach(table, w, 1, 2, n, n+1, 0, 0, 3, 3); + gtk_table_attach (table, w, 1, 2, n, n+1, 0, 0, 3, 3); #endif n++; } @@ -254,7 +254,7 @@ efhd_xpkcs7mime_add_cert_table (GtkWidget *vbox, info = info->next; } - gtk_box_pack_start((GtkBox *)vbox, (GtkWidget *)table, TRUE, TRUE, 6); + gtk_box_pack_start ((GtkBox *)vbox, (GtkWidget *)table, TRUE, TRUE, 6); } static void @@ -276,15 +276,15 @@ efhd_xpkcs7mime_validity_clicked (GtkWidget *button, vbox = e_builder_get_widget(builder, "signature_vbox"); w = gtk_label_new (_(smime_sign_table[po->valid->sign.status].description)); - gtk_misc_set_alignment((GtkMisc *)w, 0.0, 0.5); - gtk_label_set_line_wrap((GtkLabel *)w, TRUE); - gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6); + gtk_misc_set_alignment ((GtkMisc *)w, 0.0, 0.5); + gtk_label_set_line_wrap ((GtkLabel *)w, TRUE); + gtk_box_pack_start ((GtkBox *)vbox, w, TRUE, TRUE, 6); if (po->valid->sign.description) { GtkTextBuffer *buffer; - buffer = gtk_text_buffer_new(NULL); - gtk_text_buffer_set_text(buffer, po->valid->sign.description, strlen(po->valid->sign.description)); - w = g_object_new(gtk_scrolled_window_get_type(), + buffer = gtk_text_buffer_new (NULL); + gtk_text_buffer_set_text (buffer, po->valid->sign.description, strlen (po->valid->sign.description)); + w = g_object_new (gtk_scrolled_window_get_type (), "hscrollbar_policy", GTK_POLICY_AUTOMATIC, "vscrollbar_policy", GTK_POLICY_AUTOMATIC, "shadow_type", GTK_SHADOW_IN, @@ -296,27 +296,27 @@ efhd_xpkcs7mime_validity_clicked (GtkWidget *button, "height_request", 160, NULL), NULL); - g_object_unref(buffer); + g_object_unref (buffer); - gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6); + gtk_box_pack_start ((GtkBox *)vbox, w, TRUE, TRUE, 6); } - if (!camel_dlist_empty(&po->valid->sign.signers)) - efhd_xpkcs7mime_add_cert_table(vbox, &po->valid->sign.signers, po); + if (!camel_dlist_empty (&po->valid->sign.signers)) + efhd_xpkcs7mime_add_cert_table (vbox, &po->valid->sign.signers, po); - gtk_widget_show_all(vbox); + gtk_widget_show_all (vbox); vbox = e_builder_get_widget(builder, "encryption_vbox"); - w = gtk_label_new(_(smime_encrypt_table[po->valid->encrypt.status].description)); - gtk_misc_set_alignment((GtkMisc *)w, 0.0, 0.5); - gtk_label_set_line_wrap((GtkLabel *)w, TRUE); - gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6); + w = gtk_label_new (_(smime_encrypt_table[po->valid->encrypt.status].description)); + gtk_misc_set_alignment ((GtkMisc *)w, 0.0, 0.5); + gtk_label_set_line_wrap ((GtkLabel *)w, TRUE); + gtk_box_pack_start ((GtkBox *)vbox, w, TRUE, TRUE, 6); if (po->valid->encrypt.description) { GtkTextBuffer *buffer; - buffer = gtk_text_buffer_new(NULL); - gtk_text_buffer_set_text(buffer, po->valid->encrypt.description, strlen(po->valid->encrypt.description)); - w = g_object_new(gtk_scrolled_window_get_type(), + buffer = gtk_text_buffer_new (NULL); + gtk_text_buffer_set_text (buffer, po->valid->encrypt.description, strlen (po->valid->encrypt.description)); + w = g_object_new (gtk_scrolled_window_get_type (), "hscrollbar_policy", GTK_POLICY_AUTOMATIC, "vscrollbar_policy", GTK_POLICY_AUTOMATIC, "shadow_type", GTK_SHADOW_IN, @@ -328,20 +328,20 @@ efhd_xpkcs7mime_validity_clicked (GtkWidget *button, "height_request", 160, NULL), NULL); - g_object_unref(buffer); + g_object_unref (buffer); - gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6); + gtk_box_pack_start ((GtkBox *)vbox, w, TRUE, TRUE, 6); } - if (!camel_dlist_empty(&po->valid->encrypt.encrypters)) - efhd_xpkcs7mime_add_cert_table(vbox, &po->valid->encrypt.encrypters, po); + if (!camel_dlist_empty (&po->valid->encrypt.encrypters)) + efhd_xpkcs7mime_add_cert_table (vbox, &po->valid->encrypt.encrypters, po); - gtk_widget_show_all(vbox); + gtk_widget_show_all (vbox); - g_object_unref(builder); + g_object_unref (builder); g_signal_connect(po->widget, "response", G_CALLBACK(efhd_xpkcs7mime_info_response), po); - gtk_widget_show(po->widget); + gtk_widget_show (po->widget); } static gboolean @@ -508,7 +508,7 @@ efhd_format_optional (EMFormat *emf, stream, "<td><object classid=\"%s\"></object>" "</td></tr></table>", classid); - g_free(html); + g_free (html); camel_stream_write_string (stream, EM_FORMAT_HTML_VPAD, NULL); @@ -543,7 +543,7 @@ efhd_format_secure (EMFormat *emf, pobj = (struct _smime_pobject *) em_format_html_add_pobject ( EM_FORMAT_HTML (emf), sizeof (*pobj), classid, part, efhd_xpkcs7mime_button); - pobj->valid = camel_cipher_validity_clone(valid); + pobj->valid = camel_cipher_validity_clone (valid); pobj->object.free = efhd_xpkcs7mime_free; camel_stream_printf ( stream, "<td valign=center><object classid=\"%s\">" @@ -665,27 +665,27 @@ static EMFormatHandler type_builtin_table[] = { }; static void -efhd_builtin_init(EMFormatHTMLDisplayClass *efhc) +efhd_builtin_init (EMFormatHTMLDisplayClass *efhc) { gint i; for (i = 0; i < G_N_ELEMENTS (type_builtin_table); i++) - em_format_class_add_handler((EMFormatClass *)efhc, &type_builtin_table[i]); + em_format_class_add_handler ((EMFormatClass *)efhc, &type_builtin_table[i]); } static void -efhd_write_image(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) +efhd_write_image (EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) { CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *)puri->part); /* TODO: identical to efh_write_image */ d(printf("writing image '%s'\n", puri->cid)); - camel_data_wrapper_decode_to_stream(dw, stream, NULL); - camel_stream_close(stream, NULL); + camel_data_wrapper_decode_to_stream (dw, stream, NULL); + camel_stream_close (stream, NULL); } static void -efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) +efhd_message_prefix (EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { const gchar *flag, *comp, *due; time_t date; @@ -711,8 +711,8 @@ efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMF classid = g_strdup_printf("icon:///em-format-html-display/%s/%s", emf->part_id->str, comp&&comp[0]?"comp":"uncomp"); camel_stream_printf(stream, "<td align=\"left\"><img src=\"%s\"></td>", classid); - (void)em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efhd_write_image); - g_free(classid); + (void)em_format_add_puri (emf, sizeof (EMFormatPURI), classid, iconpart, efhd_write_image); + g_free (classid); g_object_unref (iconpart); } } @@ -727,8 +727,8 @@ efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMF } else if ((due = camel_folder_get_message_user_tag(emf->folder, emf->uid, "due-by")) != NULL && due[0]) { time_t now; - date = camel_header_decode_date(due, NULL); - now = time(NULL); + date = camel_header_decode_date (due, NULL); + now = time (NULL); if (now > date) camel_stream_printf(stream, "<b>%s</b> ", _("Overdue:")); @@ -770,7 +770,7 @@ efhd_attachment_button_expanded (EAttachmentButton *button, /* attachment button callback */ static gboolean -efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) +efhd_attachment_button (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) { EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)efh; struct _attach_puri *info; @@ -801,7 +801,7 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje camel_message_info_free (mi); } - info = (struct _attach_puri *)em_format_find_puri((EMFormat *)efh, pobject->classid); + info = (struct _attach_puri *)em_format_find_puri ((EMFormat *)efh, pobject->classid); if (!info || info->forward) { g_warning ("unable to expand the attachment\n"); @@ -966,7 +966,7 @@ efhd_resize (GtkWidget *w, GtkAllocation *event, EMFormatHTML *efh) /* optional render attachment button callback */ static gboolean -efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) +efhd_attachment_optional (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) { struct _attach_puri *info; GtkWidget *hbox, *vbox, *button, *mainbox, *scroll, *label, *img; @@ -980,16 +980,16 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb /* FIXME: handle default shown case */ d(printf("adding attachment button/content for optional rendering\n")); - info = (struct _attach_puri *)em_format_find_puri((EMFormat *)efh, pobject->classid); + info = (struct _attach_puri *)em_format_find_puri ((EMFormat *)efh, pobject->classid); if (!info || info->forward) { g_warning ("unable to expand the attachment\n"); return TRUE; } scroll = gtk_scrolled_window_new (NULL, NULL); - mainbox = gtk_hbox_new(FALSE, 0); + mainbox = gtk_hbox_new (FALSE, 0); - button = gtk_button_new(); + button = gtk_button_new (); hbox = gtk_hbox_new (FALSE, 0); img = gtk_image_new_from_icon_name ( "stock_show-all", GTK_ICON_SIZE_BUTTON); @@ -1002,37 +1002,37 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb if (info->handle) g_signal_connect(G_OBJECT (button), "clicked", G_CALLBACK(efhd_optional_button_show), scroll); else { - gtk_widget_set_sensitive(button, FALSE); + gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_can_focus (button, FALSE); } vbox = gtk_vbox_new (FALSE, 0); - gtk_box_pack_start(GTK_BOX (mainbox), button, FALSE, FALSE, 6); + gtk_box_pack_start (GTK_BOX (mainbox), button, FALSE, FALSE, 6); - button = gtk_button_new(); + button = gtk_button_new (); hbox = gtk_hbox_new (FALSE, 0); img = gtk_image_new_from_stock ( GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON); label = gtk_label_new_with_mnemonic(_("O_pen With")); gtk_box_pack_start (GTK_BOX (hbox), img, TRUE, TRUE, 2); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 2); - gtk_box_pack_start (GTK_BOX (hbox), gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE), TRUE, TRUE, 2); + gtk_box_pack_start (GTK_BOX (hbox), gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE), TRUE, TRUE, 2); gtk_widget_show_all (hbox); gtk_container_add (GTK_CONTAINER (button), GTK_WIDGET (hbox)); a11y = gtk_widget_get_accessible (button); atk_object_set_name (a11y, _("Attachment")); - gtk_box_pack_start(GTK_BOX (mainbox), button, FALSE, FALSE, 6); + gtk_box_pack_start (GTK_BOX (mainbox), button, FALSE, FALSE, 6); - gtk_widget_show_all(mainbox); + gtk_widget_show_all (mainbox); - gtk_box_pack_start(GTK_BOX (vbox), mainbox, FALSE, FALSE, 6); + gtk_box_pack_start (GTK_BOX (vbox), mainbox, FALSE, FALSE, 6); view = gtk_text_view_new (); gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE); - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (view)); + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); byte_array = camel_stream_mem_get_byte_array (info->mstream); gtk_text_buffer_set_text ( buffer, (gchar *) byte_array->data, byte_array->len); @@ -1042,8 +1042,8 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (scroll), GTK_WIDGET (view)); - gtk_box_pack_start(GTK_BOX (vbox), scroll, TRUE, TRUE, 6); - gtk_widget_show (GTK_WIDGET(view)); + gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 6); + gtk_widget_show (GTK_WIDGET (view)); web_view = em_format_html_get_web_view (efh); gtk_widget_get_allocation (GTK_WIDGET (web_view), &allocation); @@ -1055,7 +1055,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb gtk_widget_hide (scroll); gtk_widget_show (vbox); - gtk_container_add(GTK_CONTAINER (eb), vbox); + gtk_container_add (GTK_CONTAINER (eb), vbox); info->handle = NULL; return TRUE; diff --git a/mail/em-format-html-print.h b/mail/em-format-html-print.h index 2abdc82178..7b05d7a28e 100644 --- a/mail/em-format-html-print.h +++ b/mail/em-format-html-print.h @@ -66,7 +66,7 @@ EMFormatHTMLPrint * void em_format_html_print_message (EMFormatHTMLPrint *efhp, CamelFolder *folder, const gchar *uid); -void em_format_html_print_raw_message(EMFormatHTMLPrint *efhp, +void em_format_html_print_raw_message (EMFormatHTMLPrint *efhp, CamelMimeMessage *msg); G_END_DECLS diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 8962de2c36..327adc55e5 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -118,17 +118,17 @@ enum { PROP_WEB_VIEW }; -static void efh_url_requested(GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMFormatHTML *efh); -static gboolean efh_object_requested(GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTML *efh); -static void efh_gtkhtml_destroy(GtkHTML *html, EMFormatHTML *efh); +static void efh_url_requested (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMFormatHTML *efh); +static gboolean efh_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTML *efh); +static void efh_gtkhtml_destroy (GtkHTML *html, EMFormatHTML *efh); -static void efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info); +static void efh_format_message (EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info); -static void efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid); +static void efh_format_secure (EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid); -static void efh_builtin_init(EMFormatHTMLClass *efhc); +static void efh_builtin_init (EMFormatHTMLClass *efhc); -static void efh_write_image(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri); +static void efh_write_image (EMFormat *emf, CamelStream *stream, EMFormatPURI *puri); static gpointer parent_class; static CamelDataCache *emfh_http_cache; @@ -206,16 +206,16 @@ efh_format_exec (struct _format_msg *m) (CamelMimePart *) m->message, handle, FALSE); } - camel_stream_flush((CamelStream *)m->estream, NULL); + camel_stream_flush ((CamelStream *)m->estream, NULL); puri_level = format->pending_uri_level; base = format->base; do { /* now dispatch any added tasks ... */ - g_mutex_lock(m->format->priv->lock); + g_mutex_lock (m->format->priv->lock); while ((job = g_queue_pop_head (&m->format->priv->pending_jobs))) { - g_mutex_unlock(m->format->priv->lock); + g_mutex_unlock (m->format->priv->lock); /* This is an implicit check to see if the gtkhtml has been destroyed */ if (!cancelled) @@ -223,7 +223,7 @@ efh_format_exec (struct _format_msg *m) /* Now do an explicit check for user cancellation */ if (!cancelled) - cancelled = camel_operation_cancel_check(NULL); + cancelled = camel_operation_cancel_check (NULL); /* call jobs even if cancelled, so they can clean up resources */ format->pending_uri_level = job->puri_level; @@ -235,12 +235,12 @@ efh_format_exec (struct _format_msg *m) /* clean up the job */ g_object_unref (job->stream); if (job->base) - camel_url_free(job->base); - g_free(job); + camel_url_free (job->base); + g_free (job); - g_mutex_lock(m->format->priv->lock); + g_mutex_lock (m->format->priv->lock); } - g_mutex_unlock(m->format->priv->lock); + g_mutex_unlock (m->format->priv->lock); if (m->estream) { /* Closing this base stream can queue more jobs, so we need @@ -249,7 +249,7 @@ efh_format_exec (struct _format_msg *m) camel_stream_write_string ( (CamelStream *) m->estream, "</body>\n</html>\n", NULL); - camel_stream_close((CamelStream *)m->estream, NULL); + camel_stream_close ((CamelStream *)m->estream, NULL); g_object_unref (m->estream); m->estream = NULL; } @@ -276,18 +276,18 @@ static void efh_format_free (struct _format_msg *m) { d(printf("formatter freed\n")); - g_object_unref(m->format); + g_object_unref (m->format); if (m->estream) { - camel_stream_close((CamelStream *)m->estream, NULL); + camel_stream_close ((CamelStream *)m->estream, NULL); g_object_unref (m->estream); } if (m->folder) g_object_unref (m->folder); - g_free(m->uid); + g_free (m->uid); if (m->message) g_object_unref (m->message); if (m->format_source) - g_object_unref(m->format_source); + g_object_unref (m->format_source); } static MailMsgInfo efh_format_info = { @@ -299,7 +299,7 @@ static MailMsgInfo efh_format_info = { }; static gboolean -efh_format_timeout(struct _format_msg *m) +efh_format_timeout (struct _format_msg *m) { GtkHTMLStream *hstream; EMFormatHTML *efh = m->format; @@ -309,7 +309,7 @@ efh_format_timeout(struct _format_msg *m) web_view = em_format_html_get_web_view (m->format); if (web_view == NULL) { - mail_msg_unref(m); + mail_msg_unref (m); return FALSE; } @@ -327,24 +327,24 @@ efh_format_timeout(struct _format_msg *m) EM_FORMAT_CLASS (parent_class)->format_clone ( EM_FORMAT (efh), m->folder, m->uid, m->message, m->format_source); - em_format_html_clear_pobject(m->format); + em_format_html_clear_pobject (m->format); /* FIXME: method off EMFormat? */ if (((EMFormat *)efh)->valid) { - camel_cipher_validity_free(((EMFormat *)efh)->valid); + camel_cipher_validity_free (((EMFormat *)efh)->valid); ((EMFormat *)efh)->valid = NULL; ((EMFormat *)efh)->valid_parent = NULL; } if (m->message == NULL) { hstream = gtk_html_begin (GTK_HTML (web_view)); - gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); - mail_msg_unref(m); + gtk_html_stream_close (hstream, GTK_HTML_STREAM_OK); + mail_msg_unref (m); p->last_part = NULL; } else { efh->state = EM_FORMAT_HTML_STATE_RENDERING; #if HAVE_CLUTTER - if (p->last_part != m->message && !e_shell_get_express_mode(e_shell_get_default())) { + if (p->last_part != m->message && !e_shell_get_express_mode (e_shell_get_default ())) { #else if (p->last_part != m->message) { #endif @@ -363,7 +363,7 @@ efh_format_timeout(struct _format_msg *m) | GTK_HTML_BEGIN_BLOCK_UPDATES | GTK_HTML_BEGIN_BLOCK_IMAGES); } else { /* clear cache of inline-scanned text parts */ - g_hash_table_remove_all(p->text_inline_parts); + g_hash_table_remove_all (p->text_inline_parts); p->last_part = m->message; } @@ -379,26 +379,26 @@ efh_format_timeout(struct _format_msg *m) } static void -efh_free_cache(struct _EMFormatHTMLCache *efhc) +efh_free_cache (struct _EMFormatHTMLCache *efhc) { if (efhc->textmp) g_object_unref (efhc->textmp); - g_free(efhc); + g_free (efhc); } static void -efh_gtkhtml_destroy(GtkHTML *html, EMFormatHTML *efh) +efh_gtkhtml_destroy (GtkHTML *html, EMFormatHTML *efh) { if (efh->priv->format_timeout_id != 0) { - g_source_remove(efh->priv->format_timeout_id); + g_source_remove (efh->priv->format_timeout_id); efh->priv->format_timeout_id = 0; - mail_msg_unref(efh->priv->format_timeout_msg); + mail_msg_unref (efh->priv->format_timeout_msg); efh->priv->format_timeout_msg = NULL; } /* This probably works ... */ if (efh->priv->format_id != -1) - mail_msg_cancel(efh->priv->format_id); + mail_msg_cancel (efh->priv->format_id); if (efh->priv->web_view != NULL) { g_object_unref (efh->priv->web_view); @@ -407,13 +407,13 @@ efh_gtkhtml_destroy(GtkHTML *html, EMFormatHTML *efh) } static struct _EMFormatHTMLCache * -efh_insert_cache(EMFormatHTML *efh, const gchar *partid) +efh_insert_cache (EMFormatHTML *efh, const gchar *partid) { struct _EMFormatHTMLCache *efhc; - efhc = g_malloc0(sizeof(*efh) + strlen(partid)); - strcpy(efhc->partid, partid); - g_hash_table_insert(efh->priv->text_inline_parts, efhc->partid, efhc); + efhc = g_malloc0 (sizeof (*efh) + strlen (partid)); + strcpy (efhc->partid, partid); + g_hash_table_insert (efh->priv->text_inline_parts, efhc->partid, efhc); return efhc; } @@ -633,9 +633,9 @@ efh_format_clone (EMFormat *emf, d(printf("efh_format called\n")); if (efh->priv->format_timeout_id != 0) { d(printf(" timeout for last still active, removing ...\n")); - g_source_remove(efh->priv->format_timeout_id); + g_source_remove (efh->priv->format_timeout_id); efh->priv->format_timeout_id = 0; - mail_msg_unref(efh->priv->format_timeout_msg); + mail_msg_unref (efh->priv->format_timeout_msg); efh->priv->format_timeout_msg = NULL; } @@ -731,7 +731,7 @@ efh_format_attachment (EMFormat *emf, NULL); /* output some info about it */ - text = em_format_describe_part(part, mime_type); + text = em_format_describe_part (part, mime_type); html = camel_text_to_html ( text, ((EMFormatHTML *)emf)->text_html_flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0); @@ -916,8 +916,8 @@ efh_class_init (EMFormatHTMLClass *class) user_cache_dir = e_get_user_cache_dir (); emfh_http_cache = camel_data_cache_new (user_cache_dir, NULL); if (emfh_http_cache) { - camel_data_cache_set_expire_age(emfh_http_cache, 24*60*60); - camel_data_cache_set_expire_access(emfh_http_cache, 2*60*60); + camel_data_cache_set_expire_age (emfh_http_cache, 24*60*60); + camel_data_cache_set_expire_access (emfh_http_cache, 2*60*60); } } @@ -932,7 +932,7 @@ efh_init (EMFormatHTML *efh, g_queue_init (&efh->pending_object_list); g_queue_init (&efh->priv->pending_jobs); - efh->priv->lock = g_mutex_new(); + efh->priv->lock = g_mutex_new (); efh->priv->format_id = -1; efh->priv->text_inline_parts = g_hash_table_new_full ( g_str_hash, g_str_equal, @@ -1215,27 +1215,27 @@ em_format_html_set_show_real_date (EMFormatHTML *efh, } CamelMimePart * -em_format_html_file_part(EMFormatHTML *efh, const gchar *mime_type, const gchar *filename) +em_format_html_file_part (EMFormatHTML *efh, const gchar *mime_type, const gchar *filename) { CamelMimePart *part; CamelStream *stream; CamelDataWrapper *dw; gchar *basename; - stream = camel_stream_fs_new_with_name(filename, O_RDONLY, 0, NULL); + stream = camel_stream_fs_new_with_name (filename, O_RDONLY, 0, NULL); if (stream == NULL) return NULL; - dw = camel_data_wrapper_new(); - camel_data_wrapper_construct_from_stream(dw, stream, NULL); + dw = camel_data_wrapper_new (); + camel_data_wrapper_construct_from_stream (dw, stream, NULL); g_object_unref (stream); if (mime_type) - camel_data_wrapper_set_mime_type(dw, mime_type); - part = camel_mime_part_new(); + camel_data_wrapper_set_mime_type (dw, mime_type); + part = camel_mime_part_new (); camel_medium_set_content ((CamelMedium *)part, dw); g_object_unref (dw); basename = g_path_get_basename (filename); - camel_mime_part_set_filename(part, basename); + camel_mime_part_set_filename (part, basename); g_free (basename); return part; @@ -1244,18 +1244,18 @@ em_format_html_file_part(EMFormatHTML *efh, const gchar *mime_type, const gchar /* all this api is a pain in the bum ... */ EMFormatHTMLPObject * -em_format_html_add_pobject(EMFormatHTML *efh, gsize size, const gchar *classid, CamelMimePart *part, EMFormatHTMLPObjectFunc func) +em_format_html_add_pobject (EMFormatHTML *efh, gsize size, const gchar *classid, CamelMimePart *part, EMFormatHTMLPObjectFunc func) { EMFormatHTMLPObject *pobj; - if (size < sizeof(EMFormatHTMLPObject)) { + if (size < sizeof (EMFormatHTMLPObject)) { g_warning ("size is less than the size of EMFormatHTMLPObject\n"); - size = sizeof(EMFormatHTMLPObject); + size = sizeof (EMFormatHTMLPObject); } - pobj = g_malloc0(size); + pobj = g_malloc0 (size); if (classid) - pobj->classid = g_strdup(classid); + pobj->classid = g_strdup (classid); else pobj->classid = g_strdup_printf("e-object:///%s", ((EMFormat *)efh)->part_id->str); @@ -1344,38 +1344,38 @@ em_format_html_clear_pobject (EMFormatHTML *emf) } struct _EMFormatHTMLJob * -em_format_html_job_new(EMFormatHTML *emfh, void (*callback)(struct _EMFormatHTMLJob *job, gint cancelled), gpointer data) +em_format_html_job_new (EMFormatHTML *emfh, void (*callback)(struct _EMFormatHTMLJob *job, gint cancelled), gpointer data) { - struct _EMFormatHTMLJob *job = g_malloc0(sizeof(*job)); + struct _EMFormatHTMLJob *job = g_malloc0 (sizeof (*job)); job->format = emfh; job->puri_level = ((EMFormat *)emfh)->pending_uri_level; job->callback = callback; job->u.data = data; if (((EMFormat *)emfh)->base) - job->base = camel_url_copy(((EMFormat *)emfh)->base); + job->base = camel_url_copy (((EMFormat *)emfh)->base); return job; } void -em_format_html_job_queue(EMFormatHTML *emfh, struct _EMFormatHTMLJob *job) +em_format_html_job_queue (EMFormatHTML *emfh, struct _EMFormatHTMLJob *job) { - g_mutex_lock(emfh->priv->lock); + g_mutex_lock (emfh->priv->lock); g_queue_push_tail (&emfh->priv->pending_jobs, job); - g_mutex_unlock(emfh->priv->lock); + g_mutex_unlock (emfh->priv->lock); } /* ********************************************************************** */ -static void emfh_getpuri(struct _EMFormatHTMLJob *job, gint cancelled) +static void emfh_getpuri (struct _EMFormatHTMLJob *job, gint cancelled) { d(printf(" running getpuri task\n")); if (!cancelled) - job->u.puri->func((EMFormat *)job->format, job->stream, job->u.puri); + job->u.puri->func ((EMFormat *)job->format, job->stream, job->u.puri); } -static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled) +static void emfh_gethttp (struct _EMFormatHTMLJob *job, gint cancelled) { CamelStream *cistream = NULL, *costream = NULL, *instream = NULL; CamelURL *url; @@ -1386,13 +1386,13 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled) const gchar *length; if (cancelled - || (url = camel_url_new(job->u.uri, NULL)) == NULL) + || (url = camel_url_new (job->u.uri, NULL)) == NULL) goto badurl; d(printf(" running load uri task: %s\n", job->u.uri)); if (emfh_http_cache) - instream = cistream = camel_data_cache_get(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL); + instream = cistream = camel_data_cache_get (emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL); if (instream == NULL) { MailConfigHTTPMode policy; @@ -1403,15 +1403,15 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled) if (!(job->format->priv->load_images_now || policy == MAIL_CONFIG_HTTP_ALWAYS || (policy == MAIL_CONFIG_HTTP_SOMETIMES - && em_utils_in_addressbook((CamelInternetAddress *)camel_mime_message_get_from(job->format->parent.message), FALSE)))) { + && em_utils_in_addressbook ((CamelInternetAddress *)camel_mime_message_get_from (job->format->parent.message), FALSE)))) { /* TODO: Ideally we would put the http requests into another queue and only send them out if the user selects 'load images', when they do. The problem is how to maintain this state with multiple renderings, and how to adjust the thread dispatch/setup routine to handle it */ - camel_url_free(url); + camel_url_free (url); goto done; } - instream = camel_http_stream_new(CAMEL_HTTP_METHOD_GET, ((EMFormat *)job->format)->session, url); + instream = camel_http_stream_new (CAMEL_HTTP_METHOD_GET, ((EMFormat *)job->format)->session, url); camel_http_stream_set_user_agent((CamelHttpStream *)instream, "CamelHttpStream/1.0 Evolution/" VERSION); proxy = em_utils_get_proxy_uri (job->u.uri); if (proxy) { @@ -1420,22 +1420,22 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled) } camel_operation_start(NULL, _("Retrieving '%s'"), job->u.uri); tmp_stream = (CamelHttpStream *)instream; - content_type = camel_http_stream_get_content_type(tmp_stream); + content_type = camel_http_stream_get_content_type (tmp_stream); length = camel_header_raw_find(&tmp_stream->headers, "Content-Length", NULL); d(printf(" Content-Length: %s\n", length)); if (length != NULL) - total = atoi(length); - camel_content_type_unref(content_type); + total = atoi (length); + camel_content_type_unref (content_type); } else camel_operation_start_transient(NULL, _("Retrieving '%s'"), job->u.uri); - camel_url_free(url); + camel_url_free (url); if (instream == NULL) goto done; if (emfh_http_cache != NULL && cistream == NULL) - costream = camel_data_cache_add(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL); + costream = camel_data_cache_add (emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL); do { if (camel_operation_cancel_check (NULL)) { @@ -1443,13 +1443,13 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled) break; } /* FIXME: progress reporting in percentage, can we get the length always? do we care? */ - n = camel_stream_read(instream, buffer, sizeof (buffer), NULL); + n = camel_stream_read (instream, buffer, sizeof (buffer), NULL); if (n > 0) { nread += n; /* If we didn't get a valid Content-Length header, do not try to calculate percentage */ if (total != 0) { pc_complete = ((nread * 100) / total); - camel_operation_progress(NULL, pc_complete); + camel_operation_progress (NULL, pc_complete); } d(printf(" read %d bytes\n", n)); if (costream && camel_stream_write (costream, buffer, n, NULL) == -1) { @@ -1457,39 +1457,39 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled) break; } - camel_stream_write(job->stream, buffer, n, NULL); + camel_stream_write (job->stream, buffer, n, NULL); } } while (n>0); /* indicates success */ if (n == 0) - camel_stream_close(job->stream, NULL); + camel_stream_close (job->stream, NULL); if (costream) { /* do not store broken files in a cache */ if (n != 0) - camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL); + camel_data_cache_remove (emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL); g_object_unref (costream); } g_object_unref (instream); done: - camel_operation_end(NULL); + camel_operation_end (NULL); badurl: - g_free(job->u.uri); + g_free (job->u.uri); } /* ********************************************************************** */ static void -efh_url_requested(GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMFormatHTML *efh) +efh_url_requested (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMFormatHTML *efh) { EMFormatPURI *puri; struct _EMFormatHTMLJob *job = NULL; d(printf("url requested, html = %p, url '%s'\n", html, url)); - puri = em_format_find_visible_puri((EMFormat *)efh, url); + puri = em_format_find_visible_puri ((EMFormat *)efh, url); if (puri) { CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *)puri->part); CamelContentType *ct = dw?dw->mime_type:NULL; @@ -1507,14 +1507,14 @@ efh_url_requested(GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMForm puri->use_count++; d(printf(" adding puri job\n")); - job = em_format_html_job_new(efh, emfh_getpuri, puri); + job = em_format_html_job_new (efh, emfh_getpuri, puri); } else { d(printf(" part is unknown type '%s', not using\n", ct?camel_content_type_format(ct):"<unset>")); - gtk_html_stream_close(handle, GTK_HTML_STREAM_ERROR); + gtk_html_stream_close (handle, GTK_HTML_STREAM_ERROR); } } else if (g_ascii_strncasecmp(url, "http:", 5) == 0 || g_ascii_strncasecmp(url, "https:", 6) == 0) { d(printf(" adding job, get %s\n", url)); - job = em_format_html_job_new(efh, emfh_gethttp, g_strdup(url)); + job = em_format_html_job_new (efh, emfh_gethttp, g_strdup (url)); } else if (g_str_has_prefix (url, "file://")) { gchar *data = NULL; gsize length = 0; @@ -1533,19 +1533,19 @@ efh_url_requested(GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMForm g_free (path); } else { d(printf("HTML Includes reference to unknown uri '%s'\n", url)); - gtk_html_stream_close(handle, GTK_HTML_STREAM_ERROR); + gtk_html_stream_close (handle, GTK_HTML_STREAM_ERROR); } if (job) { - job->stream = em_html_stream_new(html, handle); - em_format_html_job_queue(efh, job); + job->stream = em_html_stream_new (html, handle); + em_format_html_job_queue (efh, job); } g_signal_stop_emission_by_name (html, "url-requested"); } static gboolean -efh_object_requested(GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTML *efh) +efh_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTML *efh) { EMFormatHTMLPObject *pobject; gint res = FALSE; @@ -1553,11 +1553,11 @@ efh_object_requested(GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTML *efh) if (eb->classid == NULL) return FALSE; - pobject = em_format_html_find_pobject(efh, eb->classid); + pobject = em_format_html_find_pobject (efh, eb->classid); if (pobject) { /* This stops recursion of the part */ g_queue_remove (&efh->pending_object_list, pobject); - res = pobject->func(efh, eb, pobject); + res = pobject->func (efh, eb, pobject); g_queue_push_head (&efh->pending_object_list, pobject); } else { d(printf("HTML Includes reference to unknown object '%s'\n", eb->classid)); @@ -1596,7 +1596,7 @@ static const gchar *smime_sign_colour[4] = { /* TODO: this could probably be virtual on em-format-html then we only need one version of each type handler */ static void -efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid) +efh_format_secure (EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid) { EMFormatClass *format_class; @@ -1625,14 +1625,14 @@ efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Camel icon = smime_sign_table[valid->sign.status].icon; else icon = smime_encrypt_table[valid->encrypt.status].icon; - iconpath = e_icon_factory_get_icon_filename(icon, GTK_ICON_SIZE_DIALOG); + iconpath = e_icon_factory_get_icon_filename (icon, GTK_ICON_SIZE_DIALOG); iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", iconpath); if (iconpart) { - (void)em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efh_write_image); + (void)em_format_add_puri (emf, sizeof (EMFormatPURI), classid, iconpart, efh_write_image); g_object_unref (iconpart); } g_free (iconpath); - g_free(classid); + g_free (classid); if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) { gchar *signers; @@ -1697,7 +1697,7 @@ efh_text_plain (EMFormatHTML *efh, filters a bit. Perhaps the superclass should just deal with html anyway and be done with it ... */ - efhc = g_hash_table_lookup(efh->priv->text_inline_parts, ((EMFormat *)efh)->part_id->str); + efhc = g_hash_table_lookup (efh->priv->text_inline_parts, ((EMFormat *)efh)->part_id->str); if (efhc == NULL || (mp = efhc->textmp) == NULL) { EMInlineFilter *inline_filter; CamelStream *null; @@ -1706,36 +1706,36 @@ efh_text_plain (EMFormatHTML *efh, /* if we had to snoop the part type to get here, then * use that as the base type, yuck */ if (((EMFormat *)efh)->snoop_mime_type == NULL - || (ct = camel_content_type_decode(((EMFormat *)efh)->snoop_mime_type)) == NULL) { + || (ct = camel_content_type_decode (((EMFormat *)efh)->snoop_mime_type)) == NULL) { ct = dw->mime_type; - camel_content_type_ref(ct); + camel_content_type_ref (ct); } - null = camel_stream_null_new(); + null = camel_stream_null_new (); filtered_stream = camel_stream_filter_new (null); g_object_unref (null); - inline_filter = em_inline_filter_new(camel_mime_part_get_encoding(part), ct); + inline_filter = em_inline_filter_new (camel_mime_part_get_encoding (part), ct); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), CAMEL_MIME_FILTER (inline_filter)); camel_data_wrapper_decode_to_stream ( dw, (CamelStream *)filtered_stream, NULL); - camel_stream_close((CamelStream *)filtered_stream, NULL); + camel_stream_close ((CamelStream *)filtered_stream, NULL); g_object_unref (filtered_stream); - mp = em_inline_filter_get_multipart(inline_filter); + mp = em_inline_filter_get_multipart (inline_filter); if (efhc == NULL) - efhc = efh_insert_cache(efh, ((EMFormat *)efh)->part_id->str); + efhc = efh_insert_cache (efh, ((EMFormat *)efh)->part_id->str); efhc->textmp = mp; g_object_unref (inline_filter); - camel_content_type_unref(ct); + camel_content_type_unref (ct); } rgb = e_color_to_value ( &efh->priv->colors[EM_FORMAT_HTML_COLOR_CITATION]); filtered_stream = camel_stream_filter_new (stream); - html_filter = camel_mime_filter_tohtml_new(flags, rgb); + html_filter = camel_mime_filter_tohtml_new (flags, rgb); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), html_filter); g_object_unref (html_filter); @@ -1743,14 +1743,14 @@ efh_text_plain (EMFormatHTML *efh, /* We handle our made-up multipart here, so we don't recursively call ourselves */ len = ((EMFormat *)efh)->part_id->len; - count = camel_multipart_get_number(mp); + count = camel_multipart_get_number (mp); for (i=0;i<count;i++) { - CamelMimePart *newpart = camel_multipart_get_part(mp, i); + CamelMimePart *newpart = camel_multipart_get_part (mp, i); if (!newpart) continue; - type = camel_mime_part_get_content_type(newpart); + type = camel_mime_part_get_content_type (newpart); if (camel_content_type_is (type, "text", "*") && (is_fallback || !camel_content_type_is (type, "text", "calendar"))) { camel_stream_printf ( stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n", @@ -1765,14 +1765,14 @@ efh_text_plain (EMFormatHTML *efh, EM_FORMAT_HTML_COLOR_TEXT])); camel_stream_write_string ( stream, "<tt>\n" EFH_MESSAGE_START, NULL); - em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)newpart); - camel_stream_flush((CamelStream *)filtered_stream, NULL); + em_format_format_text ((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)newpart); + camel_stream_flush ((CamelStream *)filtered_stream, NULL); camel_stream_write_string (stream, "</tt>\n", NULL); camel_stream_write_string (stream, "</div>\n", NULL); } else { g_string_append_printf(((EMFormat *)efh)->part_id, ".inline.%d", i); - em_format_part((EMFormat *)efh, stream, newpart); - g_string_truncate(((EMFormat *)efh)->part_id, len); + em_format_part ((EMFormat *)efh, stream, newpart); + g_string_truncate (((EMFormat *)efh)->part_id, len); } } @@ -1780,7 +1780,7 @@ efh_text_plain (EMFormatHTML *efh, } static void -efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) +efh_text_enriched (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { CamelStream *filtered_stream; CamelMimeFilter *enriched; @@ -1795,7 +1795,7 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E stream, "\n<!-- text/enriched -->\n", NULL); } - enriched = camel_mime_filter_enriched_new(flags); + enriched = camel_mime_filter_enriched_new (flags); filtered_stream = camel_stream_filter_new (stream); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), enriched); @@ -1813,33 +1813,33 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E &efh->priv->colors[ EM_FORMAT_HTML_COLOR_TEXT])); - em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); + em_format_format_text ((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); g_object_unref (filtered_stream); camel_stream_write_string (stream, "</div>", NULL); } static void -efh_write_text_html(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) +efh_write_text_html (EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) { #if d(!)0 CamelStream *out; gint fd; CamelDataWrapper *dw; - fd = dup(STDOUT_FILENO); - out = camel_stream_fs_new_with_fd(fd); + fd = dup (STDOUT_FILENO); + out = camel_stream_fs_new_with_fd (fd); printf("writing text content to frame '%s'\n", puri->cid); dw = camel_medium_get_content (puri->part); if (dw) - camel_data_wrapper_write_to_stream(dw, out); + camel_data_wrapper_write_to_stream (dw, out); g_object_unref (out); #endif - em_format_format_text(emf, stream, (CamelDataWrapper *)puri->part); + em_format_format_text (emf, stream, (CamelDataWrapper *)puri->part); } static void -efh_text_html(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) +efh_text_html (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { const gchar *location; gchar *cid = NULL; @@ -1862,36 +1862,36 @@ efh_text_html(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFor for us. our iframes are special cases, we need to use the proper base url to access them, but other children parts shouldn't blindly inherit the container's location. */ - location = camel_mime_part_get_content_location(part); + location = camel_mime_part_get_content_location (part); if (location == NULL) { if (((EMFormat *)efh)->base) - cid = camel_url_to_string(((EMFormat *)efh)->base, 0); + cid = camel_url_to_string (((EMFormat *)efh)->base, 0); else - cid = g_strdup(((EMFormat *)efh)->part_id->str); + cid = g_strdup (((EMFormat *)efh)->part_id->str); } else { - if (strchr(location, ':') == NULL && ((EMFormat *)efh)->base != NULL) { + if (strchr (location, ':') == NULL && ((EMFormat *)efh)->base != NULL) { CamelURL *uri; - uri = camel_url_new_with_base(((EMFormat *)efh)->base, location); - cid = camel_url_to_string(uri, 0); - camel_url_free(uri); + uri = camel_url_new_with_base (((EMFormat *)efh)->base, location); + cid = camel_url_to_string (uri, 0); + camel_url_free (uri); } else { - cid = g_strdup(location); + cid = g_strdup (location); } } - em_format_add_puri((EMFormat *)efh, sizeof(EMFormatPURI), cid, part, efh_write_text_html); + em_format_add_puri ((EMFormat *)efh, sizeof (EMFormatPURI), cid, part, efh_write_text_html); d(printf("adding iframe, location %s\n", cid)); - camel_stream_printf(stream, + camel_stream_printf (stream, "<iframe src=\"%s\" frameborder=0 scrolling=no>could not get %s</iframe>\n" "</div>\n", cid, cid); - g_free(cid); + g_free (cid); } /* This is a lot of code for something useless ... */ static void -efh_message_external(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) +efh_message_external (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { CamelContentType *type; const gchar *access_type; @@ -1903,7 +1903,7 @@ efh_message_external(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part } /* needs to be cleaner */ - type = camel_mime_part_get_content_type(part); + type = camel_mime_part_get_content_type (part); access_type = camel_content_type_param (type, "access-type"); if (!access_type) { camel_stream_printf(stream, _("Malformed external-body part.")); @@ -1975,8 +1975,8 @@ efh_message_external(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part goto fail; camel_stream_printf(stream, "<a href=\"%s\">%s</a>", url, desc); - g_free(url); - g_free(desc); + g_free (url); + g_free (desc); return; @@ -1985,7 +1985,7 @@ fail: } static void -efh_message_deliverystatus(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) +efh_message_deliverystatus (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { CamelStream *filtered_stream; CamelMimeFilter *html_filter; @@ -2005,28 +2005,28 @@ efh_message_deliverystatus(EMFormatHTML *efh, CamelStream *stream, CamelMimePart EM_FORMAT_HTML_COLOR_TEXT])); filtered_stream = camel_stream_filter_new (stream); - html_filter = camel_mime_filter_tohtml_new(efh->text_html_flags, rgb); + html_filter = camel_mime_filter_tohtml_new (efh->text_html_flags, rgb); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), html_filter); g_object_unref (html_filter); camel_stream_write_string (stream, "<tt>\n" EFH_MESSAGE_START, NULL); - em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); - camel_stream_flush((CamelStream *)filtered_stream, NULL); + em_format_format_text ((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); + camel_stream_flush ((CamelStream *)filtered_stream, NULL); camel_stream_write_string (stream, "</tt>\n", NULL); camel_stream_write_string (stream, "</div>", NULL); } static void -emfh_write_related(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) +emfh_write_related (EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) { - em_format_format_content(emf, stream, puri->part); - camel_stream_close(stream, NULL); + em_format_format_content (emf, stream, puri->part); + camel_stream_close (stream, NULL); } static void -emfh_multipart_related_check(struct _EMFormatHTMLJob *job, gint cancelled) +emfh_multipart_related_check (struct _EMFormatHTMLJob *job, gint cancelled) { EMFormat *format; GList *link; @@ -2069,7 +2069,7 @@ emfh_multipart_related_check(struct _EMFormatHTMLJob *job, gint cancelled) /* RFC 2387 */ static void -efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) +efh_multipart_related (EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) { CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content ((CamelMedium *)part); CamelMimePart *body_part, *display_part = NULL; @@ -2080,15 +2080,15 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c EMFormatPURI *puri; struct _EMFormatHTMLJob *job; - if (!CAMEL_IS_MULTIPART(mp)) { - em_format_format_source(emf, stream, part); + if (!CAMEL_IS_MULTIPART (mp)) { + em_format_format_source (emf, stream, part); return; } - nparts = camel_multipart_get_number(mp); - content_type = camel_mime_part_get_content_type(part); + nparts = camel_multipart_get_number (mp); + content_type = camel_mime_part_get_content_type (part); start = camel_content_type_param (content_type, "start"); - if (start && strlen(start)>2) { + if (start && strlen (start)>2) { gint len; const gchar *cid; @@ -2097,17 +2097,17 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c start++; for (i=0; i<nparts; i++) { - body_part = camel_multipart_get_part(mp, i); - cid = camel_mime_part_get_content_id(body_part); + body_part = camel_multipart_get_part (mp, i); + cid = camel_mime_part_get_content_id (body_part); - if (cid && !strncmp(cid, start, len) && strlen(cid) == len) { + if (cid && !strncmp (cid, start, len) && strlen (cid) == len) { display_part = body_part; displayid = i; break; } } } else { - display_part = camel_multipart_get_part(mp, 0); + display_part = camel_multipart_get_part (mp, 0); } if (display_part == NULL) { @@ -2115,51 +2115,51 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c return; } - em_format_push_level(emf); + em_format_push_level (emf); partidlen = emf->part_id->len; /* queue up the parts for possible inclusion */ for (i = 0; i < nparts; i++) { - body_part = camel_multipart_get_part(mp, i); + body_part = camel_multipart_get_part (mp, i); if (body_part != display_part) { g_string_append_printf(emf->part_id, "related.%d", i); - puri = em_format_add_puri(emf, sizeof(EMFormatPURI), NULL, body_part, emfh_write_related); - g_string_truncate(emf->part_id, partidlen); + puri = em_format_add_puri (emf, sizeof (EMFormatPURI), NULL, body_part, emfh_write_related); + g_string_truncate (emf->part_id, partidlen); d(printf(" part '%s' '%s' added\n", puri->uri?puri->uri:"", puri->cid)); } } g_string_append_printf(emf->part_id, "related.%d", displayid); - em_format_part(emf, stream, display_part); - g_string_truncate(emf->part_id, partidlen); - camel_stream_flush(stream, NULL); + em_format_part (emf, stream, display_part); + g_string_truncate (emf->part_id, partidlen); + camel_stream_flush (stream, NULL); /* queue a job to check for un-referenced parts to add as attachments */ - job = em_format_html_job_new((EMFormatHTML *)emf, emfh_multipart_related_check, NULL); + job = em_format_html_job_new ((EMFormatHTML *)emf, emfh_multipart_related_check, NULL); job->stream = stream; g_object_ref (stream); - em_format_html_job_queue((EMFormatHTML *)emf, job); + em_format_html_job_queue ((EMFormatHTML *)emf, job); - em_format_pull_level(emf); + em_format_pull_level (emf); } static void -efh_write_image(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) +efh_write_image (EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) { CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *)puri->part); d(printf("writing image '%s'\n", puri->cid)); - camel_data_wrapper_decode_to_stream(dw, stream, NULL); - camel_stream_close(stream, NULL); + camel_data_wrapper_decode_to_stream (dw, stream, NULL); + camel_stream_close (stream, NULL); } static void -efh_image(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) +efh_image (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { EMFormatPURI *puri; - puri = em_format_add_puri((EMFormat *)efh, sizeof(EMFormatPURI), NULL, part, efh_write_image); + puri = em_format_add_puri ((EMFormat *)efh, sizeof (EMFormatPURI), NULL, part, efh_write_image); d(printf("adding image '%s'\n", puri->cid)); camel_stream_printf(stream, "<img hspace=10 vspace=10 src=\"%s\">", puri->cid); } @@ -2202,7 +2202,7 @@ static EMFormatHandler type_builtin_table[] = { }; static void -efh_builtin_init(EMFormatHTMLClass *efhc) +efh_builtin_init (EMFormatHTMLClass *efhc) { EMFormatClass *efc; gint ii; @@ -2265,8 +2265,8 @@ efh_format_text_header (EMFormatHTML *emfh, CamelStream *stream, const gchar *la } } - camel_stream_printf(stream, fmt, label, html); - g_free(mhtml); + camel_stream_printf (stream, fmt, label, html); + g_free (mhtml); } static const gchar *addrspec_hdrs[] = { @@ -2411,7 +2411,7 @@ canon_header_name (gchar *name) } static void -efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct _camel_header_raw *header, guint32 flags, const gchar *charset) +efh_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, struct _camel_header_raw *header, guint32 flags, const gchar *charset) { EMFormatHTML *efh = (EMFormatHTML *)emf; gchar *name, *buf, *value = NULL; @@ -2420,12 +2420,12 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct gchar *str_field = NULL; gint i; - name = g_alloca(strlen(header->name)+1); - strcpy(name, header->name); + name = g_alloca (strlen (header->name)+1); + strcpy (name, header->name); canon_header_name (name); for (i = 0; addrspec_hdrs[i]; i++) { - if (!strcmp(name, addrspec_hdrs[i])) { + if (!strcmp (name, addrspec_hdrs[i])) { addrspec = TRUE; break; } @@ -2447,7 +2447,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct g_free (buf); html = g_string_new(""); - img = efh_format_address(efh, html, addrs, (gchar *)label); + img = efh_format_address (efh, html, addrs, (gchar *)label); if (img) { str_field = g_strdup_printf ("%s%s:", img, label); @@ -2456,9 +2456,9 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct g_free (img); } - camel_header_address_list_clear(&addrs); + camel_header_address_list_clear (&addrs); txt = value = html->str; - g_string_free(html, FALSE); + g_string_free (html, FALSE); flags |= EM_FORMAT_HEADER_BOLD | EM_FORMAT_HTML_HEADER_HTML; } else if (!strcmp (name, "Subject")) { @@ -2487,7 +2487,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct html = camel_text_to_html (txt, efh->text_html_flags, 0); - msg_date = camel_header_decode_date(txt, &msg_offset); + msg_date = camel_header_decode_date (txt, &msg_offset); e_localtime_with_offset (msg_date, &local, &local_tz); /* Convert message offset to minutes (e.g. -0400 --> -240) */ @@ -2539,14 +2539,14 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct g_string_append_printf(html, ", "); } - camel_header_newsgroups_free(ng); + camel_header_newsgroups_free (ng); txt = html->str; - g_string_free(html, FALSE); + g_string_free (html, FALSE); flags |= EM_FORMAT_HEADER_BOLD|EM_FORMAT_HTML_HEADER_HTML; } else if (!strcmp (name, "Received") || !strncmp (name, "X-", 2)) { /* don't unfold Received nor extension headers */ - txt = value = camel_header_decode_string(header->value, charset); + txt = value = camel_header_decode_string (header->value, charset); } else { /* don't unfold Received nor extension headers */ buf = camel_header_unfold (header->value); @@ -2554,14 +2554,14 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct g_free (buf); } - efh_format_text_header(efh, stream, label, txt, flags); + efh_format_text_header (efh, stream, label, txt, flags); g_free (value); g_free (str_field); } static void -efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) +efh_format_headers (EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) { EMFormat *emf = (EMFormat *) efh; const gchar *charset; @@ -2580,9 +2580,9 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) if (!part) return; - ct = camel_mime_part_get_content_type((CamelMimePart *)part); + ct = camel_mime_part_get_content_type ((CamelMimePart *)part); charset = camel_content_type_param (ct, "charset"); - charset = camel_iconv_charset_name(charset); + charset = camel_iconv_charset_name (charset); if (!efh->simple_headers) camel_stream_printf ( @@ -2604,12 +2604,12 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) break; html = g_string_new(""); - name = efh_format_address(efh, html, addrs, header->name); + name = efh_format_address (efh, html, addrs, header->name); header_sender = html->str; - camel_header_address_list_clear(&addrs); + camel_header_address_list_clear (&addrs); - g_string_free(html, FALSE); + g_string_free (html, FALSE); g_free (name); } else if (!g_ascii_strcasecmp (header->name, "From")) { struct _camel_header_address *addrs; @@ -2619,13 +2619,13 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) break; html = g_string_new(""); - name = efh_format_address(efh, html, addrs, header->name); + name = efh_format_address (efh, html, addrs, header->name); header_from = html->str; - camel_header_address_list_clear(&addrs); + camel_header_address_list_clear (&addrs); - g_string_free(html, FALSE); - g_free(name); + g_string_free (html, FALSE); + g_free (name); } else if (!g_ascii_strcasecmp (header->name, "X-Evolution-Mail-From-Delegate")) { mail_from_delegate = TRUE; } @@ -2662,7 +2662,7 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) if (emf->mode == EM_FORMAT_MODE_ALLHEADERS) { header = ((CamelMimePart *)part)->headers; while (header) { - efh_format_header(emf, stream, part, header, EM_FORMAT_HTML_HEADER_NOCOLUMNS, charset); + efh_format_header (emf, stream, part, header, EM_FORMAT_HTML_HEADER_NOCOLUMNS, charset); header = header->next; } } else { @@ -2724,7 +2724,7 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) face_decoded = TRUE; /* Showing an encoded "Face" header makes little sense */ } else if (!g_ascii_strcasecmp (header->name, h->name) && !face) { - efh_format_header(emf, stream, part, header, h->flags, charset); + efh_format_header (emf, stream, part, header, h->flags, charset); } header = header->next; @@ -2742,8 +2742,8 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) CamelMimePart *photopart; gboolean only_local_photo; - cia = camel_internet_address_new(); - camel_address_decode((CamelAddress *) cia, (const gchar *) photo_name); + cia = camel_internet_address_new (); + camel_address_decode ((CamelAddress *) cia, (const gchar *) photo_name); only_local_photo = em_format_html_get_only_local_photos (efh); photopart = em_utils_contact_photo (cia, only_local_photo); @@ -2751,14 +2751,14 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) contact_has_photo = TRUE; classid = g_strdup_printf("icon:///em-format-html/%s/photo/header", emf->part_id->str); - camel_stream_printf(stream, + camel_stream_printf (stream, "<td align=\"right\" valign=\"top\"><img width=64 src=\"%s\"></td>", classid); - em_format_add_puri(emf, sizeof(EMFormatPURI), classid, + em_format_add_puri (emf, sizeof (EMFormatPURI), classid, photopart, efh_write_image); g_object_unref (photopart); - g_free(classid); + g_free (classid); } g_object_unref (cia); } @@ -2771,7 +2771,7 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) camel_mime_part_set_content ((CamelMimePart *) part, (const gchar *) face_header_value, face_header_len, "image/png"); classid = g_strdup_printf("icon:///em-format-html/face/photo/header"); camel_stream_printf(stream, "<td align=\"right\" valign=\"top\"><img width=48 src=\"%s\"></td>", classid); - em_format_add_puri(emf, sizeof(EMFormatPURI), classid, part, efh_write_image); + em_format_add_puri (emf, sizeof (EMFormatPURI), classid, part, efh_write_image); g_object_unref (part); } @@ -2794,17 +2794,17 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) } if (iconpart) { - em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efh_write_image); + em_format_add_puri (emf, sizeof (EMFormatPURI), classid, iconpart, efh_write_image); g_object_unref (iconpart); } - g_free(classid); + g_free (classid); } camel_stream_printf (stream, "</tr></table>\n</font>\n"); } } static void -efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) +efh_format_message (EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) { const EMFormatHandler *handle; @@ -2819,19 +2819,19 @@ efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, cons camel_stream_printf(stream, "<blockquote>\n"); if (!efh->hide_headers) - efh_format_headers(efh, stream, (CamelMedium *)part); + efh_format_headers (efh, stream, (CamelMedium *)part); handle = em_format_find_handler(emf, "x-evolution/message/post-header"); if (handle) - handle->handler(emf, stream, part, handle, FALSE); + handle->handler (emf, stream, part, handle, FALSE); - camel_stream_printf(stream, EM_FORMAT_HTML_VPAD); - em_format_part(emf, stream, part); + camel_stream_printf (stream, EM_FORMAT_HTML_VPAD); + em_format_part (emf, stream, part); if (emf->message != (CamelMimeMessage *)part) camel_stream_printf(stream, "</blockquote>\n"); - camel_cipher_validity_free(emf->valid); + camel_cipher_validity_free (emf->valid); emf->valid = save; emf->valid_parent = save_parent; diff --git a/mail/em-format-html.h b/mail/em-format-html.h index 4e9b315765..85b91f84c3 100644 --- a/mail/em-format-html.h +++ b/mail/em-format-html.h @@ -261,7 +261,7 @@ 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, @@ -273,8 +273,8 @@ EMFormatHTMLJob * 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); gchar * em_format_html_format_cert_infos (CamelCipherCertInfo *first_cinfo); diff --git a/mail/em-inline-filter.c b/mail/em-inline-filter.c index b780256e2b..11a4b32764 100644 --- a/mail/em-inline-filter.c +++ b/mail/em-inline-filter.c @@ -59,7 +59,7 @@ static const struct { }; static void -inline_filter_add_part(EMInlineFilter *emif, const gchar *data, gint len) +inline_filter_add_part (EMInlineFilter *emif, const gchar *data, gint len) { CamelTransferEncoding encoding; CamelContentType *content_type; @@ -74,16 +74,16 @@ inline_filter_add_part(EMInlineFilter *emif, const gchar *data, gint len) else encoding = emif_types[emif->state].encoding; - g_byte_array_append(emif->data, (guchar *)data, len); + g_byte_array_append (emif->data, (guchar *)data, len); /* check the part will actually have content */ if (emif->data->len <= 0) { return; } mem = camel_stream_mem_new_with_byte_array (emif->data); - emif->data = g_byte_array_new(); + emif->data = g_byte_array_new (); - dw = camel_data_wrapper_new(); + dw = camel_data_wrapper_new (); if (encoding == emif->base_encoding && (encoding == CAMEL_TRANSFER_ENCODING_BASE64 || encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE)) { CamelMimeFilter *enc_filter = camel_mime_filter_basic_new (encoding == CAMEL_TRANSFER_ENCODING_BASE64 ? CAMEL_MIME_FILTER_BASIC_BASE64_ENC : CAMEL_MIME_FILTER_BASIC_QP_ENC); CamelStream *filter_stream; @@ -120,32 +120,32 @@ inline_filter_add_part(EMInlineFilter *emif, const gchar *data, gint len) camel_content_type_unref (content_type); dw->encoding = encoding; - part = camel_mime_part_new(); + part = camel_mime_part_new (); camel_medium_set_content ((CamelMedium *)part, dw); - camel_mime_part_set_encoding(part, encoding); + camel_mime_part_set_encoding (part, encoding); g_object_unref (dw); if (emif->filename) - camel_mime_part_set_filename(part, emif->filename); + camel_mime_part_set_filename (part, emif->filename); /* pre-snoop the mime type of unknown objects, and poke and hack it into place */ if (camel_content_type_is(dw->mime_type, "application", "octet-stream") - && (mimetype = em_format_snoop_type(part)) + && (mimetype = em_format_snoop_type (part)) && strcmp(mimetype, "application/octet-stream") != 0) { - camel_data_wrapper_set_mime_type(dw, mimetype); - camel_mime_part_set_content_type(part, mimetype); + camel_data_wrapper_set_mime_type (dw, mimetype); + camel_mime_part_set_content_type (part, mimetype); if (emif->filename) - camel_mime_part_set_filename(part, emif->filename); + camel_mime_part_set_filename (part, emif->filename); } - g_free(emif->filename); + g_free (emif->filename); emif->filename = NULL; - emif->parts = g_slist_append(emif->parts, part); + emif->parts = g_slist_append (emif->parts, part); } static gint -inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) +inline_filter_scan (CamelMimeFilter *f, gchar *in, gsize len, gint final) { EMInlineFilter *emif = (EMInlineFilter *)f; gchar *inptr = in, *inend = in+len; @@ -162,7 +162,7 @@ inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) if (inptr == inend && start == inptr) { if (!final) { - camel_mime_filter_backup(f, start, inend-start); + camel_mime_filter_backup (f, start, inend-start); inend = start; } break; @@ -190,31 +190,31 @@ inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) if (i >= rest_len || start[i++] != ' ') break; - inline_filter_add_part(emif, data_start, start-data_start); + inline_filter_add_part (emif, data_start, start-data_start); - name = g_strndup(start+i, inptr-start-i-1); + name = g_strndup (start+i, inptr-start-i-1); emif->filename = camel_header_decode_string(name, emif->base_type?camel_content_type_param(emif->base_type, "charset"):NULL); - g_free(name); + g_free (name); data_start = start; emif->state = EMIF_UUENC; } else if (rest_len >= 45 && strncmp (start, "(This file must be converted with BinHex 4.0)", 45) == 0) { restore_inptr (); - inline_filter_add_part(emif, data_start, start-data_start); + inline_filter_add_part (emif, data_start, start-data_start); data_start = start; emif->state = EMIF_BINHEX; } else if (rest_len >= 11 && strncmp (start, "%!PS-Adobe-", 11) == 0) { restore_inptr (); - inline_filter_add_part(emif, data_start, start-data_start); + inline_filter_add_part (emif, data_start, start-data_start); data_start = start; emif->state = EMIF_POSTSCRIPT; } else if (rest_len >= 34 && strncmp (start, "-----BEGIN PGP SIGNED MESSAGE-----", 34) == 0) { restore_inptr (); - inline_filter_add_part(emif, data_start, start-data_start); + inline_filter_add_part (emif, data_start, start-data_start); data_start = start; emif->state = EMIF_PGPSIGNED; } else if (rest_len >= 27 && strncmp (start, "-----BEGIN PGP MESSAGE-----", 27) == 0) { restore_inptr (); - inline_filter_add_part(emif, data_start, start-data_start); + inline_filter_add_part (emif, data_start, start-data_start); data_start = start; emif->state = EMIF_PGPENCRYPTED; } @@ -223,7 +223,7 @@ inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_UUENC: if (rest_len >= 3 && strncmp (start, "end", 3) == 0) { restore_inptr (); - inline_filter_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part (emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } else { @@ -239,7 +239,7 @@ inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) linelen *= 3; if (!(len == linelen || len == linelen-1 || len == linelen-2)) { restore_inptr (); - inline_filter_add_part(emif, data_start, start-data_start); + inline_filter_add_part (emif, data_start, start-data_start); data_start = start; inptr = start; emif->state = EMIF_PLAIN; @@ -250,7 +250,7 @@ inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_BINHEX: if (inptr > (start+1) && inptr[-2] == ':') { restore_inptr (); - inline_filter_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part (emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } @@ -258,7 +258,7 @@ inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_POSTSCRIPT: if (rest_len >= 5 && strncmp (start, "%%EOF", 5) == 0) { restore_inptr (); - inline_filter_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part (emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } @@ -266,7 +266,7 @@ inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_PGPSIGNED: if (rest_len >= 27 && strncmp (start, "-----END PGP SIGNATURE-----", 27) == 0) { restore_inptr (); - inline_filter_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part (emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } @@ -274,7 +274,7 @@ inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_PGPENCRYPTED: if (rest_len >= 25 && strncmp (start, "-----END PGP MESSAGE-----", 25) == 0) { restore_inptr (); - inline_filter_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part (emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } @@ -290,9 +290,9 @@ inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) /* always stop as plain, especially when not read those tags fully */ emif->state = EMIF_PLAIN; - inline_filter_add_part(emif, data_start, inend-data_start); + inline_filter_add_part (emif, data_start, inend-data_start); } else { - g_byte_array_append(emif->data, (guchar *)data_start, inend-data_start); + g_byte_array_append (emif->data, (guchar *)data_start, inend-data_start); } return 0; @@ -304,11 +304,11 @@ inline_filter_finalize (GObject *object) EMInlineFilter *emif = EM_INLINE_FILTER (object); if (emif->base_type) - camel_content_type_unref(emif->base_type); + camel_content_type_unref (emif->base_type); camel_mime_filter_reset (CAMEL_MIME_FILTER (object)); - g_byte_array_free(emif->data, TRUE); - g_free(emif->filename); + g_byte_array_free (emif->data, TRUE); + g_free (emif->filename); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (em_inline_filter_parent_class)->finalize (object); @@ -357,12 +357,12 @@ inline_filter_reset (CamelMimeFilter *filter) GSList *n = l->next; g_object_unref (l->data); - g_slist_free_1(l); + g_slist_free_1 (l); l = n; } emif->parts = NULL; - g_byte_array_set_size(emif->data, 0); + g_byte_array_set_size (emif->data, 0); } static void @@ -383,7 +383,7 @@ em_inline_filter_class_init (EMInlineFilterClass *class) static void em_inline_filter_init (EMInlineFilter *emif) { - emif->data = g_byte_array_new(); + emif->data = g_byte_array_new (); } /** @@ -400,7 +400,7 @@ em_inline_filter_init (EMInlineFilter *emif) * Return value: **/ EMInlineFilter * -em_inline_filter_new(CamelTransferEncoding base_encoding, CamelContentType *base_type) +em_inline_filter_new (CamelTransferEncoding base_encoding, CamelContentType *base_type) { EMInlineFilter *emif; @@ -408,21 +408,21 @@ em_inline_filter_new(CamelTransferEncoding base_encoding, CamelContentType *base emif->base_encoding = base_encoding; if (base_type) { emif->base_type = base_type; - camel_content_type_ref(emif->base_type); + camel_content_type_ref (emif->base_type); } return emif; } CamelMultipart * -em_inline_filter_get_multipart(EMInlineFilter *emif) +em_inline_filter_get_multipart (EMInlineFilter *emif) { GSList *l = emif->parts; CamelMultipart *mp; - mp = camel_multipart_new(); + mp = camel_multipart_new (); while (l) { - camel_multipart_add_part(mp, l->data); + camel_multipart_add_part (mp, l->data); l = l->next; } diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c index ceeb770128..57b5e3dcb9 100644 --- a/mail/em-subscribe-editor.c +++ b/mail/em-subscribe-editor.c @@ -124,9 +124,9 @@ struct _MailMsgListNode { MailMsg *msg; }; -static void sub_editor_busy(EMSubscribeEditor *se, gint dir); -static gint sub_queue_fill_level(EMSubscribe *sub, EMSubscribeNode *node); -static void sub_selection_changed(GtkTreeSelection *selection, EMSubscribe *sub); +static void sub_editor_busy (EMSubscribeEditor *se, gint dir); +static gint sub_queue_fill_level (EMSubscribe *sub, EMSubscribeNode *node); +static void sub_selection_changed (GtkTreeSelection *selection, EMSubscribe *sub); static gboolean test_contains (const gchar *where, const gchar *what) @@ -203,22 +203,22 @@ update_filtering_column (EMSubscribeEditor *se, struct _EMSubscribe *sub) } static void -sub_node_free(EMSubscribeNode *node) +sub_node_free (EMSubscribeNode *node) { d(printf("sub node free '%s'\n", node->info?node->info->full_name:"<unknown>")); if (node->path) - gtk_tree_path_free(node->path); - g_free(node); + gtk_tree_path_free (node->path); + g_free (node); } static void -sub_ref(EMSubscribe *sub) +sub_ref (EMSubscribe *sub) { sub->ref_count++; } static void -sub_unref(EMSubscribe *sub) +sub_unref (EMSubscribe *sub) { GSList *l; @@ -232,7 +232,7 @@ sub_unref(EMSubscribe *sub) if (sub->list_store) g_object_unref (sub->list_store); if (sub->folders) - g_hash_table_destroy(sub->folders); + g_hash_table_destroy (sub->folders); g_slist_free (sub->all_selectable); g_slist_foreach (sub->tree_expanded_paths, (GFunc) gtk_tree_path_free, NULL); g_slist_free (sub->tree_expanded_paths); @@ -240,14 +240,14 @@ sub_unref(EMSubscribe *sub) while (l) { GSList *n = l->next; - camel_store_free_folder_info(sub->store, (CamelFolderInfo *)l->data); - g_slist_free_1(l); + camel_store_free_folder_info (sub->store, (CamelFolderInfo *)l->data); + g_slist_free_1 (l); l = n; } if (sub->store) g_object_unref (sub->store); - g_free(sub->store_uri); - g_free(sub); + g_free (sub->store_uri); + g_free (sub); } } @@ -299,9 +299,9 @@ sub_folder_done (struct _zsubscribe_msg *m) /* make sure the tree view matches the correct state */ /* all actions are done on tree store, synced to list store */ model = m->sub->tree_store; - if (gtk_tree_model_get_iter_from_string(model, &iter, m->path)) { + if (gtk_tree_model_get_iter_from_string (model, &iter, m->path)) { issub = (m->node->info->flags & CAMEL_FOLDER_SUBSCRIBED) != 0; - gtk_tree_model_get(model, &iter, COL_SUBSCRIBED, &subscribed, COL_INFO_NODE, &node, -1); + gtk_tree_model_get (model, &iter, COL_SUBSCRIBED, &subscribed, COL_INFO_NODE, &node, -1); if (node == m->node) { gtk_tree_store_set ((GtkTreeStore *)model, &iter, COL_SUBSCRIBED, issub, -1); } else { @@ -314,20 +314,20 @@ sub_folder_done (struct _zsubscribe_msg *m) if (msgListNode) { next = (struct _zsubscribe_msg *) msgListNode->msg; /* Free the memory of the MailMsgListNode which won't be used anymore. */ - g_free(msgListNode); + g_free (msgListNode); next->sub->subscribe_id = next->base.seq; mail_msg_unordered_push (next); } else { /* should it go off the model instead? */ - sub_selection_changed(gtk_tree_view_get_selection(m->sub->tree), m->sub); + sub_selection_changed (gtk_tree_view_get_selection (m->sub->tree), m->sub); } } static void sub_folder_free (struct _zsubscribe_msg *m) { - g_free(m->path); - sub_unref(m->sub); + g_free (m->path); + sub_unref (m->sub); } static MailMsgInfo sub_subscribe_folder_info = { @@ -348,10 +348,10 @@ sub_subscribe_folder (EMSubscribe *sub, EMSubscribeNode *node, gint state, const m = mail_msg_new (&sub_subscribe_folder_info); m->sub = sub; - sub_ref(sub); + sub_ref (sub); m->node = node; m->subscribe = state; - m->path = g_strdup(spath); + m->path = g_strdup (spath); id = m->base.seq; if (sub->subscribe_id == -1) { @@ -359,7 +359,7 @@ sub_subscribe_folder (EMSubscribe *sub, EMSubscribeNode *node, gint state, const d(printf("running subscribe folder '%s'\n", spath)); mail_msg_unordered_push (m); } else { - msgListNode = g_malloc0(sizeof(MailMsgListNode)); + msgListNode = g_malloc0 (sizeof (MailMsgListNode)); msgListNode->msg = (MailMsg *) m; d(printf("queueing subscribe folder '%s'\n", spath)); g_queue_push_tail (&sub->subscribe, msgListNode); @@ -385,11 +385,11 @@ sub_fill_levels (EMSubscribe *sub, CamelFolderInfo *info, GtkTreeIter *parent) while (fi) { gboolean known = FALSE; - if ((node = g_hash_table_lookup(sub->folders, fi->full_name)) == NULL) { + if ((node = g_hash_table_lookup (sub->folders, fi->full_name)) == NULL) { gboolean state; - gtk_tree_store_append(treestore, &iter, parent); - node = g_malloc0(sizeof(*node)); + gtk_tree_store_append (treestore, &iter, parent); + node = g_malloc0 (sizeof (*node)); node->info = fi; state = (fi->flags & CAMEL_FOLDER_SUBSCRIBED) != 0; gtk_tree_store_set (treestore, &iter, @@ -407,8 +407,8 @@ sub_fill_levels (EMSubscribe *sub, CamelFolderInfo *info, GtkTreeIter *parent) gtk_tree_path_free (path); } if ((fi->flags & CAMEL_FOLDER_NOINFERIORS) == 0) - node->path = gtk_tree_model_get_path((GtkTreeModel *)treestore, &iter); - g_hash_table_insert(sub->folders, fi->full_name, node); + node->path = gtk_tree_model_get_path ((GtkTreeModel *)treestore, &iter); + g_hash_table_insert (sub->folders, fi->full_name, node); } else if (node->path) { gtk_tree_model_get_iter (GTK_TREE_MODEL (treestore), &iter, node->path); known = TRUE; @@ -496,18 +496,18 @@ static void sub_folderinfo_free (struct _emse_folderinfo_msg *m) { if (m->info) - m->sub->info_list = g_slist_prepend(m->sub->info_list, m->info); + m->sub->info_list = g_slist_prepend (m->sub->info_list, m->info); if (!m->sub->cancel) - sub_editor_busy(m->sub->editor, -1); + sub_editor_busy (m->sub->editor, -1); /* Now we just load the children on demand, so set the expand state to true if m->node is not NULL */ if (m->node) - gtk_tree_view_expand_row(m->sub->tree, m->node->path, FALSE); + gtk_tree_view_expand_row (m->sub->tree, m->node->path, FALSE); - sub_unref(m->sub); + sub_unref (m->sub); } static MailMsgInfo sub_folderinfo_info = { @@ -519,7 +519,7 @@ static MailMsgInfo sub_folderinfo_info = { }; static gint -sub_queue_fill_level(EMSubscribe *sub, EMSubscribeNode *node) +sub_queue_fill_level (EMSubscribe *sub, EMSubscribeNode *node) { struct _emse_folderinfo_msg *m; gint id; @@ -528,14 +528,14 @@ sub_queue_fill_level(EMSubscribe *sub, EMSubscribeNode *node) node?node->info->full_name:"<root>")); m = mail_msg_new (&sub_folderinfo_info); - sub_ref(sub); + sub_ref (sub); m->sub = sub; m->node = node; m->seq = sub->seq; sub->pending_id = m->base.seq; - sub_editor_busy(sub->editor, 1); + sub_editor_busy (sub->editor, 1); id = m->base.seq; @@ -563,19 +563,19 @@ update_buttons_sesitivity (EMSubscribeEditor *se) /* (un) subscribes the current selection */ static void -sub_subscribe_toggled(GtkCellRendererToggle *render, const gchar *spath, EMSubscribe *sub) +sub_subscribe_toggled (GtkCellRendererToggle *render, const gchar *spath, EMSubscribe *sub) { GtkTreeIter iter; - GtkTreeModel *model = gtk_tree_view_get_model(sub->tree); + GtkTreeModel *model = gtk_tree_view_get_model (sub->tree); EMSubscribeNode *node; gboolean subscribed; d(printf("subscribe toggled?\n")); - if (gtk_tree_model_get_iter_from_string(model, &iter, spath)) { + if (gtk_tree_model_get_iter_from_string (model, &iter, spath)) { gchar *free_path; - gtk_tree_model_get(model, &iter, COL_SUBSCRIBED, &subscribed, COL_INFO_NODE, &node, -1); + gtk_tree_model_get (model, &iter, COL_SUBSCRIBED, &subscribed, COL_INFO_NODE, &node, -1); g_return_if_fail (node != NULL); subscribed = !subscribed; d(printf("new state is %s\n", subscribed?"subscribed":"not subscribed")); @@ -593,17 +593,17 @@ sub_subscribe_toggled(GtkCellRendererToggle *render, const gchar *spath, EMSubsc spath = free_path; } - sub_subscribe_folder(sub, node, subscribed, spath); + sub_subscribe_folder (sub, node, subscribed, spath); } } -static void sub_do_changed(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) +static void sub_do_changed (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { EMSubscribe *sub = data; EMSubscribeNode *node; gboolean subscribed; - gtk_tree_model_get(model, iter, COL_SUBSCRIBED, &subscribed, COL_INFO_NODE, &node, -1); + gtk_tree_model_get (model, iter, COL_SUBSCRIBED, &subscribed, COL_INFO_NODE, &node, -1); if (subscribed) sub->selected_subscribed_count++; @@ -611,25 +611,25 @@ static void sub_do_changed(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter * } static void -sub_selection_changed(GtkTreeSelection *selection, EMSubscribe *sub) +sub_selection_changed (GtkTreeSelection *selection, EMSubscribe *sub) { sub->selected_count = 0; sub->selected_subscribed_count = 0; - gtk_tree_selection_selected_foreach(selection, sub_do_changed, sub); + gtk_tree_selection_selected_foreach (selection, sub_do_changed, sub); } /* double-clicking causes a node item to be evaluated directly */ -static void sub_row_activated(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *col, EMSubscribe *sub) +static void sub_row_activated (GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *col, EMSubscribe *sub) { - if (!gtk_tree_view_row_expanded(tree, path)) - gtk_tree_view_expand_row(tree, path, FALSE); + if (!gtk_tree_view_row_expanded (tree, path)) + gtk_tree_view_expand_row (tree, path, FALSE); else - gtk_tree_view_collapse_row(tree, path); + gtk_tree_view_collapse_row (tree, path); } static void -sub_destroy(GtkWidget *w, EMSubscribe *sub) +sub_destroy (GtkWidget *w, EMSubscribe *sub) { struct _zsubscribe_msg *m; MailMsgListNode *msgListNode; @@ -638,28 +638,28 @@ sub_destroy(GtkWidget *w, EMSubscribe *sub) sub->cancel = TRUE; if (sub->pending_id != -1) - mail_msg_cancel(sub->pending_id); + mail_msg_cancel (sub->pending_id); if (sub->subscribe_id != -1) - mail_msg_cancel(sub->subscribe_id); + mail_msg_cancel (sub->subscribe_id); while ((msgListNode = g_queue_pop_head (&sub->subscribe)) != NULL) { m = (struct _zsubscribe_msg *) msgListNode->msg; /* Free the memory of MailMsgListNode which won't be used anymore. */ - g_free(msgListNode); - mail_msg_unref(m); + g_free (msgListNode); + mail_msg_unref (m); } - sub_unref(sub); + sub_unref (sub); } static EMSubscribe * -subscribe_new(EMSubscribeEditor *se, const gchar *uri) +subscribe_new (EMSubscribeEditor *se, const gchar *uri) { EMSubscribe *sub; - sub = g_malloc0(sizeof(*sub)); - sub->store_uri = g_strdup(uri); + sub = g_malloc0 (sizeof (*sub)); + sub->store_uri = g_strdup (uri); sub->editor = se; sub->ref_count = 1; sub->pending_id = -1; @@ -671,17 +671,17 @@ subscribe_new(EMSubscribeEditor *se, const gchar *uri) } static void -subscribe_set_store(EMSubscribe *sub, CamelStore *store) +subscribe_set_store (EMSubscribe *sub, CamelStore *store) { - if (store == NULL || !camel_store_supports_subscriptions(store)) { + if (store == NULL || !camel_store_supports_subscriptions (store)) { GtkWidget *w = gtk_label_new(_("This store does not support subscriptions, or they are not enabled.")); - gtk_label_set_line_wrap((GtkLabel *)w, TRUE); - sub->widget = gtk_viewport_new(NULL, NULL); - gtk_viewport_set_shadow_type((GtkViewport *)sub->widget, GTK_SHADOW_IN); - gtk_container_add((GtkContainer *)sub->widget, w); - gtk_widget_show(w); - gtk_widget_show(sub->widget); + gtk_label_set_line_wrap ((GtkLabel *)w, TRUE); + sub->widget = gtk_viewport_new (NULL, NULL); + gtk_viewport_set_shadow_type ((GtkViewport *)sub->widget, GTK_SHADOW_IN); + gtk_container_add ((GtkContainer *)sub->widget, w); + gtk_widget_show (w); + gtk_widget_show (sub->widget); } else { GtkTreeSelection *selection; GtkTreeViewColumn *column; @@ -720,8 +720,8 @@ subscribe_set_store(EMSubscribe *sub, CamelStore *store) sub->widget = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sub->widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sub->widget), GTK_SHADOW_IN); - gtk_container_add((GtkContainer *)sub->widget, (GtkWidget *)sub->tree); - gtk_widget_show(sub->widget); + gtk_container_add ((GtkContainer *)sub->widget, (GtkWidget *)sub->tree); + gtk_widget_show (sub->widget); renderer = gtk_cell_renderer_toggle_new (); g_object_set(renderer, "activatable", TRUE, NULL); @@ -741,7 +741,7 @@ subscribe_set_store(EMSubscribe *sub, CamelStore *store) gtk_tree_view_column_pack_start (column, renderer, TRUE); gtk_tree_view_column_add_attribute ( column, renderer, "text", COL_NAME); - gtk_tree_view_set_expander_column(sub->tree, gtk_tree_view_get_column(sub->tree, 1)); + gtk_tree_view_set_expander_column (sub->tree, gtk_tree_view_get_column (sub->tree, 1)); selection = gtk_tree_view_get_selection (sub->tree); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); @@ -753,39 +753,39 @@ subscribe_set_store(EMSubscribe *sub, CamelStore *store) g_signal_connect(sub->tree, "row-activated", G_CALLBACK(sub_row_activated), sub); g_signal_connect(sub->tree, "destroy", G_CALLBACK(sub_destroy), sub); - sub_selection_changed(selection, sub); + sub_selection_changed (selection, sub); g_signal_connect(selection, "changed", G_CALLBACK(sub_selection_changed), sub); - sub_queue_fill_level(sub, NULL); + sub_queue_fill_level (sub, NULL); update_buttons_sesitivity (sub->editor); } - gtk_box_pack_start((GtkBox *)sub->editor->vbox, sub->widget, TRUE, TRUE, 0); + gtk_box_pack_start ((GtkBox *)sub->editor->vbox, sub->widget, TRUE, TRUE, 0); } static void -sub_editor_destroy(GtkWidget *w, EMSubscribeEditor *se) +sub_editor_destroy (GtkWidget *w, EMSubscribeEditor *se) { /* need to clean out pending store opens */ d(printf("editor destroyed, freeing editor\n")); if (se->busy_id) - g_source_remove(se->busy_id); + g_source_remove (se->busy_id); if (se->refilter_id != 0) g_source_remove (se->refilter_id); se->refilter_id = 0; - g_free(se); + g_free (se); } static void -sub_editor_close(GtkWidget *w, EMSubscribeEditor *se) +sub_editor_close (GtkWidget *w, EMSubscribeEditor *se) { - gtk_widget_destroy((GtkWidget *)se->dialog); + gtk_widget_destroy ((GtkWidget *)se->dialog); } static void -sub_editor_refresh(GtkWidget *w, EMSubscribeEditor *se) +sub_editor_refresh (GtkWidget *w, EMSubscribeEditor *se) { EMSubscribe *sub = se->current; GSList *l; @@ -798,8 +798,8 @@ sub_editor_refresh(GtkWidget *w, EMSubscribeEditor *se) /* drop any currently pending */ if (sub->pending_id != -1) { - mail_msg_cancel(sub->pending_id); - mail_msg_wait(sub->pending_id); + mail_msg_cancel (sub->pending_id); + mail_msg_wait (sub->pending_id); } g_slist_free (sub->all_selectable); @@ -813,7 +813,7 @@ sub_editor_refresh(GtkWidget *w, EMSubscribeEditor *se) gtk_list_store_clear ((GtkListStore *)sub->list_store); if (sub->folders) - g_hash_table_destroy(sub->folders); + g_hash_table_destroy (sub->folders); sub->folders = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) NULL, @@ -824,22 +824,22 @@ sub_editor_refresh(GtkWidget *w, EMSubscribeEditor *se) while (l) { GSList *n = l->next; - camel_store_free_folder_info(sub->store, (CamelFolderInfo *)l->data); - g_slist_free_1(l); + camel_store_free_folder_info (sub->store, (CamelFolderInfo *)l->data); + g_slist_free_1 (l); l = n; } - sub_queue_fill_level(sub, NULL); + sub_queue_fill_level (sub, NULL); } static void -sub_editor_got_store(gchar *uri, CamelStore *store, gpointer data) +sub_editor_got_store (gchar *uri, CamelStore *store, gpointer data) { struct _EMSubscribe *sub = data; if (!sub->cancel) - subscribe_set_store(sub, store); - sub_unref(sub); + subscribe_set_store (sub, store); + sub_unref (sub); } static void @@ -889,14 +889,14 @@ sub_editor_combobox_changed (GtkWidget *w, EMSubscribeEditor *se) if (i == n) { se->current = sub; if (sub->widget) { - gtk_widget_show(sub->widget); + gtk_widget_show (sub->widget); } else if (sub->store_id == -1) { - sub_ref(sub); - sub->store_id = mail_get_store(sub->store_uri, NULL, sub_editor_got_store, sub); + sub_ref (sub); + sub->store_id = mail_get_store (sub->store_uri, NULL, sub_editor_got_store, sub); } } else { if (sub->widget) - gtk_widget_hide(sub->widget); + gtk_widget_hide (sub->widget); } i++; @@ -909,26 +909,26 @@ sub_editor_combobox_changed (GtkWidget *w, EMSubscribeEditor *se) update_filtering_column (se, se->current); } -static gboolean sub_editor_timeout(EMSubscribeEditor *se) +static gboolean sub_editor_timeout (EMSubscribeEditor *se) { - gtk_progress_bar_pulse((GtkProgressBar *)se->progress); + gtk_progress_bar_pulse ((GtkProgressBar *)se->progress); return TRUE; } -static void sub_editor_busy(EMSubscribeEditor *se, gint dir) +static void sub_editor_busy (EMSubscribeEditor *se, gint dir) { gint was; was = se->busy != 0; se->busy += dir; if (was && !se->busy) { - g_source_remove(se->busy_id); + g_source_remove (se->busy_id); se->busy_id = 0; - gtk_widget_hide(se->progress); + gtk_widget_hide (se->progress); } else if (!was && se->busy) { - se->busy_id = g_timeout_add(1000/5, (GSourceFunc)sub_editor_timeout, se); - gtk_widget_show(se->progress); + se->busy_id = g_timeout_add (1000/5, (GSourceFunc)sub_editor_timeout, se); + gtk_widget_show (se->progress); } } @@ -1084,7 +1084,7 @@ collapse_all_cb (GtkButton *button, EMSubscribeEditor *se) } GtkWidget * -em_subscribe_editor_new(void) +em_subscribe_editor_new (void) { EMSubscribeEditor *se; EAccountList *accounts; @@ -1096,7 +1096,7 @@ em_subscribe_editor_new(void) GtkListStore *store; GtkTreeIter gtiter; - se = g_malloc0(sizeof(*se)); + se = g_malloc0 (sizeof (*se)); g_queue_init (&se->stores); /* XXX I think we're leaking the GtkBuilder. */ @@ -1118,16 +1118,16 @@ em_subscribe_editor_new(void) /* FIXME: This is just to get the shadow, is there a better way? */ w = gtk_label_new(_("Please select a server.")); - se->none_selected = gtk_viewport_new(NULL, NULL); - gtk_viewport_set_shadow_type((GtkViewport *)se->none_selected, GTK_SHADOW_IN); - gtk_container_add((GtkContainer *)se->none_selected, w); - gtk_widget_show(w); + se->none_selected = gtk_viewport_new (NULL, NULL); + gtk_viewport_set_shadow_type ((GtkViewport *)se->none_selected, GTK_SHADOW_IN); + gtk_container_add ((GtkContainer *)se->none_selected, w); + gtk_widget_show (w); - gtk_box_pack_start((GtkBox *)se->vbox, se->none_selected, TRUE, TRUE, 0); - gtk_widget_show(se->none_selected); + gtk_box_pack_start ((GtkBox *)se->vbox, se->none_selected, TRUE, TRUE, 0); + gtk_widget_show (se->none_selected); se->progress = e_builder_get_widget(builder, "progress_bar"); - gtk_widget_hide(se->progress); + gtk_widget_hide (se->progress); se->filter_entry = e_builder_get_widget (builder, "filter_entry"); gtk_entry_set_icon_sensitive (GTK_ENTRY (se->filter_entry), GTK_ENTRY_ICON_SECONDARY, FALSE); @@ -1189,7 +1189,7 @@ em_subscribe_editor_new(void) d(printf("not adding account '%s'\n", account->name)); } } - g_object_unref(iter); + g_object_unref (iter); gtk_combo_box_set_active (GTK_COMBO_BOX (se->combobox), 0); g_signal_connect(se->combobox, "changed", G_CALLBACK(sub_editor_combobox_changed), se); diff --git a/mail/em-subscribe-editor.h b/mail/em-subscribe-editor.h index 07b6796d8b..553ed7d544 100644 --- a/mail/em-subscribe-editor.h +++ b/mail/em-subscribe-editor.h @@ -23,6 +23,6 @@ #include <gtk/gtk.h> -GtkWidget *em_subscribe_editor_new(void); +GtkWidget *em_subscribe_editor_new (void); #endif /* _EM_SUBSCRIBE_EDITOR_H */ diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c index 238ccf0452..bb5a21808e 100644 --- a/mail/em-sync-stream.c +++ b/mail/em-sync-stream.c @@ -160,7 +160,7 @@ sync_stream_write (CamelStream *stream, else sync_stream_sync_op (emss, EMSS_WRITE, string, len, error); } else { - sync_stream_sync_op(emss, EMSS_WRITE, string, len, error); + sync_stream_sync_op (emss, EMSS_WRITE, string, len, error); } return (gssize) len; diff --git a/mail/em-utils.c b/mail/em-utils.c index ddf3986066..17957815ad 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -128,29 +128,29 @@ em_utils_ask_open_many (GtkWindow *parent, * Returns %TRUE if the user clicks Yes or %FALSE otherwise. **/ gboolean -em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag, ...) +em_utils_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, ...) { GtkWidget *mbox, *check = NULL; GtkWidget *container; va_list ap; gint button; - GConfClient *gconf = mail_config_get_gconf_client(); + GConfClient *gconf = mail_config_get_gconf_client (); EAlert *alert = NULL; if (promptkey - && !gconf_client_get_bool(gconf, promptkey, NULL)) + && !gconf_client_get_bool (gconf, promptkey, NULL)) return TRUE; - va_start(ap, tag); + va_start (ap, tag); alert = e_alert_new_valist (tag, ap); - va_end(ap); + va_end (ap); mbox = e_alert_dialog_new (parent, alert); g_object_unref (alert); if (promptkey) { check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again")); - gtk_container_set_border_width((GtkContainer *)check, 12); + gtk_container_set_border_width ((GtkContainer *)check, 12); container = gtk_dialog_get_content_area (GTK_DIALOG (mbox)); gtk_box_pack_start (GTK_BOX (container), check, TRUE, TRUE, 0); gtk_widget_show (check); @@ -158,9 +158,9 @@ em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag button = gtk_dialog_run ((GtkDialog *) mbox); if (promptkey) - gconf_client_set_bool(gconf, promptkey, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)), NULL); + gconf_client_set_bool (gconf, promptkey, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)), NULL); - gtk_widget_destroy(mbox); + gtk_widget_destroy (mbox); return button == GTK_RESPONSE_YES; } @@ -343,7 +343,7 @@ em_filename_make_safe (gchar *string) * achieve, and whether it does that as currently * written? */ - if (!g_unichar_isprint(c) || ( c < 0xff && strchr (unsafe_chars, c&0xff ))) { + if (!g_unichar_isprint (c) || ( c < 0xff && strchr (unsafe_chars, c&0xff ))) { while (ts<p) *ts++ = '_'; } @@ -439,7 +439,7 @@ em_utils_flag_for_followup (EMailReader *reader, CamelMessageInfo *info; CamelTag *iter; - info = camel_folder_get_message_info(folder, uids->pdata[i]); + info = camel_folder_get_message_info (folder, uids->pdata[i]); if (info == NULL) continue; @@ -484,7 +484,7 @@ em_utils_flag_for_followup_clear (GtkWindow *parent, CamelFolder *folder, GPtrAr camel_folder_freeze (folder); for (i = 0; i < uids->len; i++) { - CamelMessageInfo *mi = camel_folder_get_message_info(folder, uids->pdata[i]); + CamelMessageInfo *mi = camel_folder_get_message_info (folder, uids->pdata[i]); if (mi) { camel_message_info_set_user_tag(mi, "follow-up", NULL); @@ -523,7 +523,7 @@ em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GP camel_folder_freeze (folder); for (i = 0; i < uids->len; i++) { const gchar *tag; - CamelMessageInfo *mi = camel_folder_get_message_info(folder, uids->pdata[i]); + CamelMessageInfo *mi = camel_folder_get_message_info (folder, uids->pdata[i]); if (mi) { tag = camel_message_info_user_tag(mi, "follow-up"); @@ -542,13 +542,13 @@ em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GP /* This kind of sucks, because for various reasons most callers need to run synchronously in the gui thread, however this could take a long, blocking time, to run */ static gint -em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStream *stream) +em_utils_write_messages_to_stream (CamelFolder *folder, GPtrArray *uids, CamelStream *stream) { CamelStream *filtered_stream; CamelMimeFilter *from_filter; gint i, res = 0; - from_filter = camel_mime_filter_from_new(); + from_filter = camel_mime_filter_from_new (); filtered_stream = camel_stream_filter_new (stream); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), from_filter); @@ -558,22 +558,22 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr CamelMimeMessage *message; gchar *from; - message = camel_folder_get_message(folder, uids->pdata[i], NULL); + message = camel_folder_get_message (folder, uids->pdata[i], NULL); if (message == NULL) { res = -1; break; } /* we need to flush after each stream write since we are writing to the same stream */ - from = camel_mime_message_build_mbox_from(message); + from = camel_mime_message_build_mbox_from (message); - if (camel_stream_write_string(stream, from, NULL) == -1 - || camel_stream_flush(stream, NULL) == -1 - || camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, (CamelStream *)filtered_stream, NULL) == -1 - || camel_stream_flush((CamelStream *)filtered_stream, NULL) == -1) + if (camel_stream_write_string (stream, from, NULL) == -1 + || camel_stream_flush (stream, NULL) == -1 + || camel_data_wrapper_write_to_stream ((CamelDataWrapper *)message, (CamelStream *)filtered_stream, NULL) == -1 + || camel_stream_flush ((CamelStream *)filtered_stream, NULL) == -1) res = -1; - g_free(from); + g_free (from); g_object_unref (message); if (res == -1) @@ -588,21 +588,21 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr /* This kind of sucks, because for various reasons most callers need to run synchronously in the gui thread, however this could take a long, blocking time, to run */ static gint -em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream) +em_utils_read_messages_from_stream (CamelFolder *folder, CamelStream *stream) { - CamelMimeParser *mp = camel_mime_parser_new(); + CamelMimeParser *mp = camel_mime_parser_new (); gboolean success = TRUE; - camel_mime_parser_scan_from(mp, TRUE); - camel_mime_parser_init_with_stream(mp, stream, NULL); + camel_mime_parser_scan_from (mp, TRUE); + camel_mime_parser_init_with_stream (mp, stream, NULL); - 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; gboolean success; /* NB: de-from filter, once written */ - msg = camel_mime_message_new(); - if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp, NULL) == -1) { + msg = camel_mime_message_new (); + if (camel_mime_part_construct_from_parser ((CamelMimePart *)msg, mp, NULL) == -1) { g_object_unref (msg); break; } @@ -614,7 +614,7 @@ em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream) if (!success) break; - camel_mime_parser_step(mp, NULL, NULL); + camel_mime_parser_step (mp, NULL, NULL); } g_object_unref (mp); @@ -647,7 +647,7 @@ em_utils_selection_set_mailbox (GtkSelectionData *data, stream = camel_stream_mem_new_with_byte_array (byte_array); if (em_utils_write_messages_to_stream (folder, uids, stream) == 0) - gtk_selection_data_set( + gtk_selection_data_set ( data, target, 8, byte_array->data, byte_array->len); @@ -682,7 +682,7 @@ em_utils_selection_get_mailbox (GtkSelectionData *selection_data, /* NB: Although copying would let us run this async ... which it should */ stream = (CamelStream *) camel_stream_mem_new_with_buffer ((gchar *) data, length); - em_utils_read_messages_from_stream(folder, stream); + em_utils_read_messages_from_stream (folder, stream); g_object_unref (stream); } @@ -710,9 +710,9 @@ em_utils_selection_get_message (GtkSelectionData *selection_data, stream = (CamelStream *) camel_stream_mem_new_with_buffer ((gchar *)data, length); - msg = camel_mime_message_new(); - if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream, NULL) == 0) - camel_folder_append_message(folder, msg, NULL, NULL, NULL); + msg = camel_mime_message_new (); + if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg, stream, NULL) == 0) + camel_folder_append_message (folder, msg, NULL, NULL, NULL); g_object_unref (msg); g_object_unref (stream); } @@ -732,21 +732,21 @@ em_utils_selection_set_uidlist (GtkSelectionData *selection_data, const gchar *uri, GPtrArray *uids) { - GByteArray *array = g_byte_array_new(); + GByteArray *array = g_byte_array_new (); GdkAtom target; gint i; /* format: "uri\0uid1\0uid2\0uid3\0...\0uidn\0" */ - g_byte_array_append(array, (guchar *)uri, strlen(uri)+1); + g_byte_array_append (array, (guchar *)uri, strlen (uri)+1); for (i=0; i<uids->len; i++) - g_byte_array_append(array, uids->pdata[i], strlen(uids->pdata[i])+1); + g_byte_array_append (array, uids->pdata[i], strlen (uids->pdata[i])+1); target = gtk_selection_data_get_target (selection_data); gtk_selection_data_set ( selection_data, target, 8, array->data, array->len); - g_byte_array_free(array, TRUE); + g_byte_array_free (array, TRUE); } /** @@ -779,7 +779,7 @@ em_utils_selection_get_uidlist (GtkSelectionData *selection_data, if (data == NULL || length == -1) return; - uids = g_ptr_array_new(); + uids = g_ptr_array_new (); inptr = (gchar *) data; inend = (gchar *) (data + length); @@ -790,23 +790,23 @@ em_utils_selection_get_uidlist (GtkSelectionData *selection_data, inptr++; if (start > (gchar *) data) - g_ptr_array_add(uids, g_strndup(start, inptr-start)); + g_ptr_array_add (uids, g_strndup (start, inptr-start)); inptr++; } if (uids->len == 0) { - g_ptr_array_free(uids, TRUE); + g_ptr_array_free (uids, TRUE); return; } - folder = mail_tool_uri_to_folder((gchar *) data, 0, error); + folder = mail_tool_uri_to_folder ((gchar *) data, 0, error); if (folder) { - camel_folder_transfer_messages_to(folder, uids, dest, NULL, move, error); + camel_folder_transfer_messages_to (folder, uids, dest, NULL, move, error); g_object_unref (folder); } - em_utils_uids_free(uids); + em_utils_uids_free (uids); } /** @@ -820,7 +820,7 @@ em_utils_selection_get_uidlist (GtkSelectionData *selection_data, * up when the application quits. **/ void -em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids) +em_utils_selection_set_urilist (GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids) { gchar *tmpdir; CamelStream *fstream; @@ -834,9 +834,9 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr /* Try to get the drop filename from the message or folder */ if (uids->len == 1) { - info = camel_folder_get_message_info(folder, uids->pdata[0]); + info = camel_folder_get_message_info (folder, uids->pdata[0]); if (info) { - file = g_strdup(camel_message_info_subject(info)); + file = g_strdup (camel_message_info_subject (info)); camel_folder_free_message_info (folder, info); } } @@ -849,37 +849,37 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr camel_folder_get_name (folder)); } - e_filename_make_safe(file); + e_filename_make_safe (file); - tmpfile = g_build_filename(tmpdir, file, NULL); - g_free(tmpdir); - g_free(file); + tmpfile = g_build_filename (tmpdir, file, NULL); + g_free (tmpdir); + g_free (file); - fd = g_open(tmpfile, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0666); + fd = g_open (tmpfile, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0666); if (fd == -1) { - g_free(tmpfile); + g_free (tmpfile); return; } - uri = g_filename_to_uri(tmpfile, NULL, NULL); - g_free(tmpfile); - fstream = camel_stream_fs_new_with_fd(fd); + uri = g_filename_to_uri (tmpfile, NULL, NULL); + g_free (tmpfile); + fstream = camel_stream_fs_new_with_fd (fd); if (fstream) { - if (em_utils_write_messages_to_stream(folder, uids, fstream) == 0) { + if (em_utils_write_messages_to_stream (folder, uids, fstream) == 0) { /* terminate with \r\n to be compliant with the spec */ gchar *uri_crlf = g_strconcat(uri, "\r\n", NULL); GdkAtom target; target = gtk_selection_data_get_target (data); - gtk_selection_data_set(data, target, 8, (guchar *)uri_crlf, strlen(uri_crlf)); - g_free(uri_crlf); + gtk_selection_data_set (data, target, 8, (guchar *)uri_crlf, strlen (uri_crlf)); + g_free (uri_crlf); } g_object_unref (fstream); } else - close(fd); + close (fd); - g_free(uri); + g_free (uri); } /** @@ -906,31 +906,31 @@ em_utils_selection_get_urilist (GtkSelectionData *selection_data, uris = gtk_selection_data_get_uris (selection_data); for (i=0;res == 0 && uris[i];i++) { - g_strstrip(uris[i]); + g_strstrip (uris[i]); if (uris[i][0] == '#') continue; - url = camel_url_new(uris[i], NULL); + url = camel_url_new (uris[i], NULL); if (url == NULL) continue; if (strcmp(url->protocol, "file") == 0 - && (fd = g_open(url->path, O_RDONLY | O_BINARY, 0)) != -1) { - stream = camel_stream_fs_new_with_fd(fd); + && (fd = g_open (url->path, O_RDONLY | O_BINARY, 0)) != -1) { + stream = camel_stream_fs_new_with_fd (fd); if (stream) { - res = em_utils_read_messages_from_stream(folder, stream); + res = em_utils_read_messages_from_stream (folder, stream); g_object_unref (stream); } else - close(fd); + close (fd); } - camel_url_free(url); + camel_url_free (url); } g_strfreev (uris); } static void -emu_save_part_done(CamelMimePart *part, gchar *name, gint done, gpointer data) +emu_save_part_done (CamelMimePart *part, gchar *name, gint done, gpointer data) { ((gint *)data)[0] = done; } @@ -947,7 +947,7 @@ emu_save_part_done(CamelMimePart *part, gchar *name, gint done, gpointer data) * Return value: NULL if anything failed. **/ gchar * -em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode) +em_utils_temp_save_part (GtkWidget *parent, CamelMimePart *part, gboolean mode) { const gchar *filename; gchar *tmpdir, *path, *utf8_mfilename = NULL, *mfilename = NULL; @@ -973,18 +973,18 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode) filename = (const gchar *) mfilename; } - path = g_build_filename(tmpdir, filename, NULL); - g_free(tmpdir); - g_free(mfilename); + path = g_build_filename (tmpdir, filename, NULL); + g_free (tmpdir); + g_free (mfilename); /* FIXME: This doesn't handle default charsets */ if (mode) - mail_msg_wait(mail_save_part(part, path, emu_save_part_done, &done, TRUE)); + mail_msg_wait (mail_save_part (part, path, emu_save_part_done, &done, TRUE)); else - mail_msg_wait(mail_save_part(part, path, emu_save_part_done, &done, FALSE)); + mail_msg_wait (mail_save_part (part, path, emu_save_part_done, &done, FALSE)); if (!done) { /* mail_save_part should popup an error box automagically */ - g_free(path); + g_free (path); path = NULL; } @@ -1055,7 +1055,7 @@ em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri) * Returns %TRUE if this is a Drafts folder or %FALSE otherwise. **/ gboolean -em_utils_folder_is_drafts(CamelFolder *folder, const gchar *uri) +em_utils_folder_is_drafts (CamelFolder *folder, const gchar *uri) { CamelFolder *local_drafts_folder; CamelStore *parent_store; @@ -1077,9 +1077,9 @@ em_utils_folder_is_drafts(CamelFolder *folder, const gchar *uri) parent_store = camel_folder_get_parent_store (folder); accounts = e_get_account_list (); - iter = e_list_get_iterator((EList *)accounts); - while (e_iterator_is_valid(iter)) { - account = (EAccount *)e_iterator_get(iter); + iter = e_list_get_iterator ((EList *)accounts); + while (e_iterator_is_valid (iter)) { + account = (EAccount *)e_iterator_get (iter); if (account->drafts_folder_uri) { drafts_uri = em_uri_to_camel (account->drafts_folder_uri); @@ -1091,10 +1091,10 @@ em_utils_folder_is_drafts(CamelFolder *folder, const gchar *uri) g_free (drafts_uri); } - e_iterator_next(iter); + e_iterator_next (iter); } - g_object_unref(iter); + g_object_unref (iter); return is; } @@ -1109,7 +1109,7 @@ em_utils_folder_is_drafts(CamelFolder *folder, const gchar *uri) * Returns %TRUE if this is a Sent folder or %FALSE otherwise. **/ gboolean -em_utils_folder_is_sent(CamelFolder *folder, const gchar *uri) +em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri) { CamelFolder *local_sent_folder; CamelStore *parent_store; @@ -1130,9 +1130,9 @@ em_utils_folder_is_sent(CamelFolder *folder, const gchar *uri) parent_store = camel_folder_get_parent_store (folder); accounts = e_get_account_list (); - iter = e_list_get_iterator((EList *)accounts); - while (e_iterator_is_valid(iter)) { - account = (EAccount *)e_iterator_get(iter); + iter = e_list_get_iterator ((EList *)accounts); + while (e_iterator_is_valid (iter)) { + account = (EAccount *)e_iterator_get (iter); if (account->sent_folder_uri) { sent_uri = em_uri_to_camel (account->sent_folder_uri); @@ -1144,10 +1144,10 @@ em_utils_folder_is_sent(CamelFolder *folder, const gchar *uri) g_free (sent_uri); } - e_iterator_next(iter); + e_iterator_next (iter); } - g_object_unref(iter); + g_object_unref (iter); return is; } @@ -1162,7 +1162,7 @@ em_utils_folder_is_sent(CamelFolder *folder, const gchar *uri) * Returns %TRUE if this is an Outbox folder or %FALSE otherwise. **/ gboolean -em_utils_folder_is_outbox(CamelFolder *folder, const gchar *uri) +em_utils_folder_is_outbox (CamelFolder *folder, const gchar *uri) { CamelFolder *local_outbox_folder; const gchar *local_outbox_folder_uri; @@ -1254,7 +1254,7 @@ em_utils_message_to_html (CamelMimeMessage *message, const gchar *credits, guint mem = (CamelStreamMem *) camel_stream_mem_new (); camel_stream_mem_set_byte_array (mem, buf); - emfq = em_format_quote_new(credits, (CamelStream *)mem, flags); + emfq = em_format_quote_new (credits, (CamelStream *)mem, flags); ((EMFormat *) emfq)->composer = TRUE; if (!source) { @@ -1269,7 +1269,7 @@ em_utils_message_to_html (CamelMimeMessage *message, const gchar *credits, guint g_free (charset); } - em_format_format_clone((EMFormat *)emfq, NULL, NULL, message, source); + em_format_format_clone ((EMFormat *)emfq, NULL, NULL, message, source); if (validity_found) *validity_found = ((EMFormat *)emfq)->validity_found; g_object_unref (emfq); @@ -1283,7 +1283,7 @@ em_utils_message_to_html (CamelMimeMessage *message, const gchar *credits, guint text = (gchar *)buf->data; if (len) *len = buf->len-1; - g_byte_array_free(buf, FALSE); + g_byte_array_free (buf, FALSE); return text; } @@ -1337,7 +1337,7 @@ em_utils_empty_trash (GtkWidget *parent) /* make sure this is a valid source */ if (account->enabled && account->source->url) { - provider = camel_provider_get(account->source->url, NULL); + provider = camel_provider_get (account->source->url, NULL); if (provider) { /* make sure this store is a remote store */ if (provider->flags & CAMEL_PROVIDER_IS_STORAGE) { @@ -1388,7 +1388,7 @@ em_utils_folder_name_from_uri (const gchar *uri) * local local:/storage/path#folder -> email://local@local/folder */ -gchar *em_uri_from_camel(const gchar *curi) +gchar *em_uri_from_camel (const gchar *curi) { CamelURL *curl; EAccount *account; @@ -1398,21 +1398,21 @@ gchar *em_uri_from_camel(const gchar *curi) /* Easiest solution to code that shouldnt be calling us */ if (!strncmp(curi, "email:", 6)) - return g_strdup(curi); + return g_strdup (curi); - provider = camel_provider_get(curi, NULL); + provider = camel_provider_get (curi, NULL); if (provider == NULL) { d(printf("em uri from camel failed '%s'\n", curi)); - return g_strdup(curi); + return g_strdup (curi); } - curl = camel_url_new(curi, NULL); + curl = camel_url_new (curi, NULL); if (curl == NULL) - return g_strdup(curi); + return g_strdup (curi); if (strcmp(curl->protocol, "vfolder") == 0) uid = "vfolder@local"; - else if ((account = mail_config_get_account_by_source_url(curi)) == NULL) + else if ((account = mail_config_get_account_by_source_url (curi)) == NULL) uid = "local@local"; else uid = account->uid; @@ -1423,19 +1423,19 @@ gchar *em_uri_from_camel(const gchar *curi) tmp = camel_url_encode(path, ";?"); euri = g_strdup_printf("email://%s/%s", uid, tmp); - g_free(tmp); + g_free (tmp); } else { euri = g_strdup_printf("email://%s/", uid); } d(printf("em uri from camel '%s' -> '%s'\n", curi, euri)); - camel_url_free(curl); + camel_url_free (curl); return euri; } -gchar *em_uri_to_camel(const gchar *euri) +gchar *em_uri_to_camel (const gchar *euri) { EAccountList *accounts; const EAccount *account; @@ -1446,14 +1446,14 @@ gchar *em_uri_to_camel(const gchar *euri) if (strncmp(euri, "email:", 6) != 0) { d(printf("em uri to camel not euri '%s'\n", euri)); - return g_strdup(euri); + return g_strdup (euri); } - eurl = camel_url_new(euri, NULL); + eurl = camel_url_new (euri, NULL); if (eurl == NULL) - return g_strdup(euri); + return g_strdup (euri); - g_return_val_if_fail (eurl->host != NULL, g_strdup(euri)); + g_return_val_if_fail (eurl->host != NULL, g_strdup (euri)); if (eurl->user != NULL) { /* Sigh, shoul'dve used mbox@local for mailboxes, not local@local */ @@ -1475,12 +1475,12 @@ gchar *em_uri_to_camel(const gchar *euri) *p++ = '/'; } #endif - camel_url_set_path(curl, base); - g_free(base); - camel_url_set_fragment(curl, eurl->path[0]=='/'?eurl->path+1:eurl->path); - curi = camel_url_to_string(curl, 0); - camel_url_free(curl); - camel_url_free(eurl); + camel_url_set_path (curl, base); + g_free (base); + camel_url_set_fragment (curl, eurl->path[0]=='/'?eurl->path+1:eurl->path); + curi = camel_url_to_string (curl, 0); + camel_url_free (curl); + camel_url_free (eurl); d(printf("em uri to camel local '%s' -> '%s'\n", euri, curi)); return curi; @@ -1488,17 +1488,17 @@ gchar *em_uri_to_camel(const gchar *euri) uid = g_strdup_printf("%s@%s", eurl->user, eurl->host); } else { - uid = g_strdup(eurl->host); + uid = g_strdup (eurl->host); } accounts = e_get_account_list (); - account = e_account_list_find(accounts, E_ACCOUNT_FIND_UID, uid); - g_free(uid); + account = e_account_list_find (accounts, E_ACCOUNT_FIND_UID, uid); + g_free (uid); if (account == NULL) { - camel_url_free(eurl); + camel_url_free (eurl); d(printf("em uri to camel no account '%s' -> '%s'\n", euri, euri)); - return g_strdup(euri); + return g_strdup (euri); } service = account->source; @@ -1506,16 +1506,16 @@ gchar *em_uri_to_camel(const gchar *euri) if (provider == NULL) return g_strdup (euri); - curl = camel_url_new(service->url, NULL); + curl = camel_url_new (service->url, NULL); if (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) - camel_url_set_fragment(curl, eurl->path[0]=='/'?eurl->path+1:eurl->path); + camel_url_set_fragment (curl, eurl->path[0]=='/'?eurl->path+1:eurl->path); else - camel_url_set_path(curl, eurl->path); + camel_url_set_path (curl, eurl->path); - curi = camel_url_to_string(curl, 0); + curi = camel_url_to_string (curl, 0); - camel_url_free(eurl); - camel_url_free(curl); + camel_url_free (eurl); + camel_url_free (curl); d(printf("em uri to camel '%s' -> '%s'\n", euri, curi)); @@ -1921,7 +1921,7 @@ em_utils_contact_photo (CamelInternetAddress *cia, gboolean local_only) if (photo) { /* Form a mime part out of the photo */ part = camel_mime_part_new (); - camel_mime_part_set_content(part, + camel_mime_part_set_content (part, (const gchar *) photo->data.inlined.data, photo->data.inlined.length, "image/jpeg"); } diff --git a/mail/em-utils.h b/mail/em-utils.h index ac1f1a0928..7e071756a2 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -35,7 +35,7 @@ G_BEGIN_DECLS struct _EMFormat; gboolean em_utils_ask_open_many (GtkWindow *parent, gint how_many); -gboolean em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag, ...); +gboolean em_utils_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, ...); GPtrArray *em_utils_uids_copy (GPtrArray *uids); void em_utils_uids_free (GPtrArray *uids); @@ -52,21 +52,21 @@ void em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folde /* This stuff that follows probably doesn't belong here, then again, the stuff above probably belongs elsewhere */ -void em_utils_selection_set_mailbox(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids); -void em_utils_selection_get_mailbox(GtkSelectionData *data, CamelFolder *folder); -void em_utils_selection_get_message(GtkSelectionData *data, CamelFolder *folder); +void em_utils_selection_set_mailbox (GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids); +void em_utils_selection_get_mailbox (GtkSelectionData *data, CamelFolder *folder); +void em_utils_selection_get_message (GtkSelectionData *data, CamelFolder *folder); /* FIXME: be nice if these also worked on CamelFolder's, no easy way to get uri from folder yet tho */ -void em_utils_selection_set_uidlist(GtkSelectionData *data, const gchar *uri, GPtrArray *uids); -void em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, gint move, GError **error); -void em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids); -void em_utils_selection_get_urilist(GtkSelectionData *data, CamelFolder *folder); +void em_utils_selection_set_uidlist (GtkSelectionData *data, const gchar *uri, GPtrArray *uids); +void em_utils_selection_get_uidlist (GtkSelectionData *data, CamelFolder *dest, gint move, GError **error); +void em_utils_selection_set_urilist (GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids); +void em_utils_selection_get_urilist (GtkSelectionData *data, CamelFolder *folder); -gchar *em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode); +gchar *em_utils_temp_save_part (GtkWidget *parent, CamelMimePart *part, gboolean mode); -gboolean em_utils_folder_is_drafts(CamelFolder *folder, const gchar *uri); -gboolean em_utils_folder_is_templates(CamelFolder *folder, const gchar *uri); -gboolean em_utils_folder_is_sent(CamelFolder *folder, const gchar *uri); -gboolean em_utils_folder_is_outbox(CamelFolder *folder, const gchar *uri); +gboolean em_utils_folder_is_drafts (CamelFolder *folder, const gchar *uri); +gboolean em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri); +gboolean em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri); +gboolean em_utils_folder_is_outbox (CamelFolder *folder, const gchar *uri); gchar *em_utils_get_proxy_uri (const gchar *uri); diff --git a/mail/em-vfolder-context.c b/mail/em-vfolder-context.c index 03ecd3681f..6d5604afe4 100644 --- a/mail/em-vfolder-context.c +++ b/mail/em-vfolder-context.c @@ -35,14 +35,14 @@ #include "em-filter-folder-element.h" -static EFilterElement *vfolder_new_element(ERuleContext *rc, const gchar *type); +static EFilterElement *vfolder_new_element (ERuleContext *rc, const gchar *type); static ERuleContextClass *parent_class = NULL; static void em_vfolder_context_class_init (EMVFolderContextClass *klass) { - parent_class = g_type_class_ref(E_TYPE_RULE_CONTEXT); + parent_class = g_type_class_ref (E_TYPE_RULE_CONTEXT); ((ERuleContextClass *)klass)->new_element = vfolder_new_element; } @@ -63,7 +63,7 @@ em_vfolder_context_init (EMVFolderContext *vc) } GType -em_vfolder_context_get_type(void) +em_vfolder_context_get_type (void) { static GType type = 0; @@ -99,14 +99,14 @@ em_vfolder_context_get_type(void) EMVFolderContext * em_vfolder_context_new (void) { - return g_object_new (em_vfolder_context_get_type(), NULL, NULL); + return g_object_new (em_vfolder_context_get_type (), NULL, NULL); } static EFilterElement * vfolder_new_element (ERuleContext *rc, const gchar *type) { if (!strcmp(type, "system-flag")) { - return (EFilterElement *) e_filter_option_new(); + return (EFilterElement *) e_filter_option_new (); } else if (!strcmp(type, "score")) { return (EFilterElement *) e_filter_int_new_type("score", -3, 3); } else if (!strcmp(type, "folder-curi")) { @@ -115,9 +115,9 @@ vfolder_new_element (ERuleContext *rc, const gchar *type) ff->store_camel_uri = TRUE; return (EFilterElement *) ff; } else if (!strcmp(type, "folder")) { - return (EFilterElement *) em_filter_folder_element_new(); + return (EFilterElement *) em_filter_folder_element_new (); } else { - return parent_class->new_element(rc, type); + return parent_class->new_element (rc, type); } } diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index 9ecca7b60b..073bcec7f0 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -43,17 +43,17 @@ #define d(x) -static gint validate(EFilterRule *, EAlert **alert); -static gint vfolder_eq(EFilterRule *fr, EFilterRule *cm); -static xmlNodePtr xml_encode(EFilterRule *); -static gint xml_decode(EFilterRule *, xmlNodePtr, ERuleContext *f); -static void rule_copy(EFilterRule *dest, EFilterRule *src); +static gint validate (EFilterRule *, EAlert **alert); +static gint vfolder_eq (EFilterRule *fr, EFilterRule *cm); +static xmlNodePtr xml_encode (EFilterRule *); +static gint xml_decode (EFilterRule *, xmlNodePtr, ERuleContext *f); +static void rule_copy (EFilterRule *dest, EFilterRule *src); /*static void build_code(EFilterRule *, GString *out);*/ -static GtkWidget *get_widget(EFilterRule *fr, ERuleContext *f); +static GtkWidget *get_widget (EFilterRule *fr, ERuleContext *f); -static void em_vfolder_rule_class_init(EMVFolderRuleClass *klass); -static void em_vfolder_rule_init(EMVFolderRule *vr); -static void em_vfolder_rule_finalise(GObject *obj); +static void em_vfolder_rule_class_init (EMVFolderRuleClass *klass); +static void em_vfolder_rule_init (EMVFolderRule *vr); +static void em_vfolder_rule_finalise (GObject *obj); /* DO NOT internationalise these strings */ static const gchar *with_names[] = { @@ -66,19 +66,19 @@ static const gchar *with_names[] = { static EFilterRuleClass *parent_class = NULL; GType -em_vfolder_rule_get_type(void) +em_vfolder_rule_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { - sizeof(EMVFolderRuleClass), + sizeof (EMVFolderRuleClass), NULL, /* base_class_init */ NULL, /* base_class_finalize */ (GClassInitFunc)em_vfolder_rule_class_init, NULL, /* class_finalize */ NULL, /* class_data */ - sizeof(EMVFolderRule), + sizeof (EMVFolderRule), 0, /* n_preallocs */ (GInstanceInitFunc)em_vfolder_rule_init, }; @@ -90,12 +90,12 @@ em_vfolder_rule_get_type(void) } static void -em_vfolder_rule_class_init(EMVFolderRuleClass *klass) +em_vfolder_rule_class_init (EMVFolderRuleClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); EFilterRuleClass *fr_class =(EFilterRuleClass *)klass; - parent_class = g_type_class_ref(E_TYPE_FILTER_RULE); + parent_class = g_type_class_ref (E_TYPE_FILTER_RULE); object_class->finalize = em_vfolder_rule_finalise; @@ -110,21 +110,21 @@ em_vfolder_rule_class_init(EMVFolderRuleClass *klass) } static void -em_vfolder_rule_init(EMVFolderRule *vr) +em_vfolder_rule_init (EMVFolderRule *vr) { vr->with = EM_VFOLDER_RULE_WITH_SPECIFIC; vr->rule.source = g_strdup("incoming"); } static void -em_vfolder_rule_finalise(GObject *obj) +em_vfolder_rule_finalise (GObject *obj) { EMVFolderRule *vr =(EMVFolderRule *)obj; - g_list_foreach(vr->sources, (GFunc)g_free, NULL); - g_list_free(vr->sources); + g_list_foreach (vr->sources, (GFunc)g_free, NULL); + g_list_free (vr->sources); - G_OBJECT_CLASS(parent_class)->finalize(obj); + G_OBJECT_CLASS (parent_class)->finalize (obj); } /** @@ -135,34 +135,34 @@ em_vfolder_rule_finalise(GObject *obj) * Return value: A new #EMVFolderRule object. **/ EMVFolderRule * -em_vfolder_rule_new(void) +em_vfolder_rule_new (void) { - return (EMVFolderRule *)g_object_new(em_vfolder_rule_get_type(), NULL, NULL); + return (EMVFolderRule *)g_object_new (em_vfolder_rule_get_type (), NULL, NULL); } void -em_vfolder_rule_add_source(EMVFolderRule *vr, const gchar *uri) +em_vfolder_rule_add_source (EMVFolderRule *vr, const gchar *uri) { - g_return_if_fail (EM_IS_VFOLDER_RULE(vr)); + g_return_if_fail (EM_IS_VFOLDER_RULE (vr)); g_return_if_fail (uri); - vr->sources = g_list_append(vr->sources, g_strdup(uri)); + vr->sources = g_list_append (vr->sources, g_strdup (uri)); - e_filter_rule_emit_changed((EFilterRule *)vr); + e_filter_rule_emit_changed ((EFilterRule *)vr); } const gchar * -em_vfolder_rule_find_source(EMVFolderRule *vr, const gchar *uri) +em_vfolder_rule_find_source (EMVFolderRule *vr, const gchar *uri) { GList *l; - g_return_val_if_fail (EM_IS_VFOLDER_RULE(vr), NULL); + g_return_val_if_fail (EM_IS_VFOLDER_RULE (vr), NULL); /* only does a simple string or address comparison, should probably do a decoded url comparison */ l = vr->sources; while (l) { - if (l->data == uri || !strcmp(l->data, uri)) + if (l->data == uri || !strcmp (l->data, uri)) return l->data; l = l->next; } @@ -171,33 +171,33 @@ em_vfolder_rule_find_source(EMVFolderRule *vr, const gchar *uri) } void -em_vfolder_rule_remove_source(EMVFolderRule *vr, const gchar *uri) +em_vfolder_rule_remove_source (EMVFolderRule *vr, const gchar *uri) { gchar *found; - g_return_if_fail (EM_IS_VFOLDER_RULE(vr)); + g_return_if_fail (EM_IS_VFOLDER_RULE (vr)); - found =(gchar *)em_vfolder_rule_find_source(vr, uri); + found =(gchar *)em_vfolder_rule_find_source (vr, uri); if (found) { - vr->sources = g_list_remove(vr->sources, found); - g_free(found); - e_filter_rule_emit_changed((EFilterRule *)vr); + vr->sources = g_list_remove (vr->sources, found); + g_free (found); + e_filter_rule_emit_changed ((EFilterRule *)vr); } } const gchar * -em_vfolder_rule_next_source(EMVFolderRule *vr, const gchar *last) +em_vfolder_rule_next_source (EMVFolderRule *vr, const gchar *last) { GList *node; if (last == NULL) { node = vr->sources; } else { - node = g_list_find(vr->sources, (gchar *)last); + node = g_list_find (vr->sources, (gchar *)last); if (node == NULL) node = vr->sources; else - node = g_list_next(node); + node = g_list_next (node); } if (node) @@ -207,9 +207,9 @@ em_vfolder_rule_next_source(EMVFolderRule *vr, const gchar *last) } static gint -validate(EFilterRule *fr, EAlert **alert) +validate (EFilterRule *fr, EAlert **alert) { - g_return_val_if_fail(fr != NULL, 0); + g_return_val_if_fail (fr != NULL, 0); g_warn_if_fail (alert == NULL || *alert == NULL); if (!fr->name || !*fr->name) { @@ -227,18 +227,18 @@ validate(EFilterRule *fr, EAlert **alert) return 0; } - return E_FILTER_RULE_CLASS(parent_class)->validate (fr, alert); + return E_FILTER_RULE_CLASS (parent_class)->validate (fr, alert); } static gint -list_eq(GList *al, GList *bl) +list_eq (GList *al, GList *bl) { gint truth = TRUE; while (truth && al && bl) { gchar *a = al->data, *b = bl->data; - truth = strcmp(a, b)== 0; + truth = strcmp (a, b)== 0; al = al->next; bl = bl->next; } @@ -247,31 +247,31 @@ list_eq(GList *al, GList *bl) } static gint -vfolder_eq(EFilterRule *fr, EFilterRule *cm) +vfolder_eq (EFilterRule *fr, EFilterRule *cm) { - return E_FILTER_RULE_CLASS(parent_class)->eq(fr, cm) - && list_eq(((EMVFolderRule *)fr)->sources, ((EMVFolderRule *)cm)->sources); + return E_FILTER_RULE_CLASS (parent_class)->eq (fr, cm) + && list_eq (((EMVFolderRule *)fr)->sources, ((EMVFolderRule *)cm)->sources); } static xmlNodePtr -xml_encode(EFilterRule *fr) +xml_encode (EFilterRule *fr) { EMVFolderRule *vr =(EMVFolderRule *)fr; xmlNodePtr node, set, work; GList *l; - node = E_FILTER_RULE_CLASS(parent_class)->xml_encode(fr); + node = E_FILTER_RULE_CLASS (parent_class)->xml_encode (fr); g_return_val_if_fail (node != NULL, NULL); g_return_val_if_fail (vr->with < G_N_ELEMENTS (with_names), NULL); set = xmlNewNode(NULL, (const guchar *)"sources"); - xmlAddChild(node, set); + xmlAddChild (node, set); xmlSetProp(set, (const guchar *)"with", (guchar *)with_names[vr->with]); l = vr->sources; while (l) { work = xmlNewNode(NULL, (const guchar *)"folder"); xmlSetProp(work, (const guchar *)"uri", (guchar *)l->data); - xmlAddChild(set, work); + xmlAddChild (set, work); l = l->next; } @@ -279,12 +279,12 @@ xml_encode(EFilterRule *fr) } static void -set_with(EMVFolderRule *vr, const gchar *name) +set_with (EMVFolderRule *vr, const gchar *name) { gint i; for (i = 0; i < G_N_ELEMENTS (with_names); i++) { - if (!strcmp(name, with_names[i])) { + if (!strcmp (name, with_names[i])) { vr->with = i; return; } @@ -294,21 +294,21 @@ set_with(EMVFolderRule *vr, const gchar *name) } static gint -xml_decode(EFilterRule *fr, xmlNodePtr node, struct _ERuleContext *f) +xml_decode (EFilterRule *fr, xmlNodePtr node, struct _ERuleContext *f) { xmlNodePtr set, work; gint result; EMVFolderRule *vr =(EMVFolderRule *)fr; gchar *tmp; - result = E_FILTER_RULE_CLASS(parent_class)->xml_decode(fr, node, f); + result = E_FILTER_RULE_CLASS (parent_class)->xml_decode (fr, node, f); if (result != 0) return result; /* handle old format file, vfolder source is in filterrule */ if (strcmp(fr->source, "incoming")!= 0) { - set_with(vr, fr->source); - g_free(fr->source); + set_with (vr, fr->source); + g_free (fr->source); fr->source = g_strdup("incoming"); } @@ -317,16 +317,16 @@ xml_decode(EFilterRule *fr, xmlNodePtr node, struct _ERuleContext *f) if (!strcmp((gchar *)set->name, "sources")) { tmp = (gchar *)xmlGetProp(set, (const guchar *)"with"); if (tmp) { - set_with(vr, tmp); - xmlFree(tmp); + set_with (vr, tmp); + xmlFree (tmp); } work = set->children; while (work) { if (!strcmp((gchar *)work->name, "folder")) { tmp = (gchar *)xmlGetProp(work, (const guchar *)"uri"); if (tmp) { - vr->sources = g_list_append(vr->sources, g_strdup(tmp)); - xmlFree(tmp); + vr->sources = g_list_append (vr->sources, g_strdup (tmp)); + xmlFree (tmp); } } work = work->next; @@ -338,7 +338,7 @@ xml_decode(EFilterRule *fr, xmlNodePtr node, struct _ERuleContext *f) } static void -rule_copy(EFilterRule *dest, EFilterRule *src) +rule_copy (EFilterRule *dest, EFilterRule *src) { EMVFolderRule *vdest, *vsrc; GList *node; @@ -347,8 +347,8 @@ rule_copy(EFilterRule *dest, EFilterRule *src) vsrc =(EMVFolderRule *)src; if (vdest->sources) { - g_list_foreach(vdest->sources, (GFunc)g_free, NULL); - g_list_free(vdest->sources); + g_list_foreach (vdest->sources, (GFunc)g_free, NULL); + g_list_free (vdest->sources); vdest->sources = NULL; } @@ -356,13 +356,13 @@ rule_copy(EFilterRule *dest, EFilterRule *src) while (node) { gchar *uri = node->data; - vdest->sources = g_list_append(vdest->sources, g_strdup(uri)); + vdest->sources = g_list_append (vdest->sources, g_strdup (uri)); node = node->next; } vdest->with = vsrc->with; - E_FILTER_RULE_CLASS(parent_class)->copy(dest, src); + E_FILTER_RULE_CLASS (parent_class)->copy (dest, src); } enum { @@ -381,8 +381,8 @@ struct _source_data { GtkButton *buttons[BUTTON_LAST]; }; -static void source_add(GtkWidget *widget, struct _source_data *data); -static void source_remove(GtkWidget *widget, struct _source_data *data); +static void source_add (GtkWidget *widget, struct _source_data *data); +static void source_remove (GtkWidget *widget, struct _source_data *data); static struct { const gchar *name; @@ -393,7 +393,7 @@ static struct { }; static void -set_sensitive(struct _source_data *data) +set_sensitive (struct _source_data *data) { gtk_widget_set_sensitive ( GTK_WIDGET (data->buttons[BUTTON_ADD]), TRUE); @@ -403,23 +403,23 @@ set_sensitive(struct _source_data *data) } static void -select_source(GtkWidget *list, struct _source_data *data) +select_source (GtkWidget *list, struct _source_data *data) { GtkTreeViewColumn *column; GtkTreePath *path; GtkTreeIter iter; - gtk_tree_view_get_cursor(data->list, &path, &column); - gtk_tree_model_get_iter(GTK_TREE_MODEL(data->model), &iter, path); - gtk_tree_path_free(path); + gtk_tree_view_get_cursor (data->list, &path, &column); + gtk_tree_model_get_iter (GTK_TREE_MODEL (data->model), &iter, path); + gtk_tree_path_free (path); - gtk_tree_model_get(GTK_TREE_MODEL(data->model), &iter, 0, &data->current, -1); + gtk_tree_model_get (GTK_TREE_MODEL (data->model), &iter, 0, &data->current, -1); - set_sensitive(data); + set_sensitive (data); } static void -select_source_with_changed(GtkWidget *widget, struct _source_data *data) +select_source_with_changed (GtkWidget *widget, struct _source_data *data) { em_vfolder_rule_with_t with = 0; GSList *group = NULL; @@ -430,7 +430,7 @@ select_source_with_changed(GtkWidget *widget, struct _source_data *data) group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); - for (i=0; i< g_slist_length(group); i++) { + for (i=0; i< g_slist_length (group); i++) { if (g_slist_nth_data (group, with = i) == widget) break; } @@ -444,70 +444,70 @@ select_source_with_changed(GtkWidget *widget, struct _source_data *data) } /* attempt to make a 'nice' folder name out of the raw uri */ -static gchar *format_source(const gchar *euri) +static gchar *format_source (const gchar *euri) { CamelURL *url; GString *out; gchar *res, *uri; /* This should really probably base it on the account name? */ - uri = em_uri_to_camel(euri); - url = camel_url_new(uri, NULL); + uri = em_uri_to_camel (euri); + url = camel_url_new (uri, NULL); /* bad uri */ if (url == NULL) return uri; - g_free(uri); + g_free (uri); - out = g_string_new(url->protocol); - g_string_append_c(out, ':'); + out = g_string_new (url->protocol); + g_string_append_c (out, ':'); if (url->user && url->host) { g_string_append_printf(out, "%s@%s", url->user, url->host); if (url->port) g_string_append_printf(out, ":%d", url->port); } if (url->fragment) - g_string_append(out, url->fragment); + g_string_append (out, url->fragment); else if (url->path) - g_string_append(out, url->path); + g_string_append (out, url->path); res = out->str; - g_string_free(out, FALSE); + g_string_free (out, FALSE); return res; } static void -vfr_folder_response(GtkWidget *dialog, gint button, struct _source_data *data) +vfr_folder_response (GtkWidget *dialog, gint button, struct _source_data *data) { - const gchar *uri = em_folder_selector_get_selected_uri((EMFolderSelector *)dialog); + const gchar *uri = em_folder_selector_get_selected_uri ((EMFolderSelector *)dialog); if (button == GTK_RESPONSE_OK && uri != NULL) { gchar *urinice, *euri; GtkTreeSelection *selection; GtkTreeIter iter; - euri = em_uri_from_camel(uri); + euri = em_uri_from_camel (uri); - data->vr->sources = g_list_append(data->vr->sources, euri); + data->vr->sources = g_list_append (data->vr->sources, euri); - gtk_list_store_append(data->model, &iter); - urinice = format_source(euri); - gtk_list_store_set(data->model, &iter, 0, urinice, 1, euri, -1); - g_free(urinice); - selection = gtk_tree_view_get_selection(data->list); - gtk_tree_selection_select_iter(selection, &iter); + gtk_list_store_append (data->model, &iter); + urinice = format_source (euri); + gtk_list_store_set (data->model, &iter, 0, urinice, 1, euri, -1); + g_free (urinice); + selection = gtk_tree_view_get_selection (data->list); + gtk_tree_selection_select_iter (selection, &iter); data->current = euri; - set_sensitive(data); + set_sensitive (data); } - gtk_widget_destroy(dialog); + gtk_widget_destroy (dialog); } static void -source_add(GtkWidget *widget, struct _source_data *data) +source_add (GtkWidget *widget, struct _source_data *data) { EMFolderTree *emft; GtkWidget *dialog; @@ -524,11 +524,11 @@ source_add(GtkWidget *widget, struct _source_data *data) parent, emft, EM_FOLDER_SELECTOR_CAN_CREATE, _("Add Folder"), NULL, _("_Add")); g_signal_connect(dialog, "response", G_CALLBACK(vfr_folder_response), data); - gtk_widget_show(dialog); + gtk_widget_show (dialog); } static void -source_remove(GtkWidget *widget, struct _source_data *data) +source_remove (GtkWidget *widget, struct _source_data *data) { GtkTreeSelection *selection; const gchar *source; @@ -537,32 +537,32 @@ source_remove(GtkWidget *widget, struct _source_data *data) gint index = 0; gint n; - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->list)); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->list)); source = NULL; - while ((source = em_vfolder_rule_next_source(data->vr, source))) { - path = gtk_tree_path_new(); - gtk_tree_path_append_index(path, index); + while ((source = em_vfolder_rule_next_source (data->vr, source))) { + path = gtk_tree_path_new (); + gtk_tree_path_append_index (path, index); - if (gtk_tree_selection_path_is_selected(selection, path)) { - gtk_tree_model_get_iter(GTK_TREE_MODEL(data->model), &iter, path); + if (gtk_tree_selection_path_is_selected (selection, path)) { + gtk_tree_model_get_iter (GTK_TREE_MODEL (data->model), &iter, path); - em_vfolder_rule_remove_source(data->vr, source); - gtk_list_store_remove(data->model, &iter); - gtk_tree_path_free(path); + em_vfolder_rule_remove_source (data->vr, source); + gtk_list_store_remove (data->model, &iter); + gtk_tree_path_free (path); /* now select the next rule */ - n = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(data->model), NULL); + n = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (data->model), NULL); index = index >= n ? n - 1 : index; if (index >= 0) { - path = gtk_tree_path_new(); - gtk_tree_path_append_index(path, index); - gtk_tree_model_get_iter(GTK_TREE_MODEL(data->model), &iter, path); - gtk_tree_path_free(path); + path = gtk_tree_path_new (); + gtk_tree_path_append_index (path, index); + gtk_tree_model_get_iter (GTK_TREE_MODEL (data->model), &iter, path); + gtk_tree_path_free (path); - gtk_tree_selection_select_iter(selection, &iter); - gtk_tree_model_get(GTK_TREE_MODEL(data->model), &iter, 0, &data->current, -1); + gtk_tree_selection_select_iter (selection, &iter); + gtk_tree_model_get (GTK_TREE_MODEL (data->model), &iter, 0, &data->current, -1); } else { data->current = NULL; } @@ -571,14 +571,14 @@ source_remove(GtkWidget *widget, struct _source_data *data) } index++; - gtk_tree_path_free(path); + gtk_tree_path_free (path); } - set_sensitive(data); + set_sensitive (data); } static GtkWidget * -get_widget(EFilterRule *fr, ERuleContext *rc) +get_widget (EFilterRule *fr, ERuleContext *rc) { EMVFolderRule *vr =(EMVFolderRule *)fr; GtkWidget *widget, *frame; @@ -590,9 +590,9 @@ get_widget(EFilterRule *fr, ERuleContext *rc) GObject *object; gint i; - widget = E_FILTER_RULE_CLASS(parent_class)->get_widget(fr, rc); + widget = E_FILTER_RULE_CLASS (parent_class)->get_widget (fr, rc); - data = g_malloc0(sizeof(*data)); + data = g_malloc0 (sizeof (*data)); data->rc = rc; data->vr = vr; @@ -604,7 +604,7 @@ get_widget(EFilterRule *fr, ERuleContext *rc) g_object_set_data_full((GObject *)frame, "data", data, g_free); for (i = 0; i < BUTTON_LAST; i++) { - data->buttons[i] =(GtkButton *)e_builder_get_widget(builder, edit_buttons[i].name); + data->buttons[i] =(GtkButton *)e_builder_get_widget (builder, edit_buttons[i].name); g_signal_connect(data->buttons[i], "clicked", edit_buttons[i].func, data); } @@ -614,12 +614,12 @@ get_widget(EFilterRule *fr, ERuleContext *rc) data->model = GTK_LIST_STORE (object); source = NULL; - while ((source = em_vfolder_rule_next_source(vr, source))) { - gchar *nice = format_source(source); + while ((source = em_vfolder_rule_next_source (vr, source))) { + gchar *nice = format_source (source); - gtk_list_store_append(data->model, &iter); - gtk_list_store_set(data->model, &iter, 0, nice, 1, source, -1); - g_free(nice); + gtk_list_store_append (data->model, &iter); + gtk_list_store_set (data->model, &iter, 0, nice, 1, source, -1); + g_free (nice); } g_signal_connect(data->list, "cursor-changed", G_CALLBACK(select_source), data); @@ -647,13 +647,13 @@ get_widget(EFilterRule *fr, ERuleContext *rc) data->source_selector = (GtkWidget *) e_builder_get_widget (builder, "source_selector"); - rb = g_slist_nth_data(gtk_radio_button_get_group (rb), vr->with); + rb = g_slist_nth_data (gtk_radio_button_get_group (rb), vr->with); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), TRUE); g_signal_emit_by_name (rb, "toggled"); - set_sensitive(data); + set_sensitive (data); - gtk_box_pack_start(GTK_BOX(widget), frame, TRUE, TRUE, 3); + gtk_box_pack_start (GTK_BOX (widget), frame, TRUE, TRUE, 3); g_object_unref (builder); diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c index 87c94ff524..80d4c474bc 100644 --- a/mail/importers/elm-importer.c +++ b/mail/importers/elm-importer.c @@ -59,7 +59,7 @@ struct _elm_import_msg { }; static GHashTable * -parse_elm_rc(const gchar *elmrc) +parse_elm_rc (const gchar *elmrc) { gchar line[4096]; FILE *handle; @@ -70,7 +70,7 @@ parse_elm_rc(const gchar *elmrc) (GDestroyNotify) g_free, (GDestroyNotify) g_free); - if (!g_file_test(elmrc, G_FILE_TEST_IS_REGULAR)) + if (!g_file_test (elmrc, G_FILE_TEST_IS_REGULAR)) return prefs; handle = fopen (elmrc, "r"); @@ -111,7 +111,7 @@ parse_elm_rc(const gchar *elmrc) *end = 0; value = g_strdup (linestart); - g_hash_table_insert(prefs, key, value); + g_hash_table_insert (prefs, key, value); } fclose (handle); @@ -120,7 +120,7 @@ parse_elm_rc(const gchar *elmrc) } static gchar * -elm_get_rc(EImport *ei, const gchar *name) +elm_get_rc (EImport *ei, const gchar *name) { GHashTable *prefs; gchar *elmrc; @@ -128,19 +128,19 @@ elm_get_rc(EImport *ei, const gchar *name) prefs = g_object_get_data((GObject *)ei, "elm-rc"); if (prefs == NULL) { elmrc = g_build_filename(g_get_home_dir(), ".elm/elmrc", NULL); - prefs = parse_elm_rc(elmrc); - g_free(elmrc); + prefs = parse_elm_rc (elmrc); + g_free (elmrc); g_object_set_data((GObject *)ei, "elm-rc", prefs); } if (prefs == NULL) return NULL; else - return g_hash_table_lookup(prefs, name); + return g_hash_table_lookup (prefs, name); } static gboolean -elm_supported(EImport *ei, EImportTarget *target, EImportImporter *im) +elm_supported (EImport *ei, EImportTarget *target, EImportImporter *im) { const gchar *maildir; gchar *elmdir; @@ -150,8 +150,8 @@ elm_supported(EImport *ei, EImportTarget *target, EImportImporter *im) return FALSE; elmdir = g_build_filename(g_get_home_dir (), ".elm", NULL); - exists = g_file_test(elmdir, G_FILE_TEST_IS_DIR); - g_free(elmdir); + exists = g_file_test (elmdir, G_FILE_TEST_IS_DIR); + g_free (elmdir); if (!exists) return FALSE; @@ -159,12 +159,12 @@ elm_supported(EImport *ei, EImportTarget *target, EImportImporter *im) if (maildir == NULL) maildir = "Mail"; - if (!g_path_is_absolute(maildir)) - elmdir = g_build_filename(g_get_home_dir (), maildir, NULL); + if (!g_path_is_absolute (maildir)) + elmdir = g_build_filename (g_get_home_dir (), maildir, NULL); else elmdir = g_strdup (maildir); - mailexists = g_file_test(elmdir, G_FILE_TEST_IS_DIR); + mailexists = g_file_test (elmdir, G_FILE_TEST_IS_DIR); g_free (elmdir); return mailexists; @@ -191,47 +191,47 @@ elm_import_exec (struct _elm_import_msg *m) if (maildir == NULL) maildir = "Mail"; - if (!g_path_is_absolute(maildir)) - elmdir = g_build_filename(g_get_home_dir (), maildir, NULL); + if (!g_path_is_absolute (maildir)) + elmdir = g_build_filename (g_get_home_dir (), maildir, NULL); else - elmdir = g_strdup(maildir); + elmdir = g_strdup (maildir); - mail_importer_import_folders_sync(elmdir, elm_special_folders, 0, m->status); - g_free(elmdir); + mail_importer_import_folders_sync (elmdir, elm_special_folders, 0, m->status); + g_free (elmdir); } static void -elm_import_done(struct _elm_import_msg *m) +elm_import_done (struct _elm_import_msg *m) { printf("importing complete\n"); if (m->base.error == NULL) { GConfClient *gconf; - gconf = gconf_client_get_default(); + gconf = gconf_client_get_default (); gconf_client_set_bool(gconf, "/apps/evolution/importer/elm/mail", TRUE, NULL); - g_object_unref(gconf); + g_object_unref (gconf); } - e_import_complete(m->import, (EImportTarget *)m->target); + e_import_complete (m->import, (EImportTarget *)m->target); } static void -elm_import_free(struct _elm_import_msg *m) +elm_import_free (struct _elm_import_msg *m) { - camel_operation_unref(m->status); + camel_operation_unref (m->status); - g_free(m->status_what); - g_mutex_free(m->status_lock); + g_free (m->status_what); + g_mutex_free (m->status_lock); - g_source_remove(m->status_timeout_id); + g_source_remove (m->status_timeout_id); m->status_timeout_id = 0; - g_object_unref(m->import); + g_object_unref (m->import); } static void -elm_status(CamelOperation *op, const gchar *what, gint pc, gpointer data) +elm_status (CamelOperation *op, const gchar *what, gint pc, gpointer data) { struct _elm_import_msg *importer = data; @@ -240,28 +240,28 @@ elm_status(CamelOperation *op, const gchar *what, gint pc, gpointer data) else if (pc == CAMEL_OPERATION_END) pc = 100; - g_mutex_lock(importer->status_lock); - g_free(importer->status_what); - importer->status_what = g_strdup(what); + g_mutex_lock (importer->status_lock); + g_free (importer->status_what); + importer->status_what = g_strdup (what); importer->status_pc = pc; - g_mutex_unlock(importer->status_lock); + g_mutex_unlock (importer->status_lock); } static gboolean -elm_status_timeout(gpointer data) +elm_status_timeout (gpointer data) { struct _elm_import_msg *importer = data; gint pc; gchar *what; if (importer->status_what) { - g_mutex_lock(importer->status_lock); + g_mutex_lock (importer->status_lock); what = importer->status_what; importer->status_what = NULL; pc = importer->status_pc; - g_mutex_unlock(importer->status_lock); + 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; @@ -276,19 +276,19 @@ static MailMsgInfo elm_import_info = { }; static gint -mail_importer_elm_import(EImport *ei, EImportTarget *target) +mail_importer_elm_import (EImport *ei, EImportTarget *target) { struct _elm_import_msg *m; gint id; - m = mail_msg_new(&elm_import_info); + m = mail_msg_new (&elm_import_info); g_datalist_set_data(&target->data, "elm-msg", m); m->import = ei; - g_object_ref(m->import); + g_object_ref (m->import); m->target = (EImportTargetHome *)target; - m->status_timeout_id = g_timeout_add(100, elm_status_timeout, m); - m->status_lock = g_mutex_new(); - m->status = camel_operation_new(elm_status, m); + m->status_timeout_id = g_timeout_add (100, elm_status_timeout, m); + m->status_lock = g_mutex_new (); + m->status = camel_operation_new (elm_status, m); id = m->base.seq; @@ -306,7 +306,7 @@ checkbox_toggle_cb (GtkToggleButton *tb, EImportTarget *target) } static GtkWidget * -elm_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) +elm_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) { GtkWidget *box, *w; GConfClient *gconf; @@ -315,39 +315,39 @@ elm_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) gconf = gconf_client_get_default (); done_mail = gconf_client_get_bool ( gconf, "/apps/evolution/importer/elm/mail", NULL); - g_object_unref(gconf); + g_object_unref (gconf); g_datalist_set_data ( &target->data, "elm-do-mail", GINT_TO_POINTER(!done_mail)); - box = gtk_vbox_new(FALSE, 2); + box = gtk_vbox_new (FALSE, 2); w = gtk_check_button_new_with_label(_("Mail")); - gtk_toggle_button_set_active((GtkToggleButton *)w, !done_mail); + gtk_toggle_button_set_active ((GtkToggleButton *)w, !done_mail); g_signal_connect(w, "toggled", G_CALLBACK(checkbox_toggle_cb), target); - gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, 0); - gtk_widget_show_all(box); + gtk_box_pack_start ((GtkBox *)box, w, FALSE, FALSE, 0); + gtk_widget_show_all (box); return box; } static void -elm_import(EImport *ei, EImportTarget *target, EImportImporter *im) +elm_import (EImport *ei, EImportTarget *target, EImportImporter *im) { if (GPOINTER_TO_INT(g_datalist_get_data(&target->data, "elm-do-mail"))) - mail_importer_elm_import(ei, target); + mail_importer_elm_import (ei, target); else - e_import_complete(ei, target); + e_import_complete (ei, target); } static void -elm_cancel(EImport *ei, EImportTarget *target, EImportImporter *im) +elm_cancel (EImport *ei, EImportTarget *target, EImportImporter *im) { struct _elm_import_msg *m = g_datalist_get_data(&target->data, "elm-msg"); if (m) - camel_operation_cancel(m->status); + camel_operation_cancel (m->status); } static EImportImporter elm_importer = { @@ -361,7 +361,7 @@ static EImportImporter elm_importer = { }; EImportImporter * -elm_importer_peek(void) +elm_importer_peek (void) { elm_importer.name = _("Evolution Elm importer"); elm_importer.description = _("Import mail from Elm."); diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index 2d18bf62db..affebd74b6 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -70,14 +70,14 @@ typedef struct { } MboxImporter; static void -folder_selected(EMFolderSelectionButton *button, EImportTargetURI *target) +folder_selected (EMFolderSelectionButton *button, EImportTargetURI *target) { - g_free(target->uri_dest); - target->uri_dest = g_strdup(em_folder_selection_button_get_selection(button)); + g_free (target->uri_dest); + target->uri_dest = g_strdup (em_folder_selection_button_get_selection (button)); } static GtkWidget * -mbox_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) +mbox_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) { GtkWindow *window; GtkWidget *hbox, *w; @@ -111,24 +111,24 @@ mbox_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) if (!select_uri) select_uri = g_strdup (e_mail_local_get_folder_uri (E_MAIL_FOLDER_INBOX)); - hbox = gtk_hbox_new(FALSE, 0); + hbox = gtk_hbox_new (FALSE, 0); w = gtk_label_new_with_mnemonic (_("_Destination folder:")); - gtk_box_pack_start((GtkBox *)hbox, w, FALSE, TRUE, 6); + gtk_box_pack_start ((GtkBox *)hbox, w, FALSE, TRUE, 6); label = GTK_LABEL (w); - w = em_folder_selection_button_new( + w = em_folder_selection_button_new ( _("Select folder"), _("Select folder to import into")); gtk_label_set_mnemonic_widget (label, w); em_folder_selection_button_set_selection ((EMFolderSelectionButton *)w, select_uri); folder_selected (EM_FOLDER_SELECTION_BUTTON (w), (EImportTargetURI *)target); g_signal_connect (w, "selected", G_CALLBACK(folder_selected), target); - gtk_box_pack_start((GtkBox *)hbox, w, FALSE, TRUE, 6); + gtk_box_pack_start ((GtkBox *)hbox, w, FALSE, TRUE, 6); - w = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start((GtkBox *)w, hbox, FALSE, FALSE, 0); - gtk_widget_show_all(w); + w = gtk_vbox_new (FALSE, 0); + gtk_box_pack_start ((GtkBox *)w, hbox, FALSE, FALSE, 0); + gtk_widget_show_all (w); g_free (select_uri); @@ -136,7 +136,7 @@ mbox_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) } static gboolean -mbox_supported(EImport *ei, EImportTarget *target, EImportImporter *im) +mbox_supported (EImport *ei, EImportTarget *target, EImportImporter *im) { gchar signature[6]; gboolean ret = FALSE; @@ -154,20 +154,20 @@ mbox_supported(EImport *ei, EImportTarget *target, EImportImporter *im) if (strncmp(s->uri_src, "file:///", strlen("file:///")) != 0) return FALSE; - filename = g_filename_from_uri(s->uri_src, NULL, NULL); - fd = g_open(filename, O_RDONLY, 0); - g_free(filename); + filename = g_filename_from_uri (s->uri_src, NULL, NULL); + fd = g_open (filename, O_RDONLY, 0); + g_free (filename); if (fd != -1) { - n = read(fd, signature, 5); + n = read (fd, signature, 5); ret = n == 5 && memcmp(signature, "From ", 5) == 0; - close(fd); + close (fd); } return ret; } static void -mbox_status(CamelOperation *op, const gchar *what, gint pc, gpointer data) +mbox_status (CamelOperation *op, const gchar *what, gint pc, gpointer data) { MboxImporter *importer = data; @@ -176,77 +176,77 @@ mbox_status(CamelOperation *op, const gchar *what, gint pc, gpointer data) else if (pc == CAMEL_OPERATION_END) pc = 100; - g_mutex_lock(importer->status_lock); - g_free(importer->status_what); - importer->status_what = g_strdup(what); + g_mutex_lock (importer->status_lock); + g_free (importer->status_what); + importer->status_what = g_strdup (what); importer->status_pc = pc; - g_mutex_unlock(importer->status_lock); + g_mutex_unlock (importer->status_lock); } static gboolean -mbox_status_timeout(gpointer data) +mbox_status_timeout (gpointer data) { MboxImporter *importer = data; gint pc; gchar *what; if (importer->status_what) { - g_mutex_lock(importer->status_lock); + g_mutex_lock (importer->status_lock); what = importer->status_what; importer->status_what = NULL; pc = importer->status_pc; - g_mutex_unlock(importer->status_lock); + 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; } static void -mbox_import_done(gpointer data, GError **error) +mbox_import_done (gpointer data, GError **error) { MboxImporter *importer = data; - g_source_remove(importer->status_timeout_id); - g_free(importer->status_what); - g_mutex_free(importer->status_lock); - camel_operation_unref(importer->cancel); + g_source_remove (importer->status_timeout_id); + g_free (importer->status_what); + g_mutex_free (importer->status_lock); + camel_operation_unref (importer->cancel); - e_import_complete(importer->import, importer->target); - g_free(importer); + e_import_complete (importer->import, importer->target); + g_free (importer); } static void -mbox_import(EImport *ei, EImportTarget *target, EImportImporter *im) +mbox_import (EImport *ei, EImportTarget *target, EImportImporter *im) { MboxImporter *importer; gchar *filename; /* TODO: do we validate target? */ - importer = g_malloc0(sizeof(*importer)); + importer = g_malloc0 (sizeof (*importer)); g_datalist_set_data(&target->data, "mbox-data", importer); importer->import = ei; importer->target = target; - importer->status_lock = g_mutex_new(); - importer->status_timeout_id = g_timeout_add(100, mbox_status_timeout, importer); - importer->cancel = camel_operation_new(mbox_status, importer); + importer->status_lock = g_mutex_new (); + importer->status_timeout_id = g_timeout_add (100, mbox_status_timeout, importer); + importer->cancel = camel_operation_new (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 ( filename, ((EImportTargetURI *)target)->uri_dest, importer->cancel, mbox_import_done, importer); - g_free(filename); + g_free (filename); } static void -mbox_cancel(EImport *ei, EImportTarget *target, EImportImporter *im) +mbox_cancel (EImport *ei, EImportTarget *target, EImportImporter *im) { MboxImporter *importer = g_datalist_get_data(&target->data, "mbox-data"); if (importer) - camel_operation_cancel(importer->cancel); + camel_operation_cancel (importer->cancel); } static MboxImporterCreatePreviewFunc create_preview_func = NULL; @@ -321,7 +321,7 @@ mbox_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im) g_free (filename); - mp = camel_mime_parser_new(); + mp = camel_mime_parser_new (); camel_mime_parser_scan_from (mp, TRUE); if (camel_mime_parser_init_with_fd (mp, fd) == -1) { g_object_unref (mp); @@ -332,7 +332,7 @@ mbox_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im) CamelMimeMessage *msg; gchar *from; - msg = camel_mime_message_new(); + msg = camel_mime_message_new (); if (camel_mime_part_construct_from_parser ( (CamelMimePart *)msg, mp, NULL) == -1) { g_object_unref (msg); @@ -426,7 +426,7 @@ static EImportImporter mbox_importer = { }; EImportImporter * -mbox_importer_peek(void) +mbox_importer_peek (void) { mbox_importer.name = _("Berkeley Mailbox (mbox)"); mbox_importer.description = _("Importer Berkeley Mailbox format folders"); diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index 7c497108b1..d00725533a 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -76,7 +76,7 @@ static struct { }; static guint32 -decode_status(const gchar *status) +decode_status (const gchar *status) { const gchar *p; guint32 flags = 0; @@ -93,9 +93,9 @@ decode_status(const gchar *status) } static guint32 -decode_mozilla_status(const gchar *tmp) +decode_mozilla_status (const gchar *tmp) { - unsigned long status = strtoul(tmp, NULL, 16); + unsigned long status = strtoul (tmp, NULL, 16); guint32 flags = 0; gint i; @@ -114,7 +114,7 @@ import_mbox_exec (struct _import_mbox_msg *m) gint fd; CamelMessageInfo *info; - if (g_stat(m->path, &st) == -1) { + if (g_stat (m->path, &st) == -1) { g_warning("cannot find source file to import '%s': %s", m->path, g_strerror(errno)); return; } @@ -128,79 +128,79 @@ import_mbox_exec (struct _import_mbox_msg *m) if (folder == NULL) return; - if (S_ISREG(st.st_mode)) { + if (S_ISREG (st.st_mode)) { CamelOperation *oldcancel = NULL; - fd = g_open(m->path, O_RDONLY|O_BINARY, 0); + fd = g_open (m->path, O_RDONLY|O_BINARY, 0); if (fd == -1) { g_warning("cannot find source file to import '%s': %s", m->path, g_strerror(errno)); goto fail1; } - 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 */ + 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 */ goto fail2; } if (m->cancel) - oldcancel = camel_operation_register(m->cancel); + oldcancel = camel_operation_register (m->cancel); camel_operation_start ( NULL, _("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) { + camel_folder_freeze (folder); + while (camel_mime_parser_step (mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM) { CamelMimeMessage *msg; const gchar *tmp; gint pc = 0; guint32 flags = 0; if (st.st_size > 0) - pc = (gint)(100.0 * ((double)camel_mime_parser_tell(mp) / (double)st.st_size)); - camel_operation_progress(NULL, pc); + pc = (gint)(100.0 * ((double)camel_mime_parser_tell (mp) / (double)st.st_size)); + camel_operation_progress (NULL, pc); - msg = camel_mime_message_new(); - if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp, NULL) == -1) { + msg = camel_mime_message_new (); + if (camel_mime_part_construct_from_parser ((CamelMimePart *)msg, mp, NULL) == -1) { /* set exception? */ g_object_unref (msg); break; } - info = camel_message_info_new(NULL); + info = camel_message_info_new (NULL); tmp = camel_medium_get_header((CamelMedium *)msg, "X-Mozilla-Status"); if (tmp) - flags |= decode_mozilla_status(tmp); + flags |= decode_mozilla_status (tmp); tmp = camel_medium_get_header((CamelMedium *)msg, "Status"); if (tmp) - flags |= decode_status(tmp); + flags |= decode_status (tmp); tmp = camel_medium_get_header((CamelMedium *)msg, "X-Status"); if (tmp) - flags |= decode_status(tmp); + flags |= decode_status (tmp); - camel_message_info_set_flags(info, flags, ~0); + camel_message_info_set_flags (info, flags, ~0); camel_folder_append_message ( folder, msg, info, NULL, &m->base.error); - camel_message_info_free(info); + camel_message_info_free (info); g_object_unref (msg); if (m->base.error != NULL) break; - camel_mime_parser_step(mp, NULL, NULL); + camel_mime_parser_step (mp, NULL, NULL); } - camel_folder_sync(folder, FALSE, NULL); - camel_folder_thaw(folder); - camel_operation_end(NULL); + camel_folder_sync (folder, FALSE, NULL); + camel_folder_thaw (folder); + camel_operation_end (NULL); /* TODO: these api's are a bit weird, registering the old is the same as deregistering */ if (m->cancel) - camel_operation_register(oldcancel); + camel_operation_register (oldcancel); fail2: g_object_unref (mp); } fail1: - camel_folder_sync(folder, FALSE, NULL); + camel_folder_sync (folder, FALSE, NULL); g_object_unref (folder); } @@ -208,16 +208,16 @@ static void import_mbox_done (struct _import_mbox_msg *m) { if (m->done) - m->done(m->done_data, &m->base.error); + m->done (m->done_data, &m->base.error); } static void import_mbox_free (struct _import_mbox_msg *m) { if (m->cancel) - camel_operation_unref(m->cancel); - g_free(m->uri); - g_free(m->path); + camel_operation_unref (m->cancel); + g_free (m->uri); + g_free (m->path); } static MailMsgInfo import_mbox_info = { @@ -229,19 +229,19 @@ static MailMsgInfo import_mbox_info = { }; gint -mail_importer_import_mbox(const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, GError **), gpointer data) +mail_importer_import_mbox (const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, GError **), gpointer data) { struct _import_mbox_msg *m; gint id; - m = mail_msg_new(&import_mbox_info); - m->path = g_strdup(path); - m->uri = g_strdup(folderuri); + m = mail_msg_new (&import_mbox_info); + m->path = g_strdup (path); + m->uri = g_strdup (folderuri); m->done = done; m->done_data = data; if (cancel) { m->cancel = cancel; - camel_operation_ref(cancel); + camel_operation_ref (cancel); } id = m->base.seq; @@ -251,21 +251,21 @@ mail_importer_import_mbox(const gchar *path, const gchar *folderuri, CamelOperat } void -mail_importer_import_mbox_sync(const gchar *path, const gchar *folderuri, CamelOperation *cancel) +mail_importer_import_mbox_sync (const gchar *path, const gchar *folderuri, CamelOperation *cancel) { struct _import_mbox_msg *m; - m = mail_msg_new(&import_mbox_info); - m->path = g_strdup(path); - m->uri = g_strdup(folderuri); + m = mail_msg_new (&import_mbox_info); + m->path = g_strdup (path); + m->uri = g_strdup (folderuri); if (cancel) { m->cancel = cancel; - camel_operation_ref(cancel); + camel_operation_ref (cancel); } - import_mbox_exec(m); - import_mbox_done(m); - mail_msg_unref(m); + import_mbox_exec (m); + import_mbox_done (m); + mail_msg_unref (m); } struct _import_folders_data { @@ -276,7 +276,7 @@ struct _import_folders_data { }; static void -import_folders_rec(struct _import_folders_data *m, const gchar *filepath, const gchar *folderparent) +import_folders_rec (struct _import_folders_data *m, const gchar *filepath, const gchar *folderparent) { GDir *dir; const gchar *d; @@ -285,7 +285,7 @@ import_folders_rec(struct _import_folders_data *m, const gchar *filepath, const gchar *filefull, *foldersub, *uri, *utf8_filename; const gchar *folder; - dir = g_dir_open(filepath, 0, NULL); + dir = g_dir_open (filepath, 0, NULL); if (dir == NULL) return; @@ -295,17 +295,17 @@ import_folders_rec(struct _import_folders_data *m, const gchar *filepath, const camel_operation_start(NULL, _("Scanning %s"), utf8_filename); g_free (utf8_filename); - while ( (d=g_dir_read_name(dir))) { + while ( (d=g_dir_read_name (dir))) { if (d[0] == '.') continue; - filefull = g_build_filename(filepath, d, NULL); + filefull = g_build_filename (filepath, d, NULL); /* skip non files and directories, and skip directories in mozilla mode */ - if (g_stat(filefull, &st) == -1 - || !(S_ISREG(st.st_mode) - || (m->elmfmt && S_ISDIR(st.st_mode)))) { - g_free(filefull); + if (g_stat (filefull, &st) == -1 + || !(S_ISREG (st.st_mode) + || (m->elmfmt && S_ISDIR (st.st_mode)))) { + g_free (filefull); continue; } @@ -314,7 +314,7 @@ import_folders_rec(struct _import_folders_data *m, const gchar *filepath, const gint i; for (i=0;m->special_folders[i].orig;i++) - if (strcmp(m->special_folders[i].orig, folder) == 0) { + if (strcmp (m->special_folders[i].orig, folder) == 0) { folder = m->special_folders[i].new; break; } @@ -325,32 +325,32 @@ import_folders_rec(struct _import_folders_data *m, const gchar *filepath, const } printf("importing to uri %s\n", uri); - mail_importer_import_mbox_sync(filefull, uri, m->cancel); - g_free(uri); + mail_importer_import_mbox_sync (filefull, uri, m->cancel); + g_free (uri); /* 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); - g_free(filefull); + g_free (filefull); filefull = tmp; - if (g_stat(filefull, &st) == -1) { - g_free(filefull); + if (g_stat (filefull, &st) == -1) { + g_free (filefull); continue; } } - if (S_ISDIR(st.st_mode)) { + if (S_ISDIR (st.st_mode)) { foldersub = folderparent?g_strdup_printf("%s/%s", folderparent, folder):g_strdup(folder); - import_folders_rec(m, filefull, foldersub); - g_free(foldersub); + import_folders_rec (m, filefull, foldersub); + g_free (foldersub); } - g_free(filefull); + g_free (filefull); } - g_dir_close(dir); + g_dir_close (dir); - camel_operation_end(NULL); + camel_operation_end (NULL); } /** @@ -369,7 +369,7 @@ import_folders_rec(struct _import_folders_data *m, const gchar *filepath, const * standard unix directories. **/ void -mail_importer_import_folders_sync(const gchar *filepath, MailImporterSpecial special_folders[], gint flags, CamelOperation *cancel) +mail_importer_import_folders_sync (const gchar *filepath, MailImporterSpecial special_folders[], gint flags, CamelOperation *cancel) { struct _import_folders_data m; CamelOperation *oldcancel = NULL; @@ -379,10 +379,10 @@ mail_importer_import_folders_sync(const gchar *filepath, MailImporterSpecial spe m.cancel = cancel; if (cancel) - oldcancel = camel_operation_register(cancel); + oldcancel = camel_operation_register (cancel); - import_folders_rec(&m, filepath, NULL); + import_folders_rec (&m, filepath, NULL); if (cancel) - camel_operation_register(oldcancel); + camel_operation_register (oldcancel); } diff --git a/mail/importers/mail-importer.h b/mail/importers/mail-importer.h index 01a69c981d..9c8c531226 100644 --- a/mail/importers/mail-importer.h +++ b/mail/importers/mail-importer.h @@ -27,7 +27,7 @@ #include <e-util/e-import.h> #include <camel/camel.h> -EImportImporter *mbox_importer_peek(void); +EImportImporter *mbox_importer_peek (void); typedef void (*MboxImporterCreatePreviewFunc)(GObject *preview, GtkWidget **preview_widget); typedef void (*MboxImporterFillPreviewFunc)(GObject *preview, CamelMimeMessage *msg); @@ -36,8 +36,8 @@ typedef void (*MboxImporterFillPreviewFunc)(GObject *preview, CamelMimeMessage * (mail importer cannot link to em-format-html-display directly) */ void mbox_importer_set_preview_funcs (MboxImporterCreatePreviewFunc create_func, MboxImporterFillPreviewFunc fill_func); -EImportImporter *elm_importer_peek(void); -EImportImporter *pine_importer_peek(void); +EImportImporter *elm_importer_peek (void); +EImportImporter *pine_importer_peek (void); /* Defines copied from nsMsgMessageFlags.h in Mozilla source. */ /* Evolution only cares about these headers I think */ @@ -46,8 +46,8 @@ EImportImporter *pine_importer_peek(void); #define MSG_FLAG_MARKED 0x0004 #define MSG_FLAG_EXPUNGED 0x0008 -gint mail_importer_import_mbox(const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, GError **), gpointer data); -void mail_importer_import_mbox_sync(const gchar *path, const gchar *folderuri, CamelOperation *cancel); +gint mail_importer_import_mbox (const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, GError **), gpointer data); +void mail_importer_import_mbox_sync (const gchar *path, const gchar *folderuri, CamelOperation *cancel); struct _MailImporterSpecial { const gchar *orig, *new; @@ -58,6 +58,6 @@ typedef struct _MailImporterSpecial MailImporterSpecial; #define MAIL_IMPORTER_MOZFMT (1<<0) /* api in flux */ -void mail_importer_import_folders_sync(const gchar *filepath, MailImporterSpecial special_folders[], gint flags, CamelOperation *cancel); +void mail_importer_import_folders_sync (const gchar *filepath, MailImporterSpecial special_folders[], gint flags, CamelOperation *cancel); #endif diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c index 354d53d377..c2c0ec22d7 100644 --- a/mail/importers/pine-importer.c +++ b/mail/importers/pine-importer.c @@ -62,7 +62,7 @@ struct _pine_import_msg { }; static gboolean -pine_supported(EImport *ei, EImportTarget *target, EImportImporter *im) +pine_supported (EImport *ei, EImportTarget *target, EImportImporter *im) { gchar *maildir, *addrfile; gboolean md_exists, addr_exists; @@ -71,11 +71,11 @@ pine_supported(EImport *ei, EImportTarget *target, EImportImporter *im) return FALSE; maildir = g_build_filename(g_get_home_dir (), "mail", NULL); - md_exists = g_file_test(maildir, G_FILE_TEST_IS_DIR); - g_free(maildir); + md_exists = g_file_test (maildir, G_FILE_TEST_IS_DIR); + g_free (maildir); addrfile = g_build_filename(g_get_home_dir (), ".addressbook", NULL); - addr_exists = g_file_test(addrfile, G_FILE_TEST_IS_REGULAR); + addr_exists = g_file_test (addrfile, G_FILE_TEST_IS_REGULAR); g_free (addrfile); return md_exists || addr_exists; @@ -96,7 +96,7 @@ FIXME: we dont handle aliases in lists. */ static void -import_contact(EBook *book, gchar *line) +import_contact (EBook *book, gchar *line) { gchar **strings, *addr, **addrs; gint i; @@ -105,14 +105,14 @@ import_contact(EBook *book, gchar *line) EContact *card; gsize len; - card = e_contact_new(); + card = e_contact_new (); strings = g_strsplit(line, "\t", 5); if (strings[0] && strings[1] && strings[2]) { - e_contact_set(card, E_CONTACT_NICKNAME, strings[0]); - e_contact_set(card, E_CONTACT_FULL_NAME, strings[1]); + e_contact_set (card, E_CONTACT_NICKNAME, strings[0]); + e_contact_set (card, E_CONTACT_FULL_NAME, strings[1]); addr = strings[2]; - len = strlen(addr); + len = strlen (addr); if (addr[0] == '(' && addr[len-1] == ')') { addr[0] = 0; addr[len-1] = 0; @@ -126,37 +126,37 @@ import_contact(EBook *book, gchar *line) EDestination *d; EVCardAttribute *attr; - d = e_destination_new(); - e_destination_set_email(d, addrs[i]); + d = e_destination_new (); + e_destination_set_email (d, addrs[i]); attr = e_vcard_attribute_new (NULL, EVC_EMAIL); e_destination_export_to_vcard_attribute (d, attr); - list = g_list_append(list, attr); - g_object_unref(d); + list = g_list_append (list, attr); + g_object_unref (d); } - e_contact_set_attributes(card, E_CONTACT_EMAIL, list); - g_list_foreach(list, (GFunc)e_vcard_attribute_free, NULL); - g_list_free(list); - g_strfreev(addrs); - e_contact_set(card, E_CONTACT_IS_LIST, GINT_TO_POINTER(TRUE)); + e_contact_set_attributes (card, E_CONTACT_EMAIL, list); + g_list_foreach (list, (GFunc)e_vcard_attribute_free, NULL); + g_list_free (list); + g_strfreev (addrs); + e_contact_set (card, E_CONTACT_IS_LIST, GINT_TO_POINTER (TRUE)); } else { - e_contact_set(card, E_CONTACT_EMAIL_1, strings[2]); + e_contact_set (card, E_CONTACT_EMAIL_1, strings[2]); } /*name = e_contact_name_from_string(strings[1]);*/ if (strings[3] && strings[4]) - e_contact_set(card, E_CONTACT_NOTE, strings[4]); + e_contact_set (card, E_CONTACT_NOTE, strings[4]); /* FIXME Error checking */ - e_book_add_contact(book, card, NULL); - g_object_unref(card); + e_book_add_contact (book, card, NULL); + g_object_unref (card); } g_strfreev (strings); } static void -import_contacts(void) +import_contacts (void) { ESource *primary; ESourceList *source_list; @@ -168,51 +168,51 @@ import_contacts(void) printf("importing pine addressbook\n"); - if (!e_book_get_addressbooks(&source_list, NULL)) + if (!e_book_get_addressbooks (&source_list, NULL)) return; name = g_build_filename(g_get_home_dir(), ".addressbook", NULL); fp = fopen(name, "r"); - g_free(name); + g_free (name); if (fp == NULL) return; - primary = e_source_list_peek_source_any(source_list); + primary = e_source_list_peek_source_any (source_list); /* FIXME Better error handling */ - if ((book = e_book_new(primary,NULL)) == NULL) { - fclose(fp); + if ((book = e_book_new (primary,NULL)) == NULL) { + fclose (fp); g_warning ("Could not create EBook."); return; } - e_book_open(book, TRUE, NULL); - g_object_unref(primary); - g_object_unref(source_list); + e_book_open (book, TRUE, NULL); + g_object_unref (primary); + g_object_unref (source_list); line = g_string_new(""); - g_string_set_size(line, 256); + g_string_set_size (line, 256); offset = 0; - while (fgets(line->str+offset, 256, fp)) { + while (fgets (line->str+offset, 256, fp)) { gsize len; - len = strlen(line->str+offset)+offset; + len = strlen (line->str+offset)+offset; if (line->str[len-1] == '\n') - g_string_truncate(line, len-1); - else if (!feof(fp)) { + g_string_truncate (line, len-1); + else if (!feof (fp)) { offset = len; - g_string_set_size(line, len+256); + g_string_set_size (line, len+256); continue; } else { - g_string_truncate(line, len); + g_string_truncate (line, len); } - import_contact(book, line->str); + import_contact (book, line->str); offset = 0; } - g_string_free(line, TRUE); - fclose(fp); - g_object_unref(book); + g_string_free (line, TRUE); + fclose (fp); + g_object_unref (book); } static gchar * @@ -228,17 +228,17 @@ static MailImporterSpecial pine_special_folders[] = { }; static void -pine_import_exec(struct _pine_import_msg *m) +pine_import_exec (struct _pine_import_msg *m) { if (GPOINTER_TO_INT(g_datalist_get_data(&m->target->data, "pine-do-addr"))) - import_contacts(); + import_contacts (); if (GPOINTER_TO_INT(g_datalist_get_data(&m->target->data, "pine-do-mail"))) { gchar *path; path = g_build_filename(g_get_home_dir(), "mail", NULL); - mail_importer_import_folders_sync(path, pine_special_folders, 0, m->status); - g_free(path); + mail_importer_import_folders_sync (path, pine_special_folders, 0, m->status); + g_free (path); } } @@ -250,29 +250,29 @@ pine_import_done (struct _pine_import_msg *m) if (m->base.error == NULL) { GConfClient *gconf; - gconf = gconf_client_get_default(); + gconf = gconf_client_get_default (); if (GPOINTER_TO_INT(g_datalist_get_data(&m->target->data, "pine-do-addr"))) gconf_client_set_bool(gconf, "/apps/evolution/importer/pine/addr", TRUE, NULL); if (GPOINTER_TO_INT(g_datalist_get_data(&m->target->data, "pine-do-mail"))) gconf_client_set_bool(gconf, "/apps/evolution/importer/pine/mail", TRUE, NULL); - g_object_unref(gconf); + g_object_unref (gconf); } - e_import_complete(m->import, (EImportTarget *)m->target); + e_import_complete (m->import, (EImportTarget *)m->target); } static void pine_import_free (struct _pine_import_msg *m) { - camel_operation_unref(m->status); + camel_operation_unref (m->status); - g_free(m->status_what); - g_mutex_free(m->status_lock); + g_free (m->status_what); + g_mutex_free (m->status_lock); - g_source_remove(m->status_timeout_id); + g_source_remove (m->status_timeout_id); m->status_timeout_id = 0; - g_object_unref(m->import); + g_object_unref (m->import); } static void @@ -288,11 +288,11 @@ pine_status (CamelOperation *op, else if (pc == CAMEL_OPERATION_END) pc = 100; - g_mutex_lock(importer->status_lock); - g_free(importer->status_what); - importer->status_what = g_strdup(what); + g_mutex_lock (importer->status_lock); + g_free (importer->status_what); + importer->status_what = g_strdup (what); importer->status_pc = pc; - g_mutex_unlock(importer->status_lock); + g_mutex_unlock (importer->status_lock); } static gboolean @@ -302,11 +302,11 @@ pine_status_timeout (struct _pine_import_msg *importer) gchar *what; if (importer->status_what) { - g_mutex_lock(importer->status_lock); + g_mutex_lock (importer->status_lock); what = importer->status_what; importer->status_what = NULL; pc = importer->status_pc; - g_mutex_unlock(importer->status_lock); + g_mutex_unlock (importer->status_lock); e_import_status ( importer->import, (EImportTarget *) @@ -331,15 +331,15 @@ mail_importer_pine_import (EImport *ei, struct _pine_import_msg *m; gint id; - m = mail_msg_new(&pine_import_info); + m = mail_msg_new (&pine_import_info); g_datalist_set_data(&target->data, "pine-msg", m); m->import = ei; - g_object_ref(m->import); + g_object_ref (m->import); m->target = target; m->status_timeout_id = g_timeout_add ( 100, (GSourceFunc) pine_status_timeout, m); - m->status_lock = g_mutex_new(); - m->status = camel_operation_new(pine_status, m); + m->status_lock = g_mutex_new (); + m->status = camel_operation_new (pine_status, m); id = m->base.seq; @@ -375,7 +375,7 @@ checkbox_addr_toggle_cb (GtkToggleButton *tb, } static GtkWidget * -pine_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) +pine_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) { GtkWidget *box, *w; GConfClient *gconf; @@ -386,7 +386,7 @@ pine_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) gconf, "/apps/evolution/importer/pine/mail", NULL); done_addr = gconf_client_get_bool ( gconf, "/apps/evolution/importer/pine/address", NULL); - g_object_unref(gconf); + g_object_unref (gconf); g_datalist_set_data ( &target->data, "pine-do-mail", @@ -395,40 +395,40 @@ pine_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) &target->data, "pine-do-addr", GINT_TO_POINTER (!done_addr)); - box = gtk_vbox_new(FALSE, 2); + box = gtk_vbox_new (FALSE, 2); w = gtk_check_button_new_with_label(_("Mail")); - gtk_toggle_button_set_active((GtkToggleButton *)w, !done_mail); + gtk_toggle_button_set_active ((GtkToggleButton *)w, !done_mail); g_signal_connect(w, "toggled", G_CALLBACK(checkbox_mail_toggle_cb), target); - gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)box, w, FALSE, FALSE, 0); w = gtk_check_button_new_with_label(_("Address Book")); - gtk_toggle_button_set_active((GtkToggleButton *)w, !done_addr); + gtk_toggle_button_set_active ((GtkToggleButton *)w, !done_addr); g_signal_connect(w, "toggled", G_CALLBACK(checkbox_addr_toggle_cb), target); - gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)box, w, FALSE, FALSE, 0); - gtk_widget_show_all(box); + gtk_widget_show_all (box); return box; } static void -pine_import(EImport *ei, EImportTarget *target, EImportImporter *im) +pine_import (EImport *ei, EImportTarget *target, EImportImporter *im) { if (GPOINTER_TO_INT(g_datalist_get_data(&target->data, "pine-do-mail")) || GPOINTER_TO_INT(g_datalist_get_data(&target->data, "pine-do-addr"))) - mail_importer_pine_import(ei, target); + mail_importer_pine_import (ei, target); else - e_import_complete(ei, target); + e_import_complete (ei, target); } static void -pine_cancel(EImport *ei, EImportTarget *target, EImportImporter *im) +pine_cancel (EImport *ei, EImportTarget *target, EImportImporter *im) { struct _pine_import_msg *m = g_datalist_get_data(&target->data, "pine-msg"); if (m) - camel_operation_cancel(m->status); + camel_operation_cancel (m->status); } static EImportImporter pine_importer = { @@ -442,7 +442,7 @@ static EImportImporter pine_importer = { }; EImportImporter * -pine_importer_peek(void) +pine_importer_peek (void) { pine_importer.name = _("Evolution Pine importer"); pine_importer.description = _("Import mail from Pine."); diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index 1ad5d99649..5fa343e64b 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -110,12 +110,12 @@ reg_match (gchar *str, gchar *regstr) gint error; gint ret; - error = regcomp(®, regstr, REG_EXTENDED|REG_ICASE|REG_NOSUB); + error = regcomp (®, regstr, REG_EXTENDED|REG_ICASE|REG_NOSUB); if (error != 0) { return 0; } - error = regexec(®, str, 0, NULL, 0); - regfree(®); + error = regexec (®, str, 0, NULL, 0); + regfree (®); return (error == 0); } #endif @@ -199,7 +199,7 @@ rule_match_subject (ERuleContext *context, EFilterRule *rule, const gchar *subje } static void -rule_match_mlist(ERuleContext *context, EFilterRule *rule, const gchar *mlist) +rule_match_mlist (ERuleContext *context, EFilterRule *rule, const gchar *mlist) { EFilterPart *part; EFilterElement *element; @@ -208,13 +208,13 @@ rule_match_mlist(ERuleContext *context, EFilterRule *rule, const gchar *mlist) return; part = e_rule_context_create_part(context, "mlist"); - e_filter_rule_add_part(rule, part); + e_filter_rule_add_part (rule, part); element = e_filter_part_find_element(part, "mlist-type"); e_filter_option_set_current((EFilterOption *)element, "is"); element = e_filter_part_find_element (part, "mlist"); - e_filter_input_set_value((EFilterInput *)element, mlist); + e_filter_input_set_value ((EFilterInput *)element, mlist); } static void @@ -266,7 +266,7 @@ rule_from_message (EFilterRule *rule, ERuleContext *context, CamelMimeMessage *m from = camel_mime_message_get_from (msg); for (i = 0; from && camel_internet_address_get (from, i, &name, &address); i++) { - rule_add_sender(context, rule, address); + rule_add_sender (context, rule, address); if (name == NULL || name[0] == '\0') name = address; namestr = g_strdup_printf(_("Mail from %s"), name); @@ -287,12 +287,12 @@ rule_from_message (EFilterRule *rule, ERuleContext *context, CamelMimeMessage *m mlist = camel_header_raw_check_mailing_list (&((CamelMimePart *)msg)->headers); if (mlist) { - rule_match_mlist(context, rule, mlist); + rule_match_mlist (context, rule, mlist); name = g_strdup_printf (_("%s mailing list"), mlist); - e_filter_rule_set_name(rule, name); - g_free(name); + e_filter_rule_set_name (rule, name); + g_free (name); } - g_free(mlist); + g_free (mlist); } } @@ -300,12 +300,12 @@ EFilterRule * em_vfolder_rule_from_message (EMVFolderContext *context, CamelMimeMessage *msg, gint flags, const gchar *source) { EMVFolderRule *rule; - gchar *euri = em_uri_from_camel(source); + gchar *euri = em_uri_from_camel (source); rule = em_vfolder_rule_new (); em_vfolder_rule_add_source (rule, euri); rule_from_message ((EFilterRule *)rule, (ERuleContext *)context, msg, flags); - g_free(euri); + g_free (euri); return (EFilterRule *)rule; } @@ -314,12 +314,12 @@ EFilterRule * em_vfolder_rule_from_address (EMVFolderContext *context, CamelInternetAddress *addr, gint flags, const gchar *source) { EMVFolderRule *rule; - gchar *euri = em_uri_from_camel(source); + gchar *euri = em_uri_from_camel (source); rule = em_vfolder_rule_new (); em_vfolder_rule_add_source (rule, euri); rule_from_address ((EFilterRule *)rule, (ERuleContext *)context, addr, flags); - g_free(euri); + g_free (euri); return (EFilterRule *)rule; } @@ -366,7 +366,7 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const gchar *source, gint fl } void -mail_filter_rename_uri(CamelStore *store, const gchar *olduri, const gchar *newuri) +mail_filter_rename_uri (CamelStore *store, const gchar *olduri, const gchar *newuri) { EMFilterContext *fc; const gchar *config_dir; @@ -374,8 +374,8 @@ mail_filter_rename_uri(CamelStore *store, const gchar *olduri, const gchar *newu GList *changed; gchar *eolduri, *enewuri; - eolduri = em_uri_from_camel(olduri); - enewuri = em_uri_from_camel(newuri); + eolduri = em_uri_from_camel (olduri); + enewuri = em_uri_from_camel (newuri); fc = em_filter_context_new (); config_dir = mail_session_get_config_dir (); @@ -384,23 +384,23 @@ mail_filter_rename_uri(CamelStore *store, const gchar *olduri, const gchar *newu 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) + 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); + e_rule_context_free_uri_list ((ERuleContext *)fc, changed); } - g_free(user); - g_object_unref(fc); + g_free (user); + g_object_unref (fc); - g_free(enewuri); - g_free(eolduri); + g_free (enewuri); + g_free (eolduri); } void -mail_filter_delete_uri(CamelStore *store, const gchar *uri) +mail_filter_delete_uri (CamelStore *store, const gchar *uri) { EMFilterContext *fc; const gchar *config_dir; @@ -408,7 +408,7 @@ mail_filter_delete_uri(CamelStore *store, const gchar *uri) GList *deleted; gchar *euri; - euri = em_uri_from_camel(uri); + euri = em_uri_from_camel (uri); fc = em_filter_context_new (); config_dir = mail_session_get_config_dir (); @@ -464,7 +464,7 @@ mail_filter_delete_uri(CamelStore *store, const gchar *uri) e_rule_context_free_uri_list ((ERuleContext *) fc, deleted); } - g_free(user); - g_object_unref(fc); - g_free(euri); + g_free (user); + g_object_unref (fc); + g_free (euri); } diff --git a/mail/mail-autofilter.h b/mail/mail-autofilter.h index 2d14120e71..7e385eb36f 100644 --- a/mail/mail-autofilter.h +++ b/mail/mail-autofilter.h @@ -37,15 +37,15 @@ enum { AUTO_MLIST = 8 }; -EFilterRule *em_vfolder_rule_from_message(EMVFolderContext *context, CamelMimeMessage *msg, gint flags, const gchar *source); -EFilterRule *filter_rule_from_message(EMFilterContext *context, CamelMimeMessage *msg, gint flags); -EFilterRule *em_vfolder_rule_from_address(EMVFolderContext *context, CamelInternetAddress *addr, gint flags, const gchar *source); +EFilterRule *em_vfolder_rule_from_message (EMVFolderContext *context, CamelMimeMessage *msg, gint flags, const gchar *source); +EFilterRule *filter_rule_from_message (EMFilterContext *context, CamelMimeMessage *msg, gint flags); +EFilterRule *em_vfolder_rule_from_address (EMVFolderContext *context, CamelInternetAddress *addr, gint flags, const gchar *source); /* easiest place to put this */ -void filter_gui_add_from_message(CamelMimeMessage *msg, const gchar *source, gint flags); +void filter_gui_add_from_message (CamelMimeMessage *msg, const gchar *source, gint flags); /* Also easiest place for these, we should really share a global rule context for this stuff ... */ -void mail_filter_rename_uri(CamelStore *store, const gchar *olduri, const gchar *newuri); -void mail_filter_delete_uri(CamelStore *store, const gchar *uri); +void mail_filter_rename_uri (CamelStore *store, const gchar *olduri, const gchar *newuri); +void mail_filter_delete_uri (CamelStore *store, const gchar *uri); #endif diff --git a/mail/mail-config.c b/mail/mail-config.c index 8bbd9fc119..730aeba1bc 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -163,8 +163,8 @@ gconf_jh_headers_changed (GConfClient *client, guint cnxn_id, value = g_ptr_array_new (); while (node && node->data) { gchar **tok = g_strsplit (node->data, "=", 2); - g_ptr_array_add (name, g_strdup(tok[0])); - g_ptr_array_add (value, g_strdup(tok[1])); + g_ptr_array_add (name, g_strdup (tok[0])); + g_ptr_array_add (value, g_strdup (tok[1])); node = node->next; g_strfreev (tok); } @@ -576,13 +576,13 @@ mail_config_get_lookup_book_local_only (void) static void 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); + mail_config_uri_deleted (CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS (store))->compare_folder_name, uri); } static void 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, + mail_config_uri_renamed (CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS (store))->compare_folder_name, olduri, newuri); } diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index c9493c8d1b..d12d77ea64 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -137,7 +137,7 @@ struct _store_info { G_DEFINE_TYPE (MailFolderCache, mail_folder_cache, G_TYPE_OBJECT) static void -free_update(struct _folder_update *up) +free_update (struct _folder_update *up) { g_free (up->full_name); g_free (up->uri); @@ -200,7 +200,7 @@ real_flush_updates (gpointer o, gpointer event_data, gpointer data) } } - free_update(up); + free_update (up); g_mutex_lock (self->priv->stores_mutex); } @@ -294,17 +294,17 @@ update_1folder (MailFolderCache *self, if (unread == -1) return; - up = g_malloc0(sizeof(*up)); - up->full_name = g_strdup(mfi->full_name); + up = g_malloc0 (sizeof (*up)); + up->full_name = g_strdup (mfi->full_name); up->unread = unread; up->new = new; up->store = g_object_ref (mfi->store_info->store); - up->uri = g_strdup(mfi->uri); + up->uri = g_strdup (mfi->uri); up->msg_uid = g_strdup (msg_uid); up->msg_sender = g_strdup (msg_sender); up->msg_subject = g_strdup (msg_subject); g_queue_push_head (&self->priv->updates, up); - flush_updates(self); + flush_updates (self); } static void @@ -341,7 +341,7 @@ folder_changed_cb (CamelFolder *folder, local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX); local_sent = e_mail_local_get_folder (E_MAIL_FOLDER_SENT); - if (!CAMEL_IS_VEE_FOLDER(folder) + if (!CAMEL_IS_VEE_FOLDER (folder) && folder != local_drafts && folder != local_outbox && folder != local_sent @@ -384,8 +384,8 @@ folder_changed_cb (CamelFolder *folder, g_mutex_lock (self->priv->stores_mutex); if (self->priv->stores != NULL - && (si = g_hash_table_lookup(self->priv->stores, parent_store)) != NULL - && (mfi = g_hash_table_lookup(si->folders, full_name)) != NULL + && (si = g_hash_table_lookup (self->priv->stores, parent_store)) != NULL + && (mfi = g_hash_table_lookup (si->folders, full_name)) != NULL && mfi->folder == folder) { update_1folder (self, mfi, new, uid, sender, subject, NULL); } @@ -417,52 +417,52 @@ unset_folder_info (MailFolderCache *self, } if ((mfi->flags & CAMEL_FOLDER_NOSELECT) == 0) { - up = g_malloc0(sizeof(*up)); + up = g_malloc0 (sizeof (*up)); up->remove = TRUE; up->delete = delete; up->unsub = unsub; up->store = g_object_ref (mfi->store_info->store); up->full_name = g_strdup (mfi->full_name); - up->uri = g_strdup(mfi->uri); + up->uri = g_strdup (mfi->uri); g_queue_push_head (&self->priv->updates, up); - flush_updates(self); + flush_updates (self); } } static void -free_folder_info(struct _folder_info *mfi) +free_folder_info (struct _folder_info *mfi) { - g_free(mfi->full_name); - g_free(mfi->uri); - g_free(mfi); + g_free (mfi->full_name); + g_free (mfi->uri); + g_free (mfi); } static void -setup_folder(MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si) +setup_folder (MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si) { struct _folder_info *mfi; struct _folder_update *up; - mfi = g_hash_table_lookup(si->folders, fi->full_name); + mfi = g_hash_table_lookup (si->folders, fi->full_name); if (mfi) { update_1folder (self, mfi, 0, NULL, NULL, NULL, fi); } else { d(printf("Adding new folder: %s (%s)\n", fi->full_name, fi->uri)); - mfi = g_malloc0(sizeof(*mfi)); - mfi->full_name = g_strdup(fi->full_name); - mfi->uri = g_strdup(fi->uri); + mfi = g_malloc0 (sizeof (*mfi)); + mfi->full_name = g_strdup (fi->full_name); + mfi->uri = g_strdup (fi->uri); mfi->store_info = si; mfi->flags = fi->flags; mfi->has_children = fi->child != NULL; - g_hash_table_insert(si->folders, mfi->full_name, mfi); - g_hash_table_insert(si->folders_uri, mfi->uri, mfi); + g_hash_table_insert (si->folders, mfi->full_name, mfi); + g_hash_table_insert (si->folders_uri, mfi->uri, mfi); - up = g_malloc0(sizeof(*up)); - up->full_name = g_strdup(mfi->full_name); - up->uri = g_strdup(fi->uri); + up = g_malloc0 (sizeof (*up)); + up->full_name = g_strdup (mfi->full_name); + up->uri = g_strdup (fi->uri); up->unread = fi->unread; up->store = g_object_ref (si->store); @@ -470,20 +470,20 @@ setup_folder(MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si) up->add = TRUE; g_queue_push_head (&self->priv->updates, up); - flush_updates(self); + flush_updates (self); } } static void -create_folders(MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si) +create_folders (MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si) { d(printf("Setup new folder: %s\n %s\n", fi->uri, fi->full_name)); while (fi) { - setup_folder(self, fi, si); + setup_folder (self, fi, si); if (fi->child) - create_folders(self, fi->child, si); + create_folders (self, fi->child, si); fi = fi->next; } @@ -533,7 +533,7 @@ store_folder_unsubscribed_cb (CamelStore *store, g_mutex_lock (self->priv->stores_mutex); si = g_hash_table_lookup (self->priv->stores, store); if (si) { - mfi = g_hash_table_lookup(si->folders, info->full_name); + mfi = g_hash_table_lookup (si->folders, info->full_name); if (mfi) { g_hash_table_remove (si->folders, mfi->full_name); g_hash_table_remove (si->folders_uri, mfi->uri); @@ -556,23 +556,23 @@ store_folder_deleted_cb (CamelStore *store, } static gchar * -folder_to_url(CamelStore *store, const gchar *full_name) +folder_to_url (CamelStore *store, const gchar *full_name) { CamelURL *url; gchar *out; - url = camel_url_copy(((CamelService *)store)->url); + url = camel_url_copy (((CamelService *)store)->url); if (((CamelService *)store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) { - camel_url_set_fragment(url, full_name); + camel_url_set_fragment (url, full_name); } else { - gchar *name = g_alloca(strlen(full_name)+2); + gchar *name = g_alloca (strlen (full_name)+2); sprintf(name, "/%s", full_name); - camel_url_set_path(url, name); + camel_url_set_path (url, name); } - out = camel_url_to_string(url, CAMEL_URL_HIDE_ALL); - camel_url_free(url); + out = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); + camel_url_free (url); return out; } @@ -589,13 +589,13 @@ rename_folders (MailFolderCache *self, struct _folder_update *up; const gchar *config_dir; - up = g_malloc0(sizeof(*up)); + up = g_malloc0 (sizeof (*up)); d(printf("oldbase '%s' newbase '%s' new '%s'\n", oldbase, newbase, fi->full_name)); /* Form what was the old name, and try and look it up */ old = g_strdup_printf("%s%s", oldbase, fi->full_name + strlen(newbase)); - mfi = g_hash_table_lookup(si->folders, old); + mfi = g_hash_table_lookup (si->folders, old); if (mfi) { d(printf("Found old folder '%s' renaming to '%s'\n", mfi->full_name, fi->full_name)); @@ -603,31 +603,31 @@ rename_folders (MailFolderCache *self, up->olduri = mfi->uri; /* Its a rename op */ - g_hash_table_remove(si->folders, mfi->full_name); - g_hash_table_remove(si->folders_uri, mfi->uri); - mfi->full_name = g_strdup(fi->full_name); - mfi->uri = g_strdup(fi->uri); + g_hash_table_remove (si->folders, mfi->full_name); + g_hash_table_remove (si->folders_uri, mfi->uri); + mfi->full_name = g_strdup (fi->full_name); + mfi->uri = g_strdup (fi->uri); mfi->flags = fi->flags; mfi->has_children = fi->child != NULL; - g_hash_table_insert(si->folders, mfi->full_name, mfi); - g_hash_table_insert(si->folders_uri, mfi->uri, mfi); + g_hash_table_insert (si->folders, mfi->full_name, mfi); + g_hash_table_insert (si->folders_uri, mfi->uri, 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); - mfi->uri = g_strdup(fi->uri); + mfi = g_malloc0 (sizeof (*mfi)); + mfi->full_name = g_strdup (fi->full_name); + mfi->uri = g_strdup (fi->uri); mfi->store_info = si; mfi->flags = fi->flags; mfi->has_children = fi->child != NULL; - g_hash_table_insert(si->folders, mfi->full_name, mfi); - g_hash_table_insert(si->folders_uri, mfi->uri, mfi); + g_hash_table_insert (si->folders, mfi->full_name, mfi); + g_hash_table_insert (si->folders_uri, mfi->uri, mfi); } - up->full_name = g_strdup(mfi->full_name); - up->uri = g_strdup(mfi->uri); + up->full_name = g_strdup (mfi->full_name); + up->uri = g_strdup (mfi->uri); up->unread = fi->unread==-1?0:fi->unread; up->store = g_object_ref (si->store); @@ -635,56 +635,56 @@ rename_folders (MailFolderCache *self, up->add = TRUE; g_queue_push_tail (&self->priv->updates, up); - flush_updates(self); + flush_updates (self); #if 0 if (fi->sibling) - rename_folders(self, si, oldbase, newbase, fi->sibling, folders); + rename_folders (self, si, oldbase, newbase, fi->sibling, folders); if (fi->child) - rename_folders(self, si, oldbase, newbase, fi->child, folders); + rename_folders (self, si, oldbase, newbase, fi->child, folders); #endif /* rename the meta-data we maintain ourselves */ config_dir = mail_session_get_config_dir (); - olduri = folder_to_url(si->store, old); - e_filename_make_safe(olduri); - newuri = folder_to_url(si->store, fi->full_name); - e_filename_make_safe(newuri); + olduri = folder_to_url (si->store, old); + e_filename_make_safe (olduri); + newuri = folder_to_url (si->store, fi->full_name); + e_filename_make_safe (newuri); oldfile = g_strdup_printf("%s/custom_view-%s.xml", config_dir, olduri); newfile = g_strdup_printf("%s/custom_view-%s.xml", config_dir, newuri); - g_rename(oldfile, newfile); - g_free(oldfile); - g_free(newfile); + g_rename (oldfile, newfile); + g_free (oldfile); + g_free (newfile); oldfile = g_strdup_printf("%s/current_view-%s.xml", config_dir, olduri); newfile = g_strdup_printf("%s/current_view-%s.xml", config_dir, newuri); - g_rename(oldfile, newfile); - g_free(oldfile); - g_free(newfile); - g_free(olduri); - g_free(newuri); + g_rename (oldfile, newfile); + g_free (oldfile); + g_free (newfile); + g_free (olduri); + g_free (newuri); - g_free(old); + g_free (old); } static void -get_folders(CamelFolderInfo *fi, GPtrArray *folders) +get_folders (CamelFolderInfo *fi, GPtrArray *folders) { while (fi) { - g_ptr_array_add(folders, fi); + g_ptr_array_add (folders, fi); if (fi->child) - get_folders(fi->child, folders); + get_folders (fi->child, folders); fi = fi->next; } } static gint -folder_cmp(gconstpointer ap, gconstpointer bp) +folder_cmp (gconstpointer ap, gconstpointer bp) { const CamelFolderInfo *a = ((CamelFolderInfo **)ap)[0]; const CamelFolderInfo *b = ((CamelFolderInfo **)bp)[0]; - return strcmp(a->full_name, b->full_name); + return strcmp (a->full_name, b->full_name); } static void @@ -696,23 +696,23 @@ store_folder_renamed_cb (CamelStore *store, struct _store_info *si; g_mutex_lock (self->priv->stores_mutex); - si = g_hash_table_lookup(self->priv->stores, store); + si = g_hash_table_lookup (self->priv->stores, store); if (si) { - GPtrArray *folders = g_ptr_array_new(); + GPtrArray *folders = g_ptr_array_new (); CamelFolderInfo *top; gint i; /* Ok, so for some reason the folderinfo we have comes in all messed up from imap, should find out why ... this makes it workable */ - get_folders(info, folders); - qsort(folders->pdata, folders->len, sizeof(folders->pdata[0]), folder_cmp); + get_folders (info, folders); + qsort (folders->pdata, folders->len, sizeof (folders->pdata[0]), folder_cmp); top = folders->pdata[0]; for (i=0;i<folders->len;i++) { - rename_folders(self, si, old_name, top->full_name, folders->pdata[i]); + rename_folders (self, si, old_name, top->full_name, folders->pdata[i]); } - g_ptr_array_free(folders, TRUE); + g_ptr_array_free (folders, TRUE); } g_mutex_unlock (self->priv->stores_mutex); @@ -728,20 +728,20 @@ struct _update_data { }; static void -unset_folder_info_hash(gchar *path, struct _folder_info *mfi, gpointer data) +unset_folder_info_hash (gchar *path, struct _folder_info *mfi, gpointer data) { MailFolderCache *self = (MailFolderCache*) data; - unset_folder_info(self, mfi, FALSE, FALSE); + unset_folder_info (self, mfi, FALSE, FALSE); } static void -free_folder_info_hash(gchar *path, struct _folder_info *mfi, gpointer data) +free_folder_info_hash (gchar *path, struct _folder_info *mfi, gpointer data) { - free_folder_info(mfi); + free_folder_info (mfi); } static gboolean -update_folders(CamelStore *store, CamelFolderInfo *fi, gpointer data) +update_folders (CamelStore *store, CamelFolderInfo *fi, gpointer data) { struct _update_data *ud = data; struct _store_info *si; @@ -750,20 +750,20 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, gpointer data) d(printf("Got folderinfo for store %s\n", store->parent_object.provider->protocol)); g_mutex_lock (ud->cache->priv->stores_mutex); - si = g_hash_table_lookup(ud->cache->priv->stores, store); + si = g_hash_table_lookup (ud->cache->priv->stores, store); if (si && !ud->cancel) { /* the 'si' is still there, so we can remove ourselves from its list */ /* otherwise its not, and we're on our own and free anyway */ g_queue_remove (&si->folderinfo_updates, ud); if (fi) - create_folders(ud->cache, fi, si); + create_folders (ud->cache, fi, si); } g_mutex_unlock (ud->cache->priv->stores_mutex); if (ud->done) res = ud->done (store, fi, ud->data); - g_free(ud); + g_free (ud); return res; } @@ -852,13 +852,13 @@ store_online_cb (CamelStore *store, gpointer data) g_mutex_lock (ud->cache->priv->stores_mutex); - if (g_hash_table_lookup(ud->cache->priv->stores, store) != NULL && !ud->cancel) { + if (g_hash_table_lookup (ud->cache->priv->stores, store) != NULL && !ud->cancel) { /* re-use the cancel id. we're already in the store update list too */ - ud->id = mail_get_folderinfo(store, NULL, update_folders, ud); + ud->id = mail_get_folderinfo (store, NULL, update_folders, ud); } else { /* the store vanished, that means we were probably cancelled, or at any rate, need to clean ourselves up */ - g_free(ud); + g_free (ud); } g_mutex_unlock (ud->cache->priv->stores_mutex); @@ -883,7 +883,7 @@ storeinfo_find_folder_info (CamelStore *store, if (path[0] == '/') path++; - fi->fi = g_hash_table_lookup(si->folders, path); + fi->fi = g_hash_table_lookup (si->folders, path); } } } @@ -1043,7 +1043,7 @@ mail_folder_cache_init (MailFolderCache *self) self->priv = MAIL_FOLDER_CACHE_GET_PRIVATE (self); /* initialize values */ - self->priv->stores = g_hash_table_new(NULL, NULL); + self->priv->stores = g_hash_table_new (NULL, NULL); self->priv->stores_mutex = g_mutex_new (); g_queue_init (&self->priv->updates); @@ -1094,27 +1094,27 @@ mail_folder_cache_note_store (MailFolderCache *self, struct _update_data *ud; gint hook = 0; - g_return_if_fail (CAMEL_IS_STORE(store)); - g_return_if_fail (mail_in_main_thread()); + g_return_if_fail (CAMEL_IS_STORE (store)); + g_return_if_fail (mail_in_main_thread ()); g_mutex_lock (self->priv->stores_mutex); si = g_hash_table_lookup (self->priv->stores, store); if (si == NULL) { - si = g_malloc0(sizeof(*si)); - si->folders = g_hash_table_new(g_str_hash, g_str_equal); + si = g_malloc0 (sizeof (*si)); + si->folders = g_hash_table_new (g_str_hash, g_str_equal); si->folders_uri = g_hash_table_new ( CAMEL_STORE_CLASS ( - CAMEL_OBJECT_GET_CLASS(store))->hash_folder_name, + CAMEL_OBJECT_GET_CLASS (store))->hash_folder_name, CAMEL_STORE_CLASS ( - CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name); + CAMEL_OBJECT_GET_CLASS (store))->compare_folder_name); si->store = g_object_ref (store); - g_hash_table_insert(self->priv->stores, store, si); + g_hash_table_insert (self->priv->stores, store, si); g_queue_init (&si->folderinfo_updates); hook = TRUE; } - ud = g_malloc(sizeof(*ud)); + ud = g_malloc (sizeof (*ud)); ud->done = done; ud->data = data; ud->cancel = 0; @@ -1185,7 +1185,7 @@ mail_folder_cache_note_store_remove (MailFolderCache *self, { struct _store_info *si; - g_return_if_fail (CAMEL_IS_STORE(store)); + g_return_if_fail (CAMEL_IS_STORE (store)); if (self->priv->stores == NULL) return; @@ -1196,7 +1196,7 @@ mail_folder_cache_note_store_remove (MailFolderCache *self, if (si) { GList *link; - g_hash_table_remove(self->priv->stores, store); + g_hash_table_remove (self->priv->stores, store); g_signal_handlers_disconnect_matched ( store, G_SIGNAL_MATCH_DATA, @@ -1212,17 +1212,17 @@ mail_folder_cache_note_store_remove (MailFolderCache *self, struct _update_data *ud = link->data; d(printf("Cancelling outstanding folderinfo update %d\n", ud->id)); - mail_msg_cancel(ud->id); + mail_msg_cancel (ud->id); ud->cancel = 1; link = g_list_next (link); } g_object_unref (si->store); - g_hash_table_foreach(si->folders, (GHFunc)free_folder_info_hash, NULL); - g_hash_table_destroy(si->folders); - g_hash_table_destroy(si->folders_uri); - g_free(si); + g_hash_table_foreach (si->folders, (GHFunc)free_folder_info_hash, NULL); + g_hash_table_destroy (si->folders); + g_hash_table_destroy (si->folders_uri); + g_free (si); } g_mutex_unlock (self->priv->stores_mutex); @@ -1249,8 +1249,8 @@ mail_folder_cache_note_folder (MailFolderCache *self, g_mutex_lock (self->priv->stores_mutex); if (self->priv->stores == NULL - || (si = g_hash_table_lookup(self->priv->stores, parent_store)) == NULL - || (mfi = g_hash_table_lookup(si->folders, full_name)) == NULL) { + || (si = g_hash_table_lookup (self->priv->stores, parent_store)) == NULL + || (mfi = g_hash_table_lookup (si->folders, full_name)) == NULL) { w(g_warning("Noting folder before store initialised")); g_mutex_unlock (self->priv->stores_mutex); return; diff --git a/mail/mail-mt.c b/mail/mail-mt.c index 97144818d3..b8bfba3d29 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -75,11 +75,11 @@ mail_msg_new (MailMsgInfo *info) msg->info = info; msg->ref_count = 1; msg->seq = mail_msg_seq++; - msg->cancel = camel_operation_new(mail_operation_status, GINT_TO_POINTER(msg->seq)); + msg->cancel = camel_operation_new (mail_operation_status, GINT_TO_POINTER (msg->seq)); msg->priv = g_slice_new0 (MailMsgPrivate); msg->priv->cancelable = TRUE; - g_hash_table_insert(mail_msg_active_table, GINT_TO_POINTER(msg->seq), msg); + g_hash_table_insert (mail_msg_active_table, GINT_TO_POINTER (msg->seq), msg); d(printf("New message %p\n", msg)); @@ -114,21 +114,21 @@ end_event_callback (CamelObject *o, EActivity *activity, gpointer error) #include <mcheck.h> static void -checkmem(gpointer p) +checkmem (gpointer p) { if (p) { - gint status = mprobe(p); + gint status = mprobe (p); switch (status) { case MCHECK_HEAD: printf("Memory underrun at %p\n", p); - abort(); + abort (); case MCHECK_TAIL: printf("Memory overrun at %p\n", p); - abort(); + abort (); case MCHECK_FREE: printf("Double free %p\n", p); - abort(); + abort (); } } } @@ -178,14 +178,14 @@ mail_msg_unref (gpointer msg) return; #ifdef MALLOC_CHECK - checkmem(mail_msg); - checkmem(mail_msg->cancel); - checkmem(mail_msg->priv); + checkmem (mail_msg); + checkmem (mail_msg->cancel); + checkmem (mail_msg->priv); #endif d(printf("Free message %p\n", msg)); if (mail_msg->info->free) - mail_msg->info->free(mail_msg); + mail_msg->info->free (mail_msg); g_mutex_lock (mail_msg_lock); @@ -195,7 +195,7 @@ mail_msg_unref (gpointer msg) /* We need to make sure we dont lose a reference here YUCK YUCK */ /* This is tightly integrated with the code in do_op_status, - as it closely relates to the CamelOperation setup in msg_new() above */ + as it closely relates to the CamelOperation setup in msg_new () above */ if (mail_msg->priv->activity_state == 1) { /* tell the other to free it itself */ mail_msg->priv->activity_state = 3; @@ -222,14 +222,14 @@ mail_msg_unref (gpointer msg) /* hash table of ops->dialogue of active errors */ static GHashTable *active_errors = NULL; -static void error_destroy(GtkObject *o, gpointer data) +static void error_destroy (GtkObject *o, gpointer data) { - g_hash_table_remove(active_errors, data); + g_hash_table_remove (active_errors, data); } -static void error_response(GtkObject *o, gint button, gpointer data) +static void error_response (GtkObject *o, gint button, gpointer data) { - gtk_widget_destroy((GtkWidget *)o); + gtk_widget_destroy ((GtkWidget *)o); } void @@ -241,9 +241,9 @@ mail_msg_check_error (gpointer msg) GtkDialog *gd; #ifdef MALLOC_CHECK - checkmem(m); - checkmem(m->cancel); - checkmem(m->priv); + checkmem (m); + checkmem (m->cancel); + checkmem (m->priv); #endif if (m->error == NULL @@ -253,12 +253,12 @@ mail_msg_check_error (gpointer msg) return; if (active_errors == NULL) - active_errors = g_hash_table_new(NULL, NULL); + active_errors = g_hash_table_new (NULL, NULL); /* check to see if we have dialogue already running for this operation */ /* we key on the operation pointer, which is at least accurate enough for the operation type, although it could be on a different object. */ - if (g_hash_table_lookup(active_errors, m->info)) { + if (g_hash_table_lookup (active_errors, m->info)) { g_message ( "Error occurred while existing dialogue active:\n%s", m->error->message); @@ -272,90 +272,90 @@ mail_msg_check_error (gpointer msg) gd = (GtkDialog *) e_alert_dialog_new_for_args ( parent, "mail:async-error", what, m->error->message, NULL); - g_free(what); + g_free (what); } else gd = (GtkDialog *) e_alert_dialog_new_for_args ( parent, "mail:async-error-nodescribe", m->error->message, NULL); - g_hash_table_insert(active_errors, m->info, gd); + g_hash_table_insert (active_errors, m->info, gd); g_signal_connect(gd, "response", G_CALLBACK(error_response), m->info); g_signal_connect(gd, "destroy", G_CALLBACK(error_destroy), m->info); if (m->priv->cancelable) m->priv->error = (GtkWidget *) gd; else - gtk_widget_show((GtkWidget *)gd); + gtk_widget_show ((GtkWidget *)gd); } -void mail_msg_cancel(guint msgid) +void mail_msg_cancel (guint msgid) { MailMsg *m; g_mutex_lock (mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)); + m = g_hash_table_lookup (mail_msg_active_table, GINT_TO_POINTER (msgid)); if (m && m->cancel) - camel_operation_cancel(m->cancel); + camel_operation_cancel (m->cancel); g_mutex_unlock (mail_msg_lock); } /* waits for a message to be finished processing (freed) the messageid is from MailMsg->seq */ -void mail_msg_wait(guint msgid) +void mail_msg_wait (guint msgid) { MailMsg *m; if (mail_in_main_thread ()) { g_mutex_lock (mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)); + m = g_hash_table_lookup (mail_msg_active_table, GINT_TO_POINTER (msgid)); while (m) { g_mutex_unlock (mail_msg_lock); - gtk_main_iteration(); + gtk_main_iteration (); g_mutex_lock (mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)); + m = g_hash_table_lookup (mail_msg_active_table, GINT_TO_POINTER (msgid)); } g_mutex_unlock (mail_msg_lock); } else { g_mutex_lock (mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)); + m = g_hash_table_lookup (mail_msg_active_table, GINT_TO_POINTER (msgid)); while (m) { g_cond_wait (mail_msg_cond, mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)); + m = g_hash_table_lookup (mail_msg_active_table, GINT_TO_POINTER (msgid)); } g_mutex_unlock (mail_msg_lock); } } -gint mail_msg_active(guint msgid) +gint mail_msg_active (guint msgid) { gint active; g_mutex_lock (mail_msg_lock); if (msgid == (guint)-1) - active = g_hash_table_size(mail_msg_active_table) > 0; + active = g_hash_table_size (mail_msg_active_table) > 0; else - active = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)) != NULL; + active = g_hash_table_lookup (mail_msg_active_table, GINT_TO_POINTER (msgid)) != NULL; g_mutex_unlock (mail_msg_lock); return active; } -void mail_msg_wait_all(void) +void mail_msg_wait_all (void) { if (mail_in_main_thread ()) { g_mutex_lock (mail_msg_lock); - while (g_hash_table_size(mail_msg_active_table) > 0) { + while (g_hash_table_size (mail_msg_active_table) > 0) { g_mutex_unlock (mail_msg_lock); - gtk_main_iteration(); + gtk_main_iteration (); g_mutex_lock (mail_msg_lock); } g_mutex_unlock (mail_msg_lock); } else { g_mutex_lock (mail_msg_lock); - while (g_hash_table_size(mail_msg_active_table) > 0) { + while (g_hash_table_size (mail_msg_active_table) > 0) { g_cond_wait (mail_msg_cond, mail_msg_lock); } g_mutex_unlock (mail_msg_lock); @@ -485,7 +485,7 @@ mail_msg_proxy (MailMsg *msg) void mail_msg_cleanup (void) { - mail_msg_wait_all(); + mail_msg_wait_all (); G_LOCK (idle_source_id); if (idle_source_id != 0) { @@ -615,15 +615,15 @@ struct _proxy_msg { }; static void -do_async_event(struct _proxy_msg *m) +do_async_event (struct _proxy_msg *m) { m->thread = g_thread_self (); - m->func(m->o, m->event_data, m->data); + m->func (m->o, m->event_data, m->data); m->thread = NULL; - g_mutex_lock(m->ea->lock); - m->ea->tasks = g_slist_remove(m->ea->tasks, m); - g_mutex_unlock(m->ea->lock); + g_mutex_lock (m->ea->lock); + m->ea->tasks = g_slist_remove (m->ea->tasks, m); + g_mutex_unlock (m->ea->lock); } static gint @@ -649,8 +649,8 @@ mail_async_event_new (void) { MailAsyncEvent *ea; - ea = g_malloc0(sizeof(*ea)); - ea->lock = g_mutex_new(); + ea = g_malloc0 (sizeof (*ea)); + ea->lock = g_mutex_new (); return ea; } @@ -668,7 +668,7 @@ mail_async_event_emit (MailAsyncEvent *ea, /* We dont have a reply port for this, we dont * care when/if it gets executed, just queue it. */ - m = mail_msg_new(&async_event_info); + m = mail_msg_new (&async_event_info); m->func = func; m->o = o; m->event_data = event_data; @@ -678,9 +678,9 @@ mail_async_event_emit (MailAsyncEvent *ea, m->thread = NULL; id = m->base.seq; - g_mutex_lock(ea->lock); - ea->tasks = g_slist_prepend(ea->tasks, m); - g_mutex_unlock(ea->lock); + g_mutex_lock (ea->lock); + ea->tasks = g_slist_prepend (ea->tasks, m); + g_mutex_unlock (ea->lock); /* We use an idle function instead of our own message port only * because the gui message ports's notification buffer might @@ -690,7 +690,7 @@ mail_async_event_emit (MailAsyncEvent *ea, m->idle_id = g_idle_add ( (GSourceFunc) idle_async_event, m); else - mail_msg_main_loop_push(m); + mail_msg_main_loop_push (m); } else mail_msg_fast_ordered_push (m); @@ -703,13 +703,13 @@ mail_async_event_destroy (MailAsyncEvent *ea) gint id; struct _proxy_msg *m; - g_mutex_lock(ea->lock); + g_mutex_lock (ea->lock); while (ea->tasks) { m = ea->tasks->data; id = m->base.seq; if (m->thread == g_thread_self ()) { g_warning("Destroying async event from inside an event, returning EDEADLK"); - g_mutex_unlock(ea->lock); + g_mutex_unlock (ea->lock); errno = EDEADLK; return -1; } @@ -717,14 +717,14 @@ mail_async_event_destroy (MailAsyncEvent *ea) g_source_remove (m->idle_id); m->idle_id = 0; } - g_mutex_unlock(ea->lock); - mail_msg_wait(id); - g_mutex_lock(ea->lock); + g_mutex_unlock (ea->lock); + mail_msg_wait (id); + g_mutex_lock (ea->lock); } - g_mutex_unlock(ea->lock); + g_mutex_unlock (ea->lock); - g_mutex_free(ea->lock); - g_free(ea); + g_mutex_free (ea->lock); + g_free (ea); return 0; } @@ -742,53 +742,53 @@ struct _call_msg { }; static void -do_call(struct _call_msg *m) +do_call (struct _call_msg *m) { gpointer p1, *p2, *p3, *p4, *p5; gint i1; va_list ap; - G_VA_COPY(ap, m->ap); + G_VA_COPY (ap, m->ap); switch (m->type) { case MAIL_CALL_p_p: - p1 = va_arg(ap, gpointer ); - m->ret = m->func(p1); + p1 = va_arg (ap, gpointer ); + m->ret = m->func (p1); break; case MAIL_CALL_p_pp: - p1 = va_arg(ap, gpointer ); - p2 = va_arg(ap, gpointer ); - m->ret = m->func(p1, p2); + p1 = va_arg (ap, gpointer ); + p2 = va_arg (ap, gpointer ); + m->ret = m->func (p1, p2); break; case MAIL_CALL_p_ppp: - p1 = va_arg(ap, gpointer ); - p2 = va_arg(ap, gpointer ); - p3 = va_arg(ap, gpointer ); - m->ret = m->func(p1, p2, p3); + p1 = va_arg (ap, gpointer ); + p2 = va_arg (ap, gpointer ); + p3 = va_arg (ap, gpointer ); + m->ret = m->func (p1, p2, p3); break; case MAIL_CALL_p_pppp: - p1 = va_arg(ap, gpointer ); - p2 = va_arg(ap, gpointer ); - p3 = va_arg(ap, gpointer ); - p4 = va_arg(ap, gpointer ); - m->ret = m->func(p1, p2, p3, p4); + p1 = va_arg (ap, gpointer ); + p2 = va_arg (ap, gpointer ); + p3 = va_arg (ap, gpointer ); + p4 = va_arg (ap, gpointer ); + m->ret = m->func (p1, p2, p3, p4); break; case MAIL_CALL_p_ppppp: - p1 = va_arg(ap, gpointer ); - p2 = va_arg(ap, gpointer ); - p3 = va_arg(ap, gpointer ); - p4 = va_arg(ap, gpointer ); - p5 = va_arg(ap, gpointer ); - m->ret = m->func(p1, p2, p3, p4, p5); + p1 = va_arg (ap, gpointer ); + p2 = va_arg (ap, gpointer ); + p3 = va_arg (ap, gpointer ); + p4 = va_arg (ap, gpointer ); + p5 = va_arg (ap, gpointer ); + m->ret = m->func (p1, p2, p3, p4, p5); break; case MAIL_CALL_p_ppippp: - p1 = va_arg(ap, gpointer ); - p2 = va_arg(ap, gpointer ); - i1 = va_arg(ap, gint); - p3 = va_arg(ap, gpointer ); - p4 = va_arg(ap, gpointer ); - p5 = va_arg(ap, gpointer ); - m->ret = m->func(p1, p2, i1, p3, p4, p5); + p1 = va_arg (ap, gpointer ); + p2 = va_arg (ap, gpointer ); + i1 = va_arg (ap, gint); + p3 = va_arg (ap, gpointer ); + p4 = va_arg (ap, gpointer ); + p5 = va_arg (ap, gpointer ); + m->ret = m->func (p1, p2, i1, p3, p4, p5); break; } @@ -811,12 +811,12 @@ mail_call_main (mail_call_t type, MailMainFunc func, ...) gpointer ret; va_list ap; - va_start(ap, func); + va_start (ap, func); m = mail_msg_new (&mail_call_info); m->type = type; m->func = func; - G_VA_COPY(m->ap, ap); + G_VA_COPY (m->ap, ap); if (mail_in_main_thread ()) do_call (m); @@ -828,7 +828,7 @@ mail_call_main (mail_call_t type, MailMainFunc func, ...) e_flag_free (m->done); } - va_end(ap); + va_end (ap); ret = m->ret; mail_msg_unref (m); @@ -976,9 +976,9 @@ mail_operation_status (CamelOperation *op, d(printf("got operation statys: %s %d%%\n", what, pc)); - m = mail_msg_new(&op_status_info); + m = mail_msg_new (&op_status_info); m->op = op; - m->what = g_strdup(what); + m->what = g_strdup (what); switch (pc) { case CAMEL_OPERATION_START: pc = 0; @@ -989,7 +989,7 @@ mail_operation_status (CamelOperation *op, } m->pc = pc; m->data = data; - mail_msg_main_loop_push(m); + mail_msg_main_loop_push (m); } void diff --git a/mail/mail-mt.h b/mail/mail-mt.h index d8b4fc70d2..c27f61ce6c 100644 --- a/mail/mail-mt.h +++ b/mail/mail-mt.h @@ -54,7 +54,7 @@ struct _MailMsgInfo { }; /* setup ports */ -void mail_msg_init(void); +void mail_msg_init (void); void mail_msg_cleanup (void); gboolean mail_in_main_thread (void); @@ -64,10 +64,10 @@ gpointer mail_msg_new (MailMsgInfo *info); gpointer mail_msg_ref (gpointer msg); void mail_msg_unref (gpointer msg); void mail_msg_check_error (gpointer msg); -void mail_msg_cancel(guint msgid); -void mail_msg_wait(guint msgid); -void mail_msg_wait_all(void); -gint mail_msg_active(guint msgid); +void mail_msg_cancel (guint msgid); +void mail_msg_wait (guint msgid); +void mail_msg_wait_all (void); +gint mail_msg_active (guint msgid); /* dispatch a message */ void mail_msg_main_loop_push (gpointer msg); @@ -99,11 +99,11 @@ typedef enum _mail_async_event_t { typedef void (*MailAsyncFunc)(gpointer , gpointer , gpointer ); /* create a new async event handler */ -MailAsyncEvent *mail_async_event_new(void); +MailAsyncEvent *mail_async_event_new (void); /* forward a camel event (or other call) to the gui thread */ -guint mail_async_event_emit(MailAsyncEvent *ea, mail_async_event_t type, MailAsyncFunc func, gpointer , gpointer , gpointer ); +guint mail_async_event_emit (MailAsyncEvent *ea, mail_async_event_t type, MailAsyncFunc func, gpointer , gpointer , gpointer ); /* wait for all outstanding async events to complete */ -gint mail_async_event_destroy(MailAsyncEvent *ea); +gint mail_async_event_destroy (MailAsyncEvent *ea); void mail_mt_set_backend (gchar *backend); @@ -119,7 +119,7 @@ typedef enum { typedef gpointer (*MailMainFunc)(); -gpointer mail_call_main(mail_call_t type, MailMainFunc func, ...); +gpointer mail_call_main (mail_call_t type, MailMainFunc func, ...); /* A generic proxy event for anything that can be proxied during the life of the mailer (almost nothing) */ /* Note that almost all objects care about the lifecycle of their events, so this cannot be used */ diff --git a/mail/mail-ops.c b/mail/mail-ops.c index ae2d12dfda..defa166a42 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -132,7 +132,7 @@ em_filter_folder_element_exec (struct _filter_mail_msg *m) camel_folder_thaw (m->destination); /* this may thaw/unref source folders, do it here so we dont do it in the main thread - see also fetch_mail_fetch() below */ + see also fetch_mail_fetch () below */ g_object_unref (m->driver); m->driver = NULL; @@ -313,7 +313,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m) /* need to uncancel so writes/etc. don't fail */ if (g_error_matches (fm->base.error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - camel_operation_uncancel(NULL); + camel_operation_uncancel (NULL); /* save the cache of uids that we've just downloaded */ camel_uid_cache_save (cache); @@ -323,13 +323,13 @@ fetch_mail_exec (struct _fetch_mail_msg *m) /* not keep on server - just delete all the actual messages on the server */ for (i=0;i<folder_uids->len;i++) { d(printf("force delete uid '%s'\n", (gchar *)folder_uids->pdata[i])); - camel_folder_delete_message(folder, folder_uids->pdata[i]); + camel_folder_delete_message (folder, folder_uids->pdata[i]); } } if ((fm->delete || cache_uids) && fm->base.error == NULL) { /* expunge messages (downloaded so far) */ - camel_folder_sync(folder, fm->delete, NULL); + camel_folder_sync (folder, fm->delete, NULL); } camel_uid_cache_destroy (cache); @@ -478,7 +478,7 @@ mail_send_message (struct _send_queue_msg *m, gint i; GError *local_error = NULL; - message = camel_folder_get_message(queue, uid, error); + message = camel_folder_get_message (queue, uid, error); if (!message) return; @@ -491,7 +491,7 @@ mail_send_message (struct _send_queue_msg *m, if (tmp) { gchar *name; - name = g_strstrip(g_strdup(tmp)); + name = g_strstrip (g_strdup (tmp)); if ((account = e_get_account_by_uid (name)) /* 'old' x-evolution-account stored the name, how silly */ || (account = e_get_account_by_name (name))) { @@ -500,18 +500,18 @@ mail_send_message (struct _send_queue_msg *m, sent_folder_uri = g_strdup (account->sent_folder_uri); } - g_free(name); + g_free (name); } if (!account) { /* default back to these headers */ tmp = camel_header_raw_find(&xev, "X-Evolution-Transport", NULL); if (tmp) - transport_url = g_strstrip(g_strdup(tmp)); + transport_url = g_strstrip (g_strdup (tmp)); tmp = camel_header_raw_find(&xev, "X-Evolution-Fcc", NULL); if (tmp) - sent_folder_uri = g_strstrip(g_strdup(tmp)); + sent_folder_uri = g_strstrip (g_strdup (tmp)); } if (transport_url || destination) { @@ -542,7 +542,7 @@ mail_send_message (struct _send_queue_msg *m, camel_address_cat (recipients, CAMEL_ADDRESS (iaddr)); } - if (camel_address_length(recipients) > 0) { + if (camel_address_length (recipients) > 0) { xport = camel_session_get_transport ( session, transport_url ? transport_url : destination, error); @@ -554,8 +554,8 @@ mail_send_message (struct _send_queue_msg *m, } /* Now check for posting, failures are ignored */ - info = camel_message_info_new(NULL); - camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0); + info = camel_message_info_new (NULL); + camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, ~0); for (header = xev;header;header=header->next) { gchar *uri; @@ -565,14 +565,14 @@ mail_send_message (struct _send_queue_msg *m, /* TODO: don't lose errors */ - uri = g_strstrip(g_strdup(header->value)); - folder = mail_tool_uri_to_folder(uri, 0, NULL); + uri = g_strstrip (g_strdup (header->value)); + folder = mail_tool_uri_to_folder (uri, 0, NULL); if (folder) { - camel_folder_append_message(folder, message, info, NULL, NULL); + camel_folder_append_message (folder, message, info, NULL, NULL); g_object_unref (folder); folder = NULL; } - g_free(uri); + g_free (uri); } /* post process */ @@ -678,19 +678,19 @@ exit: g_propagate_error (error, local_error); if (folder) { - camel_folder_sync(folder, FALSE, NULL); + camel_folder_sync (folder, FALSE, NULL); g_object_unref (folder); } if (info) - camel_message_info_free(info); + camel_message_info_free (info); g_object_unref (recipients); g_object_unref (from); if (xport) g_object_unref (xport); - g_free(sent_folder_uri); - g_free(transport_url); - camel_header_raw_clear(&xev); - g_string_free(err, TRUE); + g_free (sent_folder_uri); + g_free (transport_url); + camel_header_raw_clear (&xev); + g_string_free (err, TRUE); g_object_unref (message); return; @@ -751,9 +751,9 @@ send_queue_exec (struct _send_queue_msg *m) info = camel_folder_get_message_info (m->queue, uids->pdata[i]); if (info) { - if ((camel_message_info_flags(info) & CAMEL_MESSAGE_DELETED) == 0) + if ((camel_message_info_flags (info) & CAMEL_MESSAGE_DELETED) == 0) send_uids->pdata[j++] = uids->pdata[i]; - camel_folder_free_message_info(m->queue, info); + camel_folder_free_message_info (m->queue, info); } } @@ -857,7 +857,7 @@ static void send_queue_done (struct _send_queue_msg *m) { if (m->done) - m->done(m->destination, m->data); + m->done (m->destination, m->data); } static gchar * @@ -872,9 +872,9 @@ send_queue_free (struct _send_queue_msg *m) if (m->driver) g_object_unref (m->driver); g_object_unref (m->queue); - g_free(m->destination); + g_free (m->destination); if (m->cancel) - camel_operation_unref(m->cancel); + camel_operation_unref (m->cancel); } static MailMsgInfo send_queue_info = { @@ -887,7 +887,7 @@ static MailMsgInfo send_queue_info = { /* same interface as fetch_mail, just 'cause i'm lazy today (and we need to run it from the same spot?) */ void -mail_send_queue(CamelFolder *queue, const gchar *destination, +mail_send_queue (CamelFolder *queue, const gchar *destination, const gchar *type, CamelOperation *cancel, CamelFilterGetFolderFunc get_folder, gpointer get_data, CamelFilterStatusFunc *status, gpointer status_data, @@ -895,13 +895,13 @@ mail_send_queue(CamelFolder *queue, const gchar *destination, { struct _send_queue_msg *m; - m = mail_msg_new(&send_queue_info); + m = mail_msg_new (&send_queue_info); m->queue = queue; g_object_ref (queue); - m->destination = g_strdup(destination); + m->destination = g_strdup (destination); if (cancel) { m->cancel = cancel; - camel_operation_ref(cancel); + camel_operation_ref (cancel); camel_operation_unref (m->base.cancel); mail_msg_set_cancelable (m, FALSE); @@ -941,8 +941,8 @@ append_mail_desc (struct _append_msg *m) static void append_mail_exec (struct _append_msg *m) { - camel_mime_message_set_date(m->message, CAMEL_MESSAGE_DATE_CURRENT, 0); - camel_folder_append_message(m->folder, m->message, m->info, &m->appended_uid, &m->base.error); + camel_mime_message_set_date (m->message, CAMEL_MESSAGE_DATE_CURRENT, 0); + camel_folder_append_message (m->folder, m->message, m->info, &m->appended_uid, &m->base.error); } static void @@ -1093,7 +1093,7 @@ mail_transfer_messages (CamelFolder *source, GPtrArray *uids, g_return_if_fail (uids != NULL); g_return_if_fail (dest_uri != NULL); - m = mail_msg_new(&transfer_messages_info); + m = mail_msg_new (&transfer_messages_info); m->source = source; g_object_ref (source); m->uids = uids; @@ -1123,9 +1123,9 @@ get_folderinfo_desc (struct _get_folderinfo_msg *m) { gchar *ret, *name; - name = camel_service_get_name((CamelService *)m->store, TRUE); + name = camel_service_get_name ((CamelService *)m->store, TRUE); ret = g_strdup_printf (_("Scanning folders in '%s'"), name); - g_free(name); + g_free (name); return ret; } @@ -1159,7 +1159,7 @@ static void get_folderinfo_free (struct _get_folderinfo_msg *m) { if (m->info && m->can_clear) - camel_store_free_folder_info(m->store, m->info); + camel_store_free_folder_info (m->store, m->info); g_object_unref (m->store); } @@ -1177,11 +1177,11 @@ mail_get_folderinfo (CamelStore *store, CamelOperation *op, gboolean (*done)(Cam struct _get_folderinfo_msg *m; gint id; - m = mail_msg_new(&get_folderinfo_info); + m = mail_msg_new (&get_folderinfo_info); if (op) { - camel_operation_unref(m->base.cancel); + camel_operation_unref (m->base.cancel); m->base.cancel = op; - camel_operation_ref(op); + camel_operation_ref (op); } m->store = store; g_object_ref (store); @@ -1211,48 +1211,48 @@ do_build_attachment (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, gint i; if (messages->len == 0) { - d->done(folder, messages, NULL, NULL, d->data); - g_free(d); + d->done (folder, messages, NULL, NULL, d->data); + g_free (d); return; } if (messages->len == 1) { - part = mail_tool_make_message_attachment(messages->pdata[0]); + part = mail_tool_make_message_attachment (messages->pdata[0]); } else { - multipart = camel_multipart_new(); + multipart = camel_multipart_new (); camel_data_wrapper_set_mime_type(CAMEL_DATA_WRAPPER (multipart), "multipart/digest"); - camel_multipart_set_boundary(multipart, NULL); + camel_multipart_set_boundary (multipart, NULL); for (i=0;i<messages->len;i++) { - part = mail_tool_make_message_attachment(messages->pdata[i]); - camel_multipart_add_part(multipart, part); + part = mail_tool_make_message_attachment (messages->pdata[i]); + camel_multipart_add_part (multipart, part); g_object_unref (part); } - part = camel_mime_part_new(); - camel_medium_set_content (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER(multipart)); + part = camel_mime_part_new (); + camel_medium_set_content (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (multipart)); g_object_unref (multipart); camel_mime_part_set_description(part, _("Forwarded messages")); } - subject = mail_tool_generate_forward_subject(messages->pdata[0]); - d->done(folder, messages, part, subject, d->data); - g_free(subject); + subject = mail_tool_generate_forward_subject (messages->pdata[0]); + d->done (folder, messages, part, subject, d->data); + g_free (subject); g_object_unref (part); - g_free(d); + g_free (d); } void -mail_build_attachment(CamelFolder *folder, GPtrArray *uids, +mail_build_attachment (CamelFolder *folder, GPtrArray *uids, void (*done)(CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, gchar *subject, gpointer data), gpointer data) { struct _build_data *d; - d = g_malloc(sizeof(*d)); + d = g_malloc (sizeof (*d)); d->done = done; d->data = data; - mail_get_messages(folder, uids, do_build_attachment, d); + mail_get_messages (folder, uids, do_build_attachment, d); } /* ** LOAD FOLDER ********************************************************* */ @@ -1313,7 +1313,7 @@ mail_get_folder (const gchar *uri, guint32 flags, struct _get_folder_msg *m; gint id; - m = mail_msg_new(&get_folder_info); + m = mail_msg_new (&get_folder_info); m->uri = g_strdup (uri); m->flags = flags; m->data = data; @@ -1455,9 +1455,9 @@ mail_get_store (const gchar *uri, CamelOperation *op, void (*done) (gchar *uri, m = mail_msg_new (&get_store_info); if (op) { - camel_operation_unref(m->base.cancel); + camel_operation_unref (m->base.cancel); m->base.cancel = op; - camel_operation_ref(op); + camel_operation_ref (op); } m->uri = g_strdup (uri); m->data = data; @@ -1613,14 +1613,14 @@ sync_folder_desc (struct _sync_folder_msg *m) static void sync_folder_exec (struct _sync_folder_msg *m) { - camel_folder_sync(m->folder, FALSE, &m->base.error); + camel_folder_sync (m->folder, FALSE, &m->base.error); } static void sync_folder_done (struct _sync_folder_msg *m) { if (m->done) - m->done(m->folder, m->data); + m->done (m->folder, m->data); } static void @@ -1638,11 +1638,11 @@ static MailMsgInfo sync_folder_info = { }; void -mail_sync_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpointer data), gpointer data) +mail_sync_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gpointer data), gpointer data) { struct _sync_folder_msg *m; - m = mail_msg_new(&sync_folder_info); + m = mail_msg_new (&sync_folder_info); m->folder = folder; g_object_ref (folder); m->data = data; @@ -1667,12 +1667,12 @@ sync_store_desc (struct _sync_store_msg *m) { gchar *uri, *res; - uri = camel_url_to_string(((CamelService *)m->store)->url, CAMEL_URL_HIDE_ALL); - res = g_strdup_printf(m->expunge + uri = camel_url_to_string (((CamelService *)m->store)->url, CAMEL_URL_HIDE_ALL); + res = g_strdup_printf (m->expunge ?_("Expunging and storing account '%s'") :_("Storing account '%s'"), uri); - g_free(uri); + g_free (uri); return res; } @@ -1680,14 +1680,14 @@ sync_store_desc (struct _sync_store_msg *m) static void sync_store_exec (struct _sync_store_msg *m) { - camel_store_sync(m->store, m->expunge, &m->base.error); + camel_store_sync (m->store, m->expunge, &m->base.error); } static void sync_store_done (struct _sync_store_msg *m) { if (m->done) - m->done(m->store, m->data); + m->done (m->store, m->data); } static void @@ -1705,11 +1705,11 @@ static MailMsgInfo sync_store_info = { }; void -mail_sync_store(CamelStore *store, gint expunge, void (*done) (CamelStore *store, gpointer data), gpointer data) +mail_sync_store (CamelStore *store, gint expunge, void (*done) (CamelStore *store, gpointer data), gpointer data) { struct _sync_store_msg *m; - m = mail_msg_new(&sync_store_info); + m = mail_msg_new (&sync_store_info); m->store = store; m->expunge = expunge; g_object_ref (store); @@ -1733,7 +1733,7 @@ refresh_folder_exec (struct _sync_folder_msg *m) /* camel_folder_sync (m->folder, FALSE, &m->base.error); */ /* if (!camel_exception_is_set (&m->base.error)) */ - camel_folder_refresh_info(m->folder, &m->base.error); + camel_folder_refresh_info (m->folder, &m->base.error); } /* we just use the sync stuff where we can, since it would be the same */ @@ -1746,11 +1746,11 @@ static MailMsgInfo refresh_folder_info = { }; void -mail_refresh_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpointer data), gpointer data) +mail_refresh_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gpointer data), gpointer data) { struct _sync_folder_msg *m; - m = mail_msg_new(&refresh_folder_info); + m = mail_msg_new (&refresh_folder_info); m->folder = folder; g_object_ref (folder); m->data = data; @@ -1770,7 +1770,7 @@ expunge_folder_desc (struct _sync_folder_msg *m) static void expunge_folder_exec (struct _sync_folder_msg *m) { - camel_folder_expunge(m->folder, &m->base.error); + camel_folder_expunge (m->folder, &m->base.error); } /* we just use the sync stuff where we can, since it would be the same */ @@ -1783,11 +1783,11 @@ static MailMsgInfo expunge_folder_info = { }; void -mail_expunge_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpointer data), gpointer data) +mail_expunge_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gpointer data), gpointer data) { struct _sync_folder_msg *m; - m = mail_msg_new(&expunge_folder_info); + m = mail_msg_new (&expunge_folder_info); m->folder = folder; g_object_ref (folder); m->data = data; @@ -1839,14 +1839,14 @@ static void empty_trash_done (struct _empty_trash_msg *m) { if (m->done) - m->done(m->account, m->data); + m->done (m->account, m->data); } static void empty_trash_free (struct _empty_trash_msg *m) { if (m->account) - g_object_unref(m->account); + g_object_unref (m->account); } static MailMsgInfo empty_trash_info = { @@ -1858,14 +1858,14 @@ static MailMsgInfo empty_trash_info = { }; void -mail_empty_trash(EAccount *account, void (*done) (EAccount *account, gpointer data), gpointer data) +mail_empty_trash (EAccount *account, void (*done) (EAccount *account, gpointer data), gpointer data) { struct _empty_trash_msg *m; - m = mail_msg_new(&empty_trash_info); + m = mail_msg_new (&empty_trash_info); m->account = account; if (account) - g_object_ref(account); + g_object_ref (account); m->data = data; m->done = done; @@ -1904,7 +1904,7 @@ static void get_message_done (struct _get_message_msg *m) { if (m->done) - m->done(m->folder, m->uid, m->message, m->data); + m->done (m->folder, m->uid, m->message, m->data); } static void @@ -1927,20 +1927,20 @@ static MailMsgInfo get_message_info = { }; gint -mail_get_message(CamelFolder *folder, const gchar *uid, void (*done) (CamelFolder *folder, const gchar *uid, +mail_get_message (CamelFolder *folder, const gchar *uid, void (*done) (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data), gpointer data, MailMsgDispatchFunc dispatch) { struct _get_message_msg *m; gint id; - m = mail_msg_new(&get_message_info); + m = mail_msg_new (&get_message_info); m->folder = folder; g_object_ref (folder); - m->uid = g_strdup(uid); + m->uid = g_strdup (uid); m->data = data; m->done = (void (*) (CamelFolder *, const gchar *, CamelMimeMessage *, gpointer )) done; - m->cancel = camel_operation_new(NULL, NULL); + m->cancel = camel_operation_new (NULL, NULL); id = m->base.seq; dispatch (m); @@ -1955,7 +1955,7 @@ get_messagex_done (struct _get_message_msg *m) { if (m->done && !camel_operation_cancel_check (m->cancel)) { get_done done = (get_done)m->done; - done(m->folder, m->uid, m->message, m->data, &m->base.error); + done (m->folder, m->uid, m->message, m->data, &m->base.error); } } @@ -1983,13 +1983,13 @@ mail_get_messagex (CamelFolder *folder, struct _get_message_msg *m; gint id; - m = mail_msg_new(&get_messagex_info); + m = mail_msg_new (&get_messagex_info); m->folder = folder; g_object_ref (folder); - m->uid = g_strdup(uid); + m->uid = g_strdup (uid); m->data = data; m->done = (void (*) (CamelFolder *, const gchar *, CamelMimeMessage *, gpointer )) done; - m->cancel = camel_operation_new(NULL, NULL); + m->cancel = camel_operation_new (NULL, NULL); id = m->base.seq; dispatch (m); @@ -2027,12 +2027,12 @@ get_messages_exec (struct _get_messages_msg *m) for (i=0; i<m->uids->len; i++) { gint pc = ((i+1) * 100) / m->uids->len; - message = camel_folder_get_message(m->folder, m->uids->pdata[i], &m->base.error); - camel_operation_progress(m->base.cancel, pc); + message = camel_folder_get_message (m->folder, m->uids->pdata[i], &m->base.error); + camel_operation_progress (m->base.cancel, pc); if (message == NULL) break; - g_ptr_array_add(m->messages, message); + g_ptr_array_add (m->messages, message); } } @@ -2040,7 +2040,7 @@ static void get_messages_done (struct _get_messages_msg *m) { if (m->done) - m->done(m->folder, m->uids, m->messages, m->data); + m->done (m->folder, m->uids, m->messages, m->data); } static void @@ -2053,7 +2053,7 @@ get_messages_free (struct _get_messages_msg *m) if (m->messages->pdata[i]) g_object_unref (m->messages->pdata[i]); } - g_ptr_array_free(m->messages, TRUE); + g_ptr_array_free (m->messages, TRUE); g_object_unref (m->folder); } @@ -2066,18 +2066,18 @@ static MailMsgInfo get_messages_info = { }; gint -mail_get_messages(CamelFolder *folder, GPtrArray *uids, +mail_get_messages (CamelFolder *folder, GPtrArray *uids, void (*done) (CamelFolder *folder, GPtrArray *uids, GPtrArray *msgs, gpointer data), gpointer data) { struct _get_messages_msg *m; gint id; - m = mail_msg_new(&get_messages_info); + m = mail_msg_new (&get_messages_info); m->folder = folder; g_object_ref (folder); m->uids = uids; - m->messages = g_ptr_array_new(); + m->messages = g_ptr_array_new (); m->data = data; m->done = done; id = m->base.seq; @@ -2154,7 +2154,7 @@ save_messages_exec (struct _save_messages_msg *m) path = g_filename_to_uri (m->path, NULL, NULL); stream = camel_stream_vfs_new_with_uri (path, CAMEL_STREAM_VFS_CREATE); - from_filter = camel_mime_filter_from_new(); + from_filter = camel_mime_filter_from_new (); filtered_stream = camel_stream_filter_new (stream); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), from_filter); @@ -2167,18 +2167,18 @@ save_messages_exec (struct _save_messages_msg *m) CamelMimeMessage *message; gint pc = ((i+1) * 100) / m->uids->len; - message = camel_folder_get_message(m->folder, m->uids->pdata[i], &m->base.error); - camel_operation_progress(m->base.cancel, pc); + message = camel_folder_get_message (m->folder, m->uids->pdata[i], &m->base.error); + camel_operation_progress (m->base.cancel, pc); if (message == NULL) break; save_prepare_part (CAMEL_MIME_PART (message)); /* we need to flush after each stream write since we are writing to the same fd */ - from = camel_mime_message_build_mbox_from(message); + from = camel_mime_message_build_mbox_from (message); if (camel_stream_write_string ( stream, from, &m->base.error) == -1 - || camel_stream_flush(stream, &m->base.error) == -1 + || camel_stream_flush (stream, &m->base.error) == -1 || camel_data_wrapper_write_to_stream ( (CamelDataWrapper *) message, (CamelStream *)filtered_stream, &m->base.error) == -1 @@ -2186,16 +2186,16 @@ save_messages_exec (struct _save_messages_msg *m) (CamelStream *)filtered_stream, &m->base.error) == -1 || camel_stream_write_string ( stream, "\n", &m->base.error) == -1 - || camel_stream_flush(stream, &m->base.error) == -1) { + || camel_stream_flush (stream, &m->base.error) == -1) { g_prefix_error ( &m->base.error, _("Error saving messages to: %s:\n"), m->path); - g_free(from); + g_free (from); g_object_unref ((CamelObject *)message); break; } - g_free(from); + g_free (from); g_object_unref (message); } @@ -2207,7 +2207,7 @@ static void save_messages_done (struct _save_messages_msg *m) { if (m->done) - m->done(m->folder, m->uids, m->path, m->data); + m->done (m->folder, m->uids, m->path, m->data); } static void @@ -2215,7 +2215,7 @@ save_messages_free (struct _save_messages_msg *m) { em_utils_uids_free (m->uids); g_object_unref (m->folder); - g_free(m->path); + g_free (m->path); } static MailMsgInfo save_messages_info = { @@ -2227,17 +2227,17 @@ static MailMsgInfo save_messages_info = { }; gint -mail_save_messages(CamelFolder *folder, GPtrArray *uids, const gchar *path, +mail_save_messages (CamelFolder *folder, GPtrArray *uids, const gchar *path, void (*done) (CamelFolder *folder, GPtrArray *uids, gchar *path, gpointer data), gpointer data) { struct _save_messages_msg *m; gint id; - m = mail_msg_new(&save_messages_info); + m = mail_msg_new (&save_messages_info); m->folder = folder; g_object_ref (folder); m->uids = uids; - m->path = g_strdup(path); + m->path = g_strdup (path); m->data = data; m->done = done; @@ -2371,12 +2371,12 @@ prep_offline_exec (struct _prep_offline_msg *m) CamelFolder *folder; if (m->cancel) - camel_operation_register(m->cancel); + camel_operation_register (m->cancel); - folder = mail_tool_uri_to_folder(m->uri, 0, &m->base.error); + folder = mail_tool_uri_to_folder (m->uri, 0, &m->base.error); if (folder) { - if (CAMEL_IS_DISCO_FOLDER(folder)) { - camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)folder, + if (CAMEL_IS_DISCO_FOLDER (folder)) { + camel_disco_folder_prepare_for_offline ((CamelDiscoFolder *)folder, "(match-all)", &m->base.error); } else if (CAMEL_IS_OFFLINE_FOLDER (folder)) { @@ -2384,27 +2384,27 @@ prep_offline_exec (struct _prep_offline_msg *m) } /* prepare_for_offline should do this? */ /* of course it should all be atomic, but ... */ - camel_folder_sync(folder, FALSE, NULL); + camel_folder_sync (folder, FALSE, NULL); g_object_unref (folder); } if (m->cancel) - camel_operation_unregister(m->cancel); + camel_operation_unregister (m->cancel); } static void prep_offline_done (struct _prep_offline_msg *m) { if (m->done) - m->done(m->uri, m->data); + m->done (m->uri, m->data); } static void prep_offline_free (struct _prep_offline_msg *m) { if (m->cancel) - camel_operation_unref(m->cancel); - g_free(m->uri); + camel_operation_unref (m->cancel); + g_free (m->uri); } static MailMsgInfo prep_offline_info = { @@ -2416,18 +2416,18 @@ static MailMsgInfo prep_offline_info = { }; void -mail_prep_offline(const gchar *uri, +mail_prep_offline (const gchar *uri, CamelOperation *cancel, void (*done)(const gchar *, gpointer data), gpointer data) { struct _prep_offline_msg *m; - m = mail_msg_new(&prep_offline_info); + m = mail_msg_new (&prep_offline_info); m->cancel = cancel; if (cancel) - camel_operation_ref(cancel); - m->uri = g_strdup(uri); + camel_operation_ref (cancel); + m->uri = g_strdup (uri); m->data = data; m->done = done; @@ -2453,7 +2453,7 @@ set_offline_desc (struct _set_offline_msg *m) msg = g_strdup_printf (m->offline ? _("Disconnecting from '%s'") : _("Reconnecting to '%s'"), service_name); - g_free(service_name); + g_free (service_name); return msg; } @@ -2495,7 +2495,7 @@ static void set_offline_done (struct _set_offline_msg *m) { if (m->done) - m->done(m->store, m->data); + m->done (m->store, m->data); } static void @@ -2526,7 +2526,7 @@ mail_store_set_offline (CamelStore *store, gboolean offline, if (offline) camel_service_cancel_connect (CAMEL_SERVICE (store)); - m = mail_msg_new(&set_offline_info); + m = mail_msg_new (&set_offline_info); m->store = store; g_object_ref (store); m->offline = offline; @@ -2548,7 +2548,7 @@ prepare_offline_desc (struct _set_offline_msg *m) gchar *msg; msg = g_strdup_printf (_("Preparing account '%s' for offline"), service_name); - g_free(service_name); + g_free (service_name); return msg; } @@ -2596,7 +2596,7 @@ mail_store_prepare_offline (CamelStore *store) * thread won't get queued behind a hung connect op. */ - m = mail_msg_new(&prepare_offline_info); + m = mail_msg_new (&prepare_offline_info); m->store = store; g_object_ref (store); m->data = NULL; @@ -2641,13 +2641,13 @@ check_service_exec (struct _check_msg *m) { CamelService *service; - service = camel_session_get_service(session, m->url, m->type, &m->base.error); + service = camel_session_get_service (session, m->url, m->type, &m->base.error); if (!service) { - camel_operation_unregister(m->base.cancel); + camel_operation_unregister (m->base.cancel); return; } - m->authtypes = camel_service_query_auth_types(service, &m->base.error); + m->authtypes = camel_service_query_auth_types (service, &m->base.error); g_object_unref (service); } @@ -2655,14 +2655,14 @@ static void check_service_done (struct _check_msg *m) { if (m->done) - m->done(m->url, m->type, m->authtypes, m->data); + m->done (m->url, m->type, m->authtypes, m->data); } static void check_service_free (struct _check_msg *m) { - g_free(m->url); - g_list_free(m->authtypes); + g_free (m->url); + g_list_free (m->authtypes); } static MailMsgInfo check_service_info = { @@ -2674,13 +2674,13 @@ static MailMsgInfo check_service_info = { }; gint -mail_check_service(const gchar *url, CamelProviderType type, void (*done)(const gchar *url, CamelProviderType type, GList *authtypes, gpointer data), gpointer data) +mail_check_service (const gchar *url, CamelProviderType type, void (*done)(const gchar *url, CamelProviderType type, GList *authtypes, gpointer data), gpointer data) { struct _check_msg *m; gint id; m = mail_msg_new (&check_service_info); - m->url = g_strdup(url); + m->url = g_strdup (url); m->type = type; m->done = done; m->data = data; diff --git a/mail/mail-ops.h b/mail/mail-ops.h index 7a3f045b63..879a62654e 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -50,7 +50,7 @@ gint mail_get_message (CamelFolder *folder, const gchar *uid, MailMsgDispatchFunc dispatch); gint -mail_get_messagex(CamelFolder *folder, const gchar *uid, +mail_get_messagex (CamelFolder *folder, const gchar *uid, void (*done) (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, GError **error), gpointer data, MailMsgDispatchFunc dispatch); @@ -83,7 +83,7 @@ void mail_build_attachment (CamelFolder *folder, GPtrArray *uids, void mail_sync_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gpointer data), gpointer data); -void mail_sync_store(CamelStore *store, gint expunge, +void mail_sync_store (CamelStore *store, gint expunge, void (*done) (CamelStore *store, gpointer data), gpointer data); void mail_refresh_folder (CamelFolder *folder, @@ -147,10 +147,10 @@ void mail_filter_on_demand (CamelFolder *folder, GPtrArray *uids); void mail_filter_junk (CamelFolder *folder, GPtrArray *uids); /* Work Offline */ -void mail_prep_offline(const gchar *uri, CamelOperation *cancel, +void mail_prep_offline (const gchar *uri, CamelOperation *cancel, void (*done)(const gchar *, gpointer data), gpointer data); -gint mail_store_set_offline(CamelStore *store, gboolean offline, +gint mail_store_set_offline (CamelStore *store, gboolean offline, void (*done)(CamelStore *, gpointer data), gpointer data); gint mail_store_prepare_offline (CamelStore *store); @@ -158,7 +158,7 @@ gint mail_store_prepare_offline (CamelStore *store); /* filter driver execute shell command async callback */ void mail_execute_shell_command (CamelFilterDriver *driver, gint argc, gchar **argv, gpointer data); -gint mail_check_service(const gchar *url, CamelProviderType type, +gint mail_check_service (const gchar *url, CamelProviderType type, void (*done)(const gchar *url, CamelProviderType type, GList *authtypes, gpointer data), gpointer data); G_END_DECLS diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index d03e9f3354..4d84fd0284 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -132,36 +132,36 @@ static struct _send_data *send_data = NULL; static GtkWidget *send_recv_dialog = NULL; static void -free_folder_info(struct _folder_info *info) +free_folder_info (struct _folder_info *info) { /*camel_folder_thaw (info->folder); */ - mail_sync_folder(info->folder, NULL, NULL); + mail_sync_folder (info->folder, NULL, NULL); g_object_unref (info->folder); - g_free(info->uri); - g_free(info); + g_free (info->uri); + g_free (info); } static void -free_send_info(struct _send_info *info) +free_send_info (struct _send_info *info) { - g_free(info->uri); + g_free (info->uri); if (info->cancel) - camel_operation_unref(info->cancel); + camel_operation_unref (info->cancel); if (info->timeout_id != 0) - g_source_remove(info->timeout_id); - g_free(info->what); + g_source_remove (info->timeout_id); + g_free (info->what); g_free (info->send_url); - g_free(info); + g_free (info); } static struct _send_data * -setup_send_data(void) +setup_send_data (void) { struct _send_data *data; if (send_data == NULL) { - send_data = data = g_malloc0(sizeof(*data)); - data->lock = g_mutex_new(); + send_data = data = g_malloc0 (sizeof (*data)); + data->lock = g_mutex_new (); data->folders = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) NULL, @@ -178,10 +178,10 @@ setup_send_data(void) } static void -receive_cancel(GtkButton *button, struct _send_info *info) +receive_cancel (GtkButton *button, struct _send_info *info) { if (info->state == SEND_ACTIVE) { - camel_operation_cancel(info->cancel); + camel_operation_cancel (info->cancel); if (info->status_label) gtk_label_set_text ( GTK_LABEL (info->status_label), @@ -189,38 +189,38 @@ receive_cancel(GtkButton *button, struct _send_info *info) info->state = SEND_CANCELLED; } if (info->cancel_button) - gtk_widget_set_sensitive(info->cancel_button, FALSE); + gtk_widget_set_sensitive (info->cancel_button, FALSE); } static void -free_send_data(void) +free_send_data (void) { struct _send_data *data = send_data; - g_return_if_fail (g_hash_table_size(data->active) == 0); + g_return_if_fail (g_hash_table_size (data->active) == 0); if (data->inbox) { - mail_sync_folder(data->inbox, NULL, NULL); + mail_sync_folder (data->inbox, NULL, NULL); /*camel_folder_thaw (data->inbox); */ g_object_unref (data->inbox); } - g_list_free(data->infos); - g_hash_table_destroy(data->active); - g_hash_table_destroy(data->folders); - g_mutex_free(data->lock); - g_free(data); + g_list_free (data->infos); + g_hash_table_destroy (data->active); + g_hash_table_destroy (data->folders); + g_mutex_free (data->lock); + g_free (data); send_data = NULL; } static void -cancel_send_info(gpointer key, struct _send_info *info, gpointer data) +cancel_send_info (gpointer key, struct _send_info *info, gpointer data) { receive_cancel (GTK_BUTTON (info->cancel_button), info); } static void -hide_send_info(gpointer key, struct _send_info *info, gpointer data) +hide_send_info (gpointer key, struct _send_info *info, gpointer data) { info->cancel_button = NULL; info->progress_bar = NULL; @@ -241,20 +241,20 @@ dialog_destroy_cb (struct _send_data *data, GObject *deadbeef) } static void -dialog_response(GtkDialog *gd, gint button, struct _send_data *data) +dialog_response (GtkDialog *gd, gint button, struct _send_data *data) { switch (button) { case GTK_RESPONSE_CANCEL: d(printf("cancelled whole thing\n")); if (!data->cancelled) { data->cancelled = TRUE; - g_hash_table_foreach(data->active, (GHFunc)cancel_send_info, NULL); + g_hash_table_foreach (data->active, (GHFunc)cancel_send_info, NULL); } - gtk_dialog_set_response_sensitive(gd, GTK_RESPONSE_CANCEL, FALSE); + gtk_dialog_set_response_sensitive (gd, GTK_RESPONSE_CANCEL, FALSE); break; default: d(printf("hiding dialog\n")); - g_hash_table_foreach(data->active, (GHFunc)hide_send_info, NULL); + g_hash_table_foreach (data->active, (GHFunc)hide_send_info, NULL); data->gd = NULL; /*gtk_widget_destroy((GtkWidget *)gd);*/ break; @@ -265,7 +265,7 @@ static GStaticMutex status_lock = G_STATIC_MUTEX_INIT; static gchar *format_url (const gchar *internal_url, const gchar *account_name); static gint -operation_status_timeout(gpointer data) +operation_status_timeout (gpointer data) { struct _send_info *info = data; @@ -301,12 +301,12 @@ operation_status_timeout(gpointer data) } static void -set_send_status(struct _send_info *info, const gchar *desc, gint pc) +set_send_status (struct _send_info *info, const gchar *desc, gint pc) { g_static_mutex_lock (&status_lock); - g_free(info->what); - info->what = g_strdup(desc); + g_free (info->what); + info->what = g_strdup (desc); info->pc = pc; g_static_mutex_unlock (&status_lock); @@ -325,7 +325,7 @@ set_send_account (struct _send_info *info, const gchar *account_url) /* for camel operation status */ static void -operation_status(CamelOperation *op, const gchar *what, gint pc, gpointer data) +operation_status (CamelOperation *op, const gchar *what, gint pc, gpointer data) { struct _send_info *info = data; @@ -339,7 +339,7 @@ operation_status(CamelOperation *op, const gchar *what, gint pc, gpointer data) break; } - set_send_status(info, what, pc); + set_send_status (info, what, pc); } static gchar * @@ -385,7 +385,7 @@ format_url (const gchar *internal_url, const gchar *account_name) } static send_info_t -get_receive_type(const gchar *url) +get_receive_type (const gchar *url) { CamelProvider *provider; @@ -394,7 +394,7 @@ get_receive_type(const gchar *url) if (!strncmp(url, "mbox:", 5)) return SEND_RECEIVE; - provider = camel_provider_get(url, NULL); + provider = camel_provider_get (url, NULL); if (!provider) return SEND_INVALID; @@ -481,8 +481,8 @@ build_dialog (GtkWindow *parent, /* 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); @@ -607,15 +607,15 @@ build_dialog (GtkWindow *parent, /* we also need gd during emition to be able to catch Cancel All */ data->gd = gd; target = em_event_target_new_send_receive ( - em_event_peek(), table, data, row, EM_EVENT_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)); @@ -695,7 +695,7 @@ build_dialog (GtkWindow *parent, } static void -update_folders(gchar *uri, struct _folder_info *info, gpointer data) +update_folders (gchar *uri, struct _folder_info *info, gpointer data) { time_t now = *((time_t *)data); @@ -706,7 +706,7 @@ update_folders(gchar *uri, struct _folder_info *info, gpointer data) if (now > info->update+10+info->count*5) { d(printf("upating a folder: %s\n", info->uri)); /*camel_folder_thaw(info->folder); - camel_folder_freeze(info->folder);*/ + camel_folder_freeze (info->folder);*/ info->update = now; info->count++; } @@ -720,16 +720,16 @@ receive_status (CamelFilterDriver *driver, gpointer data) { struct _send_info *info = data; - time_t now = time(NULL); + time_t now = time (NULL); /* let it flow through to the folder, every now and then too? */ - g_hash_table_foreach(info->data->folders, (GHFunc)update_folders, &now); + g_hash_table_foreach (info->data->folders, (GHFunc)update_folders, &now); if (info->data->inbox && now > info->data->inbox_update+20) { d(printf("updating inbox too\n")); /* this doesn't seem to work right :( */ /*camel_folder_thaw(info->data->inbox); - camel_folder_freeze(info->data->inbox);*/ + camel_folder_freeze (info->data->inbox);*/ info->data->inbox_update = now; } @@ -740,7 +740,7 @@ receive_status (CamelFilterDriver *driver, switch (status) { case CAMEL_FILTER_STATUS_START: case CAMEL_FILTER_STATUS_END: - set_send_status(info, desc, pc); + set_send_status (info, desc, pc); break; case CAMEL_FILTER_STATUS_ACTION: set_send_account (info, desc); @@ -776,7 +776,7 @@ receive_done (const gchar *uri, gpointer data) if (info->progress_bar) { const gchar *text; - gtk_progress_bar_set_fraction( + gtk_progress_bar_set_fraction ( GTK_PROGRESS_BAR (info->progress_bar), 1.0); if (info->state == SEND_CANCELLED) @@ -795,18 +795,18 @@ receive_done (const gchar *uri, gpointer data) /* remove/free this active download */ d(printf("%s: freeing info %p\n", G_STRFUNC, info)); if (info->type == SEND_SEND) - g_hash_table_steal(info->data->active, SEND_URI_KEY); + g_hash_table_steal (info->data->active, SEND_URI_KEY); else - g_hash_table_steal(info->data->active, info->uri); - info->data->infos = g_list_remove(info->data->infos, info); + g_hash_table_steal (info->data->active, info->uri); + info->data->infos = g_list_remove (info->data->infos, info); - if (g_hash_table_size(info->data->active) == 0) { + if (g_hash_table_size (info->data->active) == 0) { if (info->data->gd) - gtk_widget_destroy((GtkWidget *)info->data->gd); - free_send_data(); + gtk_widget_destroy ((GtkWidget *)info->data->gd); + free_send_data (); } - free_send_info(info); + free_send_info (info); } /* although we dont do anythign smart here yet, there is no need for this interface to @@ -824,9 +824,9 @@ receive_get_folder (CamelFilterDriver *d, struct _folder_info *oldinfo; gpointer oldkey, oldinfoptr; - g_mutex_lock(info->data->lock); - oldinfo = g_hash_table_lookup(info->data->folders, uri); - g_mutex_unlock(info->data->lock); + g_mutex_lock (info->data->lock); + oldinfo = g_hash_table_lookup (info->data->folders, uri); + g_mutex_unlock (info->data->lock); if (oldinfo) { g_object_ref (oldinfo->folder); return oldinfo->folder; @@ -837,7 +837,7 @@ receive_get_folder (CamelFilterDriver *d, /* we recheck that the folder hasn't snuck in while we were loading it... */ /* and we assume the newer one is the same, but unref the old one anyway */ - g_mutex_lock(info->data->lock); + g_mutex_lock (info->data->lock); if (g_hash_table_lookup_extended (info->data->folders, uri, &oldkey, &oldinfoptr)) { oldinfo = (struct _folder_info *) oldinfoptr; @@ -845,15 +845,15 @@ receive_get_folder (CamelFilterDriver *d, oldinfo->folder = folder; } else { /*camel_folder_freeze (folder); */ - oldinfo = g_malloc0(sizeof(*oldinfo)); + oldinfo = g_malloc0 (sizeof (*oldinfo)); oldinfo->folder = folder; - oldinfo->uri = g_strdup(uri); - g_hash_table_insert(info->data->folders, oldinfo->uri, oldinfo); + oldinfo->uri = g_strdup (uri); + g_hash_table_insert (info->data->folders, oldinfo->uri, oldinfo); } g_object_ref (folder); - g_mutex_unlock(info->data->lock); + g_mutex_unlock (info->data->lock); return folder; } @@ -906,17 +906,17 @@ refresh_folders_exec (struct _refresh_folders_msg *m) get_folders (m->store, m->folders, m->finfo); for (i=0;i<m->folders->len;i++) { - folder = mail_tool_uri_to_folder(m->folders->pdata[i], 0, &local_error); + folder = mail_tool_uri_to_folder (m->folders->pdata[i], 0, &local_error); if (folder) { camel_folder_sync (folder, FALSE, NULL); - camel_folder_refresh_info(folder, NULL); + camel_folder_refresh_info (folder, NULL); g_object_unref (folder); } else if (local_error != NULL) { g_warning ("Failed to refresh folders: %s", local_error->message); g_clear_error (&local_error); } - if (camel_operation_cancel_check(m->info->cancel)) + if (camel_operation_cancel_check (m->info->cancel)) break; } } @@ -933,8 +933,8 @@ refresh_folders_free (struct _refresh_folders_msg *m) gint i; for (i=0;i<m->folders->len;i++) - g_free(m->folders->pdata[i]); - g_ptr_array_free(m->folders, TRUE); + g_free (m->folders->pdata[i]); + g_ptr_array_free (m->folders, TRUE); camel_store_free_folder_info (m->store, m->finfo); g_object_unref (m->store); @@ -949,14 +949,14 @@ static MailMsgInfo refresh_folders_info = { }; static gboolean -receive_update_got_folderinfo(CamelStore *store, CamelFolderInfo *info, gpointer data) +receive_update_got_folderinfo (CamelStore *store, CamelFolderInfo *info, gpointer data) { if (info) { - GPtrArray *folders = g_ptr_array_new(); + GPtrArray *folders = g_ptr_array_new (); struct _refresh_folders_msg *m; struct _send_info *sinfo = data; - m = mail_msg_new(&refresh_folders_info); + m = mail_msg_new (&refresh_folders_info); m->store = store; g_object_ref (store); m->folders = folders; @@ -980,7 +980,7 @@ receive_update_got_store (gchar *uri, CamelStore *store, gpointer data) struct _send_info *info = data; if (store) { - mail_folder_cache_note_store(mail_folder_cache_get_default (), + mail_folder_cache_note_store (mail_folder_cache_get_default (), store, info->cancel, receive_update_got_folderinfo, info); } else { @@ -1022,7 +1022,7 @@ mail_send_receive (GtkWindow *parent) switch (info->type) { case SEND_RECEIVE: - mail_fetch_mail(info->uri, info->keep_on_server, + mail_fetch_mail (info->uri, info->keep_on_server, E_FILTER_SOURCE_INCOMING, info->cancel, receive_get_folder, info, @@ -1031,7 +1031,7 @@ mail_send_receive (GtkWindow *parent) break; case SEND_SEND: /* todo, store the folder in info? */ - mail_send_queue(local_outbox, info->uri, + mail_send_queue (local_outbox, info->uri, E_FILTER_SOURCE_OUTGOING, info->cancel, receive_get_folder, info, @@ -1039,7 +1039,7 @@ mail_send_receive (GtkWindow *parent) receive_done, info); break; case SEND_UPDATE: - mail_get_store(info->uri, info->cancel, receive_update_got_store, info); + mail_get_store (info->uri, info->cancel, receive_update_got_store, info); break; default: break; @@ -1059,7 +1059,7 @@ struct _auto_data { static GHashTable *auto_active; static gboolean -auto_timeout(gpointer data) +auto_timeout (gpointer data) { struct _auto_data *info = data; @@ -1078,54 +1078,54 @@ auto_timeout(gpointer data) } static void -auto_account_removed(EAccountList *eal, EAccount *ea, gpointer dummy) +auto_account_removed (EAccountList *eal, EAccount *ea, gpointer dummy) { struct _auto_data *info = g_object_get_data((GObject *)ea, "mail-autoreceive"); - g_return_if_fail(info != NULL); + g_return_if_fail (info != NULL); if (info->timeout_id) { - g_source_remove(info->timeout_id); + g_source_remove (info->timeout_id); info->timeout_id = 0; } } static void -auto_account_finalised(struct _auto_data *info) +auto_account_finalised (struct _auto_data *info) { if (info->timeout_id) - g_source_remove(info->timeout_id); - g_free(info); + g_source_remove (info->timeout_id); + g_free (info); } static void -auto_account_commit(struct _auto_data *info) +auto_account_commit (struct _auto_data *info) { gint period, check; check = info->account->enabled - && e_account_get_bool(info->account, E_ACCOUNT_SOURCE_AUTO_CHECK) - && e_account_get_string(info->account, E_ACCOUNT_SOURCE_URL); - period = e_account_get_int(info->account, E_ACCOUNT_SOURCE_AUTO_CHECK_TIME)*60; - period = MAX(60, period); + && e_account_get_bool (info->account, E_ACCOUNT_SOURCE_AUTO_CHECK) + && e_account_get_string (info->account, E_ACCOUNT_SOURCE_URL); + period = e_account_get_int (info->account, E_ACCOUNT_SOURCE_AUTO_CHECK_TIME)*60; + period = MAX (60, period); if (info->timeout_id && (!check || period != info->period)) { - g_source_remove(info->timeout_id); + g_source_remove (info->timeout_id); info->timeout_id = 0; } info->period = period; if (check && info->timeout_id == 0) - info->timeout_id = g_timeout_add_seconds(info->period, auto_timeout, info); + info->timeout_id = g_timeout_add_seconds (info->period, auto_timeout, info); } static void -auto_account_added(EAccountList *eal, EAccount *ea, gpointer dummy) +auto_account_added (EAccountList *eal, EAccount *ea, gpointer dummy) { struct _auto_data *info; - info = g_malloc0(sizeof(*info)); + info = g_malloc0 (sizeof (*info)); info->account = ea; g_object_set_data_full ( G_OBJECT (ea), "mail-autoreceive", info, @@ -1134,13 +1134,13 @@ auto_account_added(EAccountList *eal, EAccount *ea, gpointer dummy) } static void -auto_account_changed(EAccountList *eal, EAccount *ea, gpointer dummy) +auto_account_changed (EAccountList *eal, EAccount *ea, gpointer dummy) { struct _auto_data *info = g_object_get_data((GObject *)ea, "mail-autoreceive"); - g_return_if_fail(info != NULL); + g_return_if_fail (info != NULL); - auto_account_commit(info); + auto_account_commit (info); } static void @@ -1161,7 +1161,7 @@ auto_online (EShell *shell) G_OBJECT (e_iterator_get (iter)), "mail-autoreceive"); if (info && info->timeout_id) - auto_timeout(info); + auto_timeout (info); } } @@ -1195,8 +1195,8 @@ mail_autoreceive_init (EShellBackend *shell_backend, G_CALLBACK (auto_account_changed), NULL); for (iter = e_list_get_iterator ((EList *)accounts); - e_iterator_is_valid(iter); - e_iterator_next(iter)) + e_iterator_is_valid (iter); + e_iterator_next (iter)) auto_account_added ( accounts, (EAccount *) e_iterator_get (iter), NULL); @@ -1219,8 +1219,8 @@ mail_receive_uri (const gchar *uri, gboolean keep_on_server) CamelFolder *local_outbox; send_info_t type; - data = setup_send_data(); - info = g_hash_table_lookup(data->active, uri); + data = setup_send_data (); + info = g_hash_table_lookup (data->active, uri); if (info != NULL) { d(printf("download of %s still in progress\n", uri)); return; @@ -1273,7 +1273,7 @@ mail_receive_uri (const gchar *uri, gboolean keep_on_server) mail_get_store (info->uri, info->cancel, receive_update_got_store, info); break; default: - g_return_if_reached(); + g_return_if_reached (); } } diff --git a/mail/mail-session.c b/mail/mail-session.c index 4e4850b3d2..4725a2eea8 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -89,15 +89,15 @@ struct _MailSessionClass { static gchar *mail_data_dir; static gchar *mail_config_dir; -static gchar *get_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *prompt, const gchar *item, guint32 flags, GError **error); -static gboolean forget_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *item, GError **error); -static gboolean alert_user(CamelSession *session, CamelSessionAlertType type, const gchar *prompt, gboolean cancel); -static CamelFilterDriver *get_filter_driver(CamelSession *session, const gchar *type, GError **error); -static gboolean lookup_addressbook(CamelSession *session, const gchar *name); - -static void ms_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const gchar *text, gint pc); -static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps *ops, guint size); -static void ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m); +static gchar *get_password (CamelSession *session, CamelService *service, const gchar *domain, const gchar *prompt, const gchar *item, guint32 flags, GError **error); +static gboolean forget_password (CamelSession *session, CamelService *service, const gchar *domain, const gchar *item, GError **error); +static gboolean alert_user (CamelSession *session, CamelSessionAlertType type, const gchar *prompt, gboolean cancel); +static CamelFilterDriver *get_filter_driver (CamelSession *session, const gchar *type, GError **error); +static gboolean lookup_addressbook (CamelSession *session, const gchar *name); + +static void ms_thread_status (CamelSession *session, CamelSessionThreadMsg *msg, const gchar *text, gint pc); +static gpointer ms_thread_msg_new (CamelSession *session, CamelSessionThreadOps *ops, guint size); +static void ms_thread_msg_free (CamelSession *session, CamelSessionThreadMsg *m); static gboolean ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *message, const gchar *address, GError **error); GType mail_session_get_type (void); @@ -122,7 +122,7 @@ mail_session_finalize (GObject *object) session_gconf_proxy_id = 0; } - mail_async_event_destroy(session->async); + mail_async_event_destroy (session->async); g_free (mail_data_dir); g_free (mail_config_dir); @@ -155,7 +155,7 @@ mail_session_class_init (MailSessionClass *class) static void mail_session_init (MailSession *session) { - session->async = mail_async_event_new(); + session->async = mail_async_event_new (); session->junk_plugins = NULL; } @@ -187,30 +187,30 @@ get_password (CamelSession *session, gchar *ret = NULL; EAccount *account = NULL; - url = service?camel_url_to_string(service->url, CAMEL_URL_HIDE_ALL):NULL; + url = service?camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL):NULL; if (!strcmp(item, "popb4smtp_uri")) { /* not 100% mt safe, but should be ok */ if (url - && (account = mail_config_get_account_by_transport_url(url))) - ret = g_strdup(account->source->url); + && (account = mail_config_get_account_by_transport_url (url))) + ret = g_strdup (account->source->url); else - ret = g_strdup(url); + ret = g_strdup (url); } else { - gchar *key = make_key(service, item); + gchar *key = make_key (service, item); EAccountService *config_service = NULL; if (domain == NULL) domain = "Mail"; - ret = e_passwords_get_password(domain, key); + ret = e_passwords_get_password (domain, key); if (ret == NULL || (flags & CAMEL_SESSION_PASSWORD_REPROMPT)) { gboolean remember; if (url) { - if ((account = mail_config_get_account_by_source_url(url))) + if ((account = mail_config_get_account_by_source_url (url))) config_service = account->source; - else if ((account = mail_config_get_account_by_transport_url(url))) + else if ((account = mail_config_get_account_by_transport_url (url))) config_service = account->transport; } @@ -250,25 +250,25 @@ get_password (CamelSession *session, /* HACK: breaks abstraction ... 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)) + 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); - g_free(title); + g_free (title); if (ret && config_service) - mail_config_service_set_save_passwd(config_service, remember); + mail_config_service_set_save_passwd (config_service, remember); if (config_service) config_service->get_password_canceled = ret == NULL; } } - g_free(key); + g_free (key); } - g_free(url); + g_free (url); if (ret == NULL) g_set_error ( @@ -425,7 +425,7 @@ static MailMsgInfo user_message_info = { }; static gboolean -lookup_addressbook(CamelSession *session, const gchar *name) +lookup_addressbook (CamelSession *session, const gchar *name) { CamelInternetAddress *addr; gboolean ret; @@ -442,7 +442,7 @@ lookup_addressbook(CamelSession *session, const gchar *name) } static gboolean -alert_user(CamelSession *session, CamelSessionAlertType type, const gchar *prompt, gboolean cancel) +alert_user (CamelSession *session, CamelSessionAlertType type, const gchar *prompt, gboolean cancel) { struct _user_message_msg *m; gboolean result = TRUE; @@ -486,7 +486,7 @@ main_play_sound (CamelFilterDriver *driver, gchar *filename, gpointer user_data) { if (filename && *filename) { #ifdef HAVE_CANBERRA - ca_context_play(ca_gtk_context_get(), 0, + ca_context_play (ca_gtk_context_get (), 0, CA_PROP_MEDIA_FILENAME, filename, NULL); #endif @@ -621,7 +621,7 @@ get_filter_driver (CamelSession *session, const gchar *type, GError **error) static MailMsgInfo ms_thread_info_dummy = { sizeof (MailMsg) }; -static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps *ops, guint size) +static gpointer ms_thread_msg_new (CamelSession *session, CamelSessionThreadOps *ops, guint size) { CamelSessionThreadMsg *msg; CamelSessionClass *session_class; @@ -632,30 +632,30 @@ static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps * /* We create a dummy mail_msg, and then copy its cancellation port over to ours, so we get cancellation and progress in common with hte existing mail code, for free */ if (msg) { - MailMsg *m = mail_msg_new(&ms_thread_info_dummy); + MailMsg *m = mail_msg_new (&ms_thread_info_dummy); msg->data = m; - camel_operation_unref(msg->op); + camel_operation_unref (msg->op); msg->op = m->cancel; - camel_operation_ref(msg->op); + camel_operation_ref (msg->op); } return msg; } static void -ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m) +ms_thread_msg_free (CamelSession *session, CamelSessionThreadMsg *m) { CamelSessionClass *session_class; session_class = CAMEL_SESSION_CLASS (mail_session_parent_class); - mail_msg_unref(m->data); - session_class->thread_msg_free(session, m); + mail_msg_unref (m->data); + session_class->thread_msg_free (session, m); } static void -ms_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const gchar *text, gint pc) +ms_thread_status (CamelSession *session, CamelSessionThreadMsg *msg, const gchar *text, gint pc) { /* This should never be called since we bypass it in alloc! */ printf("Thread status '%s' %d%%\n", text, pc); @@ -920,10 +920,10 @@ mail_session_start (void) if (camel_init (e_get_user_data_dir (), TRUE) != 0) exit (0); - camel_provider_init(); + camel_provider_init (); session = g_object_new (MAIL_TYPE_SESSION, NULL); - e_account_writable(NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD); /* Init the EAccount Setup */ + e_account_writable (NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD); /* Init the EAccount Setup */ camel_session_construct (session, mail_session_get_data_dir ()); @@ -965,9 +965,9 @@ mail_session_add_junk_plugin (const gchar *plugin_name, CamelJunkPlugin *junk_pl gconf = mail_config_get_gconf_client (); def_plugin = gconf_client_get_string (gconf, "/apps/evolution/mail/junk/default_plugin", NULL); - ms->junk_plugins = g_list_append(ms->junk_plugins, junk_plugin); + ms->junk_plugins = g_list_append (ms->junk_plugins, junk_plugin); if (def_plugin && plugin_name) { - if (!strcmp(def_plugin, plugin_name)) { + if (!strcmp (def_plugin, plugin_name)) { d(printf ("Loading %s as the default junk plugin\n", def_plugin)); session->junk_plugin = junk_plugin; camel_junk_plugin_init (junk_plugin); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index fe7557d731..d717c29540 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -121,19 +121,19 @@ mail_tool_get_local_movemail_path (const guchar *uri, data_dir = mail_session_get_data_dir (); path = g_build_filename (data_dir, "spool", NULL); - if (g_stat(path, &st) == -1 && g_mkdir_with_parents(path, 0700) == -1) { + if (g_stat (path, &st) == -1 && g_mkdir_with_parents (path, 0700) == -1) { g_set_error ( error, G_FILE_ERROR, g_file_error_from_errno (errno), _("Could not create spool directory '%s': %s"), - path, g_strerror(errno)); - g_free(path); + path, g_strerror (errno)); + g_free (path); return NULL; } full = g_strdup_printf("%s/movemail.%s", path, safe_uri); - g_free(path); - g_free(safe_uri); + g_free (path); + g_free (safe_uri); return full; } @@ -149,7 +149,7 @@ mail_tool_do_movemail (const gchar *source_url, GError **error) CamelURL *uri; gboolean success; - uri = camel_url_new(source_url, error); + uri = camel_url_new (source_url, error); if (uri == NULL) return NULL; @@ -160,7 +160,7 @@ mail_tool_do_movemail (const gchar *source_url, GError **error) CAMEL_SERVICE_ERROR_URL_INVALID, _("Trying to movemail a non-mbox source '%s'"), source_url); - camel_url_free(uri); + camel_url_free (uri); return NULL; } @@ -172,7 +172,7 @@ mail_tool_do_movemail (const gchar *source_url, GError **error) /* Movemail from source (source_url) to dest_path */ success = camel_movemail (uri->path, dest_path, error) != -1; - camel_url_free(uri); + camel_url_free (uri); if (g_stat (dest_path, &sb) < 0 || sb.st_size == 0) { g_unlink (dest_path); /* Clean up the movemail.foo file. */ @@ -202,7 +202,7 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg) gchar *fwd_subj; const gint max_subject_length = 1024; - subject = camel_mime_message_get_subject(msg); + subject = camel_mime_message_get_subject (msg); if (subject && *subject) { /* Truncate insanely long subjects */ @@ -240,10 +240,10 @@ mail_tool_remove_xevolution_headers (CamelMimeMessage *message) for (scan = ((CamelMimePart *)message)->headers;scan;scan=scan->next) if (!strncmp(scan->name, "X-Evolution", 11)) - camel_header_raw_append(&list, scan->name, scan->value, scan->offset); + camel_header_raw_append (&list, scan->name, scan->value, scan->offset); for (scan=list;scan;scan=scan->next) - camel_medium_remove_header((CamelMedium *)message, scan->name); + camel_medium_remove_header ((CamelMedium *)message, scan->name); return list; } @@ -276,7 +276,7 @@ mail_tool_make_message_attachment (CamelMimeMessage *message) /* rip off the X-Evolution headers */ xev = mail_tool_remove_xevolution_headers (message); - camel_header_raw_clear(&xev); + camel_header_raw_clear (&xev); /* remove Bcc headers */ camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc"); @@ -310,7 +310,7 @@ mail_tool_uri_to_folder (const gchar *uri, guint32 flags, GError **error) offset = 6; else if (!strncmp(uri, "email:", 6)) { /* FIXME?: the filter:get_folder callback should do this itself? */ - curi = em_uri_to_camel(uri); + curi = em_uri_to_camel (uri); if (uri == NULL) { g_set_error ( error, @@ -323,7 +323,7 @@ mail_tool_uri_to_folder (const gchar *uri, guint32 flags, GError **error) url = camel_url_new (uri + offset, error); if (!url) { - g_free(curi); + g_free (curi); return NULL; } @@ -357,7 +357,7 @@ mail_tool_uri_to_folder (const gchar *uri, guint32 flags, GError **error) mail_folder_cache_note_folder (mail_folder_cache_get_default (), folder); camel_url_free (url); - g_free(curi); + g_free (curi); return folder; } @@ -421,16 +421,16 @@ mail_tools_folder_to_url (CamelFolder *folder) url = camel_url_copy (service->url); if (service->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) { - camel_url_set_fragment(url, full_name); + camel_url_set_fragment (url, full_name); } else { - gchar *name = g_alloca(strlen(full_name)+2); + gchar *name = g_alloca (strlen (full_name)+2); sprintf(name, "/%s", full_name); - camel_url_set_path(url, name); + camel_url_set_path (url, name); } - out = camel_url_to_string(url, CAMEL_URL_HIDE_ALL); - camel_url_free(url); + out = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); + camel_url_free (url); return out; } diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 2275c6eb65..9cb2844bff 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -65,7 +65,7 @@ static GHashTable *vfolder_hash; loops, and just quit processing if it is set. */ static volatile gint vfolder_shutdown; /* are we shutting down? */ -static void rule_changed(EFilterRule *rule, CamelFolder *folder); +static void rule_changed (EFilterRule *rule, CamelFolder *folder); /* ********************************************************************** */ @@ -92,7 +92,7 @@ vfolder_setup_exec (struct _setup_msg *m) GList *l, *list = NULL; CamelFolder *folder; - camel_vee_folder_set_expression((CamelVeeFolder *)m->folder, m->query); + camel_vee_folder_set_expression ((CamelVeeFolder *)m->folder, m->query); l = m->sources_uri; while (l && !vfolder_shutdown) { @@ -107,19 +107,19 @@ vfolder_setup_exec (struct _setup_msg *m) l = m->sources_folder; while (l && !vfolder_shutdown) { g_object_ref (l->data); - list = g_list_append(list, l->data); + list = g_list_append (list, l->data); l = l->next; } if (!vfolder_shutdown) - camel_vee_folder_set_folders((CamelVeeFolder *)m->folder, list); + camel_vee_folder_set_folders ((CamelVeeFolder *)m->folder, list); l = list; while (l) { g_object_unref (l->data); l = l->next; } - g_list_free(list); + g_list_free (list); } static void @@ -133,21 +133,21 @@ vfolder_setup_free (struct _setup_msg *m) GList *l; g_object_unref (m->folder); - g_free(m->query); + g_free (m->query); l = m->sources_uri; while (l) { - g_free(l->data); + g_free (l->data); l = l->next; } - g_list_free(m->sources_uri); + g_list_free (m->sources_uri); l = m->sources_folder; while (l) { g_object_unref (l->data); l = l->next; } - g_list_free(m->sources_folder); + g_list_free (m->sources_folder); } static MailMsgInfo vfolder_setup_info = { @@ -160,15 +160,15 @@ static MailMsgInfo vfolder_setup_info = { /* sources_uri should be camel uri's */ static gint -vfolder_setup(CamelFolder *folder, const gchar *query, GList *sources_uri, GList *sources_folder) +vfolder_setup (CamelFolder *folder, const gchar *query, GList *sources_uri, GList *sources_folder) { struct _setup_msg *m; gint id; - m = mail_msg_new(&vfolder_setup_info); + m = mail_msg_new (&vfolder_setup_info); m->folder = folder; g_object_ref (folder); - m->query = g_strdup(query); + m->query = g_strdup (query); m->sources_uri = sources_uri; m->sources_folder = sources_folder; @@ -195,9 +195,9 @@ vfolder_adduri_desc (struct _adduri_msg *m) /* Yuck yuck. Lookup the account name and use that to describe the path */ /* We really need to normalise this across all of camel and evolution :-/ */ - euri = em_uri_from_camel(m->uri); + euri = em_uri_from_camel (m->uri); if (euri) { - CamelURL *url = camel_url_new(euri, NULL); + CamelURL *url = camel_url_new (euri, NULL); if (url) { const gchar *loc = NULL; @@ -210,21 +210,21 @@ vfolder_adduri_desc (struct _adduri_msg *m) const EAccount *account; if (url->user == NULL) - uid = g_strdup(url->host); + uid = g_strdup (url->host); else uid = g_strdup_printf("%s@%s", url->user, url->host); account = e_get_account_by_uid (uid); - g_free(uid); + g_free (uid); if (account != NULL) loc = account->name; } if (loc && url->path) desc = g_strdup_printf(_("Updating Search Folders for '%s:%s'"), loc, url->path); - camel_url_free(url); + camel_url_free (url); } - g_free(euri); + g_free (euri); } if (desc == NULL) @@ -247,7 +247,7 @@ vfolder_adduri_exec (struct _adduri_msg *m) /* we dont try lookup the cache if we are removing it, its no longer there */ if (!m->remove && - !mail_folder_cache_get_folder_from_uri(mail_folder_cache_get_default (), + !mail_folder_cache_get_folder_from_uri (mail_folder_cache_get_default (), m->uri, &folder)) { g_warning("Folder '%s' disappeared while I was adding/remove it to/from my vfolder", m->uri); return; @@ -260,9 +260,9 @@ vfolder_adduri_exec (struct _adduri_msg *m) l = m->folders; while (l && !vfolder_shutdown) { if (m->remove) - camel_vee_folder_remove_folder((CamelVeeFolder *)l->data, folder); + camel_vee_folder_remove_folder ((CamelVeeFolder *)l->data, folder); else - camel_vee_folder_add_folder((CamelVeeFolder *)l->data, folder); + camel_vee_folder_add_folder ((CamelVeeFolder *)l->data, folder); l = l->next; } g_object_unref (folder); @@ -270,16 +270,16 @@ vfolder_adduri_exec (struct _adduri_msg *m) } static void -vfolder_adduri_done(struct _adduri_msg *m) +vfolder_adduri_done (struct _adduri_msg *m) { } static void vfolder_adduri_free (struct _adduri_msg *m) { - g_list_foreach(m->folders, (GFunc)g_object_unref, NULL); - g_list_free(m->folders); - g_free(m->uri); + g_list_foreach (m->folders, (GFunc)g_object_unref, NULL); + g_list_free (m->folders); + g_free (m->uri); } static MailMsgInfo vfolder_adduri_info = { @@ -292,14 +292,14 @@ static MailMsgInfo vfolder_adduri_info = { /* uri should be a camel uri */ static gint -vfolder_adduri(const gchar *uri, GList *folders, gint remove) +vfolder_adduri (const gchar *uri, GList *folders, gint remove) { struct _adduri_msg *m; gint id; - m = mail_msg_new(&vfolder_adduri_info); + m = mail_msg_new (&vfolder_adduri_info); m->folders = folders; - m->uri = g_strdup(uri); + m->uri = g_strdup (uri); m->remove = remove; id = m->base.seq; @@ -311,10 +311,10 @@ vfolder_adduri(const gchar *uri, GList *folders, gint remove) /* ********************************************************************** */ static GList * -mv_find_folder(GList *l, CamelStore *store, const gchar *uri) +mv_find_folder (GList *l, CamelStore *store, const gchar *uri) { while (l) { - if (camel_store_folder_uri_equal(store, l->data, uri)) + if (camel_store_folder_uri_equal (store, l->data, uri)) break; l = l->next; } @@ -323,7 +323,7 @@ mv_find_folder(GList *l, CamelStore *store, const gchar *uri) /* uri is a camel uri */ static gint -uri_is_ignore(CamelStore *store, const gchar *uri) +uri_is_ignore (CamelStore *store, const gchar *uri) { EAccountList *accounts; EAccount *account; @@ -342,9 +342,9 @@ uri_is_ignore(CamelStore *store, const gchar *uri) local_sent_uri, local_drafts_uri)); - found = camel_store_folder_uri_equal(store, local_outbox_uri, uri) - || camel_store_folder_uri_equal(store, local_sent_uri, uri) - || camel_store_folder_uri_equal(store, local_drafts_uri, uri); + found = camel_store_folder_uri_equal (store, local_outbox_uri, uri) + || camel_store_folder_uri_equal (store, local_sent_uri, uri) + || camel_store_folder_uri_equal (store, local_drafts_uri, uri); if (found) return found; @@ -360,14 +360,14 @@ uri_is_ignore(CamelStore *store, const gchar *uri) account->sent_folder_uri ? account->sent_folder_uri : "empty", uri)); if (account->sent_folder_uri) { - curi = em_uri_to_camel(account->sent_folder_uri); - found = camel_store_folder_uri_equal(store, uri, curi); - g_free(curi); + curi = em_uri_to_camel (account->sent_folder_uri); + found = camel_store_folder_uri_equal (store, uri, curi); + g_free (curi); } if (!found && account->drafts_folder_uri) { - curi = em_uri_to_camel(account->drafts_folder_uri); - found = camel_store_folder_uri_equal(store, uri, curi); - g_free(curi); + curi = em_uri_to_camel (account->drafts_folder_uri); + found = camel_store_folder_uri_equal (store, uri, curi); + g_free (curi); } if (found) @@ -383,7 +383,7 @@ uri_is_ignore(CamelStore *store, const gchar *uri) /* so special we never use it */ static gint -uri_is_spethal(CamelStore *store, const gchar *uri) +uri_is_spethal (CamelStore *store, const gchar *uri) { CamelURL *url; gint res; @@ -393,16 +393,16 @@ uri_is_spethal(CamelStore *store, const gchar *uri) if ((store->flags & (CAMEL_STORE_VTRASH|CAMEL_STORE_VJUNK)) == 0) return FALSE; - url = camel_url_new(uri, NULL); + url = camel_url_new (uri, NULL); if (url == NULL) return TRUE; /* don't use strcasecmp here */ if (url->fragment) { res = (((store->flags & CAMEL_STORE_VTRASH) - && strcmp(url->fragment, CAMEL_VTRASH_NAME) == 0) + && strcmp (url->fragment, CAMEL_VTRASH_NAME) == 0) || ((store->flags & CAMEL_STORE_VJUNK) - && strcmp(url->fragment, CAMEL_VJUNK_NAME) == 0)); + && strcmp (url->fragment, CAMEL_VJUNK_NAME) == 0)); } else { res = url->path && (((store->flags & CAMEL_STORE_VTRASH) @@ -411,7 +411,7 @@ uri_is_spethal(CamelStore *store, const gchar *uri) && strcmp(url->path, "/" CAMEL_VJUNK_NAME) == 0)); } - camel_url_free(url); + camel_url_free (url); return res; } @@ -434,7 +434,7 @@ uri_is_spethal(CamelStore *store, const gchar *uri) * NOTE: This function must be called from the main thread. */ static void -mail_vfolder_add_uri(CamelStore *store, const gchar *curi, gint remove) +mail_vfolder_add_uri (CamelStore *store, const gchar *curi, gint remove) { EFilterRule *rule; const gchar *source; @@ -444,43 +444,43 @@ mail_vfolder_add_uri(CamelStore *store, const gchar *curi, gint remove) gint is_ignore; gchar *uri; - uri = em_uri_from_camel(curi); + uri = em_uri_from_camel (curi); if (uri_is_spethal (store, curi)) { - g_free(uri); + g_free (uri); return; } - g_return_if_fail (mail_in_main_thread()); + g_return_if_fail (mail_in_main_thread ()); - is_ignore = uri_is_ignore(store, curi); + is_ignore = uri_is_ignore (store, curi); G_LOCK (vfolder); /* d(printf("%s uri to check: %s\n", remove?"Removing":"Adding", uri)); */ /* maintain the source folders lists for changed rules later on */ - if (CAMEL_IS_VEE_STORE(store)) { + if (CAMEL_IS_VEE_STORE (store)) { is_ignore = TRUE; } else if (remove) { if (remote) { - if ((link = mv_find_folder(source_folders_remote, store, curi)) != NULL) { - g_free(link->data); - source_folders_remote = g_list_remove_link(source_folders_remote, link); + if ((link = mv_find_folder (source_folders_remote, store, curi)) != NULL) { + g_free (link->data); + source_folders_remote = g_list_remove_link (source_folders_remote, link); } } else { - if ((link = mv_find_folder(source_folders_local, store, curi)) != NULL) { - g_free(link->data); - source_folders_local = g_list_remove_link(source_folders_local, link); + if ((link = mv_find_folder (source_folders_local, store, curi)) != NULL) { + g_free (link->data); + source_folders_local = g_list_remove_link (source_folders_local, link); } } } else if (!is_ignore) { /* we ignore drafts/sent/outbox here */ if (remote) { - if (mv_find_folder(source_folders_remote, store, curi) == NULL) - source_folders_remote = g_list_prepend(source_folders_remote, g_strdup(curi)); + if (mv_find_folder (source_folders_remote, store, curi) == NULL) + source_folders_remote = g_list_prepend (source_folders_remote, g_strdup (curi)); } else { - if (mv_find_folder(source_folders_local, store, curi) == NULL) - source_folders_local = g_list_prepend(source_folders_local, g_strdup(curi)); + if (mv_find_folder (source_folders_local, store, curi) == NULL) + source_folders_local = g_list_prepend (source_folders_local, g_strdup (curi)); } } @@ -488,7 +488,7 @@ mail_vfolder_add_uri(CamelStore *store, const gchar *curi, gint remove) goto done; rule = NULL; - while ((rule = e_rule_context_next_rule((ERuleContext *)context, rule, NULL))) { + while ((rule = e_rule_context_next_rule ((ERuleContext *)context, rule, NULL))) { gint found = FALSE; if (!rule->name) { @@ -504,22 +504,22 @@ mail_vfolder_add_uri(CamelStore *store, const gchar *curi, gint remove) 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); + csource = em_uri_to_camel (source); + found = camel_store_folder_uri_equal (store, curi, csource); d(printf(found?" '%s' == '%s'?\n":" '%s' != '%s'\n", curi, csource)); - g_free(csource); + g_free (csource); } if (found) { - 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_object_ref (vf); - folders = g_list_prepend(folders, vf); + folders = g_list_prepend (folders, vf); } } @@ -527,9 +527,9 @@ done: G_UNLOCK (vfolder); if (folders != NULL) - vfolder_adduri(curi, folders, remove); + vfolder_adduri (curi, folders, remove); - g_free(uri); + g_free (uri); } /** @@ -580,7 +580,7 @@ mail_vfolder_notify_uri_unavailable (CamelStore *store, const gchar *uri) * NOTE: This function must be called from the main thread. */ static void -mail_vfolder_delete_uri(CamelStore *store, const gchar *curi) +mail_vfolder_delete_uri (CamelStore *store, const gchar *curi) { EFilterRule *rule; const gchar *source; @@ -593,11 +593,11 @@ mail_vfolder_delete_uri(CamelStore *store, const gchar *curi) if (uri_is_spethal (store, curi)) return; - uri = em_uri_from_camel(curi); + uri = em_uri_from_camel (curi); d(printf ("Deleting uri to check: %s\n", uri)); - g_return_if_fail (mail_in_main_thread()); + g_return_if_fail (mail_in_main_thread ()); changed_count = 0; changed = g_string_new (""); @@ -618,11 +618,11 @@ mail_vfolder_delete_uri(CamelStore *store, const gchar *curi) source = NULL; while ((source = em_vfolder_rule_next_source ((EMVFolderRule *) rule, source))) { - gchar *csource = em_uri_to_camel(source); + gchar *csource = em_uri_to_camel (source); /* 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, curi, csource)) { + if (camel_store_folder_uri_equal (store, curi, csource)) { vf = g_hash_table_lookup (vfolder_hash, rule->name); if (!vf) { g_warning ("vf is NULL for %s\n", rule->name); @@ -644,19 +644,19 @@ mail_vfolder_delete_uri(CamelStore *store, const gchar *curi) changed_count++; source = NULL; } - g_free(csource); + g_free (csource); } } done: - if ((link = mv_find_folder(source_folders_remote, store, curi)) != NULL) { - g_free(link->data); - source_folders_remote = g_list_remove_link(source_folders_remote, link); + if ((link = mv_find_folder (source_folders_remote, store, curi)) != NULL) { + g_free (link->data); + source_folders_remote = g_list_remove_link (source_folders_remote, link); } - if ((link = mv_find_folder(source_folders_local, store, curi)) != NULL) { - g_free(link->data); - source_folders_local = g_list_remove_link(source_folders_local, link); + if ((link = mv_find_folder (source_folders_local, store, curi)) != NULL) { + g_free (link->data); + source_folders_local = g_list_remove_link (source_folders_local, link); } G_UNLOCK (vfolder); @@ -689,12 +689,12 @@ done: g_string_free (changed, TRUE); - g_free(uri); + g_free (uri); } /* called when a uri is renamed in a store */ static void -mail_vfolder_rename_uri(CamelStore *store, const gchar *cfrom, const gchar *cto) +mail_vfolder_rename_uri (CamelStore *store, const gchar *cfrom, const gchar *cto) { EFilterRule *rule; const gchar *source; @@ -704,41 +704,41 @@ mail_vfolder_rename_uri(CamelStore *store, const gchar *cfrom, const gchar *cto) d(printf("vfolder rename uri: %s to %s\n", cfrom, cto)); - if (context == NULL || uri_is_spethal(store, cfrom) || uri_is_spethal(store, cto)) + if (context == NULL || uri_is_spethal (store, cfrom) || uri_is_spethal (store, cto)) return; - g_return_if_fail (mail_in_main_thread()); + g_return_if_fail (mail_in_main_thread ()); - from = em_uri_from_camel(cfrom); - to = em_uri_from_camel(cto); + from = em_uri_from_camel (cfrom); + to = em_uri_from_camel (cto); G_LOCK (vfolder); /* 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 ((ERuleContext *)context, rule, NULL))) { source = NULL; - while ((source = em_vfolder_rule_next_source((EMVFolderRule *)rule, source))) { - gchar *csource = em_uri_to_camel(source); + while ((source = em_vfolder_rule_next_source ((EMVFolderRule *)rule, source))) { + gchar *csource = em_uri_to_camel (source); /* 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)) { + 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); + 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, + 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); + 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); changed++; source = NULL; } - g_free(csource); + g_free (csource); } } @@ -751,12 +751,12 @@ mail_vfolder_rename_uri(CamelStore *store, const gchar *cfrom, const gchar *cto) d(printf("Vfolders updated from renamed folder\n")); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "vfolders.xml", NULL); - e_rule_context_save((ERuleContext *)context, user); - g_free(user); + e_rule_context_save ((ERuleContext *)context, user); + g_free (user); } - g_free(from); - g_free(to); + g_free (from); + g_free (to); } GList * @@ -773,26 +773,26 @@ mail_vfolder_get_sources_remote (void) /* ********************************************************************** */ -static void context_rule_added(ERuleContext *ctx, EFilterRule *rule); +static void context_rule_added (ERuleContext *ctx, EFilterRule *rule); static void -rule_add_sources(GList *l, GList **sources_folderp, GList **sources_urip) +rule_add_sources (GList *l, GList **sources_folderp, GList **sources_urip) { GList *sources_folder = *sources_folderp; GList *sources_uri = *sources_urip; CamelFolder *newfolder; while (l) { - gchar *curi = em_uri_to_camel(l->data); + gchar *curi = em_uri_to_camel (l->data); if (mail_folder_cache_get_folder_from_uri (mail_folder_cache_get_default (), curi, &newfolder)) { if (newfolder) - sources_folder = g_list_append(sources_folder, newfolder); + sources_folder = g_list_append (sources_folder, newfolder); else - sources_uri = g_list_append(sources_uri, g_strdup(curi)); + sources_uri = g_list_append (sources_uri, g_strdup (curi)); } - g_free(curi); + g_free (curi); l = l->next; } @@ -801,7 +801,7 @@ rule_add_sources(GList *l, GList **sources_folderp, GList **sources_urip) } static void -rule_changed(EFilterRule *rule, CamelFolder *folder) +rule_changed (EFilterRule *rule, CamelFolder *folder) { GList *sources_uri = NULL, *sources_folder = NULL; GString *query; @@ -821,7 +821,7 @@ rule_changed(EFilterRule *rule, CamelFolder *folder) if (g_hash_table_lookup_extended (vfolder_hash, full_name, &key, &oldfolder)) { g_hash_table_remove (vfolder_hash, key); g_free (key); - g_hash_table_insert (vfolder_hash, g_strdup(rule->name), folder); + g_hash_table_insert (vfolder_hash, g_strdup (rule->name), folder); G_UNLOCK (vfolder); } else { G_UNLOCK (vfolder); @@ -829,50 +829,50 @@ rule_changed(EFilterRule *rule, CamelFolder *folder) } oldname = g_strdup (full_name); - camel_store_rename_folder(vfolder_store, oldname, rule->name, NULL); - g_free(oldname); + camel_store_rename_folder (vfolder_store, oldname, rule->name, NULL); + g_free (oldname); } d(printf("Filter rule changed? for folder '%s'!!\n", folder->name)); /* find any (currently available) folders, and add them to the ones to open */ - rule_add_sources(((EMVFolderRule *)rule)->sources, &sources_folder, &sources_uri); + rule_add_sources (((EMVFolderRule *)rule)->sources, &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) - rule_add_sources(source_folders_local, &sources_folder, &sources_uri); + rule_add_sources (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) - rule_add_sources(source_folders_remote, &sources_folder, &sources_uri); + rule_add_sources (source_folders_remote, &sources_folder, &sources_uri); G_UNLOCK (vfolder); query = g_string_new(""); - e_filter_rule_build_code(rule, query); + e_filter_rule_build_code (rule, query); - vfolder_setup(folder, query->str, sources_uri, sources_folder); + vfolder_setup (folder, query->str, sources_uri, sources_folder); - g_string_free(query, TRUE); + g_string_free (query, TRUE); } -static void context_rule_added(ERuleContext *ctx, EFilterRule *rule) +static void context_rule_added (ERuleContext *ctx, EFilterRule *rule) { CamelFolder *folder; d(printf("rule added: %s\n", rule->name)); /* this always runs quickly */ - folder = camel_store_get_folder(vfolder_store, rule->name, 0, NULL); + folder = camel_store_get_folder (vfolder_store, rule->name, 0, NULL); if (folder) { g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder); G_LOCK (vfolder); - g_hash_table_insert(vfolder_hash, g_strdup(rule->name), folder); + g_hash_table_insert (vfolder_hash, g_strdup (rule->name), folder); G_UNLOCK (vfolder); - rule_changed(rule, folder); + rule_changed (rule, folder); } } -static void context_rule_removed(ERuleContext *ctx, EFilterRule *rule) +static void context_rule_removed (ERuleContext *ctx, EFilterRule *rule) { gpointer key, folder = NULL; @@ -887,7 +887,7 @@ static void context_rule_removed(ERuleContext *ctx, EFilterRule *rule) } G_UNLOCK (vfolder); - camel_store_delete_folder(vfolder_store, rule->name, NULL); + camel_store_delete_folder (vfolder_store, rule->name, NULL); /* this must be unref'd after its deleted */ if (folder) g_object_unref ((CamelFolder *) folder); @@ -908,21 +908,21 @@ store_folder_deleted_cb (CamelStore *store, G_LOCK (vfolder); /* delete it from our list */ - rule = e_rule_context_find_rule((ERuleContext *)context, info->full_name, NULL); + rule = e_rule_context_find_rule ((ERuleContext *)context, info->full_name, NULL); 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, + 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); + e_rule_context_remove_rule ((ERuleContext *)context, rule); + g_object_unref (rule); g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "vfolders.xml", NULL); - e_rule_context_save((ERuleContext *)context, user); - g_free(user); + e_rule_context_save ((ERuleContext *)context, user); + g_free (user); } else { g_warning("Cannot find rule for deleted vfolder '%s'", info->name); } @@ -952,24 +952,24 @@ store_folder_renamed_cb (CamelStore *store, g_hash_table_remove (vfolder_hash, key); g_free (key); - g_hash_table_insert (vfolder_hash, g_strdup(info->full_name), folder); + g_hash_table_insert (vfolder_hash, g_strdup (info->full_name), folder); - rule = e_rule_context_find_rule((ERuleContext *)context, old_name, NULL); + rule = e_rule_context_find_rule ((ERuleContext *)context, old_name, NULL); if (!rule) { G_UNLOCK (vfolder); g_warning ("Rule shouldn't be NULL\n"); return; } - g_signal_handlers_disconnect_matched(rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0, + 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); + e_filter_rule_set_name (rule, info->full_name); g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "vfolders.xml", NULL); - e_rule_context_save((ERuleContext *)context, user); - g_free(user); + e_rule_context_save ((ERuleContext *)context, user); + g_free (user); G_UNLOCK (vfolder); } else { @@ -1003,7 +1003,7 @@ folder_renamed_cb (MailFolderCache *cache, CamelStore *store, const gchar *oldur } void -vfolder_load_storage(void) +vfolder_load_storage (void) { /* lock for loading storage, it is safe to call it more than once */ G_LOCK_DEFINE_STATIC (vfolder_hash); @@ -1023,7 +1023,7 @@ vfolder_load_storage(void) return; } - vfolder_hash = g_hash_table_new(g_str_hash, g_str_equal); + vfolder_hash = g_hash_table_new (g_str_hash, g_str_equal); G_UNLOCK (vfolder_hash); @@ -1032,7 +1032,7 @@ vfolder_load_storage(void) /* first, create the vfolder store, and set it up */ storeuri = g_strdup_printf("vfolder:%s/vfolder", data_dir); - vfolder_store = camel_session_get_store(session, storeuri, NULL); + vfolder_store = camel_session_get_store (session, storeuri, NULL); if (vfolder_store == NULL) { g_warning("Cannot open vfolder store - no vfolders available"); return; @@ -1068,19 +1068,19 @@ vfolder_load_storage(void) /* and setup the rules we have */ rule = NULL; - while ((rule = e_rule_context_next_rule((ERuleContext *)context, rule, NULL))) { + while ((rule = e_rule_context_next_rule ((ERuleContext *)context, rule, NULL))) { if (rule->name) { d(printf("rule added: %s\n", rule->name)); - context_rule_added((ERuleContext *)context, rule); + context_rule_added ((ERuleContext *)context, rule); } else { d(printf("invalid rule (%p) encountered: rule->name is NULL\n", rule)); } } - g_free(storeuri); + g_free (storeuri); /* reenable the feature if required */ - gconf = mail_config_get_gconf_client(); + gconf = mail_config_get_gconf_client (); if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL)) gconf_client_set_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", TRUE, NULL); @@ -1095,7 +1095,7 @@ vfolder_load_storage(void) } void -vfolder_revert(void) +vfolder_revert (void) { const gchar *config_dir; gchar *user; @@ -1103,8 +1103,8 @@ vfolder_revert(void) d(printf("vfolder_revert\n")); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "vfolders.xml", NULL); - e_rule_context_revert((ERuleContext *)context, user); - g_free(user); + e_rule_context_revert ((ERuleContext *)context, user); + g_free (user); } void @@ -1146,7 +1146,7 @@ vfolder_edit (EShellView *shell_view) } static void -edit_rule_response(GtkWidget *w, gint button, gpointer data) +edit_rule_response (GtkWidget *w, gint button, gpointer data) { if (button == GTK_RESPONSE_OK) { const gchar *config_dir; @@ -1154,18 +1154,18 @@ edit_rule_response(GtkWidget *w, gint button, gpointer data) EFilterRule *rule = g_object_get_data (G_OBJECT (w), "rule"); EFilterRule *orig = g_object_get_data (G_OBJECT (w), "orig"); - e_filter_rule_copy(orig, rule); + e_filter_rule_copy (orig, rule); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "vfolders.xml", NULL); - e_rule_context_save((ERuleContext *)context, user); - g_free(user); + e_rule_context_save ((ERuleContext *)context, user); + g_free (user); } - gtk_widget_destroy(w); + gtk_widget_destroy (w); } void -vfolder_edit_rule(const gchar *uri) +vfolder_edit_rule (const gchar *uri) { GtkWidget *w; GtkDialog *gd; @@ -1173,15 +1173,15 @@ vfolder_edit_rule(const gchar *uri) EFilterRule *rule, *newrule; CamelURL *url; - url = camel_url_new(uri, NULL); + url = camel_url_new (uri, NULL); if (url && url->fragment - && (rule = e_rule_context_find_rule((ERuleContext *)context, url->fragment, NULL))) { - g_object_ref((GtkObject *)rule); - newrule = e_filter_rule_clone(rule); + && (rule = e_rule_context_find_rule ((ERuleContext *)context, url->fragment, NULL))) { + g_object_ref ((GtkObject *)rule); + newrule = e_filter_rule_clone (rule); - w = e_filter_rule_get_widget((EFilterRule *)newrule, (ERuleContext *)context); + w = e_filter_rule_get_widget ((EFilterRule *)newrule, (ERuleContext *)context); - gd = (GtkDialog *)gtk_dialog_new_with_buttons( + gd = (GtkDialog *)gtk_dialog_new_with_buttons ( _("Edit Search Folder"), NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -1192,15 +1192,15 @@ vfolder_edit_rule(const gchar *uri) container = gtk_dialog_get_content_area (gd); gtk_box_set_spacing (GTK_BOX (container), 6); - gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK); + gtk_dialog_set_default_response (gd, GTK_RESPONSE_OK); g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); 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); + 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); - gtk_widget_show((GtkWidget *)gd); + gtk_widget_show ((GtkWidget *)gd); } else { GtkWidget *w; @@ -1210,11 +1210,11 @@ vfolder_edit_rule(const gchar *uri) } if (url) - camel_url_free(url); + camel_url_free (url); } static void -new_rule_clicked(GtkWidget *w, gint button, gpointer data) +new_rule_clicked (GtkWidget *w, gint button, gpointer data) { if (button == GTK_RESPONSE_OK) { const gchar *config_dir; @@ -1233,15 +1233,15 @@ new_rule_clicked(GtkWidget *w, gint button, gpointer data) return; } - g_object_ref(rule); - e_rule_context_add_rule((ERuleContext *)context, rule); + g_object_ref (rule); + e_rule_context_add_rule ((ERuleContext *)context, rule); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "vfolders.xml", NULL); - e_rule_context_save((ERuleContext *)context, user); - g_free(user); + e_rule_context_save ((ERuleContext *)context, user); + g_free (user); } - gtk_widget_destroy(w); + gtk_widget_destroy (w); } static void @@ -1254,28 +1254,28 @@ new_rule_changed_cb (EFilterRule *rule, GtkDialog *dialog) } EFilterPart * -vfolder_create_part(const gchar *name) +vfolder_create_part (const gchar *name) { - return e_rule_context_create_part((ERuleContext *)context, 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) */ EFilterRule * -vfolder_clone_rule(EFilterRule *in) +vfolder_clone_rule (EFilterRule *in) { - EFilterRule *rule = (EFilterRule *)em_vfolder_rule_new(); + EFilterRule *rule = (EFilterRule *)em_vfolder_rule_new (); xmlNodePtr xml; - xml = e_filter_rule_xml_encode(in); - e_filter_rule_xml_decode(rule, xml, (ERuleContext *)context); - xmlFreeNodeList(xml); + xml = e_filter_rule_xml_encode (in); + e_filter_rule_xml_decode (rule, xml, (ERuleContext *)context); + xmlFreeNodeList (xml); return rule; } /* adds a rule with a gui */ void -vfolder_gui_add_rule(EMVFolderRule *rule) +vfolder_gui_add_rule (EMVFolderRule *rule) { GtkWidget *w; GtkDialog *gd; @@ -1284,7 +1284,7 @@ vfolder_gui_add_rule(EMVFolderRule *rule) /* this should be done before we call this function */ vfolder_load_storage (); - w = e_filter_rule_get_widget((EFilterRule *)rule, (ERuleContext *)context); + w = e_filter_rule_get_widget ((EFilterRule *)rule, (ERuleContext *)context); gd = (GtkDialog *)gtk_dialog_new_with_buttons ( _("New Search Folder"), @@ -1293,7 +1293,7 @@ vfolder_gui_add_rule(EMVFolderRule *rule) GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK); + gtk_dialog_set_default_response (gd, GTK_RESPONSE_OK); gtk_container_set_border_width (GTK_CONTAINER (gd), 6); container = gtk_dialog_get_content_area (gd); @@ -1301,17 +1301,17 @@ vfolder_gui_add_rule(EMVFolderRule *rule) g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); 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); + 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", rule, (GDestroyNotify)g_object_unref); g_signal_connect(rule, "changed", G_CALLBACK (new_rule_changed_cb), gd); new_rule_changed_cb ((EFilterRule*)rule, gd); g_signal_connect(gd, "response", G_CALLBACK(new_rule_clicked), NULL); - gtk_widget_show((GtkWidget *)gd); + gtk_widget_show ((GtkWidget *)gd); } void -vfolder_gui_add_from_message(CamelMimeMessage *msg, gint flags, const gchar *source) +vfolder_gui_add_from_message (CamelMimeMessage *msg, gint flags, const gchar *source) { EMVFolderRule *rule; @@ -1320,12 +1320,12 @@ vfolder_gui_add_from_message(CamelMimeMessage *msg, gint flags, const gchar *sou /* ensures vfolder is running */ vfolder_load_storage (); - rule = (EMVFolderRule*)em_vfolder_rule_from_message(context, msg, flags, source); - vfolder_gui_add_rule(rule); + rule = (EMVFolderRule*)em_vfolder_rule_from_message (context, msg, flags, source); + vfolder_gui_add_rule (rule); } void -vfolder_gui_add_from_address(CamelInternetAddress *addr, gint flags, const gchar *source) +vfolder_gui_add_from_address (CamelInternetAddress *addr, gint flags, const gchar *source) { EMVFolderRule *rule; @@ -1334,8 +1334,8 @@ vfolder_gui_add_from_address(CamelInternetAddress *addr, gint flags, const gchar /* ensures vfolder is running */ vfolder_load_storage (); - rule = (EMVFolderRule*)em_vfolder_rule_from_address(context, addr, flags, source); - vfolder_gui_add_rule(rule); + rule = (EMVFolderRule*)em_vfolder_rule_from_address (context, addr, flags, source); + vfolder_gui_add_rule (rule); } static void @@ -1366,7 +1366,7 @@ mail_vfolder_shutdown (void) } if (context) { - g_object_unref(context); + g_object_unref (context); context = NULL; } } diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h index 84b6a41151..89610f4444 100644 --- a/mail/mail-vfolder.h +++ b/mail/mail-vfolder.h @@ -29,11 +29,11 @@ #include <mail/em-vfolder-rule.h> #include <shell/e-shell-view.h> -void vfolder_load_storage(void); -void vfolder_revert(void); +void vfolder_load_storage (void); +void vfolder_revert (void); void vfolder_edit (EShellView *shell_view); -void vfolder_edit_rule(const gchar *name); +void vfolder_edit_rule (const gchar *name); EFilterPart *vfolder_create_part (const gchar *name); EFilterRule *vfolder_clone_rule (EFilterRule *in); void vfolder_gui_add_rule (EMVFolderRule *rule); diff --git a/mail/message-list.c b/mail/message-list.c index cf68a06bee..02881f8a05 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -214,17 +214,17 @@ typedef struct _EMailAddress EMailAddress; #endif /* SMART_ADDRESS_COMPARE */ static void on_cursor_activated_cmd (ETree *tree, gint row, ETreePath path, gpointer user_data); -static void on_selection_changed_cmd(ETree *tree, MessageList *ml); +static void on_selection_changed_cmd (ETree *tree, MessageList *ml); static gint on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, MessageList *list); static gchar *filter_date (time_t date); static gchar *filter_size (gint size); /* note: @changes is owned/freed by the caller */ /*static void mail_do_regenerate_messagelist (MessageList *list, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes);*/ -static void mail_regen_list(MessageList *ml, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes); -static void mail_regen_cancel(MessageList *ml); +static void mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes); +static void mail_regen_cancel (MessageList *ml); -static void clear_info(gchar *key, ETreePath *node, MessageList *ml); +static void clear_info (gchar *key, ETreePath *node, MessageList *ml); static void folder_changed (CamelFolder *folder, CamelFolderChangeInfo *info, @@ -513,22 +513,22 @@ get_normalised_string (MessageList *message_list, CamelMessageInfo *info, gint c } static void -clear_selection(MessageList *ml, struct _MLSelection *selection) +clear_selection (MessageList *ml, struct _MLSelection *selection) { if (selection->uids) { - em_utils_uids_free(selection->uids); + em_utils_uids_free (selection->uids); selection->uids = NULL; } if (selection->folder) { g_object_unref (selection->folder); selection->folder = NULL; } - g_free(selection->folder_uri); + g_free (selection->folder_uri); selection->folder_uri = NULL; } static ETreePath -ml_search_forward(MessageList *ml, gint start, gint end, guint32 flags, guint32 mask) +ml_search_forward (MessageList *ml, gint start, gint end, guint32 flags, guint32 mask) { ETreePath path; gint row; @@ -538,10 +538,10 @@ ml_search_forward(MessageList *ml, gint start, gint end, guint32 flags, guint32 etta = e_tree_get_table_adapter (E_TREE (ml)); for (row = start; row <= end; row++) { - path = e_tree_table_adapter_node_at_row(etta, row); + path = e_tree_table_adapter_node_at_row (etta, row); if (path - && (info = get_message_info(ml, path)) - && (camel_message_info_flags(info) & mask) == flags) + && (info = get_message_info (ml, path)) + && (camel_message_info_flags (info) & mask) == flags) return path; } @@ -549,7 +549,7 @@ ml_search_forward(MessageList *ml, gint start, gint end, guint32 flags, guint32 } static ETreePath -ml_search_backward(MessageList *ml, gint start, gint end, guint32 flags, guint32 mask) +ml_search_backward (MessageList *ml, gint start, gint end, guint32 flags, guint32 mask) { ETreePath path; gint row; @@ -559,10 +559,10 @@ ml_search_backward(MessageList *ml, gint start, gint end, guint32 flags, guint32 etta = e_tree_get_table_adapter (E_TREE (ml)); for (row = start; row >= end; row--) { - path = e_tree_table_adapter_node_at_row(etta, row); + path = e_tree_table_adapter_node_at_row (etta, row); if (path - && (info = get_message_info(ml, path)) - && (camel_message_info_flags(info) & mask) == flags) + && (info = get_message_info (ml, path)) + && (camel_message_info_flags (info) & mask) == flags) return path; } @@ -570,7 +570,7 @@ ml_search_backward(MessageList *ml, gint start, gint end, guint32 flags, guint32 } static ETreePath -ml_search_path(MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) +ml_search_path (MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) { ETreePath node; gint row, count; @@ -579,31 +579,31 @@ ml_search_path(MessageList *ml, MessageListSelectDirection direction, guint32 fl etta = e_tree_get_table_adapter (E_TREE (ml)); if (ml->cursor_uid == NULL - || (node = g_hash_table_lookup(ml->uid_nodemap, ml->cursor_uid)) == NULL) + || (node = g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid)) == NULL) return NULL; - row = e_tree_table_adapter_row_of_node(etta, node); + row = e_tree_table_adapter_row_of_node (etta, node); if (row == -1) return NULL; - count = e_table_model_row_count((ETableModel *)etta); + count = e_table_model_row_count ((ETableModel *)etta); if ((direction & MESSAGE_LIST_SELECT_DIRECTION) == MESSAGE_LIST_SELECT_NEXT) - node = ml_search_forward(ml, row + 1, count - 1, flags, mask); + node = ml_search_forward (ml, row + 1, count - 1, flags, mask); else - node = ml_search_backward(ml, row-1, 0, flags, mask); + node = ml_search_backward (ml, row-1, 0, flags, mask); if (node == NULL && (direction & MESSAGE_LIST_SELECT_WRAP)) { if ((direction & MESSAGE_LIST_SELECT_DIRECTION) == MESSAGE_LIST_SELECT_NEXT) - node = ml_search_forward(ml, 0, row, flags, mask); + node = ml_search_forward (ml, 0, row, flags, mask); else - node = ml_search_backward(ml, count-1, row, flags, mask); + node = ml_search_backward (ml, count-1, row, flags, mask); } return node; } static void -select_path(MessageList *ml, ETreePath path) +select_path (MessageList *ml, ETreePath path) { ETree *tree; ETreeTableAdapter *etta; @@ -613,7 +613,7 @@ select_path(MessageList *ml, ETreePath path) etta = e_tree_get_table_adapter (tree); etsm = (ETreeSelectionModel *) e_tree_get_selection_model (tree); - g_free(ml->cursor_uid); + g_free (ml->cursor_uid); ml->cursor_uid = NULL; e_tree_table_adapter_show_node (etta, path); @@ -641,13 +641,13 @@ select_path(MessageList *ml, ETreePath path) * Returns %TRUE if a new message has been selected or %FALSE otherwise. **/ gboolean -message_list_select(MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) +message_list_select (MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) { ETreePath path; - path = ml_search_path(ml, direction, flags, mask); + path = ml_search_path (ml, direction, flags, mask); if (path) { - select_path(ml, path); + select_path (ml, path); /* This function is usually called in response to a key * press, so grab focus if the message list is visible. */ @@ -671,9 +671,9 @@ message_list_select(MessageList *ml, MessageListSelectDirection direction, guint * Return value: **/ gboolean -message_list_can_select(MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) +message_list_can_select (MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) { - return ml_search_path(ml, direction, flags, mask) != NULL; + return ml_search_path (ml, direction, flags, mask) != NULL; } /** @@ -760,20 +760,20 @@ message_list_select_next_thread (MessageList *ml) etta = e_tree_get_table_adapter (E_TREE (ml)); if (!ml->cursor_uid - || (node = g_hash_table_lookup(ml->uid_nodemap, ml->cursor_uid)) == NULL) + || (node = g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid)) == NULL) return; - row = e_tree_table_adapter_row_of_node(etta, node); + row = e_tree_table_adapter_row_of_node (etta, node); if (row == -1) return; - count = e_table_model_row_count((ETableModel *)etta); + count = e_table_model_row_count ((ETableModel *)etta); /* find the next node which has a root parent (i.e. toplevel node) */ for (i=row+1;i<count-1;i++) { - node = e_tree_table_adapter_node_at_row(etta, i); + node = e_tree_table_adapter_node_at_row (etta, i); if (node - && e_tree_model_node_is_root(ml->model, e_tree_model_node_get_parent(ml->model, node))) { - select_path(ml, node); + && e_tree_model_node_is_root (ml->model, e_tree_model_node_get_parent (ml->model, node))) { + select_path (ml, node); return; } } @@ -920,43 +920,43 @@ message_list_invert_selection (MessageList *message_list) } void -message_list_copy(MessageList *ml, gboolean cut) +message_list_copy (MessageList *ml, gboolean cut) { MessageListPrivate *p = ml->priv; GPtrArray *uids; - clear_selection(ml, &p->clipboard); + clear_selection (ml, &p->clipboard); - uids = message_list_get_selected(ml); + uids = message_list_get_selected (ml); if (uids->len > 0) { if (cut) { gint i; - camel_folder_freeze(ml->folder); + camel_folder_freeze (ml->folder); for (i=0;i<uids->len;i++) - camel_folder_set_message_flags(ml->folder, uids->pdata[i], + camel_folder_set_message_flags (ml->folder, uids->pdata[i], CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED); - camel_folder_thaw(ml->folder); + camel_folder_thaw (ml->folder); } p->clipboard.uids = uids; p->clipboard.folder = ml->folder; g_object_ref (p->clipboard.folder); - p->clipboard.folder_uri = g_strdup(ml->folder_uri); - gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time()); + p->clipboard.folder_uri = g_strdup (ml->folder_uri); + gtk_selection_owner_set (p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time ()); } else { - em_utils_uids_free(uids); - gtk_selection_owner_set(NULL, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time()); + em_utils_uids_free (uids); + gtk_selection_owner_set (NULL, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time ()); } } void -message_list_paste(MessageList *ml) +message_list_paste (MessageList *ml) { - gtk_selection_convert(ml->priv->invisible, GDK_SELECTION_CLIPBOARD, + gtk_selection_convert (ml->priv->invisible, GDK_SELECTION_CLIPBOARD, gdk_atom_intern ("x-uid-list", FALSE), GDK_CURRENT_TIME); } @@ -987,16 +987,16 @@ ml_get_save_id (ETreeModel *etm, ETreePath path, gpointer data) { CamelMessageInfo *info; - if (e_tree_model_node_is_root(etm, path)) + if (e_tree_model_node_is_root (etm, path)) return g_strdup("root"); /* Note: etable can ask for the save_id while we're clearing it, which is the only time data should be null */ - info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path); + info = e_tree_memory_node_get_data (E_TREE_MEMORY (etm), path); if (info == NULL) return NULL; - return g_strdup (camel_message_info_uid(info)); + return g_strdup (camel_message_info_uid (info)); } /* @@ -1021,7 +1021,7 @@ ml_get_node_by_id (ETreeModel *etm, const gchar *save_id, gpointer data) if (!strcmp (save_id, "root")) return e_tree_model_get_root (etm); - return g_hash_table_lookup(ml->uid_nodemap, save_id); + return g_hash_table_lookup (ml->uid_nodemap, save_id); } static gpointer @@ -1192,13 +1192,13 @@ ml_value_to_string (ETreeModel *etm, gint col, gconstpointer value, gpointer dat switch (col) { case COL_MESSAGE_STATUS: - i = GPOINTER_TO_UINT(value); + i = GPOINTER_TO_UINT (value); if (i > 5) return g_strdup (""); return g_strdup (_(status_map[i])); case COL_SCORE: - i = GPOINTER_TO_UINT(value) + 3; + i = GPOINTER_TO_UINT (value) + 3; if (i > 6) i = 3; return g_strdup (_(score_map[i])); @@ -1480,7 +1480,7 @@ ml_tree_value_at_ex (ETreeModel *etm, switch (col) { case COL_MESSAGE_STATUS: - flags = camel_message_info_flags(msg_info); + flags = camel_message_info_flags (msg_info); if (flags & CAMEL_MESSAGE_ANSWERED) return GINT_TO_POINTER (2); else if (flags & CAMEL_MESSAGE_FORWARDED) @@ -1490,7 +1490,7 @@ ml_tree_value_at_ex (ETreeModel *etm, else return GINT_TO_POINTER (0); case COL_FLAGGED: - return GINT_TO_POINTER ((camel_message_info_flags(msg_info) & CAMEL_MESSAGE_FLAGGED) != 0); + return GINT_TO_POINTER ((camel_message_info_flags (msg_info) & CAMEL_MESSAGE_FLAGGED) != 0); case COL_SCORE: { const gchar *tag; gint score = 0; @@ -1510,11 +1510,11 @@ ml_tree_value_at_ex (ETreeModel *etm, cmp = camel_message_info_user_tag(msg_info, "completed-on"); if (tag && tag[0]) { if (cmp && cmp[0]) - return GINT_TO_POINTER(2); + return GINT_TO_POINTER (2); else - return GINT_TO_POINTER(1); + return GINT_TO_POINTER (1); } else - return GINT_TO_POINTER(0); + return GINT_TO_POINTER (0); } case COL_FOLLOWUP_DUE_BY: { const gchar *tag; @@ -1534,7 +1534,7 @@ ml_tree_value_at_ex (ETreeModel *etm, case COL_ATTACHMENT: if (camel_message_info_user_flag (msg_info, "$has_cal")) return GINT_TO_POINTER (2); - return GINT_TO_POINTER ((camel_message_info_flags(msg_info) & CAMEL_MESSAGE_ATTACHMENTS) != 0); + return GINT_TO_POINTER ((camel_message_info_flags (msg_info) & CAMEL_MESSAGE_ATTACHMENTS) != 0); case COL_FROM: str = camel_message_info_from (msg_info); return (gpointer)(str ? str : ""); @@ -1572,9 +1572,9 @@ ml_tree_value_at_ex (ETreeModel *etm, case COL_TO_NORM: return (gpointer) get_normalised_string (message_list, msg_info, col); case COL_SIZE: - return GINT_TO_POINTER (camel_message_info_size(msg_info)); + return GINT_TO_POINTER (camel_message_info_size (msg_info)); case COL_DELETED: - return GINT_TO_POINTER ((camel_message_info_flags(msg_info) & CAMEL_MESSAGE_DELETED) != 0); + return GINT_TO_POINTER ((camel_message_info_flags (msg_info) & CAMEL_MESSAGE_DELETED) != 0); case COL_UNREAD: { gboolean saw_unread = FALSE; @@ -1620,7 +1620,7 @@ ml_tree_value_at_ex (ETreeModel *etm, colour_alloced = gdk_color_to_string (&colour_val); colour = g_intern_string (colour_alloced); g_free (colour_alloced); - } else if (camel_message_info_flags(msg_info) & CAMEL_MESSAGE_FLAGGED) { + } else if (camel_message_info_flags (msg_info) & CAMEL_MESSAGE_FLAGGED) { /* FIXME: extract from the important.xpm somehow. */ colour = "#A7453E"; } else if (((followup && *followup) || (due_by && *due_by)) && !(completed && *completed)) { @@ -1644,14 +1644,14 @@ ml_tree_value_at_ex (ETreeModel *etm, gchar *location = NULL; gchar *euri, *url; - if (CAMEL_IS_VEE_FOLDER(message_list->folder)) { - folder = camel_vee_folder_get_location((CamelVeeFolder *)message_list->folder, (CamelVeeMessageInfo *)msg_info, NULL); + if (CAMEL_IS_VEE_FOLDER (message_list->folder)) { + folder = camel_vee_folder_get_location ((CamelVeeFolder *)message_list->folder, (CamelVeeMessageInfo *)msg_info, NULL); } else { folder = message_list->folder; } url = mail_tools_folder_to_url (folder); - euri = em_uri_from_camel(url); + euri = em_uri_from_camel (url); account = mail_config_get_account_by_source_url (url); @@ -1660,7 +1660,7 @@ ml_tree_value_at_ex (ETreeModel *etm, location = g_strconcat (account->name, ":", curl->path, NULL); } else { /* Local account */ - euri = em_uri_from_camel(url); + euri = em_uri_from_camel (url); curl = camel_url_new (euri, NULL); if (curl->host && !strcmp(curl->host, "local") && curl->user && !strcmp(curl->user, "local")) location = g_strconcat (_("On This Computer"), ":",curl->path, NULL); @@ -1676,7 +1676,7 @@ ml_tree_value_at_ex (ETreeModel *etm, case COL_RECIPIENTS:{ str = camel_message_info_to (msg_info); - return sanitize_recipients(str); + return sanitize_recipients (str); } case COL_MIXED_SENDER: case COL_SENDER:{ @@ -1716,8 +1716,8 @@ ml_tree_value_at_ex (ETreeModel *etm, g_string_append (result, label_name_clean); - g_free(label_name_clean); - g_free(label_name); + g_free (label_name_clean); + g_free (label_name); } } @@ -1741,7 +1741,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, gint col, gpointer model_data return NULL; /* retrieve the message information array */ - msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path); + msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY (etm), path); g_return_val_if_fail (msg_info != NULL, NULL); return ml_tree_value_at_ex (etm, path, col, msg_info, message_list); @@ -1785,7 +1785,7 @@ ml_tree_is_cell_editable (ETreeModel *etm, ETreePath path, gint col, gpointer mo static gchar * filter_date (time_t date) { - time_t nowdate = time(NULL); + time_t nowdate = time (NULL); time_t yesdate; struct tm then, now, yesterday; gchar buf[26]; @@ -1873,7 +1873,7 @@ static ECell * create_composite_cell (gint col) "color_column", COL_COLOUR, NULL); - cell_from = e_cell_text_new(NULL, GTK_JUSTIFY_LEFT); + cell_from = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell_from), "bold_column", COL_UNREAD, "color_column", COL_COLOUR, @@ -1883,7 +1883,7 @@ static ECell * create_composite_cell (gint col) e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_attach, COL_ATTACHMENT, 5); e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_date, COL_SENT, 27); - cell_sub = e_cell_text_new(fixed_name? fixed_name:NULL, GTK_JUSTIFY_LEFT); + cell_sub = e_cell_text_new (fixed_name? fixed_name:NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell_sub), /* "bold_column", COL_UNREAD, */ "color_column", COL_COLOUR, @@ -1987,7 +1987,7 @@ message_list_create_extras (void) } static void -save_tree_state(MessageList *ml) +save_tree_state (MessageList *ml) { gchar *filename; @@ -1996,7 +1996,7 @@ save_tree_state(MessageList *ml) filename = mail_config_folder_to_cachename(ml->folder, "et-expanded-"); e_tree_save_expanded_state (E_TREE (ml), filename); - g_free(filename); + g_free (filename); ml->priv->any_row_changed = FALSE; } @@ -2061,7 +2061,7 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing) } static void -ml_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, MessageList *ml) +ml_selection_get (GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, MessageList *ml) { struct _MLSelection *selection; @@ -2073,20 +2073,20 @@ ml_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint ti if (info & 2) { /* text/plain */ d(printf("setting text/plain selection for uids\n")); - em_utils_selection_set_mailbox(data, selection->folder, selection->uids); + em_utils_selection_set_mailbox (data, selection->folder, selection->uids); } else { /* x-uid-list */ d(printf("setting x-uid-list selection for uids\n")); - em_utils_selection_set_uidlist(data, selection->folder_uri, selection->uids); + em_utils_selection_set_uidlist (data, selection->folder_uri, selection->uids); } } static gboolean -ml_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, MessageList *ml) +ml_selection_clear_event (GtkWidget *widget, GdkEventSelection *event, MessageList *ml) { MessageListPrivate *p = ml->priv; - clear_selection(ml, &p->clipboard); + clear_selection (ml, &p->clipboard); return TRUE; } @@ -2117,20 +2117,20 @@ ml_tree_drag_data_get (ETree *tree, gint row, ETreePath path, gint col, { GPtrArray *uids; - uids = message_list_get_selected(ml); + uids = message_list_get_selected (ml); if (uids->len > 0) { switch (info) { case DND_X_UID_LIST: - em_utils_selection_set_uidlist(data, ml->folder_uri, uids); + em_utils_selection_set_uidlist (data, ml->folder_uri, uids); break; case DND_TEXT_URI_LIST: - em_utils_selection_set_urilist(data, ml->folder, uids); + em_utils_selection_set_urilist (data, ml->folder, uids); break; } } - em_utils_uids_free(uids); + em_utils_uids_free (uids); } /* TODO: merge this with the folder tree stuff via empopup targets */ @@ -2177,10 +2177,10 @@ ml_drop_async_exec (struct _drop_msg *m) &m->base.error); break; case DND_MESSAGE_RFC822: - em_utils_selection_get_message(m->selection, m->folder); + em_utils_selection_get_message (m->selection, m->folder); break; case DND_TEXT_URI_LIST: - em_utils_selection_get_urilist(m->selection, m->folder); + em_utils_selection_get_urilist (m->selection, m->folder); break; } } @@ -2199,7 +2199,7 @@ ml_drop_async_done (struct _drop_msg *m) delete = success && m->move && !m->moved; } - gtk_drag_finish(m->context, success, delete, GDK_CURRENT_TIME); + gtk_drag_finish (m->context, success, delete, GDK_CURRENT_TIME); } static void @@ -2219,7 +2219,7 @@ static MailMsgInfo ml_drop_async_info = { }; static void -ml_drop_action(struct _drop_msg *m) +ml_drop_action (struct _drop_msg *m) { m->move = m->action == GDK_ACTION_MOVE; mail_msg_unordered_push (m); @@ -2249,9 +2249,9 @@ ml_tree_drag_data_received (ETree *tree, if (gtk_selection_data_get_length (selection_data) == -1) return; - m = mail_msg_new(&ml_drop_async_info); + m = mail_msg_new (&ml_drop_async_info); m->context = context; - g_object_ref(context); + g_object_ref (context); m->folder = ml->folder; g_object_ref (m->folder); m->action = gdk_drag_context_get_selected_action (context); @@ -2260,7 +2260,7 @@ ml_tree_drag_data_received (ETree *tree, /* need to copy, goes away once we exit */ m->selection = gtk_selection_data_copy (selection_data); - ml_drop_action(m); + ml_drop_action (m); } struct search_child_struct { @@ -2290,7 +2290,7 @@ is_tree_widget_children (ETree *tree, gconstpointer widget) } static gboolean -ml_tree_drag_motion(ETree *tree, GdkDragContext *context, gint x, gint y, guint time, MessageList *ml) +ml_tree_drag_motion (ETree *tree, GdkDragContext *context, gint x, gint y, guint time, MessageList *ml) { GList *targets; GdkDragAction action, actions = 0; @@ -2325,7 +2325,7 @@ ml_tree_drag_motion(ETree *tree, GdkDragContext *context, gint x, gint y, guint if (action == GDK_ACTION_COPY && (actions & GDK_ACTION_MOVE)) action = GDK_ACTION_MOVE; - gdk_drag_status(context, action, time); + gdk_drag_status (context, action, time); return action != 0; } @@ -2392,7 +2392,7 @@ message_list_init (MessageList *message_list) message_list->ensure_uid = NULL; message_list->uid_nodemap = g_hash_table_new (g_str_hash, g_str_equal); - message_list->async_event = mail_async_event_new(); + message_list->async_event = mail_async_event_new (); message_list->cursor_uid = NULL; message_list->last_sel_single = FALSE; @@ -2401,14 +2401,14 @@ message_list_init (MessageList *message_list) /* TODO: Should this only get the selection if we're realised? */ p = message_list->priv; - p->invisible = gtk_invisible_new(); + p->invisible = gtk_invisible_new (); p->destroyed = FALSE; - g_object_ref_sink(p->invisible); + g_object_ref_sink (p->invisible); p->any_row_changed = FALSE; matom = gdk_atom_intern ("x-uid-list", FALSE); - gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, matom, 0); - gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 2); + gtk_selection_add_target (p->invisible, GDK_SELECTION_CLIPBOARD, matom, 0); + gtk_selection_add_target (p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 2); g_signal_connect(p->invisible, "selection_get", G_CALLBACK(ml_selection_get), message_list); g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(ml_selection_clear_event), message_list); @@ -2424,7 +2424,7 @@ message_list_init (MessageList *message_list) } static void -message_list_destroy(GtkObject *object) +message_list_destroy (GtkObject *object) { MessageList *message_list = MESSAGE_LIST (object); MessageListPrivate *p = message_list->priv; @@ -2432,15 +2432,15 @@ message_list_destroy(GtkObject *object) p->destroyed = TRUE; if (message_list->async_event) { - mail_async_event_destroy(message_list->async_event); + mail_async_event_destroy (message_list->async_event); message_list->async_event = NULL; } if (message_list->folder) { - mail_regen_cancel(message_list); + mail_regen_cancel (message_list); if (message_list->uid_nodemap) { - g_hash_table_foreach(message_list->uid_nodemap, (GHFunc)clear_info, message_list); + g_hash_table_foreach (message_list->uid_nodemap, (GHFunc)clear_info, message_list); g_hash_table_destroy (message_list->uid_nodemap); message_list->uid_nodemap = NULL; } @@ -2452,7 +2452,7 @@ message_list_destroy(GtkObject *object) } if (p->invisible) { - g_object_unref(p->invisible); + g_object_unref (p->invisible); p->invisible = NULL; } @@ -2477,7 +2477,7 @@ message_list_destroy(GtkObject *object) } /* Chain up to parent's destroy() method. */ - GTK_OBJECT_CLASS (parent_class)->destroy(object); + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void @@ -2566,19 +2566,19 @@ message_list_finalize (GObject *object) } if (message_list->thread_tree) - camel_folder_thread_messages_unref(message_list->thread_tree); + camel_folder_thread_messages_unref (message_list->thread_tree); - g_free(message_list->search); - g_free(message_list->ensure_uid); - g_free(message_list->frozen_search); - g_free(message_list->cursor_uid); + g_free (message_list->search); + g_free (message_list->ensure_uid); + g_free (message_list->frozen_search); + g_free (message_list->cursor_uid); g_mutex_free (message_list->regen_lock); - g_free(message_list->folder_uri); + g_free (message_list->folder_uri); message_list->folder_uri = NULL; - clear_selection(message_list, &priv->clipboard); + clear_selection (message_list, &priv->clipboard); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (parent_class)->finalize (object); @@ -2613,7 +2613,7 @@ message_list_class_init (MessageListClass *class) gint i; for (i = 0; i < G_N_ELEMENTS (ml_drag_info); i++) - ml_drag_info[i].atom = gdk_atom_intern(ml_drag_info[i].target, FALSE); + ml_drag_info[i].atom = gdk_atom_intern (ml_drag_info[i].target, FALSE); parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (MessageListPrivate)); @@ -2731,7 +2731,7 @@ message_list_construct (MessageList *message_list) message_list); - e_tree_memory_set_expanded_default(E_TREE_MEMORY(message_list->model), + e_tree_memory_set_expanded_default (E_TREE_MEMORY (message_list->model), read_boolean_with_default (gconf, "/apps/evolution/mail/display/thread_expand", TRUE)); @@ -2752,7 +2752,7 @@ message_list_construct (MessageList *message_list) if (constructed) e_tree_root_node_set_visible (E_TREE (message_list), FALSE); - if (atk_get_root() != NULL) { + if (atk_get_root () != NULL) { a11y = gtk_widget_get_accessible (GTK_WIDGET (message_list)); atk_object_set_name(a11y, _("Messages")); } @@ -2781,7 +2781,7 @@ message_list_construct (MessageList *message_list) g_signal_connect ( message_list, "tree_drag_data_get", - G_CALLBACK(ml_tree_drag_data_get), message_list); + G_CALLBACK (ml_tree_drag_data_get), message_list); e_tree_drag_dest_set ( E_TREE (message_list), GTK_DEST_DEFAULT_ALL, @@ -2869,13 +2869,13 @@ message_list_get_shell_backend (MessageList *message_list) } static void -clear_info(gchar *key, ETreePath *node, MessageList *ml) +clear_info (gchar *key, ETreePath *node, MessageList *ml) { CamelMessageInfo *info; - info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); - camel_folder_free_message_info(ml->folder, info); - e_tree_memory_node_set_data((ETreeMemory *)ml->model, node, NULL); + info = e_tree_memory_node_get_data ((ETreeMemory *)ml->model, node); + camel_folder_free_message_info (ml->folder, info); + e_tree_memory_node_set_data ((ETreeMemory *)ml->model, node, NULL); } static void @@ -2888,7 +2888,7 @@ clear_tree (MessageList *ml, gboolean tfree) unsigned long diff; printf("Clearing tree\n"); - gettimeofday(&start, NULL); + gettimeofday (&start, NULL); #endif /* we also reset the uid_rowmap since it is no longer useful/valid anyway */ @@ -2904,14 +2904,14 @@ clear_tree (MessageList *ml, gboolean tfree) if (ml->tree_root) { /* we should be frozen already */ - e_tree_memory_node_remove (E_TREE_MEMORY(etm), ml->tree_root); + e_tree_memory_node_remove (E_TREE_MEMORY (etm), ml->tree_root); } - ml->tree_root = e_tree_memory_node_insert (E_TREE_MEMORY(etm), NULL, 0, NULL); + ml->tree_root = e_tree_memory_node_insert (E_TREE_MEMORY (etm), NULL, 0, NULL); if (tfree) - e_tree_model_rebuilt (E_TREE_MODEL(etm)); + e_tree_model_rebuilt (E_TREE_MODEL (etm)); #ifdef TIMEIT - gettimeofday(&end, NULL); + gettimeofday (&end, NULL); diff = end.tv_sec * 1000 + end.tv_usec/1000; diff -= start.tv_sec * 1000 + start.tv_usec/1000; printf("Clearing tree took %ld.%03ld seconds\n", diff / 1000, diff % 1000); @@ -3129,44 +3129,44 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c unsigned long diff; printf("Building tree\n"); - gettimeofday(&start, NULL); + gettimeofday (&start, NULL); #endif #ifdef TIMEIT - gettimeofday(&end, NULL); + gettimeofday (&end, NULL); diff = end.tv_sec * 1000 + end.tv_usec/1000; diff -= start.tv_sec * 1000 + start.tv_usec/1000; printf("Loading tree state took %ld.%03ld seconds\n", diff / 1000, diff % 1000); #endif if (ml->tree_root == NULL) { - ml->tree_root = e_tree_memory_node_insert(E_TREE_MEMORY(etm), NULL, 0, NULL); + ml->tree_root = e_tree_memory_node_insert (E_TREE_MEMORY (etm), NULL, 0, NULL); } if (ml->cursor_uid) saveuid = find_next_selectable (ml); #ifndef BROKEN_ETREE - top = e_tree_model_node_get_first_child(etm, ml->tree_root); + top = e_tree_model_node_get_first_child (etm, ml->tree_root); if (top == NULL || changes == NULL) { #else - selected = message_list_get_selected(ml); + selected = message_list_get_selected (ml); #endif - e_tree_memory_freeze(E_TREE_MEMORY(etm)); + e_tree_memory_freeze (E_TREE_MEMORY (etm)); clear_tree (ml, FALSE); - build_subtree(ml, ml->tree_root, thread->tree, &row); - e_tree_memory_thaw(E_TREE_MEMORY(etm)); + build_subtree (ml, ml->tree_root, thread->tree, &row); + e_tree_memory_thaw (E_TREE_MEMORY (etm)); #ifdef BROKEN_ETREE - message_list_set_selected(ml, selected); - em_utils_uids_free(selected); + message_list_set_selected (ml, selected); + em_utils_uids_free (selected); #else } else { - static gint tree_equal(ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp); + static gint tree_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp); - build_subtree_diff(ml, ml->tree_root, top, thread->tree, &row); - top = e_tree_model_node_get_first_child(etm, ml->tree_root); - tree_equal(ml->model, top, thread->tree); + build_subtree_diff (ml, ml->tree_root, top, thread->tree, &row); + top = e_tree_model_node_get_first_child (etm, ml->tree_root); + tree_equal (ml->model, top, thread->tree); } #endif if (saveuid) { @@ -3186,7 +3186,7 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c } #ifdef TIMEIT - gettimeofday(&end, NULL); + gettimeofday (&end, NULL); diff = end.tv_sec * 1000 + end.tv_usec/1000; diff -= start.tv_sec * 1000 + start.tv_usec/1000; printf("Building tree took %ld.%03ld seconds\n", diff / 1000, diff % 1000); @@ -3194,7 +3194,7 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c } /* this is about 20% faster than build_subtree_diff, - entirely because e_tree_model_node_insert(xx, -1 xx) + entirely because e_tree_model_node_insert (xx, -1 xx) is faster than inserting to the right row :( */ /* Otherwise, this code would probably go as it does the same thing essentially */ static void @@ -3214,7 +3214,7 @@ build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadNode *c, gint ml, (CamelMessageInfo *) c->message, parent, -1); if (c->child) { - build_subtree(ml, node, c->child, row); + build_subtree (ml, node, c->child, row); } c = c->next; } @@ -3223,13 +3223,13 @@ build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadNode *c, gint /* compares a thread tree node with the etable tree node to see if they point to the same object */ static gint -node_equal(ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) +node_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) { CamelMessageInfo *info; - info = e_tree_memory_node_get_data(E_TREE_MEMORY(etm), ap); + info = e_tree_memory_node_get_data (E_TREE_MEMORY (etm), ap); - if (bp->message && strcmp(camel_message_info_uid(info), camel_message_info_uid(bp->message))==0) + if (bp->message && strcmp (camel_message_info_uid (info), camel_message_info_uid (bp->message))==0) return 1; return 0; @@ -3238,29 +3238,29 @@ node_equal(ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) #ifndef BROKEN_ETREE /* debug function - compare the two trees to see if they are the same */ static gint -tree_equal(ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) +tree_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) { CamelMessageInfo *info; while (ap && bp) { - if (!node_equal(etm, ap, bp)) { + if (!node_equal (etm, ap, bp)) { g_warning("Nodes in tree differ"); - info = e_tree_memory_node_get_data(E_TREE_MEMORY(etm), ap); + info = e_tree_memory_node_get_data (E_TREE_MEMORY (etm), ap); printf("table uid = %s\n", camel_message_info_uid(info)); printf("camel uid = %s\n", camel_message_info_uid(bp->message)); return FALSE; } else { - if (!tree_equal(etm, e_tree_model_node_get_first_child(etm, ap), bp->child)) + if (!tree_equal (etm, e_tree_model_node_get_first_child (etm, ap), bp->child)) return FALSE; } bp = bp->next; - ap = e_tree_model_node_get_next(etm, ap); + ap = e_tree_model_node_get_next (etm, ap); } if (ap || bp) { g_warning("Tree differs, out of nodes in one branch"); if (ap) { - info = e_tree_memory_node_get_data(E_TREE_MEMORY(etm), ap); + info = e_tree_memory_node_get_data (E_TREE_MEMORY (etm), ap); if (info) printf("table uid = %s\n", camel_message_info_uid(info)); else @@ -3278,7 +3278,7 @@ tree_equal(ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp) /* adds a single node, retains save state, and handles adding children if required */ static void -add_node_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, gint *row, gint myrow) +add_node_diff (MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, gint *row, gint myrow) { CamelMessageInfo *info; ETreePath node; @@ -3294,13 +3294,13 @@ add_node_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThre (*row)++; if (c->child) { - build_subtree_diff(ml, node, NULL, c->child, row); + build_subtree_diff (ml, node, NULL, c->child, row); } } /* removes node, children recursively and all associated data */ static void -remove_node_diff(MessageList *ml, ETreePath node, gint depth) +remove_node_diff (MessageList *ml, ETreePath node, gint depth) { ETreeModel *etm = ml->model; ETreePath cp, cn; @@ -3309,19 +3309,19 @@ remove_node_diff(MessageList *ml, ETreePath node, gint depth) t(printf("Removing node: %s\n", (gchar *)e_tree_memory_node_get_data(etm, node))); /* we depth-first remove all node data's ... */ - cp = e_tree_model_node_get_first_child(etm, node); + cp = e_tree_model_node_get_first_child (etm, node); while (cp) { - cn = e_tree_model_node_get_next(etm, cp); - remove_node_diff(ml, cp, depth+1); + cn = e_tree_model_node_get_next (etm, cp); + remove_node_diff (ml, cp, depth+1); cp = cn; } /* and the rowid entry - if and only if it is referencing this node */ - info = e_tree_memory_node_get_data(E_TREE_MEMORY (etm), node); + info = e_tree_memory_node_get_data (E_TREE_MEMORY (etm), node); /* and only at the toplevel, remove the node (etree should optimise this remove somewhat) */ if (depth == 0) - e_tree_memory_node_remove(E_TREE_MEMORY(etm), node); + e_tree_memory_node_remove (E_TREE_MEMORY (etm), node); g_return_if_fail (info); ml_uid_nodemap_remove (ml, info); @@ -3330,7 +3330,7 @@ remove_node_diff(MessageList *ml, ETreePath node, gint depth) /* applies a new tree structure to an existing tree, but only by changing things that have changed */ static void -build_subtree_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, gint *row) +build_subtree_diff (MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, gint *row) { ETreeModel *etm = ml->model; ETreePath ap, *ai, *at, *tmp; @@ -3345,25 +3345,25 @@ build_subtree_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolde if (ap == NULL) { t(printf("out of old nodes\n")); /* ran out of old nodes - remaining nodes are added */ - add_node_diff(ml, parent, ap, bp, row, myrow); + add_node_diff (ml, parent, ap, bp, row, myrow); myrow++; bp = bp->next; } else if (bp == NULL) { t(printf("out of new nodes\n")); /* ran out of new nodes - remaining nodes are removed */ - tmp = e_tree_model_node_get_next(etm, ap); - remove_node_diff(ml, ap, 0); + tmp = e_tree_model_node_get_next (etm, ap); + remove_node_diff (ml, ap, 0); ap = tmp; - } else if (node_equal(etm, ap, bp)) { + } else if (node_equal (etm, ap, bp)) { /*t(printf("nodes match, verify\n"));*/ /* matching nodes, verify details/children */ #if 0 if (bp->message) { gpointer olduid, oldrow; /* if this is a message row, check/update the row id map */ - if (g_hash_table_lookup_extended(ml->uid_rowmap, camel_message_info_uid(bp->message), &olduid, &oldrow)) { + if (g_hash_table_lookup_extended (ml->uid_rowmap, camel_message_info_uid (bp->message), &olduid, &oldrow)) { if ((gint)oldrow != (*row)) { - g_hash_table_insert(ml->uid_rowmap, olduid, (gpointer)(*row)); + g_hash_table_insert (ml->uid_rowmap, olduid, (gpointer)(*row)); } } else { g_warning("Cannot find uid %s in table?", camel_message_info_uid(bp->message)); @@ -3372,24 +3372,24 @@ build_subtree_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolde #endif *row = (*row)+1; myrow++; - tmp = e_tree_model_node_get_first_child(etm, ap); + tmp = e_tree_model_node_get_first_child (etm, ap); /* make child lists match (if either has one) */ if (bp->child || tmp) { - build_subtree_diff(ml, ap, tmp, bp->child, row); + build_subtree_diff (ml, ap, tmp, bp->child, row); } - ap = e_tree_model_node_get_next(etm, ap); + ap = e_tree_model_node_get_next (etm, ap); bp = bp->next; } else { t(printf("searching for matches\n")); /* we have to scan each side for a match */ bi = bp->next; - ai = e_tree_model_node_get_next(etm, ap); + ai = e_tree_model_node_get_next (etm, ap); for (i=1;bi!=NULL;i++,bi=bi->next) { - if (node_equal(etm, ap, bi)) + if (node_equal (etm, ap, bi)) break; } - for (j=1;ai!=NULL;j++,ai=e_tree_model_node_get_next(etm, ai)) { - if (node_equal(etm, ai, bp)) + for (j=1;ai!=NULL;j++,ai=e_tree_model_node_get_next (etm, ai)) { + if (node_equal (etm, ai, bp)) break; } if (i<j) { @@ -3398,7 +3398,7 @@ build_subtree_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolde bt = bp; while (bt != bi) { t(printf("adding new node 0\n")); - add_node_diff(ml, parent, NULL, bt, row, myrow); + add_node_diff (ml, parent, NULL, bt, row, myrow); myrow++; bt = bt->next; } @@ -3406,7 +3406,7 @@ build_subtree_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolde } else { t(printf("adding new node 1\n")); /* no match in new nodes, add one, try next */ - add_node_diff(ml, parent, NULL, bp, row, myrow); + add_node_diff (ml, parent, NULL, bp, row, myrow); myrow++; bp = bp->next; } @@ -3416,20 +3416,20 @@ build_subtree_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolde at = ap; while (at != ai) { t(printf("removing old node 0\n")); - tmp = e_tree_model_node_get_next(etm, at); - remove_node_diff(ml, at, 0); + tmp = e_tree_model_node_get_next (etm, at); + remove_node_diff (ml, at, 0); at = tmp; } ap = ai; } else { t(printf("adding new node 2\n")); /* didn't find match in old nodes, must be new node? */ - add_node_diff(ml, parent, NULL, bp, row, myrow); + add_node_diff (ml, parent, NULL, bp, row, myrow); myrow++; bp = bp->next; #if 0 - tmp = e_tree_model_node_get_next(etm, ap); - remove_node_diff(etm, ap, 0); + tmp = e_tree_model_node_get_next (etm, ap); + remove_node_diff (etm, ap, 0); ap = tmp; #endif } @@ -3439,7 +3439,7 @@ build_subtree_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolde } #ifndef BROKEN_ETREE -static void build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes); +static void build_flat_diff (MessageList *ml, CamelFolderChangeInfo *changes); #endif static void @@ -3456,7 +3456,7 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) unsigned long diff; printf("Building flat\n"); - gettimeofday(&start, NULL); + gettimeofday (&start, NULL); #endif if (ml->cursor_uid) @@ -3464,28 +3464,28 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) #ifndef BROKEN_ETREE if (changes) { - build_flat_diff(ml, changes); + build_flat_diff (ml, changes); } else { #else - selected = message_list_get_selected(ml); + selected = message_list_get_selected (ml); #endif - e_tree_memory_freeze(E_TREE_MEMORY(etm)); + e_tree_memory_freeze (E_TREE_MEMORY (etm)); clear_tree (ml, FALSE); for (i = 0; i < summary->len; i++) { CamelMessageInfo *info = summary->pdata[i]; ml_uid_nodemap_insert (ml, info, NULL, -1); } - e_tree_memory_thaw(E_TREE_MEMORY(etm)); + e_tree_memory_thaw (E_TREE_MEMORY (etm)); #ifdef BROKEN_ETREE - message_list_set_selected(ml, selected); - em_utils_uids_free(selected); + message_list_set_selected (ml, selected); + em_utils_uids_free (selected); #else } #endif if (saveuid) { - ETreePath node = g_hash_table_lookup(ml->uid_nodemap, saveuid); + ETreePath node = g_hash_table_lookup (ml->uid_nodemap, saveuid); if (node == NULL) { g_free (ml->cursor_uid); ml->cursor_uid = NULL; @@ -3497,7 +3497,7 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) } #ifdef TIMEIT - gettimeofday(&end, NULL); + gettimeofday (&end, NULL); diff = end.tv_sec * 1000 + end.tv_usec/1000; diff -= start.tv_sec * 1000 + start.tv_usec/1000; printf("Building flat took %ld.%03ld seconds\n", diff / 1000, diff % 1000); @@ -3524,7 +3524,7 @@ message_list_change_first_visible_parent (MessageList *ml, ETreePath node) #ifndef BROKEN_ETREE static void -build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) +build_flat_diff (MessageList *ml, CamelFolderChangeInfo *changes) { gint i; ETreePath node; @@ -3534,7 +3534,7 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) struct timeval start, end; unsigned long diff; - gettimeofday(&start, NULL); + gettimeofday (&start, NULL); #endif d(printf("updating changes to display\n")); @@ -3542,10 +3542,10 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) /* remove individual nodes? */ d(printf("Removing messages from view:\n")); for (i=0;i<changes->uid_removed->len;i++) { - node = g_hash_table_lookup(ml->uid_nodemap, changes->uid_removed->pdata[i]); + node = g_hash_table_lookup (ml->uid_nodemap, changes->uid_removed->pdata[i]); if (node) { - info = e_tree_memory_node_get_data(E_TREE_MEMORY(ml->model), node); - e_tree_memory_node_remove(E_TREE_MEMORY(ml->model), node); + info = e_tree_memory_node_get_data (E_TREE_MEMORY (ml->model), node); + e_tree_memory_node_remove (E_TREE_MEMORY (ml->model), node); ml_uid_nodemap_remove (ml, info); } } @@ -3573,7 +3573,7 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) } #ifdef TIMEIT - gettimeofday(&end, NULL); + gettimeofday (&end, NULL); diff = end.tv_sec * 1000 + end.tv_usec/1000; diff -= start.tv_sec * 1000 + start.tv_usec/1000; printf("Inserting changes took %ld.%03ld seconds\n", diff / 1000, diff % 1000); @@ -3597,7 +3597,7 @@ mail_folder_hide_by_flag (CamelFolder *folder, MessageList *ml, CamelFolderChang info = camel_folder_get_message_info (folder, oldchanges->uid_changed->pdata[i]); if (info) - flags = camel_message_info_flags(info); + flags = camel_message_info_flags (info); if (node != NULL && info != NULL && (flags & flag) != 0) camel_folder_change_info_remove_uid (newchanges, oldchanges->uid_changed->pdata[i]); @@ -3660,7 +3660,7 @@ main_folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) camel_folder_change_info_free (changes); - g_signal_emit(ml, message_list_signals[MESSAGE_LIST_BUILT], 0); + g_signal_emit (ml, message_list_signals[MESSAGE_LIST_BUILT], 0); return; } } @@ -3679,7 +3679,7 @@ folder_changed (CamelFolder *folder, return; if (info != NULL) { - changes = camel_folder_change_info_new(); + changes = camel_folder_change_info_new (); camel_folder_change_info_cat (changes, info); } else { changes = NULL; @@ -3722,15 +3722,15 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g /* reset the normalised sort performance hack */ g_hash_table_remove_all (message_list->normalised_hash); - mail_regen_cancel(message_list); + mail_regen_cancel (message_list); if (message_list->folder != NULL) { save_tree_state (message_list); } - e_tree_memory_freeze(E_TREE_MEMORY(etm)); + e_tree_memory_freeze (E_TREE_MEMORY (etm)); clear_tree (message_list, TRUE); - e_tree_memory_thaw(E_TREE_MEMORY(etm)); + e_tree_memory_thaw (E_TREE_MEMORY (etm)); /* remove the cursor activate idle handler */ if (message_list->idle_id != 0) { @@ -3746,19 +3746,19 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g } if (message_list->thread_tree) { - camel_folder_thread_messages_unref(message_list->thread_tree); + camel_folder_thread_messages_unref (message_list->thread_tree); message_list->thread_tree = NULL; } if (message_list->folder_uri != uri) { - g_free(message_list->folder_uri); - message_list->folder_uri = uri ? g_strdup(uri):NULL; + g_free (message_list->folder_uri); + message_list->folder_uri = uri ? g_strdup (uri):NULL; } if (message_list->cursor_uid) { - g_free(message_list->cursor_uid); + g_free (message_list->cursor_uid); message_list->cursor_uid = NULL; - g_signal_emit(message_list, message_list_signals[MESSAGE_SELECTED], 0, NULL); + g_signal_emit (message_list, message_list_signals[MESSAGE_SELECTED], 0, NULL); } if (folder) { @@ -3876,7 +3876,7 @@ on_cursor_activated_cmd (ETree *tree, gint row, ETreePath path, gpointer user_da } static void -on_selection_changed_cmd(ETree *tree, MessageList *ml) +on_selection_changed_cmd (ETree *tree, MessageList *ml) { GPtrArray *uids; gchar *newuid; @@ -3884,11 +3884,11 @@ on_selection_changed_cmd(ETree *tree, MessageList *ml) /* not sure if we could just ignore this for the cursor, i think sometimes you only get a selection changed when you should also get a cursor activated? */ - uids = message_list_get_selected(ml); + uids = message_list_get_selected (ml); if (uids->len == 1) newuid = uids->pdata[0]; - else if ((cursor = e_tree_get_cursor(tree))) - newuid = (gchar *)camel_message_info_uid(e_tree_memory_node_get_data((ETreeMemory *)tree, cursor)); + else if ((cursor = e_tree_get_cursor (tree))) + newuid = (gchar *)camel_message_info_uid (e_tree_memory_node_get_data ((ETreeMemory *)tree, cursor)); else newuid = NULL; @@ -3899,15 +3899,15 @@ on_selection_changed_cmd(ETree *tree, MessageList *ml) (ml->last_sel_single && uids->len == 1 && newuid != NULL && ml->cursor_uid != NULL && !strcmp (ml->cursor_uid, newuid))) { /* noop */ } else { - g_free(ml->cursor_uid); - ml->cursor_uid = g_strdup(newuid); + g_free (ml->cursor_uid); + ml->cursor_uid = g_strdup (newuid); if (!ml->idle_id) ml->idle_id = g_idle_add_full (G_PRIORITY_LOW, on_cursor_activated_idle, ml, NULL); } ml->last_sel_single = uids->len == 1; - em_utils_uids_free(uids); + em_utils_uids_free (uids); } static gint @@ -3929,7 +3929,7 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess if (!(info = get_message_info (list, path))) return FALSE; - flags = camel_message_info_flags(info); + flags = camel_message_info_flags (info); folder_is_trash = ((list->folder->folder_flags & CAMEL_FOLDER_IS_TRASH) != 0); @@ -3975,7 +3975,7 @@ struct _ml_selected_data { }; static void -ml_getselected_cb(ETreePath path, gpointer user_data) +ml_getselected_cb (ETreePath path, gpointer user_data) { struct _ml_selected_data *data = user_data; const gchar *uid; @@ -3983,17 +3983,17 @@ ml_getselected_cb(ETreePath path, gpointer user_data) if (e_tree_model_node_is_root (data->ml->model, path)) return; - uid = get_message_uid(data->ml, path); - g_return_if_fail(uid != NULL); - g_ptr_array_add(data->uids, g_strdup(uid)); + uid = get_message_uid (data->ml, path); + g_return_if_fail (uid != NULL); + g_ptr_array_add (data->uids, g_strdup (uid)); } GPtrArray * -message_list_get_uids(MessageList *ml) +message_list_get_uids (MessageList *ml) { struct _ml_selected_data data = { ml, - g_ptr_array_new() + g_ptr_array_new () }; e_tree_path_foreach (E_TREE (ml), ml_getselected_cb, &data); @@ -4005,11 +4005,11 @@ message_list_get_uids(MessageList *ml) } GPtrArray * -message_list_get_selected(MessageList *ml) +message_list_get_selected (MessageList *ml) { struct _ml_selected_data data = { ml, - g_ptr_array_new() + g_ptr_array_new () }; e_tree_selected_path_foreach (E_TREE (ml), ml_getselected_cb, &data); @@ -4021,22 +4021,22 @@ message_list_get_selected(MessageList *ml) } void -message_list_set_selected(MessageList *ml, GPtrArray *uids) +message_list_set_selected (MessageList *ml, GPtrArray *uids) { gint i; ETreeSelectionModel *etsm; ETreePath node; - GPtrArray *paths = g_ptr_array_new(); + GPtrArray *paths = g_ptr_array_new (); etsm = (ETreeSelectionModel *) e_tree_get_selection_model (E_TREE (ml)); for (i=0; i<uids->len; i++) { - node = g_hash_table_lookup(ml->uid_nodemap, uids->pdata[i]); + node = g_hash_table_lookup (ml->uid_nodemap, uids->pdata[i]); if (node) - g_ptr_array_add(paths, node); + g_ptr_array_add (paths, node); } - e_tree_selection_model_select_paths(etsm, paths); - g_ptr_array_free(paths, TRUE); + e_tree_selection_model_select_paths (etsm, paths); + g_ptr_array_free (paths, TRUE); } struct ml_count_data { @@ -4067,20 +4067,20 @@ message_list_count (MessageList *message_list) } void -message_list_freeze(MessageList *ml) +message_list_freeze (MessageList *ml) { ml->frozen++; } void -message_list_thaw(MessageList *ml) +message_list_thaw (MessageList *ml) { g_return_if_fail (ml->frozen != 0); ml->frozen--; if (ml->frozen == 0) { - mail_regen_list(ml, ml->frozen_search?ml->frozen_search:ml->search, NULL, NULL); - g_free(ml->frozen_search); + mail_regen_list (ml, ml->frozen_search?ml->frozen_search:ml->search, NULL, NULL); + g_free (ml->frozen_search); ml->frozen_search = NULL; } } @@ -4144,21 +4144,21 @@ message_list_set_search (MessageList *ml, const gchar *search) ClutterAlpha *alpha; GtkIconInfo *info; - info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), + info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), "system-search", 72, GTK_ICON_LOOKUP_NO_SVG); if (info) { - texture = clutter_texture_new_from_file (gtk_icon_info_get_filename(info), NULL); - gtk_icon_info_free(info); + texture = clutter_texture_new_from_file (gtk_icon_info_get_filename (info), NULL); + gtk_icon_info_free (info); } clutter_container_add_actor ((ClutterContainer *)stage, texture); ml->priv->search_texture = texture; ml->priv->timeline = clutter_timeline_new (2 * 1000); alpha = clutter_alpha_new_full (ml->priv->timeline, CLUTTER_LINEAR); - path = clutter_path_new(); + path = clutter_path_new (); behaviour = clutter_behaviour_path_new (alpha, path); clutter_actor_hide (texture); clutter_path_clear (path); @@ -4193,7 +4193,7 @@ message_list_set_search (MessageList *ml, const gchar *search) return; if (ml->thread_tree) { - camel_folder_thread_messages_unref(ml->thread_tree); + camel_folder_thread_messages_unref (ml->thread_tree); ml->thread_tree = NULL; } @@ -4205,8 +4205,8 @@ message_list_set_search (MessageList *ml, const gchar *search) if (ml->frozen == 0) mail_regen_list (ml, search, NULL, NULL); else { - g_free(ml->frozen_search); - ml->frozen_search = g_strdup(search); + g_free (ml->frozen_search); + ml->frozen_search = g_strdup (search); } } @@ -4433,19 +4433,19 @@ regen_list_exec (struct _regen_list_msg *m) e_profile_event_emit("list.getuids", m->folder->full_name, 0); /* if we have hidedeleted on, use a search to find it out, merge with existing search if set */ - if (!camel_folder_has_search_capability(m->folder)) { + if (!camel_folder_has_search_capability (m->folder)) { /* if we have no search capability, dont let search or hide deleted work */ expr = NULL; } else if (m->hidedel) { if (m->hidejunk) { if (m->search) { - expr = g_alloca(strlen(m->search) + 92); + expr = g_alloca (strlen (m->search) + 92); sprintf(expr, "(and (match-all (and (not (system-flag \"deleted\")) (not (system-flag \"junk\"))))\n %s)", m->search); } else expr = (gchar *) "(match-all (and (not (system-flag \"deleted\")) (not (system-flag \"junk\"))))"; } else { if (m->search) { - expr = g_alloca(strlen(m->search) + 64); + expr = g_alloca (strlen (m->search) + 64); sprintf(expr, "(and (match-all (not (system-flag \"deleted\")))\n %s)", m->search); } else expr = (gchar *) "(match-all (not (system-flag \"deleted\")))"; @@ -4453,7 +4453,7 @@ regen_list_exec (struct _regen_list_msg *m) } else { if (m->hidejunk) { if (m->search) { - expr = g_alloca(strlen(m->search) + 64); + expr = g_alloca (strlen (m->search) + 64); sprintf(expr, "(and (match-all (not (system-flag \"junk\")))\n %s)", m->search); } else expr = (gchar *) "(match-all (not (system-flag \"junk\")))"; @@ -4512,7 +4512,7 @@ regen_list_exec (struct _regen_list_msg *m) e_profile_event_emit("list.threaduids", m->folder->full_name, 0); /* camel_folder_summary_prepare_fetch_all (m->folder->summary, NULL); */ - if (!camel_operation_cancel_check(m->base.cancel)) { + if (!camel_operation_cancel_check (m->base.cancel)) { /* update/build a new tree */ if (m->dotree) { ml_sort_uids_by_tree (m->ml, uids); @@ -4531,7 +4531,7 @@ regen_list_exec (struct _regen_list_msg *m) for (i = 0; i < uids->len; i++) { info = camel_folder_get_message_info (m->folder, uids->pdata[i]); if (info) - g_ptr_array_add(m->summary, info); + g_ptr_array_add (m->summary, info); } } @@ -4555,7 +4555,7 @@ regen_list_done (struct _regen_list_msg *m) if (!m->complete) return; - if (camel_operation_cancel_check(m->base.cancel)) + if (camel_operation_cancel_check (m->base.cancel)) return; if (m->ml->folder != m->folder) @@ -4586,7 +4586,7 @@ regen_list_done (struct _regen_list_msg *m) build_tree (m->ml, m->tree, m->changes); if (m->ml->thread_tree) - camel_folder_thread_messages_unref(m->ml->thread_tree); + camel_folder_thread_messages_unref (m->ml->thread_tree); m->ml->thread_tree = m->tree; m->tree = NULL; @@ -4609,7 +4609,7 @@ regen_list_done (struct _regen_list_msg *m) m->search = NULL; g_mutex_lock (m->ml->regen_lock); - m->ml->regen = g_list_remove(m->ml->regen, m); + m->ml->regen = g_list_remove (m->ml->regen, m); g_mutex_unlock (m->ml->regen_lock); if (m->ml->regen == NULL && m->ml->pending_select_uid) { @@ -4620,7 +4620,7 @@ regen_list_done (struct _regen_list_msg *m) m->ml->pending_select_uid = NULL; with_fallback = m->ml->pending_select_fallback; message_list_select_uid (m->ml, uid, with_fallback); - g_free(uid); + g_free (uid); } else if (m->ml->regen == NULL && m->ml->cursor_uid == NULL && m->last_row != -1) { ETreeTableAdapter *etta = e_tree_get_table_adapter (tree); @@ -4653,7 +4653,7 @@ regen_list_done (struct _regen_list_msg *m) m->ml->priv->any_row_changed = FALSE; #if HAVE_CLUTTER - if (m->ml->priv->timeline && clutter_timeline_is_playing(m->ml->priv->timeline)) { + if (m->ml->priv->timeline && clutter_timeline_is_playing (m->ml->priv->timeline)) { clutter_timeline_pause (m->ml->priv->timeline); clutter_actor_hide (m->ml->priv->search_texture); } else { @@ -4695,13 +4695,13 @@ regen_list_free (struct _regen_list_msg *m) /* we have to poke this here as well since we might've been cancelled and regened wont get called */ g_mutex_lock (m->ml->regen_lock); - m->ml->regen = g_list_remove(m->ml->regen, m); + m->ml->regen = g_list_remove (m->ml->regen, m); g_mutex_unlock (m->ml->regen_lock); if (m->expand_state) xmlFreeDoc (m->expand_state); - g_object_unref(m->ml); + g_object_unref (m->ml); } static MailMsgInfo regen_list_info = { @@ -4713,12 +4713,12 @@ static MailMsgInfo regen_list_info = { }; static gboolean -ml_regen_timeout(struct _regen_list_msg *m) +ml_regen_timeout (struct _regen_list_msg *m) { e_profile_event_emit("list.regenerate", m->folder->full_name, 0); g_mutex_lock (m->ml->regen_lock); - m->ml->regen = g_list_prepend(m->ml->regen, m); + m->ml->regen = g_list_prepend (m->ml->regen, m); g_mutex_unlock (m->ml->regen_lock); /* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */ mail_msg_fast_ordered_push (m); @@ -4730,7 +4730,7 @@ ml_regen_timeout(struct _regen_list_msg *m) } static void -mail_regen_cancel(MessageList *ml) +mail_regen_cancel (MessageList *ml) { /* cancel any outstanding regeneration requests, not we don't clear, they clear themselves */ if (ml->regen) { @@ -4743,7 +4743,7 @@ mail_regen_cancel(MessageList *ml) MailMsg *mm = l->data; if (mm->cancel) - camel_operation_cancel(mm->cancel); + camel_operation_cancel (mm->cancel); l = l->next; } @@ -4752,9 +4752,9 @@ mail_regen_cancel(MessageList *ml) /* including unqueued ones */ if (ml->regen_timeout_id) { - g_source_remove(ml->regen_timeout_id); + g_source_remove (ml->regen_timeout_id); ml->regen_timeout_id = 0; - mail_msg_unref(ml->regen_timeout_msg); + mail_msg_unref (ml->regen_timeout_msg); ml->regen_timeout_msg = NULL; } } @@ -4771,13 +4771,13 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca if (ml->folder == NULL) { if (ml->search != search) { - g_free(ml->search); - ml->search = g_strdup(search); + g_free (ml->search); + ml->search = g_strdup (search); } return; } - mail_regen_cancel(ml); + mail_regen_cancel (ml); gconf = mail_config_get_gconf_client (); @@ -4787,8 +4787,8 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca /* see if we need to goto the child thread at all anyway */ /* currently the only case is the flat view with updates and no search */ if (hideexpr == NULL && search == NULL && changes != NULL && !ml->threaded) { - build_flat_diff(ml, changes); - camel_folder_change_info_free(changes); + build_flat_diff (ml, changes); + camel_folder_change_info_free (changes); return; } #endif @@ -4807,11 +4807,11 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca m->expand_state = NULL; if ((!m->hidedel || !m->dotree) && ml->thread_tree) { - camel_folder_thread_messages_unref(ml->thread_tree); + camel_folder_thread_messages_unref (ml->thread_tree); ml->thread_tree = NULL; } else if (ml->thread_tree) { m->tree = ml->thread_tree; - camel_folder_thread_messages_ref(m->tree); + camel_folder_thread_messages_ref (m->tree); } if (e_tree_row_count (E_TREE (ml)) <= 0) { @@ -4834,9 +4834,9 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca /* if we're busy already kick off timeout processing, so normal updates are immediate */ if (ml->regen == NULL) - ml_regen_timeout(m); + ml_regen_timeout (m); else { ml->regen_timeout_msg = m; - ml->regen_timeout_id = g_timeout_add(500, (GSourceFunc)ml_regen_timeout, m); + ml->regen_timeout_id = g_timeout_add (500, (GSourceFunc)ml_regen_timeout, m); } } |