Patch to use 'what' string manage progress data
- From: Javier Fernandez <jfernandez igalia com>
- To: tinymail-devel-list gnome org
- Subject: Patch to use 'what' string manage progress data
- Date: Mon, 21 May 2007 12:04:30 +0200
Hi,
Some async operations call several camel_operation methods, which
updates progress data using different ways. To ensure progress data send
back to modest status callback is related to main operation, it 's
required to knonw 'what' operaiton is currently being executed.
To knonw executed operation, it could be possible to compare 'what'
string parameter passed to tinymail staus_callback.
--
Javier Fernández García-Boente
Ingeniero en Informática
mailto:jfernandez igalia com
Igalia http://www.igalia.com
Telf. +34 981 91 39 91
Fax. +34 981 91 39 49
Index: libtinymail-camel/tny-camel-folder.c
===================================================================
--- libtinymail-camel/tny-camel-folder.c (revision 2019)
+++ libtinymail-camel/tny-camel-folder.c (working copy)
@@ -2088,6 +2088,11 @@
CopyFolderInfo *oinfo = thr_user_data;
TnyProgressInfo *info = NULL;
+ if ((g_ascii_strcasecmp(what, "Renaming folder")) &&
+ (g_ascii_strcasecmp(what, "Moving messages")) &&
+ (g_ascii_strcasecmp(what, "Copying messages")))
+ return;
+
info = tny_progress_info_new (G_OBJECT (oinfo->self), oinfo->status_callback,
TNY_FOLDER_STATUS, TNY_FOLDER_STATUS_CODE_COPY_FOLDER, what, sofar,
oftotal, oinfo->stopper, oinfo->user_data);
@@ -2121,7 +2126,9 @@
info->cancelled = FALSE;
_tny_camel_account_start_camel_operation (TNY_CAMEL_ACCOUNT (priv->account),
- tny_camel_folder_copy_async_status, info, "Copying folder");
+ tny_camel_folder_copy_async_status,
+ info,
+ "Copying folder");
info->adds = NULL; info->rems = NULL;
Index: libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c (revision 2019)
+++ libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c (working copy)
@@ -2678,9 +2678,14 @@
CAMEL_SERVICE_REC_LOCK (imap_store, connect_lock);
+ camel_operation_start (NULL, "Renaming folder");
+
if (!camel_disco_store_check_online((CamelDiscoStore *)imap_store, ex))
goto fail;
+ /* Undefined progress */
+ camel_operation_progress(NULL, 0, -1);
+
/* make sure this folder isn't currently SELECTed - it's
actually possible to rename INBOX but if you do another
INBOX will immediately be created by the server */
@@ -2688,12 +2693,18 @@
if (!response)
goto fail;
+ /* Undefined progress */
+ camel_operation_progress(NULL, 0, -1);
+
camel_imap_response_free_without_processing (imap_store, response);
/*if (imap_store->current_folder)
camel_object_unref (imap_store->current_folder); */
/* no need to actually create a CamelFolder for INBOX */
imap_store->current_folder = NULL;
+ /* Undefined progress */
+ camel_operation_progress(NULL, 0, -1);
+
imap_store->renaming = TRUE;
if (imap_store->parameters & IMAP_PARAM_SUBSCRIPTIONS)
manage_subscriptions(store, old_name, FALSE);
@@ -2705,6 +2716,9 @@
goto fail;
}
+ /* Undefined progress */
+ camel_operation_progress(NULL, 0, -1);
+
camel_imap_response_free (imap_store, response);
/* rename summary, and handle broken server */
@@ -2713,6 +2727,9 @@
if (imap_store->parameters & IMAP_PARAM_SUBSCRIPTIONS)
manage_subscriptions(store, new_name_in, TRUE);
+ /* Undefined progress */
+ camel_operation_progress(NULL, 0, -1);
+
storage_path = g_strdup_printf("%s/folders", imap_store->storage_path);
oldpath = imap_path_to_physical (storage_path, old_name);
newpath = imap_path_to_physical (storage_path, new_name_in);
@@ -2738,6 +2755,7 @@
fail:
imap_store->renaming = FALSE;
CAMEL_SERVICE_REC_UNLOCK(imap_store, connect_lock);
+ camel_operation_end (NULL);
}
static CamelFolderInfo *
Index: libtinymail-camel/camel-lite/camel/camel-cipher-context.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-cipher-context.c (revision 2019)
+++ libtinymail-camel/camel-lite/camel/camel-cipher-context.c (working copy)
@@ -125,7 +125,7 @@
g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (context), -1);
- camel_operation_start(NULL, _("Signing message"));
+ camel_operation_start(NULL, "Signing message");
CIPHER_LOCK(context);
@@ -168,7 +168,7 @@
g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (context), NULL);
- camel_operation_start(NULL, _("Verifying message"));
+ camel_operation_start(NULL, "Verifying message");
CIPHER_LOCK(context);
@@ -212,7 +212,7 @@
g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (context), -1);
- camel_operation_start(NULL, _("Encrypting message"));
+ camel_operation_start(NULL, "Encrypting message");
CIPHER_LOCK(context);
@@ -251,7 +251,7 @@
g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (context), NULL);
- camel_operation_start(NULL, _("Decrypting message"));
+ camel_operation_start(NULL, "Decrypting message");
CIPHER_LOCK(context);
Index: libtinymail-camel/camel-lite/camel/camel-disco-diary.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-disco-diary.c (revision 2019)
+++ libtinymail-camel/camel-lite/camel/camel-disco-diary.c (working copy)
@@ -293,7 +293,7 @@
g_return_if_fail (size != 0);
rewind (diary->file);
- camel_operation_start (NULL, _("Resynchronizing with server"));
+ camel_operation_start (NULL, "Resynchronizing with server");
while (!camel_exception_is_set (ex)) {
camel_operation_progress (NULL, ftell (diary->file) , size);
Index: libtinymail-camel/camel-lite/camel/camel-net-utils.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-net-utils.c (revision 2019)
+++ libtinymail-camel/camel-lite/camel/camel-net-utils.c (working copy)
@@ -661,7 +661,7 @@
return NULL;
}
- camel_operation_start_transient(NULL, _("Resolving: %s"), name);
+ camel_operation_start_transient(NULL, "Resolving: %s", name);
/* force ipv4 addresses only */
#ifndef ENABLE_IPv6
@@ -792,7 +792,7 @@
return -1;
}
- camel_operation_start_transient(NULL, _("Resolving address"));
+ camel_operation_start_transient(NULL, "Resolving address");
msg = g_malloc0(sizeof(*msg));
msg->addr = sa;
Index: libtinymail-camel/camel-lite/camel/camel-offline-folder.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-offline-folder.c (revision 2019)
+++ libtinymail-camel/camel-lite/camel/camel-offline-folder.c (working copy)
@@ -108,7 +108,7 @@
CamelMimeMessage *message;
int i;
- camel_operation_start (NULL, _("Downloading new messages for offline mode"));
+ camel_operation_start (NULL, "Downloading new messages for offline mode");
if (m->changes) {
for (i = 0; i < m->changes->uid_added->len; i++) {
@@ -252,7 +252,7 @@
GPtrArray *uids;
int i;
- camel_operation_start (NULL, _("Syncing messages in folder '%s' to disk"), folder->full_name);
+ camel_operation_start (NULL, "Syncing messages in folder '%s' to disk", folder->full_name);
if (expression)
uids = camel_folder_search_by_expression (folder, expression, ex);
Index: libtinymail-camel/camel-lite/camel/camel-operation.h
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-operation.h (revision 2019)
+++ libtinymail-camel/camel-lite/camel/camel-operation.h (working copy)
@@ -35,6 +35,7 @@
CAMEL_OPERATION_END = -2,
} camel_operation_status_t;
+
/* main thread functions */
CamelOperation *camel_operation_new(CamelOperationStatusFunc status, void *status_data);
void camel_operation_mute(CamelOperation *cc);
Index: libtinymail-camel/camel-lite/camel/camel-folder.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-folder.c (revision 2019)
+++ libtinymail-camel/camel-lite/camel/camel-folder.c (working copy)
@@ -1403,7 +1403,7 @@
if (ex == NULL)
ex = &local;
- camel_operation_start(NULL, delete_originals ? _("Moving messages") : _("Copying messages"));
+ camel_operation_start(NULL, delete_originals ? "Moving messages" : "Copying messages");
if (uids->len > 1) {
camel_folder_freeze(dest);
@@ -1658,7 +1658,7 @@
CamelJunkPlugin *csp = ((CamelService *)m->folder->parent_store)->session->junk_plugin;
if (m->junk) {
- camel_operation_start (NULL, _("Learning junk"));
+ camel_operation_start (NULL, "Learning junk");
for (i = 0; i < m->junk->len; i ++) {
/* TNY TODO: Partial message retrieval exception */
@@ -1675,7 +1675,7 @@
}
if (m->notjunk) {
- camel_operation_start (NULL, _("Learning non-junk"));
+ camel_operation_start (NULL, "Learning non-junk");
for (i = 0; i < m->notjunk->len; i ++) {
/* TNY TODO: Partial message retrieval exception */
CamelMimeMessage *msg = camel_folder_get_message(m->folder, m->notjunk->pdata[i], CAMEL_FOLDER_RECEIVE_FULL, -1, NULL);
@@ -1694,7 +1694,7 @@
camel_junk_plugin_commit_reports (csp);
if (m->driver && m->recents) {
- camel_operation_start(NULL, _("Filtering new message(s)"));
+ camel_operation_start(NULL, "Filtering new message(s)");
source_url = camel_service_get_url((CamelService *)m->folder->parent_store);
uri = camel_url_new(source_url, NULL);
Index: libtinymail-camel/camel-lite/camel/camel-disco-folder.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-disco-folder.c (revision 2019)
+++ libtinymail-camel/camel-lite/camel/camel-disco-folder.c (working copy)
@@ -102,7 +102,7 @@
struct _cdf_sync_msg *m = (struct _cdf_sync_msg *)mm;
int i;
- camel_operation_start(NULL, _("Downloading new messages for offline mode"));
+ camel_operation_start(NULL, "Downloading new messages for offline mode");
if (m->changes) {
for (i=0;i<m->changes->uid_added->len;i++) {
@@ -464,7 +464,7 @@
GPtrArray *uids;
int i;
- camel_operation_start(NULL, _("Preparing folder '%s' for offline"), folder->full_name);
+ camel_operation_start(NULL, "Preparing folder '%s' for offline", folder->full_name);
if (expression)
uids = camel_folder_search_by_expression (folder, expression, ex);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]