aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2001-01-07 13:33:54 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-01-07 13:33:54 +0800
commitb1bfee4db1eed475d5528a5179eea1f6435e5ebe (patch)
tree790a7ab99a7b6598b145561a9f347ba62e223ba0 /mail
parentdf57651390a172b0192b2dd158d24ec9ff271d83 (diff)
downloadgsoc2013-evolution-b1bfee4db1eed475d5528a5179eea1f6435e5ebe.tar
gsoc2013-evolution-b1bfee4db1eed475d5528a5179eea1f6435e5ebe.tar.gz
gsoc2013-evolution-b1bfee4db1eed475d5528a5179eea1f6435e5ebe.tar.bz2
gsoc2013-evolution-b1bfee4db1eed475d5528a5179eea1f6435e5ebe.tar.lz
gsoc2013-evolution-b1bfee4db1eed475d5528a5179eea1f6435e5ebe.tar.xz
gsoc2013-evolution-b1bfee4db1eed475d5528a5179eea1f6435e5ebe.tar.zst
gsoc2013-evolution-b1bfee4db1eed475d5528a5179eea1f6435e5ebe.zip
Implemented. (ok_clicked): Implemented. (cancel_clicked): Implemented.
2001-01-07 Jeffrey Stedfast <fejj@helixcode.com> * mail-account-editor.c (apply_clicked): Implemented. (ok_clicked): Implemented. (cancel_clicked): Implemented. (source_auth_type_changed): Implemented. (source_auth_init): Implemented. (transport_construct_authmenu): Implemented. (transport_type_changed): Updated to change regenerate the auth option menu. (construct): Attached callbacks to OK, Apply and Cancel buttons. * mail-account-editor.c (source_auth_init): Use the new mail_config_check_service(). * mail-config-druid.c: Remove check_service() as it will be moved into mail-config. svn path=/trunk/; revision=7289
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog18
-rw-r--r--mail/mail-account-editor.c197
-rw-r--r--mail/mail-account-editor.h1
-rw-r--r--mail/mail-config-druid.c71
4 files changed, 203 insertions, 84 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8a8cfc050f..21f1cae416 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,21 @@
+2001-01-07 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * mail-account-editor.c (apply_clicked): Implemented.
+ (ok_clicked): Implemented.
+ (cancel_clicked): Implemented.
+ (source_auth_type_changed): Implemented.
+ (source_auth_init): Implemented.
+ (transport_construct_authmenu): Implemented.
+ (transport_type_changed): Updated to change regenerate the auth
+ option menu.
+ (construct): Attached callbacks to OK, Apply and Cancel buttons.
+
+ * mail-account-editor.c (source_auth_init): Use the new
+ mail_config_check_service().
+
+ * mail-config-druid.c: Remove check_service() as it will be moved
+ into mail-config.
+
2001-01-06 Christopher James Lahey <clahey@helixcode.com>
* message-list.c (message_list_select): Made it so that going to
diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c
index 1146485758..ec36a8fcab 100644
--- a/mail/mail-account-editor.c
+++ b/mail/mail-account-editor.c
@@ -86,6 +86,107 @@ mail_account_editor_finalise (GtkObject *obj)
}
static void
+apply_clicked (GtkWidget *widget, gpointer data)
+{
+ MailAccountEditor *editor = data;
+ const MailConfigAccount *account;
+ char *host, *pport;
+ CamelURL *url;
+ int port;
+
+ account = editor->account;
+
+ /* account name */
+ g_free (account->name);
+ account->name = g_strdup (gtk_entry_get_text (editor->account_name));
+
+ /* identity info */
+ g_free (account->id->name);
+ account->id->name = g_strdup (gtk_entry_get_text (editor->name));
+
+ g_free (account->id->address);
+ account->id->address = g_strdup (gtk_entry_get_text (editor->email));
+
+ g_free (account->id->reply_to);
+ account->id->reply_to = g_strdup (gtk_entry_get_text (editor->reply_to));
+
+ g_free (account->id->organization);
+ account->id->organization = g_strdup (gtk_entry_get_text (editor->organization));
+
+ g_free (account->id->signature);
+ account->id->signature = gnome_file_entry_get_full_path (editor->signature, TRUE);
+
+ /* source */
+ url = camel_url_new (account->source->url, NULL);
+
+ g_free (url->user);
+ url->user = g_strdup (gtk_entry_get_text (editor->source_user));
+
+ g_free (url->passwd);
+ url->passwd = g_strdup (gtk_entry_get_text (editor->source_passwd));
+
+ g_free (url->authmech);
+ url->authmech = g_strdup (gtk_object_get_data (GTK_OBJECT (editor), "source_authmech"));
+
+ g_free (url->host);
+ host = g_strdup (gtk_entry_get_text (editor->source_host));
+ if (host && (pport = strchr (host, ':'))) {
+ *pport = '\0';
+ port = atoi (pport + 1);
+ } else {
+ port = 0;
+ }
+ url->host = host;
+ url->port = port;
+
+ g_free (account->source->url);
+ account->source->url = camel_url_to_string (url);
+ camel_url_free (url);
+
+ account->source->save_passwd = GTK_TOGGLE_BUTTON (editor->save_passwd)->active;
+ account->source->keep_on_server = GTK_TOGGLE_BUTTON (editor->keep_on_server)->active;
+
+ /* transport */
+ url = camel_url_new (account->transport->url, NULL);
+
+ g_free (url->authmech);
+ url->authmech = g_strdup (gtk_object_get_data (GTK_OBJECT (editor), "transport_authmech"));
+
+ g_free (url->host);
+ host = g_strdup (gtk_entry_get_text (editor->transport_host));
+ if (host && (pport = strchr (host, ':'))) {
+ *pport = '\0';
+ port = atoi (pport + 1);
+ } else {
+ port = 0;
+ }
+ url->host = host;
+ url->port = port;
+
+ g_free (account->transport->url);
+ account->transport->url = camel_url_to_string (url);
+ camel_url_free (url);
+}
+
+static void
+ok_clicked (GtkWidget *widget, gpointer data)
+{
+ MailAccountEditor *editor = data;
+
+ apply_clicked (widget, data);
+
+ gtk_widget_destroy (GTK_WIDGET (editor));
+}
+
+static void
+cancel_clicked (GtkWidget *widget, gpointer data)
+{
+ MailAccountEditor *editor = data;
+
+ gtk_widget_destroy (GTK_WIDGET (editor));
+}
+
+static void
source_auth_type_changed (GtkWidget *widget, gpointer user_data)
{
MailAccountEditor *editor = user_data;
@@ -116,7 +217,7 @@ source_auth_init (MailAccountEditor *editor, CamelURL *url)
gtk_option_menu_set_menu (editor->source_auth, menu);
/* If we can't connect, don't let them continue. */
- if (!check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
+ if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
return;
}
@@ -136,7 +237,7 @@ source_auth_init (MailAccountEditor *editor, CamelURL *url)
gtk_menu_append (GTK_MENU (menu), item);
- if (!g_strcasecmp (authtype->authproto, url->authmech))
+ if (url->authmech && !g_strcasecmp (authtype->authproto, url->authmech))
authmech = item;
}
@@ -146,6 +247,64 @@ source_auth_init (MailAccountEditor *editor, CamelURL *url)
}
static void
+transport_auth_type_changed (GtkWidget *widget, gpointer user_data)
+{
+ MailAccountEditor *editor = user_data;
+ CamelServiceAuthType *authtype;
+ gboolean sensitive;
+
+ authtype = gtk_object_get_data (GTK_OBJECT (widget), "authtype");
+
+ gtk_object_set_data (GTK_OBJECT (editor), "transport_authmech", authtype->authproto);
+}
+
+static void
+transport_construct_authmenu (MailAccountEditor *editor, CamelURL *url)
+{
+ GtkWidget *first = NULL, *preferred = NULL;
+ GtkWidget *menu, *item;
+ CamelServiceAuthType *authtype;
+ GList *authtypes = NULL;
+
+ menu = gtk_menu_new ();
+ gtk_option_menu_set_menu (editor->transport_auth, menu);
+
+ /* If we can't connect, don't let them continue. */
+ if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, &authtypes)) {
+ return;
+ }
+
+ if (authtypes) {
+ GList *l;
+
+ menu = gtk_menu_new ();
+ l = authtypes;
+ while (l) {
+ authtype = l->data;
+
+ item = gtk_menu_item_new_with_label (authtype->name);
+ gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype);
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ GTK_SIGNAL_FUNC (transport_auth_type_changed),
+ editor);
+
+ gtk_menu_append (GTK_MENU (menu), item);
+
+ if (!first)
+ first = item;
+
+ if (url->authmech && !g_strcasecmp (authtype->authproto, url->authmech))
+ preferred = item;
+ }
+ }
+
+ if (preferred)
+ gtk_signal_emit_by_name (GTK_OBJECT (preferred), "activate", editor);
+ else if (first)
+ gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", editor);
+}
+
+static void
transport_type_changed (GtkWidget *widget, gpointer user_data)
{
MailAccountEditor *editor = user_data;
@@ -161,12 +320,20 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_host), FALSE);
/* auth */
- if (provider->url_flags & CAMEL_URL_ALLOW_AUTH)
+ if (provider->url_flags & CAMEL_URL_ALLOW_AUTH) {
+ CamelURL *url;
+
gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_auth_type), TRUE);
- else
+
+ /* regen the auth list */
+ url = g_new0 (CamelURL, 1);
+ url->protocol = g_strdup (provider->protocol);
+ url->host = g_strdup (gtk_entry_get_text (editor->transport_host));
+ transport_contstruct_authmenu (editor, url);
+ camel_url_free (url);
+ } else {
gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_auth_type), FALSE);
-
- /* FIXME: regen the auth list */
+ }
}
static void
@@ -211,13 +378,6 @@ transport_type_init (MailAccountEditor *editor, CamelURL *url)
}
static void
-transport_auth_init (MailAccountEditor *editor, CamelURL *url)
-{
- /* FIXME: look through the options and select the prefered authmech */
- ;
-}
-
-static void
construct (MailAccountEditor *editor, const MailConfigAccount *account)
{
GladeXML *gui;
@@ -238,6 +398,16 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account)
GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_APPLY,
GNOME_STOCK_BUTTON_CANCEL);
+ gnome_dialog_button_connect (GNOME_DIALOG (editor), 0 /* OK */,
+ GTK_SIGNAL_FUNC (ok_clicked),
+ editor);
+ gnome_dialog_button_connect (GNOME_DIALOG (editor), 1 /* APPLY */,
+ GTK_SIGNAL_FUNC (apply_clicked),
+ editor);
+ gnome_dialog_button_connect (GNOME_DIALOG (editor), 2 /* CANCEL */,
+ GTK_SIGNAL_FUNC (cancel_clicked),
+ editor);
+
/* General */
editor->account_name = GTK_ENTRY (glade_xml_get_widget (gui, "txtAccountName"));
gtk_entry_set_text (editor->account_name, account->name);
@@ -296,7 +466,6 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account)
editor->transport_ssl = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkTransportSSL"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->transport_ssl), account->transport->use_ssl);
transport_type_init (editor, url);
- transport_auth_init (editor, url);
camel_url_free (url);
editor->account = account;
diff --git a/mail/mail-account-editor.h b/mail/mail-account-editor.h
index f439275901..5694e5320d 100644
--- a/mail/mail-account-editor.h
+++ b/mail/mail-account-editor.h
@@ -66,7 +66,6 @@ struct _MailAccountEditor {
GtkOptionMenu *transport_auth;
GtkCheckButton *transport_ssl;
- GtkSpinButton *auto_mail_check;
GtkCheckButton *keep_on_server;
const CamelProvider *transport;
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 4c8ada2aa5..511e162bd6 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -36,8 +36,6 @@ static void mail_config_druid_finalise (GtkObject *obj);
static void construct_auth_menu (MailConfigDruid *druid, GList *authtypes);
-static gboolean check_service (CamelURL *url, CamelProviderType type, GList **authtypes);
-
static GtkWindowClass *parent_class;
GtkType
@@ -324,7 +322,7 @@ incoming_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
url->path = mail_config_druid_get_incoming_path (config);
/* If we can't connect, don't let them continue. */
- if (!check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
+ if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
camel_url_free (url);
return TRUE;
}
@@ -509,7 +507,7 @@ transport_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
url->host = mail_config_druid_get_outgoing_hostname (config);
/* If we can't connect, don't let them continue. */
- if (!check_service (url, CAMEL_PROVIDER_TRANSPORT, NULL)) {
+ if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, NULL)) {
camel_url_free (url);
return TRUE;
}
@@ -736,71 +734,6 @@ construct (MailConfigDruid *druid)
gnome_druid_set_buttons_sensitive (druid->druid, FALSE, TRUE, TRUE);
}
-/* Async service-checking/authtype-lookup code. */
-
-typedef struct {
- char *url;
- CamelProviderType type;
- GList **authtypes;
- gboolean success;
-} check_service_input_t;
-
-static char *
-describe_check_service (gpointer in_data, gboolean gerund)
-{
- if (gerund)
- return g_strdup (_("Connecting to server"));
- else
- return g_strdup (_("Connect to server"));
-}
-
-static void
-do_check_service (gpointer in_data, gpointer op_data, CamelException *ex)
-{
- check_service_input_t *input = in_data;
- CamelService *service;
-
- if (input->authtypes) {
- service = camel_session_get_service (
- session, input->url, input->type, ex);
- if (!service)
- return;
- *input->authtypes = camel_service_query_auth_types (service, ex);
- } else {
- service = camel_session_get_service_connected (
- session, input->url, input->type, ex);
- }
- if (service)
- camel_object_unref (CAMEL_OBJECT (service));
- if (!camel_exception_is_set (ex))
- input->success = TRUE;
-}
-
-static const mail_operation_spec op_check_service = {
- describe_check_service,
- 0,
- NULL,
- do_check_service,
- NULL
-};
-
-static gboolean
-check_service (CamelURL *url, CamelProviderType type, GList **authtypes)
-{
- check_service_input_t input;
-
- input.url = camel_url_to_string (url, TRUE);
- input.type = type;
- input.authtypes = authtypes;
- input.success = FALSE;
-
- mail_operation_queue (&op_check_service, &input, FALSE);
- mail_operation_wait_for_finish ();
- g_free (input.url);
-
- return input.success;
-}
-
MailConfigDruid *
mail_config_druid_new ()
{