aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/mail-local.c14
-rw-r--r--mail/mail-mt.c75
-rw-r--r--mail/message-list.c4
4 files changed, 104 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 5e4beb6ab5..dea9a29bff 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
2001-02-21 Jeffrey Stedfast <fejj@ximian.com>
* mail-crypto.c (pgp_mime_part_verify): Changed to use
diff --git a/mail/mail-local.c b/mail/mail-local.c
index 087d8d94bb..eba6f36992 100644
--- a/mail/mail-local.c
+++ b/mail/mail-local.c
@@ -460,11 +460,14 @@ register_folder_register(struct _mail_msg *mm)
meta = load_metainfo (name);
g_free (name);
+ camel_operation_register(mm->cancel);
+
name = g_strdup_printf ("%s:%s", meta->format, path);
store = camel_session_get_store (session, name, &mm->ex);
g_free (name);
if (!store) {
free_metainfo (meta);
+ camel_operation_unregister(mm->cancel);
return;
}
@@ -484,6 +487,8 @@ register_folder_register(struct _mail_msg *mm)
camel_object_unref (CAMEL_OBJECT (store));
free_metainfo (meta);
+
+ camel_operation_register(mm->cancel);
}
static void
@@ -519,6 +524,11 @@ static struct _mail_msg_op register_folder_op = {
register_folder_free,
};
+static void new_status(struct _CamelOperation *op, const char *what, int pc, void *data)
+{
+ printf("oepration %s %d %% complete\n", what, pc);
+}
+
static void
local_storage_new_folder_cb (EvolutionStorageListener *storage_listener,
const char *path,
@@ -547,6 +557,10 @@ local_storage_new_folder_cb (EvolutionStorageListener *storage_listener,
m->local_folder = local_folder;
+ /* HACK: so we reuse the cancel pointer */
+ camel_operation_unref(m->msg.cancel);
+ m->msg.cancel = camel_operation_new(new_status, m);
+
/* run synchronous, the shell expects it (I think) */
id = m->msg.seq;
e_thread_put(mail_thread_queued, (EMsg *)m);
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;
+}
diff --git a/mail/message-list.c b/mail/message-list.c
index b8c85cf808..c1e180a8bf 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -806,6 +806,10 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
uid = id_uid(uid);
msg_info = camel_folder_get_message_info (message_list->folder, uid);
+ if (msg_info == NULL) {
+ g_warning("Invalid node encountered: %s", uid);
+ goto fake;
+ }
switch (col){
case COL_MESSAGE_STATUS: {