aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Williams <peterw@src.gnome.org>2000-08-28 22:36:26 +0800
committerPeter Williams <peterw@src.gnome.org>2000-08-28 22:36:26 +0800
commit906a178ce8264e7848330d5244639c0c2d856aee (patch)
treeee996ea73f2867a65bebf8e212daaabf85a16c87
parent09a9a8cd34cbeeef5ce1902e7f0ab7d8c2584053 (diff)
downloadgsoc2013-evolution-906a178ce8264e7848330d5244639c0c2d856aee.tar
gsoc2013-evolution-906a178ce8264e7848330d5244639c0c2d856aee.tar.gz
gsoc2013-evolution-906a178ce8264e7848330d5244639c0c2d856aee.tar.bz2
gsoc2013-evolution-906a178ce8264e7848330d5244639c0c2d856aee.tar.lz
gsoc2013-evolution-906a178ce8264e7848330d5244639c0c2d856aee.tar.xz
gsoc2013-evolution-906a178ce8264e7848330d5244639c0c2d856aee.tar.zst
gsoc2013-evolution-906a178ce8264e7848330d5244639c0c2d856aee.zip
Goodbye, GDK_THREADS!
svn path=/trunk/; revision=5074
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-callbacks.c12
-rw-r--r--mail/mail-config-gui.c10
-rw-r--r--mail/mail-display.c7
-rw-r--r--mail/mail-local.c2
-rw-r--r--mail/mail-ops.c2
-rw-r--r--mail/mail-threads.c77
-rw-r--r--mail/mail-tools.c2
-rw-r--r--mail/mail.h7
-rw-r--r--mail/main.c5
-rw-r--r--mail/session.c2
11 files changed, 31 insertions, 102 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 580495a31a..fd9ab2082b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2000-08-28 Peter Williams <peterw@helixcode.com>
+
+ * *.c: s,mail_dialog_run,gnome_dialog_run,g.
+
+ * main.c (main): Since only the main thread is dealing with GTK+,
+ free the GDK threads mutex and never worry about locking again.
+
2000-08-28 Jeffrey Stedfast <fejj@helixcode.com>
* mail-crypto.c (mail_crypto_openpgp_encrypt): Fix to prevent
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index c335315c34..90dd3d3ab9 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -84,7 +84,7 @@ check_send_configuration (FolderBrowser *fb)
"before you can compose mail."),
GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb),
GTK_TYPE_WINDOW)));
- mail_dialog_run_and_close (GNOME_DIALOG (message));
+ gnome_dialog_run_and_close (GNOME_DIALOG (message));
return FALSE;
}
@@ -97,7 +97,7 @@ check_send_configuration (FolderBrowser *fb)
"before you can compose mail."),
GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb),
GTK_TYPE_WINDOW)));
- mail_dialog_run_and_close (GNOME_DIALOG (message));
+ gnome_dialog_run_and_close (GNOME_DIALOG (message));
return FALSE;
}
@@ -111,7 +111,7 @@ check_send_configuration (FolderBrowser *fb)
"before you can compose mail."),
GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb),
GTK_TYPE_WINDOW)));
- mail_dialog_run_and_close (GNOME_DIALOG (message));
+ gnome_dialog_run_and_close (GNOME_DIALOG (message));
return FALSE;
}
@@ -186,7 +186,7 @@ ask_confirm_for_empty_subject (EMsgComposer *composer)
GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO,
NULL);
- button = mail_dialog_run_and_close (GNOME_DIALOG (message_box));
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (message_box));
if (button == 0)
return TRUE;
@@ -487,7 +487,7 @@ edit_msg (GtkWidget *widget, gpointer user_data)
message = gnome_warning_dialog (_("You may only edit messages saved\n"
"in the Drafts folder."));
- mail_dialog_run_and_close (GNOME_DIALOG (message));
+ gnome_dialog_run_and_close (GNOME_DIALOG (message));
return;
}
@@ -580,7 +580,7 @@ filter_edit (BonoboUIHandler *uih, void *user_data, const char *path)
dialog = gnome_warning_dialog (err);
g_free (err);
- mail_dialog_run_and_close (GNOME_DIALOG (dialog));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
return;
}
diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c
index 1770967014..58ec993e03 100644
--- a/mail/mail-config-gui.c
+++ b/mail/mail-config-gui.c
@@ -1275,7 +1275,7 @@ identity_dialog (const MailConfigIdentity *id, GtkWidget *parent)
GTK_SIGNAL_FUNC (iddialog_ok_clicked),
iddialog);
- mail_dialog_run_and_close (GNOME_DIALOG (iddialog->dialog));
+ gnome_dialog_run_and_close (GNOME_DIALOG (iddialog->dialog));
returnid = iddialog->id;
g_free (iddialog);
@@ -1372,7 +1372,7 @@ source_dialog (MailConfigService *source, GtkWidget *parent)
GTK_SIGNAL_FUNC (sdialog_ok_clicked),
sdialog);
- mail_dialog_run_and_close (GNOME_DIALOG (sdialog->dialog));
+ gnome_dialog_run_and_close (GNOME_DIALOG (sdialog->dialog));
returnsource = sdialog->source;
g_free (sdialog);
@@ -1468,7 +1468,7 @@ news_dialog (MailConfigService *source, GtkWidget *parent)
GTK_SIGNAL_FUNC (ndialog_ok_clicked),
ndialog);
- mail_dialog_run_and_close (GNOME_DIALOG (ndialog->dialog));
+ gnome_dialog_run_and_close (GNOME_DIALOG (ndialog->dialog));
returnsource = ndialog->source;
g_free (ndialog);
@@ -2203,7 +2203,7 @@ mail_config (Evolution_Shell shell)
GTK_SIGNAL_FUNC (mail_config_apply_clicked),
dialog);
- mail_dialog_run (GNOME_DIALOG (dialog->dialog));
+ gnome_dialog_run (GNOME_DIALOG (dialog->dialog));
/* Clean up */
gtk_object_unref (GTK_OBJECT (gui));
@@ -2283,7 +2283,7 @@ static void cleanup_test_service (gpointer in_data, gpointer op_data, CamelExcep
if (data->success) {
dlg = gnome_ok_dialog (_("The connection was successful!"));
- mail_dialog_run_and_close (GNOME_DIALOG (dlg));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
}
g_free (input->url);
diff --git a/mail/mail-display.c b/mail/mail-display.c
index ab42452cf3..d8b49c2128 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -58,12 +58,7 @@ write_data_to_file (CamelMimePart *part, const char *name, gboolean unique)
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4);
gtk_widget_show (text);
- /* This should be mail_dialog_run_and_close, but for some reason this
- * particular dialog will deadlock as it tries to GDK_THREADS_ENTER
- * (gtk_main_level is indeed 1). I think it has to do with being in
- * the file selection window. God this sucks.
- */
- if (gnome_dialog_run_and_close (GNOME_DIALOG (dlg)) != 0) /* !!! */
+ if (gnome_dialog_run_and_close (GNOME_DIALOG (dlg)) != 0)
return FALSE;
gtk_widget_destroy (dlg);
diff --git a/mail/mail-local.c b/mail/mail-local.c
index fe36fdcf3b..04ca6fe0d1 100644
--- a/mail/mail-local.c
+++ b/mail/mail-local.c
@@ -498,5 +498,5 @@ local_reconfigure_folder(FolderBrowser *fb)
gtk_signal_connect((GtkObject *)gd, "clicked", reconfigure_clicked, data);
gtk_object_unref((GtkObject *)gui);
- mail_dialog_run_and_close (GNOME_DIALOG (gd));
+ gnome_dialog_run_and_close (GNOME_DIALOG (gd));
}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 7703122388..851bc591de 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -167,7 +167,7 @@ cleanup_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex)
input->source_url);
dialog = gnome_ok_dialog (str);
g_free (str);
- mail_dialog_run_and_close (GNOME_DIALOG (dialog));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
g_free (input->source_url);
diff --git a/mail/mail-threads.c b/mail/mail-threads.c
index 6643b75615..d886a8a981 100644
--- a/mail/mail-threads.c
+++ b/mail/mail-threads.c
@@ -278,7 +278,7 @@ mail_operation_queue (const mail_operation_spec * spec, gpointer input,
g_free (msg);
gnome_dialog_set_close (GNOME_DIALOG (err_dialog),
TRUE);
- mail_dialog_run_and_close (GNOME_DIALOG (err_dialog));
+ gnome_dialog_run_and_close (GNOME_DIALOG (err_dialog));
g_warning ("Setup failed for `%s': %s",
clur->infinitive,
@@ -518,77 +518,6 @@ mail_operations_get_status (int *busy_return,
*message_return = current_message;
}
-/**
- * mail_dialog_run_and_close:
- *
- * A wrapper for gnome_dialog... that will Do The Right Thing
- * wrt the GDK lock.
- **/
-
-gint
-mail_dialog_run_and_close (GnomeDialog *dlg)
-{
- gint ret;
- gboolean unlock = FALSE;
-
- /*g_message ("DLG: IN: r_a_c");*/
-
- /*if (inside_read_msg || gtk_main_level() == 1)
- * GDK_THREADS_ENTER ();
- */
-
- if (gdk_threads_mutex && g_mutex_trylock (gdk_threads_mutex))
- unlock = TRUE;
-
- ret = gnome_dialog_run_and_close (dlg);
-
- /*if (inside_read_msg || gtk_main_level() == 1)
- * GDK_THREADS_LEAVE();
- */
-
- if (unlock)
- g_mutex_unlock (gdk_threads_mutex);
-
- /*g_message ("DLG: OUT: r_a_c");*/
-
- return ret;
-}
-
-/**
- * mail_dialog_run:
- *
- * Analogous to above.
- **/
-
-gint
-mail_dialog_run (GnomeDialog *dlg)
-{
- gint ret;
- gboolean unlock = FALSE;
-
- /*g_message ("DLG: IN: run");*/
-
- /*if (inside_read_msg || gtk_main_level() == 1)
- * GDK_THREADS_ENTER();
- */
-
- if (gdk_threads_mutex && g_mutex_trylock (gdk_threads_mutex))
- unlock = TRUE;
-
- ret = gnome_dialog_run (dlg);
-
- /*if (inside_read_msg || gtk_main_level() == 1)
- * GDK_THREADS_LEAVE();
- */
-
- if (unlock)
- g_mutex_unlock (gdk_threads_mutex);
-
- /*g_message ("DLG: OUT: run");*/
-
- return ret;
-}
-
/* ** Static functions **************************************************** */
static void check_dispatcher (void)
@@ -890,7 +819,7 @@ show_error (com_msg_t * msg)
* only GDK_THREADS_ENTER were recursive...
*/
- mail_dialog_run_and_close (GNOME_DIALOG (err_dialog));
+ gnome_dialog_run_and_close (GNOME_DIALOG (err_dialog));
/* Allow the other thread to proceed */
@@ -928,7 +857,7 @@ get_password (com_msg_t * msg)
button = -1;
} else {
*(msg->reply) = NULL;
- button = mail_dialog_run_and_close (GNOME_DIALOG (dialog));
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
if (button == 1 || *(msg->reply) == NULL) {
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 42eb6e1912..62da0dade8 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -668,7 +668,7 @@ mail_tool_uri_to_folder_noex (const char *uri)
camel_exception_get_description (&ex));
dialog = gnome_error_dialog (msg);
g_free (msg);
- mail_dialog_run_and_close (GNOME_DIALOG (dialog));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
diff --git a/mail/mail.h b/mail/mail.h
index b69f1376b4..b17107369e 100644
--- a/mail/mail.h
+++ b/mail/mail.h
@@ -99,13 +99,6 @@ void forget_passwords (BonoboUIHandler *uih, void *user_data,
const char *path);
extern CamelSession *session;
-/* mail-threads */
-/* These are NOT for the async thread. They handle locking
- * of GDK, which is a bit wacky when threads are enabled.
- */
-gint mail_dialog_run_and_close (GnomeDialog *dlg);
-gint mail_dialog_run (GnomeDialog *dlg);
-
/* message-list */
void vfolder_subject(GtkWidget *w, FolderBrowser *fb);
void vfolder_sender(GtkWidget *w, FolderBrowser *fb);
diff --git a/mail/main.c b/mail/main.c
index a88117b2c3..be35d52fd4 100644
--- a/mail/main.c
+++ b/mail/main.c
@@ -65,6 +65,11 @@ main (int argc, char *argv [])
signal (SIGSEGV, SIG_DFL);
signal (SIGBUS, SIG_DFL);
+ if (gdk_threads_mutex) {
+ g_mutex_free (gdk_threads_mutex);
+ gdk_threads_mutex = NULL;
+ }
+
GDK_THREADS_ENTER ();
bonobo_main ();
GDK_THREADS_LEAVE ();
diff --git a/mail/session.c b/mail/session.c
index 2d5a01a9d2..09416b0825 100644
--- a/mail/session.c
+++ b/mail/session.c
@@ -45,7 +45,7 @@ mail_request_dialog (const char *prompt, gboolean secret, const char *key,
request_callback, &ans, NULL);
if (!dialog)
return NULL;
- if (mail_dialog_run_and_close (GNOME_DIALOG (dialog)) == -1 ||
+ if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == -1 ||
ans == NULL)
return NULL;
} else {