mail-notification

Fork of Jean-Yves Lefort's mail-notification, a tray icon to notify of new mail
git clone https://code.djc.id.au/git/mail-notification/

src/mn-compact-message-view.gob (2354B) - 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:Compact:Message:View from MN:Message:View
     33 {
     34   override (MN:Message:View) void
     35     append_header (MNMessageView *view)
     36   {
     37     Self *self = SELF(view);
     38 
     39     self_append_header(self, _("Mailbox"));
     40     self_append_header(self, _("From"));
     41     self_append_header(self, _("Subject"));
     42     self_append_header(self, _("Sent"));
     43     mn_text_table_line_break(MN_TEXT_TABLE(self));
     44   }
     45 
     46   override (MN:Message:View) void
     47     append_message (MNMessageView *view, MNMessage *message, time_t now)
     48   {
     49     Self *self = SELF(view);
     50 
     51     self_append_cell(self, message->mailbox->runtime_name);
     52     self_append_cell(self, message->from);
     53     self_append_cell(self, message->subject);
     54 
     55     if (message->sent_time > 0)
     56       mn_message_view_append_past_time_cell(MN_MESSAGE_VIEW(self), message->sent_time, now);
     57 
     58     mn_text_table_line_break(MN_TEXT_TABLE(self));
     59   }
     60 
     61   private void
     62     append_header (self, const char *name (check null))
     63   {
     64     char *markup;
     65 
     66     markup = g_markup_printf_escaped("<span weight=\"bold\">%s</span>", name);
     67     mn_text_table_append_text_cell_from_markup(MN_TEXT_TABLE(self), markup);
     68     g_free(markup);
     69   }
     70 
     71   private void
     72     append_cell (self, const char *text (check null))
     73   {
     74     mn_text_table_append_text_cell(MN_TEXT_TABLE(self), text);
     75   }
     76 
     77   public GtkWidget *
     78     new (void)
     79   {
     80     return GTK_WIDGET(GET_NEW);
     81   }
     82 }