[evolution] Bug 233140 - Show message counts in subscribe folders dialog
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 233140 - Show message counts in subscribe folders dialog
- Date: Mon, 10 Aug 2015 10:16:43 +0000 (UTC)
commit 094d9c07dce115cb963665501327c286ff111645
Author: Milan Crha <mcrha redhat com>
Date: Mon Aug 10 12:16:44 2015 +0200
Bug 233140 - Show message counts in subscribe folders dialog
mail/em-subscription-editor.c | 43 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c
index e0dfff1..c4b6f39 100644
--- a/mail/em-subscription-editor.c
+++ b/mail/em-subscription-editor.c
@@ -1316,6 +1316,41 @@ subscription_editor_selection_changed_cb (GtkTreeSelection *selection,
}
static void
+em_subscription_editor_get_unread_total_text_cb (GtkTreeViewColumn *tree_column,
+ GtkCellRenderer *cell,
+ GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ gpointer user_data)
+{
+ CamelFolderInfo *folder_info = NULL;
+ GString *text = NULL;
+
+ g_return_if_fail (GTK_IS_CELL_RENDERER_TEXT (cell));
+ g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
+ g_return_if_fail (iter != NULL);
+
+ gtk_tree_model_get (tree_model, iter, COL_FOLDER_INFO, &folder_info, -1);
+
+ if (folder_info && folder_info->total > 0 && folder_info->unread >= 0 && folder_info->unread <=
folder_info->total) {
+ text = g_string_new ("");
+
+ if (folder_info->unread > 0)
+ g_string_append_printf (
+ text, ngettext ("%d unread, ",
+ "%d unread, ", folder_info->unread), folder_info->unread);
+
+ g_string_append_printf (
+ text, ngettext ("%d total", "%d total",
+ folder_info->total), folder_info->total);
+ }
+
+ g_object_set (G_OBJECT (cell), "text", text ? text->str : NULL, NULL);
+
+ if (text)
+ g_string_free (text, TRUE);
+}
+
+static void
subscription_editor_add_store (EMSubscriptionEditor *editor,
CamelStore *store)
{
@@ -1406,6 +1441,14 @@ subscription_editor_add_store (EMSubscriptionEditor *editor,
gtk_tree_view_column_add_attribute (
column, renderer, "text", COL_FOLDER_NAME);
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, renderer, FALSE);
+ gtk_tree_view_column_set_cell_data_func (column, renderer,
+ em_subscription_editor_get_unread_total_text_cb, NULL, NULL);
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
g_signal_connect (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]