From 41a4ef665287d566fbb4de0d96ec148a0750bf24 Mon Sep 17 00:00:00 2001 From: "simon.zheng" Date: Tue, 22 Aug 2006 09:58:10 +0000 Subject: ** Fixes for bug #352108 2006-08-22 simon.zheng ** Fixes for bug #352108 * em-account-editor.c: (emae_service_url_path_changed), (emae_path_changed), (emae_setup_service): Replace widget GnomeFileEntry by GtkFileButton. svn path=/trunk/; revision=32624 --- mail/ChangeLog | 9 +++++++++ mail/em-account-editor.c | 50 +++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 69cec633be..5efa4bba18 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +2006-08-22 simon.zheng + + ** Fixes for bug #352108 + + * em-account-editor.c: (emae_service_url_path_changed), + (emae_path_changed), + (emae_setup_service): + Replace widget GnomeFileEntry by GtkFileButton. + 2006-08-21 Matthew Barnes * mail-send-recv.c: diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 0a5b93a995..80ca0bf043 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -1135,6 +1135,39 @@ emae_uri_changed(EMAccountEditorService *service, CamelURL *url) static void emae_service_url_changed(EMAccountEditorService *service, void (*setval)(CamelURL *, const char *), GtkEntry *entry) +{ + GtkComboBox *dropdown; + int id; + GtkTreeModel *model; + GtkTreeIter iter; + CamelServiceAuthType *authtype; + + CamelURL *url = emae_account_url(service->emae, emae_service_info[service->type].account_uri_key); + const char *text = gtk_entry_get_text(entry); + + setval(url, (text && text[0])?text:NULL); + + if (text && text[0] && setval == camel_url_set_user) { + dropdown = service->authtype; + if(dropdown) { + id = gtk_combo_box_get_active (dropdown); + if (id != -1) { + model = gtk_combo_box_get_model (dropdown); + if (gtk_tree_model_iter_nth_child (model, &iter, NULL, id)) { + gtk_tree_model_get (model, &iter, 1, &authtype, -1); + if (authtype) + camel_url_set_authmech (url, authtype->authproto); + } + } + } + } + + emae_uri_changed(service, url); + camel_url_free(url); +} + +static void +emae_service_url_path_changed(EMAccountEditorService *service, void (*setval)(CamelURL *, const char *), GtkWidget *widget) { GtkComboBox *dropdown; int id; @@ -1143,7 +1176,7 @@ emae_service_url_changed(EMAccountEditorService *service, void (*setval)(CamelUR CamelServiceAuthType *authtype; CamelURL *url = emae_account_url(service->emae, emae_service_info[service->type].account_uri_key); - const char *text = gtk_entry_get_text(entry); + const char *text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); setval(url, (text && text[0])?text:NULL); @@ -1179,9 +1212,9 @@ emae_username_changed(GtkEntry *entry, EMAccountEditorService *service) } static void -emae_path_changed(GtkEntry *entry, EMAccountEditorService *service) +emae_path_changed(GtkWidget *widget, EMAccountEditorService *service) { - emae_service_url_changed(service, camel_url_set_path, entry); + emae_service_url_path_changed(service, camel_url_set_path, widget); } static int @@ -1609,8 +1642,7 @@ emae_setup_service(EMAccountEditor *emae, EMAccountEditorService *service, Glade service->hostlabel = (GtkLabel *)glade_xml_get_widget (xml, info->hostlabel); service->username = GTK_ENTRY (glade_xml_get_widget (xml, info->username)); service->userlabel = (GtkLabel *)glade_xml_get_widget (xml, info->userlabel); - if (info->path) { - service->path = GTK_ENTRY (glade_xml_get_widget (xml, info->path)); + if (info->pathentry) { service->pathlabel = (GtkLabel *)glade_xml_get_widget(xml, info->pathlabel); service->pathentry = glade_xml_get_widget(xml, info->pathentry); } @@ -1633,8 +1665,8 @@ emae_setup_service(EMAccountEditor *emae, EMAccountEditorService *service, Glade } if (url->user) gtk_entry_set_text(service->username, url->user); - if (service->path && url->path) - gtk_entry_set_text(service->path, url->path); + if (service->pathentry && url->path) + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (service->path), url->path); tmp = camel_url_get_param(url, "use_ssl"); if (tmp == NULL) @@ -1649,8 +1681,8 @@ emae_setup_service(EMAccountEditor *emae, EMAccountEditorService *service, Glade g_signal_connect (service->hostname, "changed", G_CALLBACK (emae_hostname_changed), service); g_signal_connect (service->username, "changed", G_CALLBACK (emae_username_changed), service); - if (service->path) - g_signal_connect (service->path, "changed", G_CALLBACK (emae_path_changed), service); + if (service->pathentry) + g_signal_connect (GTK_FILE_CHOOSER (service->pathentry), "selection-changed", G_CALLBACK (emae_path_changed), service); g_signal_connect(service->use_ssl, "changed", G_CALLBACK(emae_ssl_changed), service); -- cgit v1.2.3