src/mn-custom-vfs-mailbox.gob (2002B) - 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-vfs-mailbox.h" 22 %} 23 24 %{ 25 #include <glib/gi18n.h> 26 #include "mn-mailbox-private.h" 27 %} 28 29 class MN:Custom:VFS:Mailbox from MN:VFS:Mailbox 30 { 31 public char *uri destroywith g_free; 32 property STRING uri (link, flags = MN_MAILBOX_PARAM_LOAD_SAVE | MN_MAILBOX_PARAM_REQUIRED); 33 34 class_init (class) 35 { 36 MN_MAILBOX_CLASS(class)->type = "custom-vfs"; 37 } 38 39 override (MN:Mailbox) void 40 seal (MNMailbox *mailbox) 41 { 42 MN_VFS_MAILBOX(mailbox)->uri = gnome_vfs_make_uri_canonical(SELF(mailbox)->uri); 43 44 PARENT_HANDLER(mailbox); 45 } 46 47 override (MN:Mailbox) MNMailbox * 48 parse_uri (MNMailbox *dummy, const char *uri) 49 { 50 GnomeVFSURI *vfs_uri; 51 MNMailbox *mailbox = NULL; 52 53 vfs_uri = gnome_vfs_uri_new(uri); 54 if (vfs_uri) 55 { 56 mailbox = mn_mailbox_new("custom-vfs", "uri", uri, NULL); 57 gnome_vfs_uri_unref(vfs_uri); 58 } 59 60 return mailbox; 61 } 62 63 override (MN:Mailbox) void 64 check (MNMailbox *mailbox) 65 { 66 if (MN_VFS_MAILBOX(mailbox)->vfs_uri) 67 { 68 PARENT_HANDLER(mailbox); 69 } 70 else 71 { 72 mn_mailbox_set_error(mailbox, _("invalid location")); 73 mn_mailbox_set_poll(mailbox, FALSE); /* disable the mailbox */ 74 } 75 } 76 }