aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-08-08 10:08:44 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-08-08 10:08:44 +0800
commit573ea91f0c6dc6de73884bbf1a4b039975fcacda (patch)
treebdfab5a98b22e1253d7864cf70528360add0fb62 /mail
parent5428d055d162ffa0dde2b0dc5a9b2e6907a6ca73 (diff)
downloadgsoc2013-evolution-573ea91f0c6dc6de73884bbf1a4b039975fcacda.tar
gsoc2013-evolution-573ea91f0c6dc6de73884bbf1a4b039975fcacda.tar.gz
gsoc2013-evolution-573ea91f0c6dc6de73884bbf1a4b039975fcacda.tar.bz2
gsoc2013-evolution-573ea91f0c6dc6de73884bbf1a4b039975fcacda.tar.lz
gsoc2013-evolution-573ea91f0c6dc6de73884bbf1a4b039975fcacda.tar.xz
gsoc2013-evolution-573ea91f0c6dc6de73884bbf1a4b039975fcacda.tar.zst
gsoc2013-evolution-573ea91f0c6dc6de73884bbf1a4b039975fcacda.zip
Added mail-view.c
2000-08-07 Jeffrey Stedfast <fejj@helixcode.com> * Makefile.am: Added mail-view.c * folder-browser-factory.c (control_activate): Adda menu item for viewing the message * mail-view.c: New file containing methods for viewing messages in separate windows * mail-ops.c (view_message): New callback for viewing messages in a new window. svn path=/trunk/; revision=4588
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog13
-rw-r--r--mail/Makefile.am1
-rw-r--r--mail/folder-browser-factory.c7
-rw-r--r--mail/mail-ops.c44
-rw-r--r--mail/mail-view.c129
-rw-r--r--mail/mail.h5
6 files changed, 199 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 760b678752..0ec5dce9bc 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,18 @@
2000-08-07 Jeffrey Stedfast <fejj@helixcode.com>
+ * Makefile.am: Added mail-view.c
+
+ * folder-browser-factory.c (control_activate): Adda menu item for
+ viewing the message
+
+ * mail-view.c: New file containing methods for viewing messages in
+ separate windows
+
+ * mail-ops.c (view_message): New callback for viewing messages in
+ a new window.
+
+2000-08-07 Jeffrey Stedfast <fejj@helixcode.com>
+
* component-factory.c (real_create_generic_storage): New function
to replace real_create_imap_storage and real_create_news_storage
(create_imap_storage): Updated.
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 5386741906..faeddf2dfa 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -53,6 +53,7 @@ evolution_mail_SOURCES = \
mail-threads.h \
mail-types.h \
mail-vfolder.c \
+ mail-view.c \
main.c \
message-list.c \
message-list.h \
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index 2b034522b0..c391c5023d 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -79,6 +79,12 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
GNOME_STOCK_PIXMAP_MAIL_NEW,
0, 0, edit_message, folder_browser);
+ bonobo_ui_handler_menu_new_item (uih, "/Actions/View Message", _("_View Message"),
+ NULL, -1,
+ BONOBO_UI_HANDLER_PIXMAP_STOCK,
+ GNOME_STOCK_PIXMAP_MAIL_NEW,
+ 0, 0, view_message, folder_browser);
+
bonobo_ui_handler_menu_new_item (uih, "/Actions/Expunge", _("_Expunge"),
NULL, -1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
@@ -143,6 +149,7 @@ control_deactivate (BonoboControl *control, BonoboUIHandler *uih,
bonobo_ui_handler_menu_remove (uih, "/View/Threaded");
bonobo_ui_handler_menu_remove (uih, "/Actions/Mark all seen");
bonobo_ui_handler_menu_remove (uih, "/Actions/Edit Message");
+ bonobo_ui_handler_menu_remove (uih, "/Actions/View Message");
bonobo_ui_handler_menu_remove (uih, "/Actions/Expunge");
bonobo_ui_handler_menu_remove (uih, "/Tools/Mail Filters ...");
bonobo_ui_handler_menu_remove (uih, "/Tools/vFolder Editor ...");
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 41211d20ea..768856a6f3 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1028,3 +1028,47 @@ print_msg (GtkWidget *button, gpointer user_data)
gtk_object_unref (GTK_OBJECT (print_master));
}
+
+struct view_msg_data {
+ FolderBrowser *fb;
+ CamelException *ex;
+};
+
+static void
+real_view_msg (MessageList *ml, const char *uid, gpointer user_data)
+{
+ struct view_msg_data *data = user_data;
+ CamelMimeMessage *msg;
+ GtkWidget *view;
+
+ if (camel_exception_is_set (data->ex))
+ return;
+
+ msg = camel_folder_get_message (ml->folder, uid, data->ex);
+
+ view = mail_view_create (msg, data->fb);
+
+ gtk_widget_show (view);
+}
+
+void
+view_message (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ struct view_msg_data data;
+ FolderBrowser *fb = user_data;
+ CamelException ex;
+ MessageList *ml;
+
+ camel_exception_init (&ex);
+
+ data.fb = fb;
+ data.ex = &ex;
+
+ ml = fb->message_list;
+ message_list_foreach (ml, real_view_msg, &data);
+ if (camel_exception_is_set (&ex)) {
+ mail_exception_dialog ("Could not open message for viewing", &ex, fb);
+ camel_exception_clear (&ex);
+ return;
+ }
+}
diff --git a/mail/mail-view.c b/mail/mail-view.c
new file mode 100644
index 0000000000..72ed83654d
--- /dev/null
+++ b/mail/mail-view.c
@@ -0,0 +1,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;
+}
diff --git a/mail/mail.h b/mail/mail.h
index 4643fc8be5..26a6276a80 100644
--- a/mail/mail.h
+++ b/mail/mail.h
@@ -22,6 +22,7 @@
#include "camel/camel.h"
#include "composer/e-msg-composer.h"
#include "mail-config.h"
+#include "folder-browser.h"
/* FIXME FIXME FIXME this sucks sucks sucks sucks */
@@ -71,11 +72,15 @@ void print_msg (GtkWidget *button, gpointer user_data);
void mark_all_seen (BonoboUIHandler *uih, void *user_data, const char *path);
void edit_message (BonoboUIHandler *uih, void *user_data, const char *path);
+void view_message (BonoboUIHandler *uih, void *user_data, const char *path);
void expunge_folder (BonoboUIHandler *uih, void *user_data, const char *path);
void filter_edit (BonoboUIHandler *uih, void *user_data, const char *path);
void vfolder_edit_vfolders (BonoboUIHandler *uih, void *user_data, const char *path);
void providers_config (BonoboUIHandler *uih, void *user_data, const char *path);
+/* mail view */
+GtkWidget *mail_view_create (CamelMimeMessage *msg, FolderBrowser *folder_browser);
+
/* session */
void session_init (void);
char *mail_request_dialog (const char *prompt, gboolean secret, const char *key);