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-test-mailbox.gob (1920B) - 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-mailbox.h"
     22 %}
     23 
     24 %{
     25 #include <glib/gi18n.h>
     26 #include "mn-mailbox-private.h"
     27 #include "mn-message.h"
     28 #include "mn-util.h"
     29 %}
     30 
     31 class MN:Test:Mailbox from MN:Mailbox
     32 {
     33   init (self)
     34   {
     35     MNMailbox *mailbox = MN_MAILBOX(self);
     36 
     37     mn_mailbox_set_poll(mailbox, FALSE);
     38     mailbox->runtime_name = g_strdup(_("Test mailbox"));
     39   }
     40 
     41   override (MN:Mailbox) void
     42     check (MNMailbox *mailbox)
     43   {
     44     GSList *messages = NULL;
     45     time_t now;
     46     int i;
     47 
     48     PARENT_HANDLER(mailbox);
     49 
     50     now = mn_time();
     51 
     52     for (i = 1; i < 4; i++)
     53       {
     54 	MNMessage *message;
     55 	char *subject;
     56 
     57 	subject = g_strdup_printf(_("Test message #%i"), i);
     58 	message = mn_message_new(mailbox,
     59 				 now,
     60 				 NULL,
     61 				 NULL,
     62 				 /* translators: header capitalization */
     63 				 _("Mail Notification Properties Dialog"),
     64 				 subject,
     65 				 NULL,
     66 				 MN_MESSAGE_NEW);
     67 	g_free(subject);
     68 
     69 	messages = g_slist_append(messages, message);
     70       }
     71 
     72     mn_mailbox_set_messages(mailbox, messages);
     73     mn_g_object_slist_free(messages);
     74   }
     75 
     76   public MNMailbox *
     77     new (void)
     78   {
     79     return MN_MAILBOX(GET_NEW);
     80   }
     81 }