[balsa/wip/gmime3: 97/197] Remove deprecated gdk_threads_* stuff
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/wip/gmime3: 97/197] Remove deprecated gdk_threads_* stuff
- Date: Wed, 23 May 2018 21:20:31 +0000 (UTC)
commit 4fb4d481630f2f944a2266cff5b39488b571fb36
Author: Albrecht Dreß <albrecht dress arcor de>
Date: Sat Sep 23 10:26:04 2017 -0400
Remove deprecated gdk_threads_* stuff
* configure.ac:
* libbalsa/address-view.c (lbav_ensure_blank_line):
* libbalsa/identity.c (sd_response_ok):
* libbalsa/information.c (libbalsa_information_idle_handler):
* libbalsa/libbalsa-gpgme-cb.c (get_passphrase_idle):
* libbalsa/libbalsa.c (ask_idle), (libbalsa_ask):
* libbalsa/libbalsa.h:
* libbalsa/mailbox.c (libbalsa_mailbox_close),
(libbalsa_mailbox_msgno_inserted),
(libbalsa_mailbox_msgno_filt_in), (libbalsa_mailbox_msgno_removed),
(libbalsa_mailbox_msgno_filt_out), (lbm_set_threading),
(mbox_set_sort_column_id), (libbalsa_mailbox_unlink_and_prepend),
(lbm_set_msg_tree), (libbalsa_mailbox_set_msg_tree):
* libbalsa/mailbox_imap.c (idle_unread_update_cb),
(imap_exists_idle):
* libbalsa/mailbox_local.c (lbm_local_restore_tree),
(lbml_load_messages_idle_cb),
(libbalsa_mailbox_local_set_threading):
* libbalsa/send.c:
* libinit_balsa/assistant_init.c (balsa_init_begin):
* src/balsa-app.c (ask_passwd_idle), (balsa_open_mailbox_list),
(balsa_find_mailbox), (balsa_find_dir):
* src/balsa-index.c (bndx_destroy),
(bndx_mailbox_row_inserted_idle), (balsa_index_load_mailbox_node),
(balsa_index_expunge):
* src/balsa-mblist.c (bmbl_set_property_node_style),
(balsa_mblist_close_lru_peer_mbx), (bmbl_sort_idle),
(balsa_mblist_mailbox_node_append):
* src/balsa-mime-widget-image.c (img_check_size):
* src/balsa-mime-widget-text.c (statusbar_pop):
* src/balsa-mime-widget.c (resize_idle):
* src/information-dialog.c (status_bar_refresh):
* src/mailbox-node.c (bmbn_scan_children_idle):
* src/main-window.c (bw_focus_idle), (mail_progress_notify_cb),
(bw_idle_replace), (bw_progress_timeout):
* src/main.c (initial_open_unread_mailboxes), (initial_open_inbox),
(balsa_get_stats), (scan_mailboxes_idle_cb), (periodic_expunge_cb),
(balsa_progress_set_fraction), (balsa_progress_set_activity),
(real_main), (handle_remote):
* src/message-window.c (message_window_idle_handler):
* src/pref-manager.c (open_preferences_manager_idle):
* src/save-restore.c (config_warning_idle):
* src/sendmsg-window.c (edit_with_gnome_check),
(sw_autosave_timeout_cb), (sw_grab_focus_to_text):
* src/spell-check.c (highlight_idle):
Signed-off-by: Peter Bloomfield <PeterBloomfield bellsouth net>
ChangeLog | 50 ++++++++++++++++++++++++++++++++++++++++
configure.ac | 13 ----------
libbalsa/address-view.c | 7 +----
libbalsa/identity.c | 2 -
libbalsa/information.c | 2 -
libbalsa/libbalsa-gpgme-cb.c | 2 -
libbalsa/libbalsa.c | 4 ---
libbalsa/libbalsa.h | 9 -------
libbalsa/mailbox.c | 32 +------------------------
libbalsa/mailbox_imap.c | 4 ---
libbalsa/mailbox_local.c | 14 +----------
libbalsa/send.c | 3 +-
libinit_balsa/assistant_init.c | 2 -
src/balsa-app.c | 17 -------------
src/balsa-index.c | 8 ------
src/balsa-mblist.c | 13 ----------
src/balsa-mime-widget-image.c | 6 ----
src/balsa-mime-widget-text.c | 3 --
src/balsa-mime-widget.c | 2 -
src/information-dialog.c | 4 ---
src/mailbox-node.c | 5 ----
src/main-window.c | 14 +----------
src/main.c | 22 +----------------
src/message-window.c | 4 ---
src/pref-manager.c | 5 ----
src/save-restore.c | 2 -
src/sendmsg-window.c | 8 ------
src/spell-check.c | 2 -
28 files changed, 56 insertions(+), 203 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0dcf05d..52efdfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,53 @@
+2017-09-23 Albrecht Dreß <albrecht dress arcor de>
+
+ Remove deprecated gdk_threads_* stuff
+
+ * configure.ac:
+ * libbalsa/address-view.c (lbav_ensure_blank_line):
+ * libbalsa/identity.c (sd_response_ok):
+ * libbalsa/information.c (libbalsa_information_idle_handler):
+ * libbalsa/libbalsa-gpgme-cb.c (get_passphrase_idle):
+ * libbalsa/libbalsa.c (ask_idle), (libbalsa_ask):
+ * libbalsa/libbalsa.h:
+ * libbalsa/mailbox.c (libbalsa_mailbox_close),
+ (libbalsa_mailbox_msgno_inserted),
+ (libbalsa_mailbox_msgno_filt_in), (libbalsa_mailbox_msgno_removed),
+ (libbalsa_mailbox_msgno_filt_out), (lbm_set_threading),
+ (mbox_set_sort_column_id), (libbalsa_mailbox_unlink_and_prepend),
+ (lbm_set_msg_tree), (libbalsa_mailbox_set_msg_tree):
+ * libbalsa/mailbox_imap.c (idle_unread_update_cb),
+ (imap_exists_idle):
+ * libbalsa/mailbox_local.c (lbm_local_restore_tree),
+ (lbml_load_messages_idle_cb),
+ (libbalsa_mailbox_local_set_threading):
+ * libbalsa/send.c:
+ * libinit_balsa/assistant_init.c (balsa_init_begin):
+ * src/balsa-app.c (ask_passwd_idle), (balsa_open_mailbox_list),
+ (balsa_find_mailbox), (balsa_find_dir):
+ * src/balsa-index.c (bndx_destroy),
+ (bndx_mailbox_row_inserted_idle), (balsa_index_load_mailbox_node),
+ (balsa_index_expunge):
+ * src/balsa-mblist.c (bmbl_set_property_node_style),
+ (balsa_mblist_close_lru_peer_mbx), (bmbl_sort_idle),
+ (balsa_mblist_mailbox_node_append):
+ * src/balsa-mime-widget-image.c (img_check_size):
+ * src/balsa-mime-widget-text.c (statusbar_pop):
+ * src/balsa-mime-widget.c (resize_idle):
+ * src/information-dialog.c (status_bar_refresh):
+ * src/mailbox-node.c (bmbn_scan_children_idle):
+ * src/main-window.c (bw_focus_idle), (mail_progress_notify_cb),
+ (bw_idle_replace), (bw_progress_timeout):
+ * src/main.c (initial_open_unread_mailboxes), (initial_open_inbox),
+ (balsa_get_stats), (scan_mailboxes_idle_cb), (periodic_expunge_cb),
+ (balsa_progress_set_fraction), (balsa_progress_set_activity),
+ (real_main), (handle_remote):
+ * src/message-window.c (message_window_idle_handler):
+ * src/pref-manager.c (open_preferences_manager_idle):
+ * src/save-restore.c (config_warning_idle):
+ * src/sendmsg-window.c (edit_with_gnome_check),
+ (sw_autosave_timeout_cb), (sw_grab_focus_to_text):
+ * src/spell-check.c (highlight_idle):
+
2017-09-22 Peter Bloomfield <pbloomfield bellsouth net>
Drop 'enable-' and 'with-', inherited from autotools,
diff --git a/configure.ac b/configure.ac
index dd6a54f..39aa46e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,19 +60,6 @@ if test x$balsa_cv_fcntl = xyes; then
AC_DEFINE(USE_FCNTL,1,[Define if fcntl locking should be used.])
fi
-AC_ARG_ENABLE(debug-threads,
- AC_HELP_STRING([--enable-debug-threads],
- [Debug threads (default=no)]),[
- debug_threads=$enableval
-],[
- debug_threads=no
-])
-
-if test x"$debug_threads" = xyes; then
- AC_DEFINE(BALSA_DEBUG_THREADS, 1,[Defined to debug threads.])
-fi
-
-
AC_ARG_WITH([gpgme],
AC_HELP_STRING([--with-gpgme=gpgme-config],
[build with gpgme/GnuPG support (default=no, path to gpgme-config optional)]),
diff --git a/libbalsa/address-view.c b/libbalsa/address-view.c
index f788297..9bff0e3 100644
--- a/libbalsa/address-view.c
+++ b/libbalsa/address-view.c
@@ -264,9 +264,6 @@ lbav_entry_setup_matches(LibBalsaAddressView * address_view,
/*
* Idle callback to set the GtkTreeView's cursor.
- *
- * Scheduled with gdk_threads_add_idle, so it already holds the GDK
- * lock, and its GSource has not been removed.
*/
static gboolean
lbav_ensure_blank_line_idle_cb(LibBalsaAddressView * address_view)
@@ -349,9 +346,7 @@ lbav_ensure_blank_line(LibBalsaAddressView * address_view,
if (!address_view->focus_idle_id)
address_view->focus_idle_id =
- gdk_threads_add_idle((GSourceFunc)
- lbav_ensure_blank_line_idle_cb,
- address_view);
+ g_idle_add((GSourceFunc) lbav_ensure_blank_line_idle_cb, address_view);
}
/*
diff --git a/libbalsa/identity.c b/libbalsa/identity.c
index bf1b8ad..3be561d 100644
--- a/libbalsa/identity.c
+++ b/libbalsa/identity.c
@@ -553,12 +553,10 @@ sd_idle_add_response_ok(SelectDialogInfo * sdi)
static gboolean
sd_response_ok(SelectDialogInfo * sdi)
{
- gdk_threads_enter();
if (sdi->idle_handler_id) {
sdi->idle_handler_id = 0;
gtk_dialog_response(GTK_DIALOG(sdi->dialog), GTK_RESPONSE_OK);
}
- gdk_threads_leave();
return FALSE;
}
diff --git a/libbalsa/information.c b/libbalsa/information.c
index 8667739..52d1c25 100644
--- a/libbalsa/information.c
+++ b/libbalsa/information.c
@@ -192,11 +192,9 @@ libbalsa_information_parented(GtkWindow *parent, LibBalsaInformationType type,
static gboolean
libbalsa_information_idle_handler(struct information_data *data)
{
- gdk_threads_enter();
libbalsa_real_information_func(data->parent,
data->message_type,
data->msg);
- gdk_threads_leave();
if(data->parent)
g_object_remove_weak_pointer(G_OBJECT(data->parent),
diff --git a/libbalsa/libbalsa-gpgme-cb.c b/libbalsa/libbalsa-gpgme-cb.c
index eb95ef8..4c18fb1 100644
--- a/libbalsa/libbalsa-gpgme-cb.c
+++ b/libbalsa/libbalsa-gpgme-cb.c
@@ -409,12 +409,10 @@ get_passphrase_idle(gpointer data)
{
ask_passphrase_data_t *apd = (ask_passphrase_data_t *) data;
- gdk_threads_enter();
apd->res =
get_passphrase_real(apd->uid_hint, apd->passphrase_info,
apd->was_bad, apd->parent);
apd->done = TRUE;
- gdk_threads_leave();
g_cond_signal(&apd->cond);
return FALSE;
}
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 5569b7d..a0291e1 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -298,10 +298,8 @@ ask_idle(gpointer data)
{
AskData* ad = (AskData*)data;
printf("ask_idle: ENTER %p\n", data);
- gdk_threads_enter();
ad->res = (ad->cb)(ad->arg);
ad->done = TRUE;
- gdk_threads_leave();
g_cond_signal(&ad->condvar);
printf("ask_idle: LEAVE %p\n", data);
return FALSE;
@@ -319,9 +317,7 @@ libbalsa_ask(gboolean (*cb)(void *arg), void *arg)
if (!libbalsa_am_i_subthread()) {
int ret;
printf("Main thread asks the following question.\n");
- gdk_threads_enter();
ret = cb(arg);
- gdk_threads_leave();
return ret;
}
printf("Side thread asks the following question.\n");
diff --git a/libbalsa/libbalsa.h b/libbalsa/libbalsa.h
index 3e537f7..d1b2de9 100644
--- a/libbalsa/libbalsa.h
+++ b/libbalsa/libbalsa.h
@@ -143,15 +143,6 @@ gboolean libbalsa_abort_on_timeout(const char *host);
GThread *libbalsa_get_main_thread(void);
gboolean libbalsa_am_i_subthread(void);
-#if defined(BALSA_DEBUG_THREADS)
-#define gdk_threads_enter() \
- do if (libbalsa_am_i_subthread()) \
- g_warning("%s: sub-thread!\n", __func__); \
- while (0)
-#else
-#define gdk_threads_enter()
-#endif
-#define gdk_threads_leave()
void libbalsa_message(const char *fmt, ...)
G_GNUC_PRINTF(1, 2);
gchar * libbalsa_rot(const gchar * pass);
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 59c249d..51c57ac 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -639,12 +639,10 @@ libbalsa_mailbox_close(LibBalsaMailbox * mailbox, gboolean expunge)
/* do not try expunging read-only mailboxes, it's a waste of time */
expunge = expunge && !mailbox->readonly;
LIBBALSA_MAILBOX_GET_CLASS(mailbox)->close_mailbox(mailbox, expunge);
- gdk_threads_enter();
if(mailbox->msg_tree) {
g_node_destroy(mailbox->msg_tree);
mailbox->msg_tree = NULL;
}
- gdk_threads_leave();
libbalsa_mailbox_free_mindex(mailbox);
mailbox->stamp++;
mailbox->state = LB_MAILBOX_STATE_CLOSED;
@@ -1347,7 +1345,6 @@ libbalsa_mailbox_msgno_inserted(LibBalsaMailbox *mailbox, guint seqno,
GUINT_TO_POINTER(seqno)));
#endif
- gdk_threads_enter();
/* Insert node into the message tree before getting path. */
iter.user_data = g_node_new(GUINT_TO_POINTER(seqno));
iter.stamp = mailbox->stamp;
@@ -1370,7 +1367,6 @@ libbalsa_mailbox_msgno_inserted(LibBalsaMailbox *mailbox, guint seqno,
libbalsa_unlock_mailbox(mailbox);
mailbox->msg_tree_changed = TRUE;
- gdk_threads_leave();
}
static void
@@ -1379,9 +1375,7 @@ libbalsa_mailbox_msgno_filt_in(LibBalsaMailbox *mailbox, guint seqno)
GtkTreeIter iter;
GtkTreePath *path;
- gdk_threads_enter();
if (!mailbox->msg_tree) {
- gdk_threads_leave();
return;
}
@@ -1397,8 +1391,6 @@ libbalsa_mailbox_msgno_filt_in(LibBalsaMailbox *mailbox, guint seqno)
mailbox->msg_tree_changed = TRUE;
lbm_changed_schedule_idle(mailbox);
-
- gdk_threads_leave();
}
/*
@@ -1430,12 +1422,10 @@ libbalsa_mailbox_msgno_removed(LibBalsaMailbox * mailbox, guint seqno)
GNode *child;
GNode *parent;
- gdk_threads_enter();
g_signal_emit(mailbox, libbalsa_mailbox_signals[MESSAGE_EXPUNGED],
0, seqno);
if (!mailbox->msg_tree) {
- gdk_threads_leave();
return;
}
@@ -1456,7 +1446,6 @@ libbalsa_mailbox_msgno_removed(LibBalsaMailbox * mailbox, guint seqno)
if (!dt.node) {
/* It's ok, apparently the view did not include this message */
- gdk_threads_leave();
return;
}
@@ -1507,8 +1496,6 @@ libbalsa_mailbox_msgno_removed(LibBalsaMailbox * mailbox, guint seqno)
gtk_tree_path_free(path);
mailbox->stamp++;
-
- gdk_threads_leave();
}
static void
@@ -1518,9 +1505,7 @@ libbalsa_mailbox_msgno_filt_out(LibBalsaMailbox * mailbox, GNode * node)
GtkTreePath *path;
GNode *child, *parent;
- gdk_threads_enter();
if (!mailbox->msg_tree) {
- gdk_threads_leave();
return;
}
@@ -1567,8 +1552,6 @@ libbalsa_mailbox_msgno_filt_out(LibBalsaMailbox * mailbox, GNode * node)
mailbox->msg_tree_changed = TRUE;
lbm_changed_schedule_idle(mailbox);
-
- gdk_threads_leave();
}
/*
@@ -2269,12 +2252,9 @@ lbm_set_threading(LibBalsaMailbox * mailbox,
LIBBALSA_MAILBOX_GET_CLASS(mailbox)->set_threading(mailbox,
thread_type);
if (libbalsa_am_i_subthread()) {
- gdk_threads_add_idle((GSourceFunc) lbm_set_threading_idle_cb,
- g_object_ref(mailbox));
+ g_idle_add((GSourceFunc) lbm_set_threading_idle_cb, g_object_ref(mailbox));
} else {
- gdk_threads_enter();
lbm_check_and_sort(mailbox);
- gdk_threads_leave();
}
return TRUE;
@@ -3629,9 +3609,7 @@ mbox_set_sort_column_id(GtkTreeSortable * sortable,
if (new_field != LB_MAILBOX_SORT_NO) {
gboolean rc;
- gdk_threads_leave();
rc = libbalsa_mailbox_prepare_threading(mbox, 0);
- gdk_threads_enter();
if (!rc)
/* Prepare-threading failed--perhaps mailbox was closed. */
@@ -3683,7 +3661,6 @@ libbalsa_mailbox_unlink_and_prepend(LibBalsaMailbox * mailbox,
g_return_if_fail(!parent || !g_node_is_ancestor(node, parent));
#endif
- gdk_threads_enter();
iter.stamp = mailbox->stamp;
path = mbox_model_get_path_helper(node, mailbox->msg_tree);
@@ -3733,7 +3710,6 @@ libbalsa_mailbox_unlink_and_prepend(LibBalsaMailbox * mailbox,
mailbox->msg_tree_changed = TRUE;
}
- gdk_threads_leave();
}
struct lbm_update_msg_tree_info {
@@ -3860,7 +3836,6 @@ lbm_set_msg_tree(LibBalsaMailbox * mailbox)
if (!mailbox->msg_tree)
return;
- gdk_threads_enter();
path = gtk_tree_path_new();
gtk_tree_path_down(path);
@@ -3877,14 +3852,11 @@ lbm_set_msg_tree(LibBalsaMailbox * mailbox)
}
gtk_tree_path_free(path);
- gdk_threads_leave();
}
void
libbalsa_mailbox_set_msg_tree(LibBalsaMailbox * mailbox, GNode * new_tree)
{
- gdk_threads_enter();
-
if (mailbox->msg_tree && mailbox->msg_tree->children) {
lbm_update_msg_tree(mailbox, new_tree);
g_node_destroy(new_tree);
@@ -3896,8 +3868,6 @@ libbalsa_mailbox_set_msg_tree(LibBalsaMailbox * mailbox, GNode * new_tree)
}
mailbox->msg_tree_changed = TRUE;
-
- gdk_threads_leave();
}
static GMimeMessage *
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index 1086b0c..cbb0dff 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -770,7 +770,6 @@ idle_unread_update_cb(LibBalsaMailbox *mailbox)
glong unread;
libbalsa_lock_mailbox(mailbox);
- gdk_threads_enter();
unread = mailbox->unread_messages;
lbm_imap_get_unseen(LIBBALSA_MAILBOX_IMAP(mailbox));
@@ -778,7 +777,6 @@ idle_unread_update_cb(LibBalsaMailbox *mailbox)
libbalsa_mailbox_set_unread_messages_flag(mailbox,
mailbox->unread_messages>0);
LIBBALSA_MAILBOX_IMAP(mailbox)->unread_update_id = 0;
- gdk_threads_leave();
libbalsa_unlock_mailbox(mailbox);
return FALSE;
}
@@ -827,7 +825,6 @@ imap_exists_idle(gpointer data)
unsigned cnt;
libbalsa_lock_mailbox(mailbox);
- gdk_threads_enter();
mimap->sort_field = -1; /* Invalidate. */
@@ -883,7 +880,6 @@ imap_exists_idle(gpointer data)
lbm_imap_get_unseen(LIBBALSA_MAILBOX_IMAP(mailbox));
}
- gdk_threads_leave();
libbalsa_unlock_mailbox(mailbox);
g_object_unref(G_OBJECT(mailbox));
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index 16b6538..c0734cd 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -637,8 +637,6 @@ lbm_local_restore_tree(LibBalsaMailboxLocal * local, guint * total)
}
*total = info->value.total;
- gdk_threads_enter();
-
seen = g_new0(guint8, *total);
parent = mailbox->msg_tree;
sibling = NULL;
@@ -653,7 +651,6 @@ lbm_local_restore_tree(LibBalsaMailboxLocal * local, guint * total)
g_free(seen);
g_free(contents);
g_free(name);
- gdk_threads_leave();
return FALSE;
}
seen[info->msgno - 1] = TRUE;
@@ -677,7 +674,6 @@ lbm_local_restore_tree(LibBalsaMailboxLocal * local, guint * total)
g_free(seen);
g_free(contents);
g_free(name);
- gdk_threads_leave();
return FALSE;
}
}
@@ -703,8 +699,6 @@ lbm_local_restore_tree(LibBalsaMailboxLocal * local, guint * total)
g_free(contents);
g_free(name);
- gdk_threads_leave();
-
return TRUE;
}
@@ -1053,11 +1047,9 @@ lbml_load_messages_idle_cb(LibBalsaMailbox * mailbox)
libbalsa_lock_mailbox(mailbox);
local = (LibBalsaMailboxLocal *) mailbox;
local->load_messages_id = 0;
- gdk_threads_enter();
if (!mailbox->msg_tree) {
/* Mailbox is closed, or no view has been created. */
- gdk_threads_leave();
libbalsa_unlock_mailbox(mailbox);
return FALSE;
}
@@ -1077,8 +1069,6 @@ lbml_load_messages_idle_cb(LibBalsaMailbox * mailbox)
msg_info->message);
}
- gdk_threads_leave();
-
if (new_messages) {
libbalsa_mailbox_run_filters_on_reception(mailbox);
libbalsa_mailbox_set_unread_messages_flag(mailbox,
@@ -1200,11 +1190,9 @@ libbalsa_mailbox_local_set_threading(LibBalsaMailbox * mailbox,
info = g_slice_new(LbmlSetThreadingInfo);
info->mailbox = g_object_ref(mailbox);
info->thread_type = thread_type;
- gdk_threads_add_idle((GSourceFunc) lbml_set_threading_idle_cb, info);
+ g_idle_add((GSourceFunc) lbml_set_threading_idle_cb, info);
} else {
- gdk_threads_enter();
lbml_set_threading(mailbox, thread_type);
- gdk_threads_leave();
}
#if defined(DEBUG_LOADING_AND_THREADING)
printf("after threading time=%lu\n", (unsigned long) time(NULL));
diff --git a/libbalsa/send.c b/libbalsa/send.c
index e58ab12..f272611 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -911,8 +911,7 @@ libbalsa_process_queue(LibBalsaMailbox *outbox,
/* balsa_send_message_real:
does the actual message sending.
- This function may be called as a thread and should therefore do
- proper gdk_threads_{enter/leave} stuff around GTK or libbalsa calls.
+ This function may be called as a thread.
Also, structure info should be freed before exiting.
*/
diff --git a/libinit_balsa/assistant_init.c b/libinit_balsa/assistant_init.c
index 0121872..e96c520 100644
--- a/libinit_balsa/assistant_init.c
+++ b/libinit_balsa/assistant_init.c
@@ -139,9 +139,7 @@ balsa_init_begin(void)
balsa_initdruid(GTK_ASSISTANT(assistant));
gtk_widget_show_all(assistant);
- gdk_threads_enter();
gtk_main();
- gdk_threads_leave();
/* we do not want to destroy wizard immediately to avoid confusing
delay between the wizard that left and balsa that entered. */
diff --git a/src/balsa-app.c b/src/balsa-app.c
index 672804d..45dd90b 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -136,10 +136,8 @@ static gboolean
ask_passwd_idle(gpointer data)
{
AskPasswdData* apd = (AskPasswdData*)data;
- gdk_threads_enter();
apd->res = ask_password_real(apd->server, apd->mbox);
apd->done = TRUE;
- gdk_threads_leave();
g_cond_signal(&apd->cond);
return FALSE;
}
@@ -529,8 +527,6 @@ balsa_open_mailbox_list(gchar ** urls)
g_return_if_fail(urls != NULL);
- gdk_threads_enter();
-
for (tmp = urls; *tmp; ++tmp) {
gchar **p;
@@ -545,8 +541,6 @@ balsa_open_mailbox_list(gchar ** urls)
}
g_strfreev(urls);
-
- gdk_threads_leave();
}
void
@@ -595,16 +589,12 @@ balsa_find_mailbox(LibBalsaMailbox * mailbox)
{
BalsaFind bf;
- gdk_threads_enter();
-
bf.data = mailbox;
bf.mbnode = NULL;
if (balsa_app.mblist_tree_store)
gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
find_mailbox, &bf);
- gdk_threads_leave();
-
return bf.mbnode;
}
@@ -633,10 +623,6 @@ BalsaMailboxNode *
balsa_find_dir(LibBalsaServer *server, const gchar * path)
{
BalsaFind bf;
- gboolean is_sub_thread = libbalsa_am_i_subthread();
-
- if (is_sub_thread)
- gdk_threads_enter();
bf.data = path;
bf.server = server;
@@ -644,9 +630,6 @@ balsa_find_dir(LibBalsaServer *server, const gchar * path)
gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
(GtkTreeModelForeachFunc) find_path, &bf);
- if (is_sub_thread)
- gdk_threads_leave();
-
return bf.mbnode;
}
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 137436a..07a4505 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -223,9 +223,7 @@ bndx_destroy(GObject * obj)
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, index);
gtk_tree_view_set_model(GTK_TREE_VIEW(index), NULL);
- gdk_threads_leave();
libbalsa_mailbox_close(mailbox, balsa_app.expunge_on_close);
- gdk_threads_enter();
}
if (index->mailbox_node) {
@@ -884,7 +882,6 @@ static gboolean
bndx_mailbox_row_inserted_idle(struct bndx_mailbox_row_inserted_info *info)
{
GtkTreePath *path;
- gdk_threads_enter();
if (libbalsa_mailbox_msgno_find(info->mailbox, info->msgno,
&path, NULL)) {
bndx_expand_to_row(info->index, path);
@@ -893,7 +890,6 @@ bndx_mailbox_row_inserted_idle(struct bndx_mailbox_row_inserted_info *info)
g_object_unref(info->mailbox);
g_object_unref(info->index);
g_free(info);
- gdk_threads_leave();
return FALSE;
}
@@ -974,7 +970,6 @@ balsa_index_load_mailbox_node(BalsaIndex * index,
/*
* rename "from" column to "to" for outgoing mail
*/
- gdk_threads_enter();
tree_view = GTK_TREE_VIEW(index);
if (libbalsa_mailbox_get_show(mailbox) == LB_MAILBOX_SHOW_TO) {
GtkTreeViewColumn *column =
@@ -995,7 +990,6 @@ balsa_index_load_mailbox_node(BalsaIndex * index,
g_object_set_data(G_OBJECT(mailbox), "tree-view", tree_view);
#endif
gtk_tree_view_set_model(tree_view, GTK_TREE_MODEL(mailbox));
- gdk_threads_leave();
/* Create a search-iter for SEARCH UNDELETED. */
if (!cond_undeleted)
@@ -2225,9 +2219,7 @@ balsa_index_expunge(BalsaIndex * index)
if (mailbox->readonly)
return;
- gdk_threads_leave();
rc = libbalsa_mailbox_sync_storage(mailbox, TRUE);
- gdk_threads_enter();
if (!rc)
balsa_information(LIBBALSA_INFORMATION_WARNING,
_("Committing mailbox %s failed."),
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index ddf307e..95f009f 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -216,8 +216,6 @@ bmbl_set_property_node_style(GSList * list)
GSList *l;
GtkTreePath *path;
- gdk_threads_enter();
-
for (l = list; l; l = l->next) {
GtkTreeRowReference *reference = l->data;
path = gtk_tree_row_reference_get_path(reference);
@@ -234,7 +232,6 @@ bmbl_set_property_node_style(GSList * list)
}
g_slist_free(list);
- gdk_threads_leave();
}
static gboolean
@@ -1251,9 +1248,7 @@ balsa_mblist_close_lru_peer_mbx(BalsaMBList * mblist,
dt.mbnode = NULL;
gtk_tree_model_foreach(model, get_lru_descendant, &dt);
if(dt.mbnode) {
- gdk_threads_enter();
balsa_window_close_mbnode(balsa_app.main_window, dt.mbnode);
- gdk_threads_leave();
g_object_unref(dt.mbnode);
}
return dt.mbnode != NULL;
@@ -2246,16 +2241,12 @@ bmbl_sort_idle(gpointer data)
{
GtkTreeSortable *sortable = data;
- gdk_threads_enter();
-
gtk_tree_sortable_set_sort_column_id(sortable,
balsa_app.mblist->sort_column_id,
GTK_SORT_ASCENDING);
balsa_app.mblist->sort_idle_id = 0;
g_object_unref(sortable);
- gdk_threads_leave();
-
return FALSE;
}
@@ -2268,8 +2259,6 @@ balsa_mblist_mailbox_node_append(BalsaMailboxNode * root,
GtkTreeIter *parent_iter = NULL;
GtkTreeIter iter;
- gdk_threads_enter();
-
model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
if (!balsa_app.mblist->sort_idle_id) {
@@ -2304,8 +2293,6 @@ balsa_mblist_mailbox_node_append(BalsaMailboxNode * root,
/* The tree-store owns mbnode. */
g_object_unref(mbnode);
-
- gdk_threads_leave();
}
/* Rerender a row after its properties have changed. */
diff --git a/src/balsa-mime-widget-image.c b/src/balsa-mime-widget-image.c
index a0f5278..47834a6 100644
--- a/src/balsa-mime-widget-image.c
+++ b/src/balsa-mime-widget-image.c
@@ -198,12 +198,9 @@ img_check_size(GtkImage ** widget_p)
gint curr_w, dst_w;
GtkAllocation allocation;
- gdk_threads_enter();
-
widget = *widget_p;
g_free(widget_p);
if (!widget) {
- gdk_threads_leave();
return FALSE;
}
g_object_remove_weak_pointer(G_OBJECT(widget), (gpointer) widget_p);
@@ -217,7 +214,6 @@ img_check_size(GtkImage ** widget_p)
GINT_TO_POINTER(FALSE));
g_warn_if_fail(viewport && mime_body && orig_width > 0);
if (!(viewport && mime_body && orig_width > 0)) {
- gdk_threads_leave();
return FALSE;
}
@@ -253,7 +249,6 @@ img_check_size(GtkImage ** widget_p)
load_err->message);
g_error_free(load_err);
}
- gdk_threads_leave();
return FALSE;
}
dst_h = (gfloat)dst_w /
@@ -265,6 +260,5 @@ img_check_size(GtkImage ** widget_p)
g_object_unref(scaled_pixbuf);
}
- gdk_threads_leave();
return FALSE;
}
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index 3a3bddb..a4f6d78 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -758,8 +758,6 @@ find_url(GtkWidget * widget, gint x, gint y, GList * url_list)
static gboolean
statusbar_pop(gpointer data)
{
- gdk_threads_enter();
-
if (BALSA_IS_WINDOW(balsa_app.main_window)
&& GTK_IS_STATUSBAR(balsa_app.main_window->statusbar)) {
GtkStatusbar *statusbar;
@@ -770,7 +768,6 @@ statusbar_pop(gpointer data)
gtk_statusbar_pop(statusbar, context_id);
}
- gdk_threads_leave();
return FALSE;
}
diff --git a/src/balsa-mime-widget.c b/src/balsa-mime-widget.c
index 9f632dc..3a82032 100644
--- a/src/balsa-mime-widget.c
+++ b/src/balsa-mime-widget.c
@@ -329,12 +329,10 @@ static gdouble old_upper, new_upper;
static gboolean
resize_idle(GtkWidget * widget)
{
- gdk_threads_enter();
resize_idle_id = 0;
gtk_widget_queue_resize(widget);
old_widget = new_widget;
old_upper = new_upper;
- gdk_threads_leave();
return FALSE;
}
diff --git a/src/information-dialog.c b/src/information-dialog.c
index f6194b1..06af13d 100644
--- a/src/information-dialog.c
+++ b/src/information-dialog.c
@@ -304,8 +304,6 @@ static guint bar_timeout_id = 0;
static gboolean
status_bar_refresh(gpointer data)
{
- gdk_threads_enter();
-
if (balsa_app.main_window) {
GtkStatusbar *statusbar;
guint context_id;
@@ -317,8 +315,6 @@ status_bar_refresh(gpointer data)
bar_timeout_id = 0;
- gdk_threads_leave();
-
return FALSE;
}
diff --git a/src/mailbox-node.c b/src/mailbox-node.c
index 3d7bb31..ffacd2b 100644
--- a/src/mailbox-node.c
+++ b/src/mailbox-node.c
@@ -866,11 +866,8 @@ bmbn_scan_children_idle(BalsaMailboxNode ** mbnode)
GSList *list;
GSList *l;
- gdk_threads_enter();
-
if (!*mbnode) {
g_free(mbnode);
- gdk_threads_leave();
return FALSE;
}
@@ -907,8 +904,6 @@ bmbn_scan_children_idle(BalsaMailboxNode ** mbnode)
}
g_free(mbnode);
- gdk_threads_leave();
-
return FALSE;
}
diff --git a/src/main-window.c b/src/main-window.c
index 12ce465..8586fea 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2977,13 +2977,11 @@ balsa_window_real_open_mbnode(BalsaWindow * window,
static gboolean
bw_focus_idle(LibBalsaMailbox ** mailbox)
{
- gdk_threads_enter();
if (*mailbox)
g_object_remove_weak_pointer(G_OBJECT(*mailbox), (gpointer) mailbox);
if (balsa_app.mblist_tree_store)
balsa_mblist_focus_mailbox(balsa_app.mblist, *mailbox);
g_free(mailbox);
- gdk_threads_leave();
return FALSE;
}
@@ -3525,8 +3523,6 @@ mail_progress_notify_cb(GIOChannel * source, GIOCondition condition,
return TRUE;
}
- gdk_threads_enter();
-
statusbar = GTK_STATUSBAR((*window)->statusbar);
context_id = gtk_statusbar_get_context_id(statusbar, "BalsaWindow mail progress");
@@ -3622,7 +3618,6 @@ mail_progress_notify_cb(GIOChannel * source, GIOCondition condition,
count -= sizeof(void *);
}
g_free(msgbuffer);
- gdk_threads_leave();
return TRUE;
}
@@ -4415,8 +4410,7 @@ bw_idle_replace(BalsaWindow * window, BalsaIndex * bindex)
bw_idle_remove(window);
/* Skip if the window is being destroyed: */
if (window->preview != NULL) {
- window->set_message_id =
- gdk_threads_add_idle((GSourceFunc) bw_idle_cb, window);
+ window->set_message_id = g_idle_add((GSourceFunc) bw_idle_cb, window);
if (BALSA_MESSAGE(window->preview)->message != NULL)
gtk_widget_hide(window->preview);
}
@@ -4593,22 +4587,16 @@ static gboolean bw_notebook_drag_motion_cb(GtkWidget * widget,
*
* This function is called at a preset interval to cause the progress
* bar to move in activity mode.
- * this routine is called from g_timeout_dispatch() and needs to take care
- * of GDK locking itself using gdk_threads_{enter,leave}
*
* Use of the progress bar to show a fraction of a task takes priority.
**/
static gint
bw_progress_timeout(BalsaWindow ** window)
{
- gdk_threads_enter();
-
if (balsa_app.show_statusbar
&& *window && (*window)->progress_type == BALSA_PROGRESS_ACTIVITY)
gtk_progress_bar_pulse(GTK_PROGRESS_BAR((*window)->progress_bar));
- gdk_threads_leave();
-
/* return true so it continues to be called */
return *window != NULL;
}
diff --git a/src/main.c b/src/main.c
index 3bd5a14..351d3b9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -193,13 +193,12 @@ threads_destroy(void)
/* initial_open_mailboxes:
open mailboxes on startup if requested so.
- This is an idle handler. Be sure to use gdk_threads_{enter/leave}
+ This is an idle handler.
*/
static gboolean
initial_open_unread_mailboxes()
{
GList *l, *gl;
- gdk_threads_enter();
gl = balsa_mblist_find_all_unread_mboxes(NULL);
if (gl) {
@@ -211,7 +210,6 @@ initial_open_unread_mailboxes()
}
g_list_free(gl);
}
- gdk_threads_leave();
return FALSE;
}
@@ -223,9 +221,7 @@ initial_open_inbox()
return FALSE;
printf("opening %s..\n", balsa_app.inbox->name);
- gdk_threads_enter();
balsa_mblist_open_mailbox_hidden(balsa_app.inbox);
- gdk_threads_leave();
return FALSE;
}
@@ -236,10 +232,8 @@ balsa_get_stats(long *unread, long *unsent)
if(balsa_app.inbox && libbalsa_mailbox_open(balsa_app.inbox, NULL) ) {
/* set threading type to load messages */
- gdk_threads_enter();
libbalsa_mailbox_set_threading(balsa_app.inbox,
balsa_app.inbox->view->threading_type);
- gdk_threads_leave();
*unread = balsa_app.inbox->unread_messages;
libbalsa_mailbox_close(balsa_app.inbox, FALSE);
} else *unread = -1;
@@ -282,7 +276,6 @@ scan_mailboxes_idle_cb()
GtkTreeIter iter;
GPtrArray *url_array;
- gdk_threads_enter();
model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
/* The model contains only nodes from config. */
for (valid = gtk_tree_model_get_iter_first(model, &iter); valid;
@@ -296,7 +289,6 @@ scan_mailboxes_idle_cb()
/* The root-node (typically ~/mail) isn't in the model, so its
* children will be appended to the top level. */
balsa_mailbox_node_append_subtree(balsa_app.root_node);
- gdk_threads_leave();
url_array = g_ptr_array_new();
if (cmd_open_unread_mailbox || balsa_app.open_unread_mailbox){
@@ -379,13 +371,11 @@ periodic_expunge_cb(void)
/* should we enforce expunging now and then? Perhaps not... */
if(!balsa_app.expunge_auto) return TRUE;
- gdk_threads_enter();
libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
_("Compressing mail folders…"));
gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
(GtkTreeModelForeachFunc)mbnode_expunge_func,
&list);
- gdk_threads_leave();
for (l = list; l; l = l->next) {
BalsaMailboxNode *mbnode = l->data;
@@ -461,24 +451,20 @@ balsa_progress_set_fraction(LibBalsaProgress * progress, gdouble fraction)
g_time_val_add(&time_val, LIBBALSA_PROGRESS_MIN_UPDATE_USECS);
min_fraction += LIBBALSA_PROGRESS_MIN_UPDATE_STEP;
- gdk_threads_enter();
if (balsa_app.main_window)
balsa_window_increment_progress(balsa_app.main_window, fraction,
!libbalsa_am_i_subthread());
- gdk_threads_leave();
}
static void
balsa_progress_set_activity(gboolean set, const gchar * text)
{
- gdk_threads_enter();
if (balsa_app.main_window) {
if (set)
balsa_window_increase_activity(balsa_app.main_window, text);
else
balsa_window_decrease_activity(balsa_app.main_window, text);
}
- gdk_threads_leave();
}
static gboolean
@@ -610,9 +596,7 @@ real_main(int argc, char *argv[])
balsa_app.main_window);
accel_map_load();
- gdk_threads_enter();
gtk_main();
- gdk_threads_leave();
balsa_cleanup();
accel_map_save();
@@ -753,8 +737,6 @@ handle_remote(int argc, char **argv,
"Unread: %ld Unsent: %ld\n",
unread, unsent);
} else {
- gdk_threads_enter();
-
if (cmd_check_mail_on_startup)
balsa_main_check_new_messages(balsa_app.main_window);
@@ -771,8 +753,6 @@ handle_remote(int argc, char **argv,
/* Move the main window to the request's screen */
gtk_window_present(GTK_WINDOW(balsa_app.main_window));
}
-
- gdk_threads_leave();
}
}
diff --git a/src/message-window.c b/src/message-window.c
index 0d179b2..f1a9cfa 100644
--- a/src/message-window.c
+++ b/src/message-window.c
@@ -112,19 +112,15 @@ message_window_idle_handler(MessageWindow * mw)
{
BalsaMessage *msg;
- gdk_threads_enter();
-
mw->idle_handler_id = 0;
msg = BALSA_MESSAGE(mw->bmessage);
if (!balsa_message_set(msg, mw->message->mailbox, mw->message->msgno)) {
gtk_widget_destroy(mw->window);
- gdk_threads_leave();
return FALSE;
}
balsa_message_grab_focus(msg);
- gdk_threads_leave();
return FALSE;
}
diff --git a/src/pref-manager.c b/src/pref-manager.c
index 21eee1c..a90be2c 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -3235,10 +3235,7 @@ open_preferences_manager_idle(void)
{
gchar *name;
- gdk_threads_enter();
-
if (pui == NULL) {
- gdk_threads_leave();
return FALSE;
}
@@ -3247,7 +3244,6 @@ open_preferences_manager_idle(void)
if (!name || strcmp(name, balsa_app.local_mail_directory) != 0) {
/* Chooser still hasn't been initialized. */
g_free(name);
- gdk_threads_leave();
return TRUE;
}
g_free(name);
@@ -3255,7 +3251,6 @@ open_preferences_manager_idle(void)
g_signal_connect(pui->mail_directory, "selection-changed",
G_CALLBACK(properties_modified_cb), property_box);
- gdk_threads_leave();
return FALSE;
} /* open_preferences_manager_idle */
diff --git a/src/save-restore.c b/src/save-restore.c
index 00a923c..24a9e62 100644
--- a/src/save-restore.c
+++ b/src/save-restore.c
@@ -479,9 +479,7 @@ config_folder_init(const gchar * prefix)
static gboolean
config_warning_idle(const gchar * text)
{
- gdk_threads_enter();
balsa_information(LIBBALSA_INFORMATION_WARNING, "%s", text);
- gdk_threads_leave();
return FALSE;
}
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 5bbb5ff..1887352 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -736,7 +736,6 @@ edit_with_gnome_check(gpointer data) {
perror("fopen");
return TRUE;
}
- gdk_threads_enter();
if (balsa_app.edit_headers) {
while (fgets(line, sizeof(line), tmp)) {
guint type;
@@ -778,7 +777,6 @@ edit_with_gnome_check(gpointer data) {
unlink(data_real->filename);
gtk_widget_set_sensitive(data_real->bsmsg->text, TRUE);
g_free(data);
- gdk_threads_leave();
return FALSE;
}
@@ -3849,15 +3847,11 @@ sw_save_draft(BalsaSendmsg * bsmsg)
static gboolean
sw_autosave_timeout_cb(BalsaSendmsg * bsmsg)
{
- gdk_threads_enter();
-
if (bsmsg->state == SENDMSG_STATE_MODIFIED) {
if (sw_save_draft(bsmsg))
bsmsg->state = SENDMSG_STATE_AUTO_SAVED;
}
- gdk_threads_leave();
-
return TRUE; /* do repeat it */
}
@@ -4382,10 +4376,8 @@ set_identity(BalsaSendmsg * bsmsg, LibBalsaMessage * message)
static gboolean
sw_grab_focus_to_text(GtkWidget * text)
{
- gdk_threads_enter();
gtk_widget_grab_focus(text);
g_object_unref(text);
- gdk_threads_leave();
return FALSE;
}
diff --git a/src/spell-check.c b/src/spell-check.c
index d85ac14..037099c 100644
--- a/src/spell-check.c
+++ b/src/spell-check.c
@@ -696,7 +696,6 @@ highlight_idle(BalsaSpellCheck * spell_check)
{
GtkTextBuffer *buffer;
- gdk_threads_enter();
if (spell_check->highlight_idle_id) {
spch_restore_word_iters(spell_check);
buffer = gtk_text_view_get_buffer(spell_check->text_view);
@@ -704,7 +703,6 @@ highlight_idle(BalsaSpellCheck * spell_check)
&spell_check->end_iter);
spell_check->highlight_idle_id = 0;
}
- gdk_threads_leave();
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]