src/mn-system-vfs-mailbox-properties.gob (2703B) - 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-properties.h"
22 %}
23
24 %{
25 #include <glib/gi18n.h>
26 #include <libgnomevfs/gnome-vfs-utils.h>
27 #include "mn-mailbox-properties-private.h"
28 #include "mn-system-vfs-mailbox.h"
29 #include "mn-stock.h"
30 %}
31
32 class MN:System:VFS:Mailbox:Properties from MN:Mailbox:Properties
33 {
34 property BOOLEAN complete (override)
35 get { g_value_set_boolean(VAL, mn_system_vfs_mailbox_get_uri() != NULL); };
36
37 property STRING default_name (override)
38 get { g_value_set_string(VAL, _("System mailbox")); };
39
40 class_init (class)
41 {
42 MNMailboxPropertiesClass *p_class = MN_MAILBOX_PROPERTIES_CLASS(class);
43
44 p_class->type = "system-vfs";
45 p_class->stock_id = MN_STOCK_SYSTEM_MAILBOX;
46 p_class->combo_label = _("System mailbox");
47 }
48
49 init (self)
50 {
51 MNMailboxProperties *properties = MN_MAILBOX_PROPERTIES(self);
52 GtkWidget *location_vbox;
53 GtkWidget *label;
54 const char *system_uri;
55
56 /* translators: header capitalization */
57 location_vbox = mn_mailbox_properties_add_general_section(properties, _("Location"));
58
59 label = gtk_label_new(NULL);
60
61 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
62 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
63 gtk_label_set_selectable(GTK_LABEL(label), TRUE);
64
65 system_uri = mn_system_vfs_mailbox_get_uri();
66 if (system_uri)
67 {
68 char *path;
69 char *markup;
70
71 path = gnome_vfs_get_local_path_from_uri(system_uri);
72
73 markup = g_markup_printf_escaped(_("Your system mailbox is <span weight=\"bold\">%s</span>."), path ? path : system_uri);
74 gtk_label_set_markup(GTK_LABEL(label), markup);
75 g_free(markup);
76
77 g_free(path);
78 }
79 else
80 gtk_label_set_text(GTK_LABEL(label), _("The location of your system mailbox could not be detected. Check the MAIL environment variable."));
81
82 gtk_widget_show(label);
83 gtk_box_pack_start(GTK_BOX(location_vbox), label, FALSE, FALSE, 0);
84 }
85 }