aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-09-26 07:36:00 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-09-26 07:36:00 +0000
commitc5b3f5701e836a2283461065a79d17875fe454f1 (patch)
treeddae4610ca946f0e075dcaabdb5c402373d136a7 /src
parent2569f2416f350e29ff414671b74f2524fa883113 (diff)
added progress column to the progress dialog.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2043 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/inc.c41
-rw-r--r--src/progressdialog.c35
-rw-r--r--src/progressdialog.h8
-rw-r--r--src/send_message.c7
4 files changed, 65 insertions, 26 deletions
diff --git a/src/inc.c b/src/inc.c
index 17b83ce3..39ab8f28 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -545,7 +545,7 @@ static void inc_progress_dialog_set_list(IncProgressDialog *inc_dialog)
session->data = inc_dialog;
progress_dialog_append(inc_dialog->dialog, NULL,
pop3_session->ac_prefs->account_name,
- _("Standby"), NULL);
+ _("Standby"), "", NULL);
}
}
@@ -664,12 +664,16 @@ static gint inc_start(IncProgressDialog *inc_dialog)
qlist = next;
}
-#define SET_PIXMAP_AND_TEXT(pixbuf, str) \
+#define SET_PIXMAP_AND_TEXT(pixbuf, status, progress) \
{ \
progress_dialog_set_row_pixbuf(inc_dialog->dialog, \
inc_dialog->cur_row, pixbuf); \
progress_dialog_set_row_status(inc_dialog->dialog, \
- inc_dialog->cur_row, str); \
+ inc_dialog->cur_row, status); \
+ if (progress) \
+ progress_dialog_set_row_progress(inc_dialog->dialog, \
+ inc_dialog->cur_row, \
+ progress); \
}
for (; inc_dialog->queue_list != NULL; inc_dialog->cur_row++) {
@@ -678,7 +682,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
if (session->inc_state == INC_CANCEL ||
pop3_session->pass == NULL) {
- SET_PIXMAP_AND_TEXT(ok_pixbuf, _("Cancelled"));
+ SET_PIXMAP_AND_TEXT(ok_pixbuf, _("Cancelled"), NULL);
inc_session_destroy(session);
inc_dialog->queue_list =
g_list_remove(inc_dialog->queue_list, session);
@@ -689,7 +693,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
progress_dialog_scroll_to_row(inc_dialog->dialog,
inc_dialog->cur_row);
- SET_PIXMAP_AND_TEXT(current_pixbuf, _("Retrieving"));
+ SET_PIXMAP_AND_TEXT(current_pixbuf, _("Retrieving"), NULL);
/* begin POP3 session */
inc_state = inc_pop3_session_do(session);
@@ -698,36 +702,37 @@ static gint inc_start(IncProgressDialog *inc_dialog)
case INC_SUCCESS:
if (pop3_session->cur_total_num > 0)
msg = g_strdup_printf
- (_("Done (%d message(s) (%s) received)"),
+ (_("%d message(s) (%s) received"),
pop3_session->cur_total_num,
to_human_readable(pop3_session->cur_total_recv_bytes));
else
- msg = g_strdup_printf(_("Done (no new messages)"));
- SET_PIXMAP_AND_TEXT(ok_pixbuf, msg);
+ msg = g_strdup_printf(_("no new messages"));
+ SET_PIXMAP_AND_TEXT(ok_pixbuf, _("Done"), msg);
g_free(msg);
break;
case INC_CONNECT_ERROR:
SET_PIXMAP_AND_TEXT(error_pixbuf,
- _("Connection failed"));
+ _("Connection failed"), NULL);
break;
case INC_AUTH_FAILED:
- SET_PIXMAP_AND_TEXT(error_pixbuf, _("Auth failed"));
+ SET_PIXMAP_AND_TEXT(error_pixbuf, _("Auth failed"),
+ NULL);
break;
case INC_LOCKED:
- SET_PIXMAP_AND_TEXT(error_pixbuf, _("Locked"));
+ SET_PIXMAP_AND_TEXT(error_pixbuf, _("Locked"), NULL);
break;
case INC_ERROR:
case INC_NO_SPACE:
case INC_IO_ERROR:
case INC_SOCKET_ERROR:
case INC_EOF:
- SET_PIXMAP_AND_TEXT(error_pixbuf, _("Error"));
+ SET_PIXMAP_AND_TEXT(error_pixbuf, _("Error"), NULL);
break;
case INC_TIMEOUT:
- SET_PIXMAP_AND_TEXT(error_pixbuf, _("Timeout"));
+ SET_PIXMAP_AND_TEXT(error_pixbuf, _("Timeout"), NULL);
break;
case INC_CANCEL:
- SET_PIXMAP_AND_TEXT(ok_pixbuf, _("Cancelled"));
+ SET_PIXMAP_AND_TEXT(ok_pixbuf, _("Cancelled"), NULL);
break;
default:
break;
@@ -1007,12 +1012,12 @@ static void inc_progress_dialog_set_progress(IncProgressDialog *inc_dialog,
if (pop3_session->cur_total_num > 0) {
g_snprintf(buf, sizeof(buf),
- _("Retrieving (%d message(s) (%s) received)"),
+ _("%d message(s) (%s) received"),
pop3_session->cur_total_num,
to_human_readable
(pop3_session->cur_total_recv_bytes));
- progress_dialog_set_row_status(inc_dialog->dialog,
- inc_dialog->cur_row, buf);
+ progress_dialog_set_row_progress(inc_dialog->dialog,
+ inc_dialog->cur_row, buf);
}
}
diff --git a/src/progressdialog.c b/src/progressdialog.c
index d1dd40ab..a015ad31 100644
--- a/src/progressdialog.c
+++ b/src/progressdialog.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -101,7 +101,8 @@ ProgressDialog *progress_dialog_create(void)
GTK_SHADOW_IN);
store = gtk_list_store_new(PROG_N_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_POINTER);
+ G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_POINTER);
treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
@@ -128,7 +129,7 @@ ProgressDialog *progress_dialog_create(void)
(_("Account"), renderer, "text", PROG_COL_NAME, NULL);
gtk_tree_view_column_set_resizable(column, TRUE);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_column_set_fixed_width(column, 160);
+ gtk_tree_view_column_set_fixed_width(column, 120);
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
renderer = gtk_cell_renderer_text_new();
@@ -136,6 +137,14 @@ ProgressDialog *progress_dialog_create(void)
(_("Status"), renderer, "text", PROG_COL_STATUS, NULL);
gtk_tree_view_column_set_resizable(column, TRUE);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width(column, 80);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes
+ (_("Progress"), renderer, "text", PROG_COL_PROGRESS, NULL);
+ gtk_tree_view_column_set_resizable(column, TRUE);
+ gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
progress->window = dialog;
@@ -175,7 +184,7 @@ void progress_dialog_set_percentage(ProgressDialog *progress,
void progress_dialog_append(ProgressDialog *progress, GdkPixbuf *pixbuf,
const gchar *name, const gchar *status,
- gpointer data)
+ const gchar *progress_str, gpointer data)
{
GtkListStore *store = progress->store;
GtkTreeIter iter;
@@ -186,13 +195,15 @@ void progress_dialog_append(ProgressDialog *progress, GdkPixbuf *pixbuf,
PROG_COL_PIXBUF, pixbuf,
PROG_COL_NAME, name,
PROG_COL_STATUS, status,
+ PROG_COL_PROGRESS, progress_str,
PROG_COL_POINTER, data,
-1);
}
void progress_dialog_set_row(ProgressDialog *progress, gint row,
GdkPixbuf *pixbuf, const gchar *name,
- const gchar *status, gpointer data)
+ const gchar *status, const gchar *progress_str,
+ gpointer data)
{
GtkListStore *store = progress->store;
GtkTreeIter iter;
@@ -203,6 +214,7 @@ void progress_dialog_set_row(ProgressDialog *progress, gint row,
PROG_COL_PIXBUF, pixbuf,
PROG_COL_NAME, name,
PROG_COL_STATUS, status,
+ PROG_COL_PROGRESS, progress_str,
PROG_COL_POINTER, data,
-1);
}
@@ -244,6 +256,19 @@ void progress_dialog_set_row_status(ProgressDialog *progress, gint row,
}
}
+void progress_dialog_set_row_progress(ProgressDialog *progress, gint row,
+ const gchar *progress_str)
+{
+ GtkListStore *store = progress->store;
+ GtkTreeIter iter;
+
+ if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store),
+ &iter, NULL, row)) {
+ gtk_list_store_set(store, &iter, PROG_COL_PROGRESS,
+ progress_str, -1);
+ }
+}
+
void progress_dialog_scroll_to_row(ProgressDialog *progress, gint row)
{
GtkTreeModel *model = GTK_TREE_MODEL(progress->store);
diff --git a/src/progressdialog.h b/src/progressdialog.h
index 33cf9836..1a722b3a 100644
--- a/src/progressdialog.h
+++ b/src/progressdialog.h
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,6 +43,7 @@ typedef enum
PROG_COL_PIXBUF,
PROG_COL_NAME,
PROG_COL_STATUS,
+ PROG_COL_PROGRESS,
PROG_COL_POINTER,
PROG_N_COLS
} ProgressColumn;
@@ -61,12 +62,14 @@ void progress_dialog_append (ProgressDialog *progress,
GdkPixbuf *pixbuf,
const gchar *name,
const gchar *status,
+ const gchar *progress_str,
gpointer data);
void progress_dialog_set_row (ProgressDialog *progress,
gint row,
GdkPixbuf *pixbuf,
const gchar *name,
const gchar *status,
+ const gchar *progress_str,
gpointer data);
void progress_dialog_set_row_pixbuf (ProgressDialog *progress,
@@ -78,6 +81,9 @@ void progress_dialog_set_row_name (ProgressDialog *progress,
void progress_dialog_set_row_status (ProgressDialog *progress,
gint row,
const gchar *status);
+void progress_dialog_set_row_progress (ProgressDialog *progress,
+ gint row,
+ const gchar *progress_str);
void progress_dialog_scroll_to_row (ProgressDialog *progress,
gint row);
diff --git a/src/send_message.c b/src/send_message.c
index 42126812..db474602 100644
--- a/src/send_message.c
+++ b/src/send_message.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -717,7 +717,7 @@ static gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp)
dialog->session = session;
progress_dialog_append(dialog->dialog, NULL, ac_prefs->smtp_server,
- _("Connecting"), NULL);
+ _("Connecting"), "", NULL);
g_snprintf(buf, sizeof(buf), _("Connecting to SMTP server: %s ..."),
ac_prefs->smtp_server);
@@ -860,6 +860,9 @@ static gint send_send_data_progressive(Session *session, guint cur_len,
progress_dialog_set_label(dialog->dialog, buf);
progress_dialog_set_percentage
(dialog->dialog, (gfloat)cur_len / (gfloat)total_len);
+ g_snprintf(buf, sizeof(buf), _("%d / %d bytes"),
+ cur_len, total_len);
+ progress_dialog_set_row_progress(dialog->dialog, 0, buf);
#ifdef G_OS_WIN32
GTK_EVENTS_FLUSH();
#endif