src/mn-standard-message-view.gob (2439B) - raw
1 /* 2 * Mail Notification 3 * Copyright (C) 2003-2008 Jean-Yves Lefort <jylefort@brutele.be> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 %headertop{ 21 #include "mn-message-view.h" 22 %} 23 24 %{ 25 #include <glib/gi18n.h> 26 #include "mn-message-view-private.h" 27 #include "mn-message.h" 28 #include "mn-util.h" 29 #include "mn-text-table.h" 30 %} 31 32 class MN:Standard:Message:View from MN:Message:View 33 { 34 override (MN:Message:View) void 35 append_message (MNMessageView *view, MNMessage *message, time_t now) 36 { 37 Self *self = SELF(view); 38 39 self_append_row(self, _("Mailbox:"), message->mailbox->runtime_name); 40 self_append_row(self, _("From:"), message->from); 41 self_append_row(self, _("Subject:"), message->subject); 42 43 if (message->sent_time > 0) 44 { 45 self_append_header(self, _("Sent:")); 46 mn_message_view_append_past_time_cell(MN_MESSAGE_VIEW(self), message->sent_time, now); 47 mn_text_table_line_break(MN_TEXT_TABLE(self)); 48 } 49 } 50 51 override (MN:Message:View) void 52 append_message_separator (MNMessageView *view) 53 { 54 mn_text_table_append_blank_cell(MN_TEXT_TABLE(view), 0, 12); 55 mn_text_table_line_break(MN_TEXT_TABLE(view)); 56 } 57 58 private void 59 append_row (self, 60 const char *name (check null), 61 const char *value (check null)) 62 { 63 self_append_header(self, name); 64 mn_text_table_append_text_cell(MN_TEXT_TABLE(self), value); 65 mn_text_table_line_break(MN_TEXT_TABLE(self)); 66 } 67 68 private void 69 append_header (self, const char *name (check null)) 70 { 71 char *markup; 72 73 markup = g_markup_printf_escaped("<span weight=\"bold\">%s</span>", name); 74 mn_text_table_append_text_cell_from_markup(MN_TEXT_TABLE(self), markup); 75 g_free(markup); 76 } 77 78 public GtkWidget * 79 new (void) 80 { 81 return GTK_WIDGET(GET_NEW); 82 } 83 }