X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-details-dialog.c;h=fcbf32a60805afee0f7e4afd770d9325b35c130d;hb=aa217bb73f75e470e94184a592701176623bcc1f;hp=7adbf141c8e03ada3d27168970a7f2a858511d4f;hpb=db0f954f230572de353f9397777459cd8daa30c6;p=modest diff --git a/src/widgets/modest-details-dialog.c b/src/widgets/modest-details-dialog.c index 7adbf14..fcbf32a 100644 --- a/src/widgets/modest-details-dialog.c +++ b/src/widgets/modest-details-dialog.c @@ -37,10 +37,11 @@ #include #include #include -#include +#include #include +#include #include - +#include /* for strlen */ static void modest_details_dialog_set_header_default (ModestDetailsDialog *self, TnyHeader *header); @@ -219,34 +220,48 @@ modest_details_dialog_set_header_default (ModestDetailsDialog *self, if (cc == NULL) cc = g_strdup (""); - /* Add from and subject */ + /* Add from and subject for all folders */ modest_details_dialog_add_data (self, _("mcen_fi_message_properties_from"), from); modest_details_dialog_add_data (self, _("mcen_fi_message_properties_subject"), subject); - /* Set received (optional) */ + + /* for inbox, user-created folders and archive: Received */ if (received && (folder_type != TNY_FOLDER_TYPE_SENT) && (folder_type != TNY_FOLDER_TYPE_DRAFTS) && (folder_type != TNY_FOLDER_TYPE_OUTBOX)) { - + modest_text_utils_strftime (date_time_buffer, DATE_TIME_BUFFER_SIZE, "%x %X", received); modest_details_dialog_add_data (self, _("mcen_fi_message_properties_received"), date_time_buffer); } - /* Set date sent (optional) */ + /* for outbox, drafts: Modified: (_created) */ + if ((folder_type == TNY_FOLDER_TYPE_DRAFTS) || + (folder_type == TNY_FOLDER_TYPE_OUTBOX) || + (folder_type == TNY_FOLDER_TYPE_SENT)) { + modest_text_utils_strftime (date_time_buffer, DATE_TIME_BUFFER_SIZE, "%x %X", + received); + modest_details_dialog_add_data (self, _("mcen_fi_message_properties_created"), + date_time_buffer); + } + + /* for everyting except outbox, drafts: Sent */ if (sent && (folder_type != TNY_FOLDER_TYPE_DRAFTS)&& (folder_type != TNY_FOLDER_TYPE_OUTBOX)) { - + modest_text_utils_strftime (date_time_buffer, DATE_TIME_BUFFER_SIZE, "%x %X", sent); modest_details_dialog_add_data (self, _("mcen_fi_message_properties_sent"), date_time_buffer); } - + /* Set To and CC */ modest_details_dialog_add_data (self, _("mcen_fi_message_properties_to"), to); - modest_details_dialog_add_data (self, _("mcen_fi_message_properties_cc"), cc); + + /* only show cc when it's there */ + if (cc && strlen(cc) > 0) + modest_details_dialog_add_data (self, _("mcen_fi_message_properties_cc"), cc); /* Set size */ if (size <= 0) @@ -267,19 +282,19 @@ static void modest_details_dialog_set_folder_default (ModestDetailsDialog *self, TnyFolder *folder) { - TnyFolderStats *stats; - gchar *count, *size_s, *name; - gint size; + gchar *count_s, *size_s, *name = NULL; + gint size, count; /* Set window title */ gtk_window_set_title (GTK_WINDOW (self), _("mcen_ti_folder_properties")); gtk_dialog_add_button (GTK_DIALOG (self), _("mcen_bd_close"), GTK_RESPONSE_CLOSE); - /* Get stats */ - stats = tny_folder_get_stats (folder); - count = g_strdup_printf ("%d", tny_folder_stats_get_all_count (stats)); - /* Format the size */ - size = tny_folder_stats_get_local_size (stats); + /* Get data. We use our function because it's recursive */ + count = modest_tny_folder_store_get_message_count (TNY_FOLDER_STORE (folder)); + size = modest_tny_folder_store_get_local_size (TNY_FOLDER_STORE (folder)); + + /* Format count and size */ + count_s = g_strdup_printf ("%d", count); if (size <= 0) size_s = g_strdup (_("mcen_va_message_properties_size_noinfo")); else @@ -287,22 +302,22 @@ modest_details_dialog_set_folder_default (ModestDetailsDialog *self, /* Different names for the local folders */ if (modest_tny_folder_is_local_folder (folder)) { - gint type = modest_tny_folder_get_local_folder_type (folder); + gint type = modest_tny_folder_get_local_or_mmc_folder_type (folder); if (type != TNY_FOLDER_TYPE_UNKNOWN) name = g_strdup(modest_local_folder_info_get_type_display_name (type)); - } else { + } + + if (!name) name = g_strdup (tny_folder_get_name (folder)); - } modest_details_dialog_add_data (self, _("mcen_fi_folder_properties_foldername"), name); - modest_details_dialog_add_data (self, _("mcen_fi_folder_properties_messages"), count); + modest_details_dialog_add_data (self, _("mcen_fi_folder_properties_messages"), count_s); modest_details_dialog_add_data (self, _("mcen_fi_folder_properties_size"), size_s); /* Frees */ g_free (name); g_free (size_s); - g_free (count); - g_object_unref (stats); + g_free (count_s); } static void