diff options
author | Iain Holmes <iain@src.gnome.org> | 2001-07-07 05:49:20 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2001-07-07 05:49:20 +0800 |
commit | 3dc641a7bf4d435e32ee89ad7748c639574a32e0 (patch) | |
tree | 719bbdf545625dc1d2ce9e50bf605bc672c950a7 /my-evolution/e-summary-mail.c | |
parent | 214d03a44a266edbba2e82ab776b950a2bacbaf3 (diff) | |
download | gsoc2013-evolution-3dc641a7bf4d435e32ee89ad7748c639574a32e0.tar.gz gsoc2013-evolution-3dc641a7bf4d435e32ee89ad7748c639574a32e0.tar.zst gsoc2013-evolution-3dc641a7bf4d435e32ee89ad7748c639574a32e0.zip |
Mail stuff added
svn path=/trunk/; revision=10867
Diffstat (limited to 'my-evolution/e-summary-mail.c')
-rw-r--r-- | my-evolution/e-summary-mail.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/my-evolution/e-summary-mail.c b/my-evolution/e-summary-mail.c index 4ce4fd90c9..bf00686f1e 100644 --- a/my-evolution/e-summary-mail.c +++ b/my-evolution/e-summary-mail.c @@ -356,3 +356,87 @@ e_summary_mail_reconfigure (ESummary *summary) e_summary_draw (summary); } + +static void +free_row_data (gpointer data) +{ + ESummaryMailRowData *rd = data; + + g_free (rd->name); + g_free (rd->uri); + g_free (rd); +} + +static void +hash_to_list (gpointer key, + gpointer value, + gpointer data) +{ + ESummaryMailRowData *rd; + ESummaryMailFolder *folder; + GList **p; + + p = (GList **) data; + folder = (ESummaryMailFolder *) value; + + rd = g_new (ESummaryMailRowData, 1); + rd->name = g_strdup (folder->name); + rd->uri = g_strdup (key); + + *p = g_list_prepend (*p, rd); +} + +static int +str_compare (gconstpointer a, + gconstpointer b) +{ + ESummaryMailRowData *rda, *rdb; + + rda = a; + rdb = b; + return strcmp (rda->name, rdb->name); +} + +void +e_summary_mail_fill_list (GtkCList *clist, + ESummary *summary) +{ + ESummaryMail *mail; + GList *names = NULL, *p; + + mail = summary->mail; + if (mail == NULL) { + return; + } + + g_hash_table_foreach (mail->folders, hash_to_list, &names); + + names = g_list_sort (names, str_compare); + for (p = names; p; p = p->next) { + ESummaryMailRowData *rd; + char *text[1]; + int row; + + rd = p->data; + text[0] = rd->name + 1; + row = gtk_clist_append (clist, text); + gtk_clist_set_row_data_full (clist, row, rd, free_row_data); + } + + g_list_free (names); +} + +const char * +e_summary_mail_uri_to_name (ESummary *summary, + const char *uri) +{ + ESummaryMailFolder *folder; + + folder = g_hash_table_lookup (summary->mail->folders, uri); + if (folder == NULL) { + return NULL; + } else { + return folder->name; + } +} + |