From a47f11a04b6acab3bcf40edd6f531d5d68c7f02a Mon Sep 17 00:00:00 2001 From: Sushma Rai Date: Wed, 7 Jun 2006 07:04:44 +0000 Subject: Enabling the OK button only when the username is entered, fixes #317025. svn path=/trunk/; revision=32086 --- .../exchange-folder-subscription.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'plugins/exchange-operations/exchange-folder-subscription.c') diff --git a/plugins/exchange-operations/exchange-folder-subscription.c b/plugins/exchange-operations/exchange-folder-subscription.c index babaa2bc95..122366d9fb 100644 --- a/plugins/exchange-operations/exchange-folder-subscription.c +++ b/plugins/exchange-operations/exchange-folder-subscription.c @@ -131,6 +131,18 @@ folder_name_entry_changed_callback (GtkEditable *editable, gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, TRUE); } +static void +user_name_entry_changed_callback (GtkEditable *editable, void *data) +{ + GtkDialog *dialog = GTK_DIALOG (data); + const char *user_name_text = gtk_entry_get_text (GTK_ENTRY (editable)); + + if (*user_name_text == '\0') + gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, FALSE); + else + gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, TRUE); +} + static void setup_server_option_menu (GladeXML *glade_xml, gchar *mail_account) { @@ -263,7 +275,7 @@ create_folder_subscription_dialog (ExchangeAccount *account, gchar *fname) { ENameSelector *name_selector; GladeXML *glade_xml; - GtkWidget *dialog; + GtkWidget *dialog, *ok_button; SubscriptionInfo *subscription_info; subscription_info = g_new0 (SubscriptionInfo, 1); @@ -281,6 +293,12 @@ create_folder_subscription_dialog (ExchangeAccount *account, gchar *fname) subscription_info->name_selector_widget = setup_name_selector (glade_xml, &name_selector); subscription_info->name_selector = name_selector; gtk_widget_grab_focus (subscription_info->name_selector_widget); + + ok_button = glade_xml_get_widget (glade_xml, "button1"); + gtk_widget_set_sensitive (ok_button, FALSE); + g_signal_connect (subscription_info->name_selector_widget, "changed", + G_CALLBACK (user_name_entry_changed_callback), dialog); + setup_server_option_menu (glade_xml, account->account_name); setup_folder_name_combo (glade_xml, fname); subscription_info->folder_name_entry = glade_xml_get_widget (glade_xml, "folder-name-entry"); -- cgit v1.2.3