aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-accounts.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-11-06 07:10:12 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-11-06 07:10:12 +0800
commitcdd8a5be80319480840cb62521ee157b41319950 (patch)
treeea5c22c2648bc5246a15fb33d9809e5991855b52 /mail/mail-accounts.c
parent016bfe6a735a8f5b2b31731795d4812cbdaf8f7a (diff)
downloadgsoc2013-evolution-cdd8a5be80319480840cb62521ee157b41319950.tar.gz
gsoc2013-evolution-cdd8a5be80319480840cb62521ee157b41319950.tar.zst
gsoc2013-evolution-cdd8a5be80319480840cb62521ee157b41319950.zip
Don't make the account editor modal either.
2001-11-05 Jeffrey Stedfast <fejj@ximian.com> * mail-account-editor.c (construct): Don't make the account editor modal either. * mail-accounts.c (mail_add): Use the new global account druid variable so that we can avoid having more than a single druid at a time. If a druid already exists, bring it to the top. (mail_edit): Same idea only for the account editor this time. (mail_editor_destroyed): Set the global editor to NULL. (mail_add_finished): Set the global druid to NULL. (mail_delete): Don't allow any deletes if an account editor is opened (we don't want to be able to delete the account we are editing...) (news_edit): Same thing for the news editor. (news_editor_destroyed): Set the news editor to NULL. (news_add): And again for the news add. * mail-account-gui.c (service_check_supported): Updated to pass a GtkWindow argument to mail_config_check_service(). * mail-config.c (mail_config_check_service): Now takes a GtkWindow argument so we can set our parent window. Also, don't make this dialog modal either. * mail-config-druid.c (construct): Don't make this druid modal. svn path=/trunk/; revision=14598
Diffstat (limited to 'mail/mail-accounts.c')
-rw-r--r--mail/mail-accounts.c116
1 files changed, 68 insertions, 48 deletions
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index de022a9176..3e2452db0f 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -54,6 +54,11 @@ static void mail_accounts_dialog_init (MailAccountsDialog *dialog);
static void mail_accounts_dialog_finalise (GtkObject *obj);
static void mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data);
+static MailConfigDruid *druid = NULL;
+static MailAccountEditor *editor = NULL;
+#ifdef ENABLE_NNTP
+static MailAccountEditorNews *news_editor = NULL;
+#endif
static GnomeDialogClass *parent_class;
@@ -201,7 +206,7 @@ mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gp
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE);
-
+
/*
* If an insensitive button in a button box has the focus, and if you hit tab,
* there is a segfault. I think that this might be a gtk bug. Anyway, this
@@ -218,25 +223,30 @@ mail_add_finished (GtkWidget *widget, gpointer data)
dialog->accounts = mail_config_get_accounts ();
load_accounts (dialog);
+ druid = NULL;
}
static void
mail_add (GtkButton *button, gpointer data)
{
MailAccountsDialog *dialog = data;
- MailConfigDruid *druid;
- druid = mail_config_druid_new (dialog->shell);
- gtk_signal_connect (GTK_OBJECT (druid), "destroy",
- GTK_SIGNAL_FUNC (mail_add_finished), dialog);
-
- gtk_widget_show (GTK_WIDGET (druid));
+ if (druid == NULL) {
+ druid = mail_config_druid_new (dialog->shell);
+ gtk_signal_connect (GTK_OBJECT (druid), "destroy",
+ GTK_SIGNAL_FUNC (mail_add_finished), dialog);
+
+ gtk_widget_show (GTK_WIDGET (druid));
+ } else {
+ gdk_window_raise (GTK_WIDGET (druid)->window);
+ }
}
static void
mail_editor_destroyed (GtkWidget *widget, gpointer data)
{
load_accounts (MAIL_ACCOUNTS_DIALOG (data));
+ editor = NULL;
}
static void
@@ -244,17 +254,20 @@ mail_edit (GtkButton *button, gpointer data)
{
MailAccountsDialog *dialog = data;
- if (dialog->accounts_row >= 0) {
- MailConfigAccount *account;
- MailAccountEditor *editor;
-
- account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row);
- editor = mail_account_editor_new (account);
- gnome_dialog_set_parent (GNOME_DIALOG (editor), GTK_WINDOW (dialog));
- gtk_signal_connect (GTK_OBJECT (editor), "destroy",
- GTK_SIGNAL_FUNC (mail_editor_destroyed),
- dialog);
- gtk_widget_show (GTK_WIDGET (editor));
+ if (editor == NULL) {
+ if (dialog->accounts_row >= 0) {
+ MailConfigAccount *account;
+
+ account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row);
+ editor = mail_account_editor_new (account);
+ gnome_dialog_set_parent (GNOME_DIALOG (editor), GTK_WINDOW (dialog));
+ gtk_signal_connect (GTK_OBJECT (editor), "destroy",
+ GTK_SIGNAL_FUNC (mail_editor_destroyed),
+ dialog);
+ gtk_widget_show (GTK_WIDGET (editor));
+ }
+ } else {
+ gdk_window_raise (GTK_WIDGET (editor)->window);
}
}
@@ -273,7 +286,8 @@ mail_delete (GtkButton *button, gpointer data)
GnomeDialog *confirm;
int ans;
- if (dialog->accounts_row < 0)
+ /* make sure we have a valid account selected and that we aren't editing anything... */
+ if (dialog->accounts_row < 0 || editor != NULL)
return;
confirm = GNOME_DIALOG (gnome_message_box_new (_("Are you sure you want to delete this account?"),
@@ -343,7 +357,7 @@ mail_able (GtkButton *button, gpointer data)
{
MailAccountsDialog *dialog = data;
const MailConfigAccount *account;
-
+
if (dialog->accounts_row >= 0) {
int row;
@@ -387,9 +401,9 @@ load_news (MailAccountsDialog *dialog)
url = camel_url_new (service->url, NULL);
else
url = NULL;
-
+
text[0] = g_strdup_printf ("%s", url && url->host ? url->host : _("None"));
-
+
if (url)
camel_url_free (url);
@@ -432,31 +446,33 @@ static void
news_editor_destroyed (GtkWidget *widget, gpointer data)
{
load_news (MAIL_ACCOUNTS_DIALOG (data));
+ news_editor = NULL;
}
-
static void
news_edit (GtkButton *button, gpointer data)
{
MailAccountsDialog *dialog = data;
- if (dialog->news_row >= 0) {
- MailConfigService *service;
- MailAccountEditorNews *editor;
-
- service = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row);
- editor = mail_account_editor_news_new (service);
- gtk_signal_connect (GTK_OBJECT (editor), "destroy",
- GTK_SIGNAL_FUNC (news_editor_destroyed),
- dialog);
- gtk_widget_show (GTK_WIDGET (editor));
+ if (news_editor == NULL) {
+ if (dialog->news_row >= 0) {
+ MailConfigService *service;
+
+ service = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row);
+ news_editor = mail_account_editor_news_new (service);
+ gtk_signal_connect (GTK_OBJECT (news_editor), "destroy",
+ GTK_SIGNAL_FUNC (news_editor_destroyed),
+ dialog);
+ gtk_widget_show (GTK_WIDGET (news_editor));
+ }
+ } else {
+ gdk_window_raise (GTK_WIDGET (news_editor)->window);
}
}
static void
news_add_destroyed (GtkWidget *widget, gpointer data)
{
-
gpointer *send = data;
MailAccountsDialog *dialog;
MailConfigService *service;
@@ -480,21 +496,24 @@ news_add (GtkButton *button, gpointer data)
{
MailAccountsDialog *dialog = data;
MailConfigService *service;
- MailAccountEditorNews *editor;
gpointer *send;
- send = g_new(gpointer, 2);
-
- service = g_new0 (MailConfigService, 1);
- service->url = NULL;
-
- editor = mail_account_editor_news_new (service);
- send[0] = service;
- send[1] = dialog;
- gtk_signal_connect (GTK_OBJECT (editor), "destroy",
- GTK_SIGNAL_FUNC (news_add_destroyed),
- send);
- gtk_widget_show (GTK_WIDGET (editor));
+ if (news_editor == NULL) {
+ send = g_new (gpointer, 2);
+
+ service = g_new0 (MailConfigService, 1);
+ service->url = NULL;
+
+ news_editor = mail_account_editor_news_new (service);
+ send[0] = service;
+ send[1] = dialog;
+ gtk_signal_connect (GTK_OBJECT (news_editor), "destroy",
+ GTK_SIGNAL_FUNC (news_add_destroyed),
+ send);
+ gtk_widget_show (GTK_WIDGET (news_editor));
+ } else {
+ gdk_window_raise (GTK_WIDGET (news_editor)->window);
+ }
}
static void
@@ -506,7 +525,8 @@ news_delete (GtkButton *button, gpointer data)
GtkWidget *label;
int ans;
- if (dialog->news_row < 0)
+ /* don't allow user to delete an account if he might be editing it */
+ if (dialog->news_row < 0 || news_editor != NULL)
return;
confirm = GNOME_DIALOG (gnome_dialog_new (_("Are you sure you want to delete this news account?"),