aboutsummaryrefslogtreecommitdiffstats
path: root/mail
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
parent016bfe6a735a8f5b2b31731795d4812cbdaf8f7a (diff)
downloadgsoc2013-evolution-cdd8a5be80319480840cb62521ee157b41319950.tar
gsoc2013-evolution-cdd8a5be80319480840cb62521ee157b41319950.tar.gz
gsoc2013-evolution-cdd8a5be80319480840cb62521ee157b41319950.tar.bz2
gsoc2013-evolution-cdd8a5be80319480840cb62521ee157b41319950.tar.lz
gsoc2013-evolution-cdd8a5be80319480840cb62521ee157b41319950.tar.xz
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')
-rw-r--r--mail/ChangeLog27
-rw-r--r--mail/mail-account-editor.c9
-rw-r--r--mail/mail-account-gui.c5
-rw-r--r--mail/mail-accounts.c116
-rw-r--r--mail/mail-config-druid.c5
-rw-r--r--mail/mail-config.c5
-rw-r--r--mail/mail-config.h4
7 files changed, 109 insertions, 62 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6ad2e81963..bdb5541c33 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,30 @@
+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.
+
2001-11-05 <NotZed@Ximian.com>
* message-browser.c (set_bonobo_ui): Override the Move/Copy
diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c
index 01dc21eae6..893cdd7426 100644
--- a/mail/mail-account-editor.c
+++ b/mail/mail-account-editor.c
@@ -111,9 +111,6 @@ apply_changes (MailAccountEditor *editor)
if (mail_account_gui_save (editor->gui) == FALSE)
return FALSE;
- /* FIXME: uh, what the hell is this for? */
- account = editor->gui->account;
-
/* save any changes we may have */
mail_config_write ();
@@ -162,7 +159,7 @@ construct (MailAccountEditor *editor, MailConfigAccount *account)
/* give our dialog an OK button and title */
gtk_window_set_title (GTK_WINDOW (editor), _("Evolution Account Editor"));
gtk_window_set_policy (GTK_WINDOW (editor), FALSE, TRUE, TRUE);
- gtk_window_set_modal (GTK_WINDOW (editor), TRUE);
+ gtk_window_set_modal (GTK_WINDOW (editor), FALSE);
gnome_dialog_append_buttons (GNOME_DIALOG (editor),
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_APPLY,
@@ -188,9 +185,9 @@ MailAccountEditor *
mail_account_editor_new (MailConfigAccount *account)
{
MailAccountEditor *new;
-
+
new = (MailAccountEditor *) gtk_type_new (mail_account_editor_get_type ());
construct (new, account);
-
+
return new;
}
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 3445b5cd60..4f42b960a1 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -503,6 +503,7 @@ service_check_supported (GtkButton *button, gpointer user_data)
MailConfigService *service;
GList *authtypes = NULL;
GtkWidget *authitem;
+ GtkWidget *window;
service = g_new0 (MailConfigService, 1);
@@ -516,7 +517,9 @@ service_check_supported (GtkButton *button, gpointer user_data)
gsvc->authitem = authitem;
- if (mail_config_check_service (service->url, gsvc->provider_type, &authtypes)) {
+ window = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW);
+
+ if (mail_config_check_service (service->url, gsvc->provider_type, &authtypes, GTK_WINDOW (window))) {
build_auth_menu (gsvc, gsvc->provider->authtypes, authtypes, TRUE);
if (!authtypes) {
/* provider doesn't support any authtypes */
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?"),
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 08e77db626..41d272a626 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -592,16 +592,15 @@ construct (MailConfigDruid *druid)
/* get our toplevel widget and reparent it */
widget = glade_xml_get_widget (druid->xml, "druid");
gtk_widget_reparent (widget, GTK_WIDGET (druid));
-
+
druid->druid = GNOME_DRUID (widget);
/* set window title */
gtk_window_set_title (GTK_WINDOW (druid), _("Evolution Account Assistant"));
gtk_window_set_policy (GTK_WINDOW (druid), FALSE, TRUE, FALSE);
- gtk_window_set_modal (GTK_WINDOW (druid), TRUE);
+ gtk_window_set_modal (GTK_WINDOW (druid), FALSE);
gtk_object_set (GTK_OBJECT (druid), "type", GTK_WINDOW_DIALOG, NULL);
-
druid->listener = bonobo_listener_new (NULL, NULL);
gtk_signal_connect (GTK_OBJECT (druid->listener), "event-notify",
GTK_SIGNAL_FUNC (wizard_listener_event), druid);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index c2a0472530..bdda99103b 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1948,7 +1948,7 @@ check_cancelled (GnomeDialog *dialog, int button, gpointer data)
* Return value: %TRUE on success or %FALSE on error.
**/
gboolean
-mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes)
+mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes, GtkWindow *window)
{
gboolean ret = FALSE;
struct _check_msg *m;
@@ -1967,13 +1967,14 @@ mail_config_check_service (const char *url, CamelProviderType type, GList **auth
dialog = gnome_dialog_new (_("Connecting to server..."),
GNOME_STOCK_BUTTON_CANCEL,
NULL);
+ gnome_dialog_set_parent (GNOME_DIALOG (dialog), window);
label = gtk_label_new (_("Connecting to server..."));
gtk_box_pack_start (GTK_BOX(GNOME_DIALOG (dialog)->vbox),
label, TRUE, TRUE, 10);
gnome_dialog_set_close (GNOME_DIALOG (dialog), FALSE);
gtk_signal_connect (GTK_OBJECT (dialog), "clicked",
GTK_SIGNAL_FUNC (check_cancelled), &id);
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_modal (GTK_WINDOW (dialog), FALSE);
gtk_widget_show_all (dialog);
mail_msg_wait(id);
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 367f7f217e..66bdfd4b1b 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -23,7 +23,7 @@
#ifndef MAIL_CONFIG_H
#define MAIL_CONFIG_H
-#include <glib.h>
+#include <gtk/gtk.h>
#include <camel/camel.h>
#ifdef __cplusplus
@@ -205,7 +205,7 @@ GSList *mail_config_get_sources (void);
/* static utility functions */
char *mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix);
-gboolean mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes);
+gboolean mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes, GtkWindow *window);