aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-mt.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-02-22 04:13:07 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-02-22 04:13:07 +0800
commit3d924d9972c35c96d57c6e503f21f26a2cc6e95d (patch)
treec977751da2680be7240d19c44f1c9c754a1859ae /mail/mail-mt.c
parent535fea211a9a35f5b04017124a71764daf926723 (diff)
downloadgsoc2013-evolution-3d924d9972c35c96d57c6e503f21f26a2cc6e95d.tar.gz
gsoc2013-evolution-3d924d9972c35c96d57c6e503f21f26a2cc6e95d.tar.zst
gsoc2013-evolution-3d924d9972c35c96d57c6e503f21f26a2cc6e95d.zip
started hack for progress reporting, which is currently to the console.
2001-02-22 Not Zed <NotZed@Ximian.com> * mail-local.c (local_storage_new_folder_cb): started hack for progress reporting, which is currently to the console. * mail-mt.c (set_stop): Set the stop button sensitivity. (mail_msg_received): enable/disable stop button while we're processing stuff in another thread. * message-list.c (ml_tree_value_at): If our uid entry vanishes before w'ere ready, then make a fake. svn path=/trunk/; revision=8338
Diffstat (limited to 'mail/mail-mt.c')
-rw-r--r--mail/mail-mt.c75
1 files changed, 74 insertions, 1 deletions
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index ec2529448d..72af0f750d 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -20,6 +20,10 @@
#define d(x)
static void set_view_data(const char *current_message, int busy);
+static void set_stop(int sensitive);
+
+static void mail_enable_stop(void);
+static void mail_disable_stop(void);
#define MAIL_MT_LOCK(x) pthread_mutex_lock(&x)
#define MAIL_MT_UNLOCK(x) pthread_mutex_unlock(&x)
@@ -213,8 +217,11 @@ mail_msg_received(EThread *e, EMsg *msg, void *data)
g_free(text);
}
- if (m->ops->receive_msg)
+ if (m->ops->receive_msg) {
+ mail_enable_stop();
m->ops->receive_msg(m);
+ mail_disable_stop();
+ }
}
static void mail_msg_cleanup(void)
@@ -579,6 +586,48 @@ int mail_proxy_event(CamelObjectEventHookFunc func, CamelObject *o, void *event_
}
}
+/* ********************************************************************** */
+/* locked via status_lock */
+static int busy_state;
+
+static void do_set_busy(struct _mail_msg *mm)
+{
+ set_stop(busy_state > 0);
+}
+
+struct _mail_msg_op set_busy_op = {
+ NULL,
+ do_set_busy,
+ NULL,
+ NULL,
+};
+
+static void mail_enable_stop(void)
+{
+ struct _mail_msg *m;
+
+ MAIL_MT_LOCK(status_lock);
+ busy_state++;
+ if (busy_state == 1) {
+ m = mail_msg_new(&set_busy_op, NULL, sizeof(*m));
+ e_msgport_put(mail_gui_port, (EMsg *)m);
+ }
+ MAIL_MT_UNLOCK(status_lock);
+}
+
+static void mail_disable_stop(void)
+{
+ struct _mail_msg *m;
+
+ MAIL_MT_LOCK(status_lock);
+ busy_state--;
+ if (busy_state == 0) {
+ m = mail_msg_new(&set_busy_op, NULL, sizeof(*m));
+ e_msgport_put(mail_gui_port, (EMsg *)m);
+ }
+ MAIL_MT_UNLOCK(status_lock);
+}
+
/* ******************** */
/* FIXME FIXME FIXME This is a totally evil hack. */
@@ -653,3 +702,27 @@ set_view_data(const char *current_message, int busy)
}
gtk_object_unref(GTK_OBJECT(it));
}
+
+static void
+set_stop(int sensitive)
+{
+ EList *controls;
+ EIterator *it;
+ static int last = FALSE;
+
+ if (last == sensitive)
+ return;
+
+ controls = folder_browser_factory_get_control_list ();
+ for (it = e_list_get_iterator (controls); e_iterator_is_valid (it); e_iterator_next (it)) {
+ BonoboControl *control;
+ BonoboUIComponent *uic;
+
+ control = BONOBO_CONTROL (e_iterator_get (it));
+ uic = bonobo_control_get_ui_component (control);
+
+ bonobo_ui_component_set_prop(uic, "/commands/MailStop", "sensitive", sensitive?"1":"0", NULL);
+ }
+ gtk_object_unref(GTK_OBJECT(it));
+ last = sensitive;
+}