diff options
author | Not Zed <NotZed@Ximian.com> | 2003-09-18 05:19:04 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2003-09-18 05:19:04 +0800 |
commit | 81a0ff5bc44a3bd11399e6b3c985735737606c8c (patch) | |
tree | 54b5ed4342a6843c1db4c7e75f2e1b1fe9b82dff /mail/em-message-browser.c | |
parent | a36a1bb70b6ebcb51ac39304370c89bda63e11b9 (diff) | |
download | gsoc2013-evolution-81a0ff5bc44a3bd11399e6b3c985735737606c8c.tar gsoc2013-evolution-81a0ff5bc44a3bd11399e6b3c985735737606c8c.tar.gz gsoc2013-evolution-81a0ff5bc44a3bd11399e6b3c985735737606c8c.tar.bz2 gsoc2013-evolution-81a0ff5bc44a3bd11399e6b3c985735737606c8c.tar.lz gsoc2013-evolution-81a0ff5bc44a3bd11399e6b3c985735737606c8c.tar.xz gsoc2013-evolution-81a0ff5bc44a3bd11399e6b3c985735737606c8c.tar.zst gsoc2013-evolution-81a0ff5bc44a3bd11399e6b3c985735737606c8c.zip |
cvs removed.
2003-09-17 Not Zed <NotZed@Ximian.com>
* folder-browser.c, folder-browser.h, folder-browser-ui.c
folder-browser-ui.h, mail-callbacks.c, mail-callbacks.h
mail-display.c, mail-display.h, mail-display-stream.c
mail-display-stream.h, mail-format.c, mail-format.h
mail-identify.c, mail-search.c, mail-search.h
message-browser.c, message-browser.h, subscribe-dialog.c
subscribe-dialog.h, mail-font-prefs.c, mail-font-prefs.h: cvs
removed.
* Makefile.am: Removed mail-font-prefs.[ch], hasn't been built for
ages.
* em-*.c: killed a bunch of printfs.
* em-format-html-display.c (efhd_html_button_press_event): update
for html object api chagnes.
** Merge in mail-refactor-2 branch.
svn path=/trunk/; revision=22602
Diffstat (limited to 'mail/em-message-browser.c')
-rw-r--r-- | mail/em-message-browser.c | 171 |
1 files changed, 171 insertions, 0 deletions
diff --git a/mail/em-message-browser.c b/mail/em-message-browser.c new file mode 100644 index 0000000000..503ebef9e5 --- /dev/null +++ b/mail/em-message-browser.c @@ -0,0 +1,171 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Michael Zucchi <notzed@ximian.com> + * + * Copyright 2003 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 <gtk/gtkscrolledwindow.h> +#include <gtk/gtkbutton.h> + +#include <camel/camel-folder.h> + +#include <bonobo/bonobo-main.h> +#include <bonobo/bonobo-object.h> +#include <bonobo/bonobo-window.h> +#include <bonobo/bonobo-generic-factory.h> +#include <bonobo/bonobo-ui-component.h> +#include <bonobo/bonobo-ui-util.h> + +#include "em-format-html-display.h" +#include "em-message-browser.h" + +#include "evolution-shell-component-utils.h" /* Pixmap stuff, sigh */ + +struct _EMMessageBrowserPrivate { + GtkWidget *preview; /* container for message display */ +}; + +static void emmb_set_message(EMFolderView *emfv, const char *uid); +static void emmb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state); + +static EMFolderViewClass *emmb_parent; + +static void +emmb_init(GObject *o) +{ + EMMessageBrowser *emmb = (EMMessageBrowser *)o; + struct _EMMessageBrowserPrivate *p; + + p = emmb->priv = g_malloc0(sizeof(struct _EMMessageBrowserPrivate)); + + ((EMFolderView *)emmb)->preview_active = TRUE; + + g_slist_free(emmb->view.ui_files); + emmb->view.ui_files = g_slist_append(NULL, EVOLUTION_UIDIR "/evolution-mail-message.xml"); + emmb->view.ui_files = g_slist_append(emmb->view.ui_files, EVOLUTION_UIDIR "/evolution-mail-messagedisplay.xml"); + + /* currently: just use a scrolledwindow for preview widget */ + p->preview = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy((GtkScrolledWindow *)p->preview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)p->preview, GTK_SHADOW_IN); + gtk_widget_show(p->preview); + + gtk_container_add((GtkContainer *)p->preview, (GtkWidget *)emmb->view.preview->formathtml.html); + gtk_widget_show((GtkWidget *)emmb->view.preview->formathtml.html); + + gtk_widget_show(p->preview); + + gtk_box_pack_start_defaults((GtkBox *)emmb, p->preview); +} + +static void +emmb_finalise(GObject *o) +{ + EMMessageBrowser *emmb = (EMMessageBrowser *)o; + + g_free(emmb->priv); + ((GObjectClass *)emmb_parent)->finalize(o); +} + +static void +emmb_class_init(GObjectClass *klass) +{ + klass->finalize = emmb_finalise; + ((EMFolderViewClass *)klass)->set_message = emmb_set_message; + ((EMFolderViewClass *)klass)->activate = emmb_activate; +} + +GType +em_message_browser_get_type(void) +{ + static GType type = 0; + + if (type == 0) { + static const GTypeInfo info = { + sizeof(EMMessageBrowserClass), + NULL, NULL, + (GClassInitFunc)emmb_class_init, + NULL, NULL, + sizeof(EMMessageBrowser), 0, + (GInstanceInitFunc)emmb_init + }; + emmb_parent = g_type_class_ref(em_folder_view_get_type()); + type = g_type_register_static(em_folder_view_get_type(), "EMMessageBrowser", &info, 0); + } + + return type; +} + +GtkWidget *em_message_browser_new(void) +{ + EMMessageBrowser *emmb = g_object_new(em_message_browser_get_type(), 0); + + return (GtkWidget *)emmb; +} + +GtkWidget *em_message_browser_window_new(void) +{ + EMMessageBrowser *emmb; + BonoboUIContainer *uicont; + BonoboUIComponent *uic; + + emmb = (EMMessageBrowser *)em_message_browser_new(); + gtk_widget_show((GtkWidget *)emmb); + /* FIXME: title set elsewhere? */ + emmb->window = g_object_new(bonobo_window_get_type(), "title", "Ximian Evolution", NULL); + bonobo_window_set_contents((BonoboWindow *)emmb->window, (GtkWidget *)emmb); + + uicont = bonobo_window_get_ui_container((BonoboWindow *)emmb->window); + uic = bonobo_ui_component_new_default(); + bonobo_ui_component_set_container(uic, BONOBO_OBJREF(uicont), NULL); + + em_folder_view_activate((EMFolderView *)emmb, uic, TRUE); + + /* FIXME: keep track of size changes for next instantation */ + gtk_window_set_default_size((GtkWindow *)emmb->window, 600, 400); + + /* cleanup? */ + + return (GtkWidget *)emmb; +} + +/* ********************************************************************** */ + +static void +emmb_set_message(EMFolderView *emfv, const char *uid) +{ + emmb_parent->set_message(emfv, uid); + + /* Well we don't know if it got displayed (yet) ... but whatever ... */ + camel_folder_set_message_flags(emfv->folder, uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); +} + +static void +emmb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state) +{ + emmb_parent->activate(emfv, uic, state); + + if (state) + bonobo_ui_component_set_prop(uic, "/commands/EditPaste", "sensitive", "0", NULL); +} |