aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.ja8
-rw-r--r--libsylph/imap.c6
-rw-r--r--libsylph/utils.c13
-rw-r--r--libsylph/utils.h8
-rw-r--r--src/main.c1
-rw-r--r--src/mainwindow.c14
-rw-r--r--src/mainwindow.h3
8 files changed, 60 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6ef6e70f..82081b61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-09-09
+
+ * libsylph/utils.[ch]
+ libsylph/imap.c
+ src/main.c
+ src/mainwindow.[ch]: update progress bar when executing long
+ operations.
+
2005-09-08
* src/addressbook.c: addressbook_tree_button_pressed(): fixed a bug
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 52358bad..c72a4892 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,11 @@
+2005-09-09
+
+ * libsylph/utils.[ch]
+ libsylph/imap.c
+ src/main.c
+ src/mainwindow.[ch]: 長い処理の実行中にプログレスバーを更新する
+ ようにした。
+
2005-09-08
* src/addressbook.c: addressbook_tree_button_pressed(): フォルダ
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);
diff --git a/src/main.c b/src/main.c
index 3b7c4a18..6a632277 100644
--- a/src/main.c
+++ b/src/main.c
@@ -196,6 +196,7 @@ int main(int argc, char *argv[])
set_log_file("sylpheed.log");
set_ui_update_func(gtkut_events_flush);
+ set_progress_func(main_window_progress_show);
set_input_query_password_func(input_dialog_query_password);
CHDIR_EXIT_IF_FAIL(get_home_dir(), 1);
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 14e7e0e9..5bd94bfe 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -1520,6 +1520,20 @@ void main_window_progress_set(MainWindow *mainwin, gint cur, gint total)
(gfloat)cur / (gfloat)total);
}
+void main_window_progress_show(gint cur, gint total)
+{
+ MainWindow *mainwin;
+
+ mainwin = main_window_get();
+
+ if (total > 0) {
+ gtk_progress_set_show_text(GTK_PROGRESS(mainwin->progressbar),
+ TRUE);
+ main_window_progress_set(mainwin, cur, total);
+ } else
+ main_window_progress_off(mainwin);
+}
+
void main_window_toggle_online(MainWindow *mainwin, gboolean online)
{
if (prefs_common.online_mode != online)
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 3184ca8b..d78f08c7 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -155,6 +155,9 @@ void main_window_progress_set (MainWindow *mainwin,
gint cur,
gint total);
+void main_window_progress_show (gint cur,
+ gint total);
+
void main_window_toggle_online (MainWindow *mainwin,
gboolean online);
gboolean main_window_toggle_online_if_offline (MainWindow *mainwin);