aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-view.c
blob: 72ed83654d09b15f034cf98a45b121230d3f32df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 *  Authors: Jeffrey Stedfast <fejj@helixcode.com>
 *
 *  Copyright 2000 Helix Code, Inc. (www.helixcode.com)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
 *
 */

#include <mail.h>
#include <camel.h>

static void
on_close (GtkWidget *menuitem, gpointer user_data)
{
    GtkWidget *view;
    
    view = gtk_widget_get_toplevel (menuitem);
    
    gtk_widget_destroy (view);
}

static GnomeUIInfo mail_view_toolbar [] = {
    
    /*GNOMEUIINFO_ITEM_STOCK (N_("Save"), N_("Save this message"),
      save_msg, GNOME_STOCK_PIXMAP_SAVE),*/
    
    GNOMEUIINFO_ITEM_STOCK (N_("Reply"), N_("Reply to the sender of this message"),
                reply_to_sender, GNOME_STOCK_PIXMAP_MAIL_RPL),
    
    GNOMEUIINFO_ITEM_STOCK (N_("Reply to All"), N_("Reply to all recipients of this message"),
                reply_to_all, GNOME_STOCK_PIXMAP_MAIL_RPL),
    
    GNOMEUIINFO_ITEM_STOCK (N_("Forward"), N_("Forward this message"), forward_msg, GNOME_STOCK_PIXMAP_MAIL_FWD),
    
    GNOMEUIINFO_SEPARATOR,
    
    GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print the selected message"), print_msg, GNOME_STOCK_PIXMAP_PRINT),
    
    GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete this message"), delete_msg, GNOME_STOCK_PIXMAP_TRASH),
    
    GNOMEUIINFO_SEPARATOR,
    
    /*GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Next message"), mail_view_next_msg, GNOME_STOCK_PIXMAP_NEXT),
    
      GNOMEUIINFO_ITEM_STOCK (N_("Previous"), N_("Previous message"), mail_view_prev__msg, GNOME_STOCK_PIXMAP_PREVIOUS),*/
    
    GNOMEUIINFO_END
};

static GnomeUIInfo file_menu[] = {
    /*GNOMEUIINFO_MENU_SAVE_ITEM (save, NULL),*/
    /*GNOMEUIINFO_MENU_SAVE_AS_ITEM (save_as, NULL),*/
    /*GNOMEUIINFO_SEPARATOR,*/
    GNOMEUIINFO_MENU_CLOSE_ITEM (on_close, NULL),
    GNOMEUIINFO_END
};

static GnomeUIInfo view_menu[] =
{
    GNOMEUIINFO_END
};

static GnomeUIInfo mail_view_menubar[] =
{
    GNOMEUIINFO_MENU_FILE_TREE (file_menu),
    GNOMEUIINFO_MENU_VIEW_TREE (view_menu),
    GNOMEUIINFO_END
};

GtkWidget *
mail_view_create (CamelMimeMessage *msg, FolderBrowser *folder_browser)
{
    GtkWidget *window;
    GtkWidget *toolbar;
    GtkWidget *mail_display;
    char *subject;
    
    subject = (char *) camel_mime_message_get_subject (msg);
    if (!subject)
        subject = "";
    
    window = gnome_app_new ("Evolution", subject);
    toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
    
    gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar),
                      mail_view_toolbar,
                      NULL, folder_browser);
    
    gnome_app_set_toolbar (GNOME_APP (window), GTK_TOOLBAR (toolbar));
    
    gnome_app_create_menus (GNOME_APP (window), mail_view_menubar);
    
    gtk_widget_ref (mail_view_menubar[0].widget);
    gtk_object_set_data_full (GTK_OBJECT (window), "file",
                  mail_view_menubar[0].widget,
                  (GtkDestroyNotify) gtk_widget_unref);
    
    gtk_widget_ref (file_menu[0].widget);
    gtk_object_set_data_full (GTK_OBJECT (window), "close",
                  file_menu[0].widget,
                  (GtkDestroyNotify) gtk_widget_unref);
    
    gtk_widget_ref (mail_view_menubar[1].widget);
    gtk_object_set_data_full (GTK_OBJECT (window), "view",
                  mail_view_menubar[1].widget,
                  (GtkDestroyNotify) gtk_widget_unref);
    
    mail_display = mail_display_new (folder_browser);
    mail_display_set_message (MAIL_DISPLAY (mail_display), CAMEL_MEDIUM (msg));
    gtk_widget_set_usize (mail_display, 600, 600);
    
    gnome_app_set_contents (GNOME_APP (window), mail_display);
    
    return window;
}