aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-04-24 05:16:00 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-04-24 05:16:00 +0800
commit373b8669f5e8b377ba0d17d938641e8650551abb (patch)
treed63d1ce1faa9fc617c84058fa6ad704580eaf7fc /mail
parent23faa57aef230148a5ab1c746a325be4ba029b02 (diff)
downloadgsoc2013-evolution-373b8669f5e8b377ba0d17d938641e8650551abb.tar
gsoc2013-evolution-373b8669f5e8b377ba0d17d938641e8650551abb.tar.gz
gsoc2013-evolution-373b8669f5e8b377ba0d17d938641e8650551abb.tar.bz2
gsoc2013-evolution-373b8669f5e8b377ba0d17d938641e8650551abb.tar.lz
gsoc2013-evolution-373b8669f5e8b377ba0d17d938641e8650551abb.tar.xz
gsoc2013-evolution-373b8669f5e8b377ba0d17d938641e8650551abb.tar.zst
gsoc2013-evolution-373b8669f5e8b377ba0d17d938641e8650551abb.zip
Use the message-browser widget rather than the mail-view window.
2001-04-23 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (do_view_message): Use the message-browser widget rather than the mail-view window. * mail-view.c: Removed. * folder-browser.c: Added a folder_loaded signal. * message-browser.[c,h]: New window to solve all our message browsing needs. This replaces mail-view.c. * message-list.c (message_list_select_uid): New function needed by the new message-browser window. svn path=/trunk/; revision=9525
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog23
-rw-r--r--mail/Makefile.am3
-rw-r--r--mail/folder-browser.c19
-rw-r--r--mail/folder-browser.h3
-rw-r--r--mail/mail-callbacks.c14
-rw-r--r--mail/mail-types.h1
-rw-r--r--mail/mail-view.c256
-rw-r--r--mail/message-browser.c282
-rw-r--r--mail/message-browser.h60
-rw-r--r--mail/message-list.c28
-rw-r--r--mail/message-list.h3
11 files changed, 425 insertions, 267 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1ceda1f344..d42fca5110 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,18 @@
+2001-04-23 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-callbacks.c (do_view_message): Use the message-browser
+ widget rather than the mail-view window.
+
+ * mail-view.c: Removed.
+
+ * folder-browser.c: Added a folder_loaded signal.
+
+ * message-browser.[c,h]: New window to solve all our message
+ browsing needs. This replaces mail-view.c.
+
+ * message-list.c (message_list_select_uid): New function needed by
+ the new message-browser window.
+
2001-04-23 Dan Winship <danw@ximian.com>
* mail-callbacks.c (save_msg): Append a "/" to the result of
@@ -14,10 +29,10 @@
2001-04-22 Gediminas Paulauskas <menesis@delfi.lt>
- * folder-browser.c, mail-autofilter.c, mail-callbacks.c, mail-ops.c,
- mail-summary.c, mail-vfolder.c: use system = EVOLUTION_DATADIR "/file"
- instead of g_strdup_printf. Rename userrules to user (and system) to be
- consistent.
+ * folder-browser.c, mail-autofilter.c, mail-callbacks.c,
+ mail-ops.c, mail-summary.c, mail-vfolder.c: use system =
+ EVOLUTION_DATADIR "/file" instead of g_strdup_printf. Rename
+ userrules to user (and system) to be consistent.
* mail-send-recv.c: set window icon to send-receive.xpm
diff --git a/mail/Makefile.am b/mail/Makefile.am
index de0b3c92e1..ed3cdf3b2b 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -92,7 +92,8 @@ evolution_mail_SOURCES = \
mail-types.h \
mail-vfolder.c \
mail-vfolder.h \
- mail-view.c \
+ message-browser.c \
+ message-browser.h \
main.c \
message-list.c \
message-list.h \
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 7cf89d58f7..e7416e50b5 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -52,6 +52,13 @@ static void fb_resize_cb (GtkWidget *w, GtkAllocation *a);
static GtkObjectClass *folder_browser_parent_class;
+enum {
+ FOLDER_LOADED,
+ LAST_SIGNAL
+};
+
+static guint folder_browser_signals [LAST_SIGNAL] = {0, };
+
static void
folder_browser_destroy (GtkObject *object)
{
@@ -92,6 +99,16 @@ folder_browser_class_init (GtkObjectClass *object_class)
object_class->destroy = folder_browser_destroy;
folder_browser_parent_class = gtk_type_class (PARENT_TYPE);
+
+ folder_browser_signals[FOLDER_LOADED] =
+ gtk_signal_new ("folder_loaded",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (FolderBrowserClass, folder_loaded),
+ gtk_marshal_NONE__STRING,
+ GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
+
+ gtk_object_class_add_signals (object_class, folder_browser_signals, LAST_SIGNAL);
}
/*
@@ -189,6 +206,8 @@ done:
/* Sigh, i dont like this (it can be set in reconfigure folder),
but its just easier right now to do it this way */
fb->reconfigure = FALSE;
+
+ gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [FOLDER_LOADED], fb->uri);
}
gboolean
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index 9e4531b055..94f70b225d 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -63,6 +63,9 @@ struct _FolderBrowser {
typedef struct {
GtkTableClass parent_class;
+
+ /* signals - select a message */
+ void (*folder_loaded) (FolderBrowser *fb, const char *uri);
} FolderBrowserClass;
struct fb_ondemand_closure {
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 46a38030fa..083c3e89ff 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -42,6 +42,7 @@
#include <gal/widgets/e-gui-utils.h>
#include <filter/filter-editor.h>
#include "mail.h"
+#include "message-browser.h"
#include "mail-callbacks.h"
#include "mail-config.h"
#include "mail-accounts.h"
@@ -1522,15 +1523,16 @@ configure_folder (BonoboUIComponent *uih, void *user_data, const char *path)
}
static void
-do_view_message(CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
+do_view_message (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
{
- /*FolderBrowser *fb = data;*/
- GtkWidget *view;
+ FolderBrowser *fb = FOLDER_BROWSER (data);
- if (message) {
+ if (message && fb) {
+ GtkWidget *mb;
+
camel_folder_set_message_flags (folder, uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
- view = mail_view_create(folder, uid, message);
- gtk_widget_show(view);
+ mb = message_browser_new (fb->shell, fb->uri, uid);
+ gtk_widget_show (mb);
}
}
diff --git a/mail/mail-types.h b/mail/mail-types.h
index 74e650fd4f..3a71f2c8a2 100644
--- a/mail/mail-types.h
+++ b/mail/mail-types.h
@@ -29,6 +29,7 @@ extern "C" {
typedef struct _FolderBrowser FolderBrowser;
+typedef struct _MessageBrowser MessageBrowser;
typedef struct _SubscribeDialog SubscribeDialog;
typedef struct _MessageList MessageList;
typedef struct _MailDisplay MailDisplay;
diff --git a/mail/mail-view.c b/mail/mail-view.c
deleted file mode 100644
index 196533b6d5..0000000000
--- a/mail/mail-view.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* -*- 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.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-app-helper.h>
-#include <libgnomeui/gnome-stock.h>
-#include "mail.h"
-#include "mail-ops.h"
-#include "camel/camel.h"
-#include "mail-display.h"
-#include "mail-callbacks.h"
-
-typedef struct mail_view_data_s {
- CamelFolder *source;
- gchar *uid;
- CamelMimeMessage *msg;
- MailDisplay *md;
-} mail_view_data;
-
-#define MINIMUM_WIDTH 600
-#define MINIMUM_HEIGHT 400
-
-/* Size of the window last time it was changed. */
-static GtkAllocation last_allocation = { 0, 0 };
-
-static void
-mail_view_data_free (gpointer mvd)
-{
- mail_view_data *data = (mail_view_data *) mvd;
-
- if (data->uid)
- g_free (data->uid);
- if (data->msg)
- camel_object_unref (CAMEL_OBJECT (data->msg));
- if (data->source)
- camel_object_unref (CAMEL_OBJECT (data->source));
-
- g_free (data);
-}
-
-static mail_view_data *
-mail_view_data_new (CamelFolder *source, const gchar *uid, CamelMimeMessage *msg)
-{
- mail_view_data *data;
-
- data = g_new (mail_view_data, 1);
- data->source = source;
- camel_object_ref (CAMEL_OBJECT (data->source));
- data->msg = msg;
- camel_object_ref (CAMEL_OBJECT (data->msg));
- data->uid = g_strdup (uid);
-
- return data;
-}
-
-static void
-on_close (GtkWidget *menuitem, gpointer user_data)
-{
- GtkWidget *view_window;
-
- view_window = gtk_object_get_data (GTK_OBJECT (menuitem), "view-window");
- g_return_if_fail (view_window);
- gtk_widget_destroy (GTK_WIDGET (view_window));
-}
-
-static void
-view_reply_to_sender (GtkWidget *widget, gpointer user_data)
-{
- mail_view_data *data = (mail_view_data *) user_data;
-
- mail_reply (data->source, data->msg, data->uid, FALSE);
-}
-
-static void
-view_reply_to_all (GtkWidget *widget, gpointer user_data)
-{
- mail_view_data *data = (mail_view_data *) user_data;
-
- mail_reply (data->source, data->msg, data->uid, TRUE);
-}
-
-static void
-view_forward_msg (GtkWidget *widget, gpointer user_data)
-{
- mail_view_data *data = (mail_view_data *) user_data;
- GPtrArray *uids;
-
- uids = g_ptr_array_new ();
- g_ptr_array_add (uids, g_strdup (data->uid));
- forward_messages (data->source, uids, FORWARD_ATTACHED);
-}
-
-static void
-view_print_msg (GtkWidget *widget, gpointer user_data)
-{
- mail_view_data *data = (mail_view_data *) user_data;
-
- mail_print_msg (data->md);
-}
-
-static void
-view_delete_msg (GtkWidget *button, gpointer user_data)
-{
- mail_view_data *data = (mail_view_data *) user_data;
-
- camel_folder_set_message_flags(data->source, data->uid, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN);
-}
-
-static void
-view_size_allocate_cb (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- last_allocation = *allocation;
-}
-
-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"),
- view_reply_to_sender, GNOME_STOCK_PIXMAP_MAIL_RPL),
-
- GNOMEUIINFO_ITEM_STOCK (N_("Reply to All"), N_("Reply to all recipients of this message"),
- view_reply_to_all, GNOME_STOCK_PIXMAP_MAIL_RPL),
-
- GNOMEUIINFO_ITEM_STOCK (N_("Forward"), N_("Forward this message"), view_forward_msg, GNOME_STOCK_PIXMAP_MAIL_FWD),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print the selected message"), view_print_msg, GNOME_STOCK_PIXMAP_PRINT),
-
- GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete this message"), view_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
-};
-
-static void
-set_default_size (GtkWidget *widget)
-{
- int width, height;
-
- width = MAX (MINIMUM_WIDTH, last_allocation.width);
- height = MAX (MINIMUM_HEIGHT, last_allocation.height);
-
- gtk_window_set_default_size (GTK_WINDOW (widget), width, height);
-}
-
-GtkWidget *
-mail_view_create (CamelFolder *source, const char *uid, CamelMimeMessage *msg)
-{
- GtkWidget *window;
- GtkWidget *toolbar;
- GtkWidget *mail_display;
- char *subject;
- mail_view_data *data;
-
- data = mail_view_data_new (source, uid, msg);
-
- 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, data);
-
- gnome_app_set_toolbar (GNOME_APP (window), GTK_TOOLBAR (toolbar));
- gnome_app_create_menus (GNOME_APP (window), mail_view_menubar);
-
- gtk_object_set_data_full (GTK_OBJECT (window), "mvd", data,
- mail_view_data_free);
-
- 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 (GTK_OBJECT (file_menu[0].widget), "view-window", window);
- 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 ();
- mail_display_set_message (MAIL_DISPLAY (mail_display), CAMEL_MEDIUM (msg));
- data->md = MAIL_DISPLAY (mail_display);
- gnome_app_set_contents (GNOME_APP (window), mail_display);
- gtk_widget_grab_focus (GTK_WIDGET (MAIL_DISPLAY (mail_display)->html));
-
- gtk_signal_connect (GTK_OBJECT (window), "size_allocate",
- GTK_SIGNAL_FUNC (view_size_allocate_cb), NULL);
-
- set_default_size (window);
-
- return window;
-}
-
diff --git a/mail/message-browser.c b/mail/message-browser.c
new file mode 100644
index 0000000000..2286772f50
--- /dev/null
+++ b/mail/message-browser.c
@@ -0,0 +1,282 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors: Jeffrey Stedfast <fejj@ximian.com>
+ *
+ * Copyright 2001 Ximian, Inc. (www.ximian.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.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "message-browser.h"
+
+#include "mail.h"
+#include "mail-callbacks.h"
+#include "mail-tools.h"
+#include "message-list.h"
+#include "mail-ops.h"
+#include "mail-vfolder.h"
+#include "mail-autofilter.h"
+#include "mail-mlist-magic.h"
+#include "mail-mt.h"
+
+#include "mail-local.h"
+#include "mail-config.h"
+
+#define d(x) x
+
+#define MINIMUM_WIDTH 600
+#define MINIMUM_HEIGHT 400
+
+#define PARENT_TYPE (gnome_app_get_type ())
+
+/* Size of the window last time it was changed. */
+static GtkAllocation last_allocation = { 0, 0 };
+
+static GnomeAppClass *message_browser_parent_class;
+
+static void
+message_browser_destroy (GtkObject *object)
+{
+ MessageBrowser *message_browser;
+
+ message_browser = MESSAGE_BROWSER (object);
+
+ gtk_object_unref (GTK_OBJECT (message_browser->fb));
+
+ gtk_widget_destroy (GTK_WIDGET (message_browser));
+}
+
+static void
+message_browser_class_init (GtkObjectClass *object_class)
+{
+ object_class->destroy = message_browser_destroy;
+
+ message_browser_parent_class = gtk_type_class (PARENT_TYPE);
+}
+
+static void
+message_browser_init (GtkObject *object)
+{
+
+}
+
+static void
+message_browser_close (GtkWidget *menuitem, gpointer user_data)
+{
+ gtk_widget_destroy (GTK_WIDGET (user_data));
+}
+
+static void
+message_browser_reply_to_sender (GtkWidget *widget, gpointer user_data)
+{
+ MessageBrowser *mb = MESSAGE_BROWSER (user_data);
+
+ reply_to_sender (NULL, mb->fb);
+}
+
+static void
+message_browser_reply_to_all (GtkWidget *widget, gpointer user_data)
+{
+ MessageBrowser *mb = MESSAGE_BROWSER (user_data);
+
+ reply_to_all (NULL, mb->fb);
+}
+
+static void
+message_browser_forward_msg (GtkWidget *widget, gpointer user_data)
+{
+ MessageBrowser *mb = MESSAGE_BROWSER (user_data);
+
+ forward_attached (NULL, mb->fb);
+}
+
+static void
+message_browser_print_msg (GtkWidget *widget, gpointer user_data)
+{
+ MessageBrowser *mb = MESSAGE_BROWSER (user_data);
+
+ mail_print_msg (mb->fb->mail_display);
+}
+
+static void
+message_browser_delete_msg (GtkWidget *button, gpointer user_data)
+{
+ MessageBrowser *mb = MESSAGE_BROWSER (user_data);
+
+ delete_msg (NULL, mb->fb);
+}
+
+static void
+message_browser_next_msg (GtkWidget *button, gpointer user_data)
+{
+ MessageBrowser *mb = MESSAGE_BROWSER (user_data);
+
+ next_msg (NULL, mb->fb);
+}
+
+static void
+message_browser_prev_msg (GtkWidget *button, gpointer user_data)
+{
+ MessageBrowser *mb = MESSAGE_BROWSER (user_data);
+
+ previous_msg (NULL, mb->fb);
+}
+
+static void
+message_browser_message_selected (MessageList *ml, const char *uid, MessageBrowser *mb)
+{
+ CamelMimeMessage *message;
+ char *subject = NULL;
+
+ g_warning ("got 'message_selected' event");
+
+ message = mb->fb->mail_display->current_message;
+
+ if (message)
+ subject = (char *) camel_mime_message_get_subject (message);
+
+ gtk_window_set_title (GTK_WINDOW (mb), subject ? subject : "");
+}
+
+static void
+message_browser_folder_loaded (FolderBrowser *fb, const char *uri, MessageBrowser *mb)
+{
+ const char *uid = gtk_object_get_data (GTK_OBJECT (mb), "uid");
+
+ g_warning ("got 'folder_loaded' event");
+
+ gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_selected",
+ message_browser_message_selected, mb);
+
+ message_list_select_uid (fb->message_list, uid);
+}
+
+static GnomeUIInfo message_browser_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"),
+ message_browser_reply_to_sender, GNOME_STOCK_PIXMAP_MAIL_RPL),
+
+ GNOMEUIINFO_ITEM_STOCK (N_("Reply to All"), N_("Reply to all recipients of this message"),
+ message_browser_reply_to_all, GNOME_STOCK_PIXMAP_MAIL_RPL),
+
+ GNOMEUIINFO_ITEM_STOCK (N_("Forward"), N_("Forward this message"),
+ message_browser_forward_msg, GNOME_STOCK_PIXMAP_MAIL_FWD),
+
+ GNOMEUIINFO_SEPARATOR,
+
+ GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print the selected message"),
+ message_browser_print_msg, GNOME_STOCK_PIXMAP_PRINT),
+
+ GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete this message"),
+ message_browser_delete_msg, GNOME_STOCK_PIXMAP_TRASH),
+
+ GNOMEUIINFO_SEPARATOR,
+
+ GNOMEUIINFO_ITEM_STOCK (N_("Previous"), N_("Previous message"),
+ message_browser_prev_msg, GNOME_STOCK_PIXMAP_BACK),
+
+ GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Next message"),
+ message_browser_next_msg, GNOME_STOCK_PIXMAP_FORWARD),
+
+ 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 (message_browser_close, NULL),
+ GNOMEUIINFO_END
+};
+
+static GnomeUIInfo view_menu[] =
+{
+ GNOMEUIINFO_END
+};
+
+static GnomeUIInfo message_browser_menubar[] =
+{
+ GNOMEUIINFO_MENU_FILE_TREE (file_menu),
+ GNOMEUIINFO_MENU_VIEW_TREE (view_menu),
+ GNOMEUIINFO_END
+};
+
+static void
+set_default_size (GtkWidget *widget)
+{
+ int width, height;
+
+ width = MAX (MINIMUM_WIDTH, last_allocation.width);
+ height = MAX (MINIMUM_HEIGHT, last_allocation.height);
+
+ gtk_window_set_default_size (GTK_WINDOW (widget), width, height);
+}
+
+GtkWidget *
+message_browser_new (const GNOME_Evolution_Shell shell, const char *uri, const char *uid)
+{
+ GtkWidget *toolbar, *vbox;
+ MessageBrowser *new;
+ FolderBrowser *fb;
+
+ new = gtk_type_new (message_browser_get_type ());
+
+ gnome_app_construct (GNOME_APP (new), "Evolution", "");
+
+ gtk_object_set_data_full (GTK_OBJECT (new), "uid", g_strdup (uid), g_free);
+
+ toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
+ gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar),
+ message_browser_toolbar,
+ NULL, new);
+
+ gnome_app_set_toolbar (GNOME_APP (new), GTK_TOOLBAR (toolbar));
+ gnome_app_create_menus (GNOME_APP (new), message_browser_menubar);
+
+ fb = FOLDER_BROWSER (folder_browser_new (shell));
+ new->fb = fb;
+
+ /* some evil hackery action... */
+ vbox = gtk_vbox_new (TRUE, 0);
+ gtk_widget_ref (GTK_WIDGET (fb->mail_display));
+ gtk_widget_reparent (GTK_WIDGET (fb->mail_display), vbox);
+ gtk_widget_show (GTK_WIDGET (fb->mail_display));
+ gtk_widget_show (vbox);
+
+ gnome_app_set_contents (GNOME_APP (new), vbox);
+ gtk_widget_grab_focus (GTK_WIDGET (MAIL_DISPLAY (fb->mail_display)->html));
+
+ set_default_size (GTK_WIDGET (new));
+
+ /* more evil hackery... */
+ gtk_signal_connect (GTK_OBJECT (fb), "folder_loaded",
+ message_browser_folder_loaded, new);
+
+ folder_browser_set_uri (fb, uri);
+
+ return GTK_WIDGET (new);
+}
+
+
+E_MAKE_TYPE (message_browser, "MessageBrowser", MessageBrowser, message_browser_class_init,
+ message_browser_init, PARENT_TYPE);
diff --git a/mail/message-browser.h b/mail/message-browser.h
new file mode 100644
index 0000000000..365a2cd6da
--- /dev/null
+++ b/mail/message-browser.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors: Jeffrey Stedfast <fejj@ximian.com>
+ *
+ * Copyright 2001 Ximian, Inc. (www.ximian.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.
+ *
+ */
+
+#ifndef _MESSAGE_BROWSER_H_
+#define _MESSAGE_BROWSER_H_
+
+#include <gnome.h>
+#include <camel/camel-folder.h>
+#include "folder-browser.h"
+#include "mail-display.h"
+#include "mail-types.h"
+
+#define MESSAGE_BROWSER_TYPE (message_browser_get_type ())
+#define MESSAGE_BROWSER(o) (GTK_CHECK_CAST ((o), MESSAGE_BROWSER_TYPE, MessageBrowser))
+#define MESSAGE_BROWSER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MESSAGE_BROWSER_TYPE, MessageBrowserClass))
+#define IS_MESSAGE_BROWSER(o) (GTK_CHECK_TYPE ((o), MESSAGE_BROWSER_TYPE))
+#define IS_MESSAGE_BROWSER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MESSAGE_BROWSER_TYPE))
+
+
+struct _MessageBrowser {
+ GnomeApp parent;
+
+ /*
+ * The current URI being displayed by the MessageBrowser
+ */
+ FolderBrowser *fb;
+};
+
+
+typedef struct {
+ GnomeAppClass parent_class;
+
+} MessageBrowserClass;
+
+GtkType message_browser_get_type (void);
+
+GtkWidget *message_browser_new (const GNOME_Evolution_Shell shell,
+ const char *uri, const char *uid);
+
+#endif /* _MESSAGE_BROWSER_H_ */
+
diff --git a/mail/message-list.c b/mail/message-list.c
index dc4eff7ef0..35f413e674 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -420,6 +420,34 @@ message_list_select (MessageList *message_list, int base_row,
gtk_signal_emit(GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], NULL);
}
+
+/**
+ * message_list_select_uid:
+ * @message_list:
+ * @uid:
+ *
+ * Selects the message with the given UID.
+ **/
+void
+message_list_select_uid (MessageList *message_list, const char *uid)
+{
+ ETreePath node;
+
+ node = g_hash_table_lookup (message_list->uid_nodemap, uid);
+ if (node) {
+ CamelMessageInfo *info;
+
+ info = get_message_info (message_list, node);
+ e_tree_set_cursor (message_list->tree, node);
+ gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED],
+ camel_message_info_uid (info));
+ } else {
+ g_free (message_list->cursor_uid);
+ message_list->cursor_uid = NULL;
+ gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], uid);
+ }
+}
+
static void
add_uid (MessageList *ml, const char *uid, gpointer data)
{
diff --git a/mail/message-list.h b/mail/message-list.h
index da959de1bf..a856396ecf 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -112,6 +112,9 @@ void message_list_select (MessageList *message_list,
MessageListSelectDirection direction,
guint32 flags, guint32 mask);
+void message_list_select_uid (MessageList *message_list,
+ const char *uid);
+
/* info */
unsigned int message_list_length(MessageList *ml);