aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-05-21 17:10:00 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-05-21 17:10:00 +0800
commitffa75e6801faaffb2626d83779fe0a91a8f58d3a (patch)
treede74dcb1ab7ea1e4dc93d9421215bb02a2c05f99 /mail
parent2bc97c08c1ca8057f03b3b3d872eafa306bab22c (diff)
downloadgsoc2013-evolution-ffa75e6801faaffb2626d83779fe0a91a8f58d3a.tar
gsoc2013-evolution-ffa75e6801faaffb2626d83779fe0a91a8f58d3a.tar.gz
gsoc2013-evolution-ffa75e6801faaffb2626d83779fe0a91a8f58d3a.tar.bz2
gsoc2013-evolution-ffa75e6801faaffb2626d83779fe0a91a8f58d3a.tar.lz
gsoc2013-evolution-ffa75e6801faaffb2626d83779fe0a91a8f58d3a.tar.xz
gsoc2013-evolution-ffa75e6801faaffb2626d83779fe0a91a8f58d3a.tar.zst
gsoc2013-evolution-ffa75e6801faaffb2626d83779fe0a91a8f58d3a.zip
add marshaller for p_ppppp call.
2004-05-21 Not Zed <NotZed@Ximian.com> * mail-mt.c (do_call): add marshaller for p_ppppp call. * mail-session.c (get_password): fix for camel api changes. (forget_password): same. ** See #58376. * message-list.c (mail_regen_list): do some timeout foo so we don't keep doing list regnerations if we're getting called too often. God knows what this will break. (message_list_set_selected): removede bug printf. (regen_list_free): move the message-list poking stuff into regen_list_regened. (message_list_set_folder): call mail_regen_cancel to cancel any regen stuff. (mail_regen_cancel): cancel/clear outstanding regenerations. (message_list_destroy): do it here too. (message_list_select_uid): also set the pending select uid if we have a timeout pending. * mail-component.c (impl_createControls): set the defualt parent to the main folderview as soon as its created. * em-folder-tree.c (emft_popup_copy_folder_selected): use get_toplevel rather than get_ancestor. seems the more reliable one. also we're always parented so we shoudl always find a toplevel window. (em_folder_tree_create_folder): same. (emft_popup_delete_response): set error parent. (emft_popup_delete_folder, emft_popup_rename_folder) (emft_popup_rename_folder, emft_popup_rename_folder): svn path=/trunk/; revision=26030
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog32
-rw-r--r--mail/em-folder-tree.c23
-rw-r--r--mail/mail-component.c3
-rw-r--r--mail/mail-mt.c14
-rw-r--r--mail/mail-mt.h1
-rw-r--r--mail/mail-session.c28
-rw-r--r--mail/message-list.c110
-rw-r--r--mail/message-list.h2
8 files changed, 144 insertions, 69 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1f6dc71bc1..22a5631ecf 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,37 @@
2004-05-21 Not Zed <NotZed@Ximian.com>
+ * mail-mt.c (do_call): add marshaller for p_ppppp call.
+
+ * mail-session.c (get_password): fix for camel api changes.
+ (forget_password): same.
+
+ ** See #58376.
+
+ * message-list.c (mail_regen_list): do some timeout foo so we
+ don't keep doing list regnerations if we're getting called too
+ often. God knows what this will break.
+ (message_list_set_selected): removede bug printf.
+ (regen_list_free): move the message-list poking stuff into
+ regen_list_regened.
+ (message_list_set_folder): call mail_regen_cancel to cancel any
+ regen stuff.
+ (mail_regen_cancel): cancel/clear outstanding regenerations.
+ (message_list_destroy): do it here too.
+ (message_list_select_uid): also set the pending select uid if we
+ have a timeout pending.
+
+ * mail-component.c (impl_createControls): set the defualt parent
+ to the main folderview as soon as its created.
+
+ * em-folder-tree.c (emft_popup_copy_folder_selected): use
+ get_toplevel rather than get_ancestor. seems the more reliable
+ one. also we're always parented so we shoudl always find a
+ toplevel window.
+ (em_folder_tree_create_folder): same.
+ (emft_popup_delete_response): set error parent.
+ (emft_popup_delete_folder, emft_popup_rename_folder)
+ (emft_popup_rename_folder, emft_popup_rename_folder):
+
* em-migrate.c (update_passwords_1_2): finally put the 1.2
password upgrade patch in. Untested. #42721.
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index e789f5e233..67e16ae0bf 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -2007,19 +2007,19 @@ emft_popup_copy_folder_selected (const char *uri, void *data)
frombase = priv->selected_path + 1;
if (!(fromstore = camel_session_get_store (session, priv->selected_uri, &ex))) {
- e_error_run((GtkWindow *)gtk_widget_get_ancestor ((GtkWidget *) cfd->emft, GTK_TYPE_WINDOW),
+ e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *) cfd->emft),
cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", frombase, uri, ex.desc, NULL);
goto fail;
}
if (cfd->delete && fromstore == mail_component_peek_local_store (NULL) && is_special_local_folder (frombase)) {
- e_error_run((GtkWindow *)gtk_widget_get_ancestor ((GtkWidget *) cfd->emft, GTK_TYPE_WINDOW),
+ e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *) cfd->emft),
"mail:no-rename-special-folder", frombase, NULL);
goto fail;
}
if (!(tostore = camel_session_get_store (session, uri, &ex))) {
- e_error_run((GtkWindow *)gtk_widget_get_ancestor ((GtkWidget *) cfd->emft, GTK_TYPE_WINDOW),
+ e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *) cfd->emft),
cfd->delete?"mail:no-move-folder-to-notexist":"mail:no-move-folder-to-notexist", frombase, uri, ex.desc, NULL);
goto fail;
}
@@ -2194,7 +2194,7 @@ em_folder_tree_create_folder (EMFolderTree *emft, const char *path, const char *
camel_exception_init (&ex);
if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
- e_error_run((GtkWindow *)gtk_widget_get_ancestor((GtkWidget *)emft, GTK_TYPE_WINDOW),
+ e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft),
"mail:no-create-folder-nostore", path, ex.desc, NULL);
goto fail;
}
@@ -2398,7 +2398,8 @@ emft_popup_delete_response (GtkWidget *dialog, guint response, EMFolderTree *emf
camel_exception_init (&ex);
emft_popup_delete_folders (store, path, &ex);
if (camel_exception_is_set (&ex)) {
- e_error_run(NULL, "mail:no-delete-folder", path, ex.desc, NULL);
+ e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft),
+ "mail:no-delete-folder", path, ex.desc, NULL);
camel_exception_clear (&ex);
}
}
@@ -2429,7 +2430,8 @@ emft_popup_delete_folder (GtkWidget *item, EMFolderTree *emft)
return;
}
- dialog = e_error_new(NULL, "mail:ask-delete-folder", full_name, NULL);
+ dialog = e_error_new((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft),
+ "mail:ask-delete-folder", full_name, NULL);
g_signal_connect (dialog, "response", G_CALLBACK (emft_popup_delete_response), emft);
gtk_widget_show (dialog);
}
@@ -2462,7 +2464,8 @@ emft_popup_rename_folder (GtkWidget *item, EMFolderTree *emft)
/* don't allow user to rename one of the special local folders */
if (store == local && is_special_local_folder (full_name)) {
- e_error_run(NULL, "mail:no-rename-spethal-folder", full_name, NULL);
+ e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft),
+ "mail:no-rename-spethal-folder", full_name, NULL);
return;
}
@@ -2495,7 +2498,8 @@ emft_popup_rename_folder (GtkWidget *item, EMFolderTree *emft)
camel_exception_init (&ex);
if ((fi = camel_store_get_folder_info (store, path, CAMEL_STORE_FOLDER_INFO_FAST, &ex)) != NULL) {
camel_store_free_folder_info (store, fi);
- e_error_run(NULL, "mail:no-rename-folder-exists", name, new_name, NULL);
+ e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft),
+ "mail:no-rename-folder-exists", name, new_name, NULL);
} else {
const char *oldpath, *newpath;
@@ -2507,7 +2511,8 @@ emft_popup_rename_folder (GtkWidget *item, EMFolderTree *emft)
camel_exception_clear (&ex);
camel_store_rename_folder (store, oldpath, newpath, &ex);
if (camel_exception_is_set (&ex)) {
- e_error_run(NULL, "mail:no-rename-folder", oldpath, newpath, ex.desc, NULL);
+ e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft),
+ "mail:no-rename-folder", oldpath, newpath, ex.desc, NULL);
camel_exception_clear (&ex);
}
diff --git a/mail/mail-component.c b/mail/mail-component.c
index ad186f961e..4db24e0baf 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -531,6 +531,9 @@ impl_createControls (PortableServer_Servant servant,
mc_startup(mail_component);
view_widget = em_folder_browser_new ();
+ /* so error boxes have a parent if none supplied */
+ e_error_default_parent((GtkWindow *)view_widget);
+
tree_widget = (GtkWidget *) em_folder_tree_new_with_model (priv->model);
em_folder_tree_set_excluded ((EMFolderTree *) tree_widget, 0);
em_folder_tree_enable_drag_and_drop ((EMFolderTree *) tree_widget);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index e9830175f0..1581d283bb 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -738,6 +738,14 @@ do_call(struct _mail_msg *mm)
p4 = va_arg(ap, void *);
m->ret = m->func(p1, p2, p3, p4);
break;
+ case MAIL_CALL_p_ppppp:
+ p1 = va_arg(ap, void *);
+ p2 = va_arg(ap, void *);
+ p3 = va_arg(ap, void *);
+ p4 = va_arg(ap, void *);
+ p5 = va_arg(ap, void *);
+ m->ret = m->func(p1, p2, p3, p4, p5);
+ break;
case MAIL_CALL_p_ppippp:
p1 = va_arg(ap, void *);
p2 = va_arg(ap, void *);
@@ -894,8 +902,10 @@ static void do_op_status(struct _mail_msg *mm)
MAIL_MT_UNLOCK (mail_msg_lock);
if (msg->ops->describe_msg)
what = msg->ops->describe_msg (msg, FALSE);
- else
- what = _("Working");
+ else {
+ what = g_strdup_printf("Working %p", msg);
+ /*what = _("Working");*/
+ }
data->activity_id = e_activity_handler_operation_started (activity_handler, "evolution-mail", progress_icon, what, TRUE);
diff --git a/mail/mail-mt.h b/mail/mail-mt.h
index 11a7166d74..b6d402199f 100644
--- a/mail/mail-mt.h
+++ b/mail/mail-mt.h
@@ -95,6 +95,7 @@ typedef enum {
MAIL_CALL_p_pp,
MAIL_CALL_p_ppp,
MAIL_CALL_p_pppp,
+ MAIL_CALL_p_ppppp,
MAIL_CALL_p_ppippp,
} mail_call_t;
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 9b16b99b82..d4c63fdd30 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -86,8 +86,8 @@ typedef struct _MailSessionClass {
static CamelSessionClass *ms_parent_class;
-static char *get_password(CamelSession *session, const char *prompt, guint32 flags, CamelService *service, const char *item, CamelException *ex);
-static void forget_password(CamelSession *session, CamelService *service, const char *item, CamelException *ex);
+static char *get_password(CamelSession *session, CamelService *service, const char *domain, const char *prompt, const char *item, guint32 flags, CamelException *ex);
+static void forget_password(CamelSession *session, CamelService *service, const char *domain, const char *item, CamelException *ex);
static gboolean alert_user(CamelSession *session, CamelSessionAlertType type, const char *prompt, gboolean cancel);
static CamelFilterDriver *get_filter_driver(CamelSession *session, const char *type, CamelException *ex);
@@ -172,15 +172,16 @@ struct _pass_msg {
struct _mail_msg msg;
CamelSession *session;
- const char *prompt;
- guint32 flags;
CamelService *service;
+ const char *domain;
+ const char *prompt;
const char *item;
+ guint32 flags;
CamelException *ex;
char *service_url;
char *key;
-
+
EAccountService *config_service;
GtkWidget *check;
GtkWidget *entry;
@@ -323,7 +324,7 @@ do_get_pass(struct _mail_msg *mm)
if (account)
m->result = g_strdup(account->source->url);
} else if (m->key) {
- m->result = e_passwords_get_password ("Mail", m->key);
+ m->result = e_passwords_get_password (m->domain?m->domain:"Mail", m->key);
if (m->result == NULL || (m->flags & CAMEL_SESSION_PASSWORD_REPROMPT)) {
if (mail_session->interactive) {
request_password(m);
@@ -352,8 +353,8 @@ static struct _mail_msg_op get_pass_op = {
};
static char *
-get_password (CamelSession *session, const char *prompt, guint32 flags,
- CamelService *service, const char *item, CamelException *ex)
+get_password (CamelSession *session, CamelService *service, const char *domain,
+ const char *prompt, const char *item, guint32 flags, CamelException *ex)
{
struct _pass_msg *m, *r;
EMsgPort *pass_reply;
@@ -369,6 +370,7 @@ get_password (CamelSession *session, const char *prompt, guint32 flags,
m->prompt = prompt;
m->flags = flags;
m->service = service;
+ m->domain = domain;
m->item = item;
m->ex = ex;
if (service)
@@ -395,20 +397,20 @@ get_password (CamelSession *session, const char *prompt, guint32 flags,
}
static void
-main_forget_password (CamelSession *session, CamelService *service, const char *item, CamelException *ex)
+main_forget_password (CamelSession *session, CamelService *service, const char *domain, const char *item, CamelException *ex)
{
char *key = make_key (service, item);
- e_passwords_forget_password ("Mail", key);
+ e_passwords_forget_password (domain?domain:"Mail", key);
g_free (key);
}
static void
-forget_password (CamelSession *session, CamelService *service, const char *item, CamelException *ex)
+forget_password (CamelSession *session, CamelService *service, const char *domain, const char *item, CamelException *ex)
{
- mail_call_main(MAIL_CALL_p_pppp, (MailMainFunc)main_forget_password,
- session, service, item, ex);
+ mail_call_main(MAIL_CALL_p_ppppp, (MailMainFunc)main_forget_password,
+ session, service, domain, item, ex);
}
/* ********************************************************************** */
diff --git a/mail/message-list.c b/mail/message-list.c
index 38b389b062..58f579dc4b 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -181,6 +181,7 @@ static void load_hide_state(MessageList *ml);
/* note: @changes is owned/freed by the caller */
/*static void mail_do_regenerate_messagelist (MessageList *list, const char *search, const char *hideexpr, CamelFolderChangeInfo *changes);*/
static void mail_regen_list(MessageList *ml, const char *search, const char *hideexpr, CamelFolderChangeInfo *changes);
+static void mail_regen_cancel(MessageList *ml);
static void clear_info(char *key, ETreePath *node, MessageList *ml);
@@ -565,7 +566,7 @@ message_list_select_uid (MessageList *message_list, const char *uid)
if (message_list->folder == NULL)
return;
- if (message_list->regen) {
+ if (message_list->regen || message_list->regen_timeout_id) {
g_free(message_list->pending_select_uid);
message_list->pending_select_uid = g_strdup(uid);
}
@@ -1800,7 +1801,9 @@ message_list_destroy(GtkObject *object)
/* need to do this before removing folder, folderinfo's might not exist after */
save_tree_state(message_list);
save_hide_state(message_list);
-
+
+ mail_regen_cancel(message_list);
+
if (message_list->uid_nodemap) {
g_hash_table_foreach(message_list->uid_nodemap, (GHFunc)clear_info, message_list);
g_hash_table_destroy (message_list->uid_nodemap);
@@ -1836,7 +1839,7 @@ message_list_destroy(GtkObject *object)
g_source_remove (message_list->seen_id);
message_list->seen_id = 0;
}
-
+
message_list->destroyed = TRUE;
GTK_OBJECT_CLASS (message_list_parent_class)->destroy(object);
@@ -2716,19 +2719,8 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c
g_source_remove (message_list->idle_id);
message_list->idle_id = 0;
}
-
- /* cancel any outstanding regeneration requests */
- if (message_list->regen) {
- GList *l = message_list->regen;
-
- while (l) {
- struct _mail_msg *mm = l->data;
-
- if (mm->cancel)
- camel_operation_cancel(mm->cancel);
- l = l->next;
- }
- }
+
+ mail_regen_cancel(message_list);
if (message_list->folder != NULL) {
save_tree_state (message_list);
@@ -2994,7 +2986,6 @@ message_list_set_selected(MessageList *ml, GPtrArray *uids)
for (i=0; i<uids->len; i++) {
node = g_hash_table_lookup(ml->uid_nodemap, uids->pdata[i]);
- printf("reselecting uid '%s' %s\n", uids->pdata[i], node?"found":"not found");
if (node)
e_tree_selection_model_add_to_selection(etsm, node);
}
@@ -3521,6 +3512,18 @@ regen_list_regened (struct _mail_msg *mm)
} else
build_flat (m->ml, m->summary, m->changes);
+ if (m->ml->search && m->ml->search != m->search)
+ g_free (m->ml->search);
+ m->ml->search = m->search;
+
+ if (m->ml->regen == NULL && m->ml->pending_select_uid) {
+ char *uid = m->ml->pending_select_uid;
+
+ m->ml->pending_select_uid = NULL;
+ message_list_select_uid(m->ml, uid);
+ g_free(uid);
+ }
+
g_signal_emit (m->ml, message_list_signals[MESSAGE_LIST_BUILT], 0);
}
@@ -3539,10 +3542,6 @@ regen_list_free (struct _mail_msg *mm)
if (m->tree)
camel_folder_thread_messages_unref (m->tree);
- if (m->ml->search && m->ml->search != m->search)
- g_free (m->ml->search);
- m->ml->search = m->search;
-
g_free (m->hideexpr);
camel_object_unref (m->folder);
@@ -3550,18 +3549,9 @@ regen_list_free (struct _mail_msg *mm)
if (m->changes)
camel_folder_change_info_free (m->changes);
- /* This should probably lock the list.
- However, since we have a received function, this will always be called in gui thread */
+ /* we have to poke this here since we might've been cancelled and regened wont get called */
m->ml->regen = g_list_remove(m->ml->regen, m);
- if (m->ml->regen == NULL && m->ml->pending_select_uid) {
- char *uid = m->ml->pending_select_uid;
-
- m->ml->pending_select_uid = NULL;
- message_list_select_uid(m->ml, uid);
- g_free(uid);
- }
-
g_object_unref(m->ml);
}
@@ -3572,28 +3562,55 @@ static struct _mail_msg_op regen_list_op = {
regen_list_free,
};
-static void
-mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, CamelFolderChangeInfo *changes)
+static gboolean
+ml_regen_timeout(struct _regen_list_msg *m)
{
- struct _regen_list_msg *m;
- GConfClient *gconf;
-
- if (ml->folder == NULL)
- return;
+ m->ml->regen = g_list_prepend(m->ml->regen, m);
+ /* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */
+ e_thread_put (mail_thread_queued, (EMsg *)m);
+
+ m->ml->regen_timeout_msg = NULL;
+ m->ml->regen_timeout_id = 0;
+
+ return FALSE;
+}
- /* cancel any outstanding regeneration requests, we rebuild from scratch anyway */
+static void
+mail_regen_cancel(MessageList *ml)
+{
+ /* cancel any outstanding regeneration requests, not we don't clear, they clear themselves */
if (ml->regen) {
GList *l = ml->regen;
-
+
while (l) {
struct _mail_msg *mm = l->data;
-
+
if (mm->cancel)
camel_operation_cancel(mm->cancel);
l = l->next;
}
}
+
+ /* including unqueued ones */
+ if (ml->regen_timeout_id) {
+ g_source_remove(ml->regen_timeout_id);
+ ml->regen_timeout_id = 0;
+ mail_msg_free((struct _mail_msg *)ml->regen_timeout_msg);
+ ml->regen_timeout_msg = NULL;
+ }
+}
+
+static void
+mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, CamelFolderChangeInfo *changes)
+{
+ struct _regen_list_msg *m;
+ GConfClient *gconf;
+ if (ml->folder == NULL)
+ return;
+
+ mail_regen_cancel(ml);
+
gconf = mail_config_get_gconf_client ();
#ifndef BROKEN_ETREE
@@ -3629,10 +3646,13 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came
camel_folder_thread_messages_ref(m->tree);
}
- ml->regen = g_list_prepend(ml->regen, m);
-
- /* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */
- e_thread_put (mail_thread_queued, (EMsg *)m);
+ /* if we're busy already kick off timeout processing, so normal updates are immediate */
+ if (ml->regen == NULL)
+ ml_regen_timeout(m);
+ else {
+ ml->regen_timeout_msg = m;
+ ml->regen_timeout_id = g_timeout_add(500, (GSourceFunc)ml_regen_timeout, m);
+ }
}
diff --git a/mail/message-list.h b/mail/message-list.h
index a6048527e3..c8ec571ec5 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -139,6 +139,8 @@ struct _MessageList {
/* list of outstanding regeneration requests */
GList *regen;
char *pending_select_uid; /* set if we were busy regnerating while we had a select come in */
+ guint regen_timeout_id;
+ void *regen_timeout_msg;
char *frozen_search; /* to save search took place while we were frozen */