diff options
-rw-r--r-- | mail/Makefile.am | 36 | ||||
-rw-r--r-- | mail/README.async | 7 | ||||
-rw-r--r-- | mail/mail-config-gui.c | 138 | ||||
-rw-r--r-- | mail/mail-local.c | 2 | ||||
-rw-r--r-- | mail/mail-threads.c | 36 |
5 files changed, 152 insertions, 67 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am index f8f63885ce..9e0b0a2640 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -1,6 +1,6 @@ bin_PROGRAMS = evolution-mail -noinst_PROGRAMS = test-mail test-thread +noinst_PROGRAMS = test-mail #test-thread providerdir = $(libdir)/evolution/camel-providers/$(VERSION) @@ -93,23 +93,23 @@ evolution_mail_LDADD = \ test_mail_SOURCES = \ test-mail.c -test_mail_LDADD = \ - $(BONOBO_HTML_GNOME_LIBS) - -test_thread_SOURCES = \ - mail-threads.c \ - mail-threads.h \ - test-thread.c - -test_thread_LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libibex/libibex.la \ - $(BONOBO_HTML_GNOME_LIBS) \ - $(UNICODE_LIBS) \ - $(THREADS_LIBS) - -test_thread_CFLAGS = -g $(THREADS_CFLAGS) +#test_mail_LDADD = \ +# $(BONOBO_HTML_GNOME_LIBS) +# +#test_thread_SOURCES = \ +# mail-threads.c \ +# mail-threads.h \ +# test-thread.c +# +#test_thread_LDADD = \ +# $(top_builddir)/camel/libcamel.la \ +# $(top_builddir)/e-util/libeutil.la \ +# $(top_builddir)/libibex/libibex.la \ +# $(BONOBO_HTML_GNOME_LIBS) \ +# $(UNICODE_LIBS) \ +# $(THREADS_LIBS) +# +#test_thread_CFLAGS = -g $(THREADS_CFLAGS) GOAD_FILES = evolution-mail.gnorba OAF_FILES = evolution-mail.oafinfo diff --git a/mail/README.async b/mail/README.async index a7b9d9d92d..238fafcedb 100644 --- a/mail/README.async +++ b/mail/README.async @@ -185,6 +185,8 @@ static void cleanup_operation_name (gpointer in_data, gpointer op_data, CamelExc static gchar *describe_operation_name (gpointer in_data, gboolean gerund) { + operation_name_input_t *input = (operation_name_input_t *) in_data; + if (gerund) { return a g_strdup'ed string describing what we're doing } else { @@ -195,6 +197,7 @@ static gchar *describe_operation_name (gpointer in_data, gboolean gerund) static void setup_operation_name (gpointer in_data, gpointer op_data, CamelException *ex) { operation_name_input_t *input = (operation_name_input_t *) in_data; + operation_name_data_t *data = (operation_name_data_t *) op_data; verify that parameters are valid @@ -225,7 +228,7 @@ static void cleanup_operation_name (gpointer in_data, gpointer op_data, CamelExc static const mail_operation_spec op_operation_name = { describe_operation_name, - sizoef (operation_name_data_t), + sizeof (operation_name_data_t), setup_operation_name, do_operation_name, cleanup_operation_name @@ -234,7 +237,7 @@ static const mail_operation_spec op_operation_name = { void mail_do_operation_name (parameters) { - operation_name_input_t *input + operation_name_input_t *input; input = g_new (operation_name_input_t, 1); diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c index eb199bca11..a3e69b81fc 100644 --- a/mail/mail-config-gui.c +++ b/mail/mail-config-gui.c @@ -34,6 +34,7 @@ #include "e-util/e-html-utils.h" #include "mail.h" +#include "mail-threads.h" #include "mail-config.h" #include "mail-config-gui.h" @@ -171,6 +172,8 @@ typedef struct } MailDialog; /* private prototypes - these are ugly, rename some of them? */ +static void config_do_test_service (const char *url, CamelProviderType type); + static void html_size_req (GtkWidget *widget, GtkRequisition *requisition); static GtkWidget *html_new (gboolean white); static void put_html (GtkHTML *html, char *text); @@ -264,6 +267,7 @@ error_dialog (GtkWidget *parent_finder, const char *fmt, ...) g_free (msg); } +#if 0 static void info_dialog (GtkWidget *parent_finder, const char *fmt, ...) { @@ -281,6 +285,7 @@ info_dialog (GtkWidget *parent_finder, const char *fmt, ...) gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); g_free (msg); } +#endif /* Provider List */ static GSList * @@ -725,41 +730,14 @@ service_page_item_auth_fill (MailDialogServicePage *page, service_page_item_auth_activate (firstitem, spitem); } -static gboolean +static void service_acceptable (MailDialogServicePage *page) { - char *url = NULL; - CamelService *service; - CamelException *ex; - + char *url; + url = service_page_get_url (page); - - ex = camel_exception_new (); - camel_exception_clear (ex); - service = camel_session_get_service (session, url, - page->spitem->type, ex); + config_do_test_service (url, page->spitem->type); g_free (url); - - if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) - goto error; - - if (camel_service_connect (service, ex)) { - camel_service_disconnect (service, ex); - camel_object_unref (CAMEL_OBJECT (service)); - camel_exception_free (ex); - - info_dialog (page->vbox, "Connection successful!"); - - return TRUE; - } - - gtk_object_unref (GTK_OBJECT (service)); - - error: - error_dialog (page->vbox, camel_exception_get_description (ex)); - camel_exception_free (ex); - - return FALSE; } static MailConfigService * @@ -2164,3 +2142,101 @@ mail_config (void) gtk_object_unref (GTK_OBJECT (gui)); g_free (dialog); } + +/* ************************************************************************ */ + +typedef struct test_service_input_s { + gchar *url; + CamelProviderType type; +} test_service_input_t; + +typedef struct test_service_data_s { + gboolean success; +} test_service_data_t; + +static gchar *describe_test_service (gpointer in_data, gboolean gerund); +static void setup_test_service (gpointer in_data, gpointer op_data, CamelException *ex); +static void do_test_service (gpointer in_data, gpointer op_data, CamelException *ex); +static void cleanup_test_service (gpointer in_data, gpointer op_data, CamelException *ex); + +static gchar *describe_test_service (gpointer in_data, gboolean gerund) +{ + test_service_input_t *input = (test_service_input_t *) in_data; + + if (gerund) { + return g_strdup_printf ("Testing \"%s\"", input->url); + } else { + return g_strdup_printf ("Test connection to \"%s\"", input->url); + } +} + +static void setup_test_service (gpointer in_data, gpointer op_data, CamelException *ex) +{ + test_service_input_t *input = (test_service_input_t *) in_data; + test_service_data_t *data = (test_service_data_t *) op_data; + + if (!input->url) { + camel_exception_set (ex, CAMEL_EXCEPTION_INVALID_PARAM, + "No URL was provided to test"); + return; + } + + data->success = FALSE; +} + +static void do_test_service (gpointer in_data, gpointer op_data, CamelException *ex) +{ + test_service_input_t *input = (test_service_input_t *) in_data; + test_service_data_t *data = (test_service_data_t *) op_data; + + CamelService *service; + + service = camel_session_get_service (session, input->url, + input->type, ex); + + if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) { + data->success = FALSE; + } else if (camel_service_connect (service, ex)) { + camel_service_disconnect (service, ex); + data->success = TRUE; + } else { + data->success = FALSE; + } + + camel_object_unref (CAMEL_OBJECT (service)); +} + +static void cleanup_test_service (gpointer in_data, gpointer op_data, CamelException *ex) +{ + test_service_input_t *input = (test_service_input_t *) in_data; + test_service_data_t *data = (test_service_data_t *) op_data; + + GtkWidget *dlg; + + if (data->success) { + dlg = gnome_ok_dialog (_("The connection was successful!")); + gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); + } + + g_free (input->url); +} + +static const mail_operation_spec op_test_service = { + describe_test_service, + sizeof (test_service_data_t), + setup_test_service, + do_test_service, + cleanup_test_service +}; + +static void +config_do_test_service (const char *url, CamelProviderType type) +{ + test_service_input_t *input; + + input = g_new (test_service_input_t, 1); + input->url = g_strdup (url); + input->type = type; + + mail_operation_queue (&op_test_service, input, TRUE); +} diff --git a/mail/mail-local.c b/mail/mail-local.c index f5ac994dd4..7548d32e8b 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -228,7 +228,7 @@ static void update_progress(char *fmt, float percent) { if (fmt) mail_op_set_message ("%s", fmt); - mail_op_set_percentage (percent); + /*mail_op_set_percentage (percent);*/ } /* ******************** */ diff --git a/mail/mail-threads.c b/mail/mail-threads.c index a995a2ad70..ebf1e862ad 100644 --- a/mail/mail-threads.c +++ b/mail/mail-threads.c @@ -292,7 +292,7 @@ mail_operation_queue (const mail_operation_spec * spec, gpointer input, g_free (msg); gnome_dialog_set_close (GNOME_DIALOG (err_dialog), TRUE); - /*gnome_dialog_run_and_close (GNOME_DIALOG (err_dialog)); */ + /*gnome_dialog_run_and_close (GNOME_DIALOG (err_dialog));*/ /*gtk_widget_destroy (err_dialog); */ gtk_widget_show (GTK_WIDGET (err_dialog)); @@ -1043,13 +1043,16 @@ show_error (com_msg_t * msg) timeout_toggle (FALSE); modal_may_proceed = FALSE; - gtk_widget_show_all (GTK_WIDGET (err_dialog)); - gnome_win_hints_set_layer (err_dialog, WIN_LAYER_ONTOP); - gnome_win_hints_set_state (err_dialog, WIN_STATE_ARRANGE_IGNORE); - gnome_win_hints_set_hints (err_dialog, - WIN_HINTS_SKIP_FOCUS | - WIN_HINTS_SKIP_WINLIST | - WIN_HINTS_SKIP_TASKBAR); + /*gtk_widget_show_all (GTK_WIDGET (err_dialog));*/ + gnome_dialog_run_and_close (GNOME_DIALOG (err_dialog)); + /* + *gnome_win_hints_set_layer (err_dialog, WIN_LAYER_ONTOP); + *gnome_win_hints_set_state (err_dialog, WIN_STATE_ARRANGE_IGNORE); + *gnome_win_hints_set_hints (err_dialog, + * WIN_HINTS_SKIP_FOCUS | + * WIN_HINTS_SKIP_WINLIST | + * WIN_HINTS_SKIP_TASKBAR); + */ } /** @@ -1117,13 +1120,16 @@ get_password (com_msg_t * msg) } else { *(msg->reply) = NULL; timeout_toggle (FALSE); - gtk_widget_show_all (GTK_WIDGET (dialog)); - gnome_win_hints_set_layer (dialog, WIN_LAYER_ONTOP); - gnome_win_hints_set_state (dialog, WIN_STATE_ARRANGE_IGNORE); - gnome_win_hints_set_hints (dialog, - WIN_HINTS_SKIP_FOCUS | - WIN_HINTS_SKIP_WINLIST | - WIN_HINTS_SKIP_TASKBAR); + /* + *gtk_widget_show_all (GTK_WIDGET (dialog)); + *gnome_win_hints_set_layer (dialog, WIN_LAYER_ONTOP); + *gnome_win_hints_set_state (dialog, WIN_STATE_ARRANGE_IGNORE); + *gnome_win_hints_set_hints (dialog, + * WIN_HINTS_SKIP_FOCUS | + * WIN_HINTS_SKIP_WINLIST | + * WIN_HINTS_SKIP_TASKBAR); + */ + gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); } } |