diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-09 07:19:52 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-09 07:19:52 +0000 |
commit | f7ca35cbcbb20c446d2fc392adcb67bf3ccacc77 (patch) | |
tree | 23096150e8bea463a5b7ff6d4e63eaa7eee1b9b8 /libsylph | |
parent | 1bddee29d23efedb91b43a1fa6667090a52f54f9 (diff) |
update progress bar when executing long IMAP4 operations.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@567 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/imap.c | 6 | ||||
-rw-r--r-- | libsylph/utils.c | 13 | ||||
-rw-r--r-- | libsylph/utils.h | 8 |
3 files changed, 26 insertions, 1 deletions
diff --git a/libsylph/imap.c b/libsylph/imap.c index cc178340..7b915c9d 100644 --- a/libsylph/imap.c +++ b/libsylph/imap.c @@ -1210,6 +1210,7 @@ static gint imap_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list, PROGRESS_UPDATE_INTERVAL * 1000) { status_print(_("Appending messages to %s (%d / %d)"), dest->path, count, total); + progress_show(count, total); ui_update(); tv_prev = tv_cur; } @@ -1221,6 +1222,7 @@ static gint imap_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list, if (ok != IMAP_SUCCESS) { g_warning("can't append message %s\n", fileinfo->file); g_free(destdir); + progress_show(0, 0); return -1; } @@ -1240,6 +1242,7 @@ static gint imap_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list, dest->unread++; } + progress_show(0, 0); g_free(destdir); if (remove_source) { @@ -2299,6 +2302,7 @@ static GSList *imap_get_uncached_messages(IMAPSession *session, status_print (_("Getting message headers (%d / %d)"), count, exists); + progress_show(count, exists); ui_update(); tv_prev = tv_cur; } @@ -2308,6 +2312,7 @@ static GSList *imap_get_uncached_messages(IMAPSession *session, if (sock_getline(SESSION(session)->sock, &tmp) < 0) { log_warning(_("error occurred while getting envelope.\n")); g_string_free(str, TRUE); + progress_show(0, 0); return newlist; } strretchomp(tmp); @@ -2355,6 +2360,7 @@ static GSList *imap_get_uncached_messages(IMAPSession *session, item->total++; } + progress_show(0, 0); g_string_free(str, TRUE); session_set_access_time(SESSION(session)); diff --git a/libsylph/utils.c b/libsylph/utils.c index c6427cfd..8c2c2b80 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -3278,6 +3278,19 @@ void ui_update(void) ui_update_func(); } +static ProgressFunc progress_func = NULL; + +void set_progress_func(ProgressFunc func) +{ + progress_func = func; +} + +void progress_show(gint cur, gint total) +{ + if (progress_func) + progress_func(cur, total); +} + /* user input */ static QueryPasswordFunc query_password_func = NULL; diff --git a/libsylph/utils.h b/libsylph/utils.h index 8d257366..d367f362 100644 --- a/libsylph/utils.h +++ b/libsylph/utils.h @@ -177,6 +177,8 @@ gint g_chmod (const gchar *path, } typedef void (*UIUpdateFunc) (void); +typedef void (*ProgressFunc) (gint cur, + gint total); typedef gchar * (*QueryPasswordFunc) (const gchar *server, const gchar *user); typedef void (*LogFunc) (const gchar *str); @@ -475,7 +477,11 @@ size_t my_strftime (gchar *s, /* UI hints */ void set_ui_update_func (UIUpdateFunc func); -void ui_update(void); +void ui_update (void); + +void set_progress_func (ProgressFunc func); +void progress_show (gint cur, + gint total); /* user input */ void set_input_query_password_func (QueryPasswordFunc func); |