diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/.cvsignore | 11 | ||||
-rw-r--r-- | mail/ChangeLog | 222 | ||||
-rw-r--r-- | mail/Mail.idl | 30 | ||||
-rw-r--r-- | mail/Makefile.am | 75 | ||||
-rw-r--r-- | mail/e-attchmt.png | bin | 169 -> 0 bytes | |||
-rw-r--r-- | mail/evolution-mail.gnorba | 13 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 238 | ||||
-rw-r--r-- | mail/folder-browser.c | 222 | ||||
-rw-r--r-- | mail/folder-browser.h | 59 | ||||
-rw-r--r-- | mail/html-stream.c | 139 | ||||
-rw-r--r-- | mail/html-stream.h | 26 | ||||
-rw-r--r-- | mail/mail-component.c | 50 | ||||
-rw-r--r-- | mail/mail-display.c | 476 | ||||
-rw-r--r-- | mail/mail-display.h | 56 | ||||
-rw-r--r-- | mail/mail-sources.c | 771 | ||||
-rw-r--r-- | mail/mail-types.h | 39 | ||||
-rw-r--r-- | mail/main.c | 59 | ||||
-rw-r--r-- | mail/main.h | 6 | ||||
-rw-r--r-- | mail/message-list.c | 687 | ||||
-rw-r--r-- | mail/message-list.h | 75 | ||||
-rw-r--r-- | mail/session.c | 110 | ||||
-rw-r--r-- | mail/session.h | 17 | ||||
-rw-r--r-- | mail/test-mail.c | 73 |
23 files changed, 0 insertions, 3454 deletions
diff --git a/mail/.cvsignore b/mail/.cvsignore deleted file mode 100644 index 728f3debdd..0000000000 --- a/mail/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -Mail-stubs.c -Mail-skels.c -Mail-common.c -Mail.h -evolution-mail -test-mail -test-sources diff --git a/mail/ChangeLog b/mail/ChangeLog deleted file mode 100644 index 1c5721af0c..0000000000 --- a/mail/ChangeLog +++ /dev/null @@ -1,222 +0,0 @@ -2000-03-27 Chris Toshok <toshok@helixcode.com> - * mail-display.c: quiet warnings when building in ../po - -2000-03-26 Miguel de Icaza <miguel@gnu.org> - - * folder-browser-factory.c (folder_browser_set_shell): Memory leak - fix. - -2000-03-25 Dan Winship <danw@helixcode.com> - - * message-list.c (select_msg, ml_value_at): update for summary - changes. Hey, neat, it really does make it more efficient. - -2000-03-22 Christopher James Lahey <clahey@helixcode.com> - - * .cvsignore: Updated .cvsignore. - -2000-03-21 Matt Loper <matt@helixcode.com> - - * mail-display.c: Minor cleanup & commenting. - - * folder-browser-factory.c: Minor cleanup & warning elimination. - -2000-03-21 bertrand <bertrand@helixcode.com> - - * message-list.c (ml_value_at): display message size - -2000-03-20 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Properly ref & sink the table and header models. - -2000-03-14 Dan Winship <danw@helixcode.com> - - * mail-sources.c: First cut at a mail source selection wizard. - Basically a rigged demo at this point. Doesn't use camel to get - its information, and is not yet complete or integrated with the - mail component. Did I mention that the code is ugly? - -2000-03-13 bertrand <bertrand@helixcode.com> - - * folder-browser-factory.c (folder_browser_set_shell): - for testing and demonstration purpose, immediately - register a fake service. - -2000-03-12 bertrand <bertrand@helixcode.com> - - * folder-browser-factory.c (folder_browser_factory_init): - name change. - (control_activate_cb): when the control is activated, - it merges its own UI with the remote UIHandler. - (control_add_menu): sample menu merging. - (folder_browser_factory): connect the control "activate" signal. - - * evolution-mail.gnorba: - name changes - - * folder-browser.h: added a reference to an - Evolution::Shell object. - - * folder-browser-factory.c (folder_browser_set_shell): - (folder_browser_control_add_service_repository_interface): - (folder_browser_factory): the folder-browser control now - implements the Evolution/ServiceRepository interface. - -2000-03-07 bertrand <bertrand@helixcode.com> - - * folder-browser-factory.c (development_warning): - added a warning so that the user knows that this - version may crash his mails. - -2000-03-05 bertrand <bertrand@helixcode.com> - - * message-list.h: include a referrence to the parent - folder browser. - - * message-list.c (ml_value_at): use the message summary - from the - - * html-stream.c (html_stream_close): when the stream - is closed, set the html stream to NULL - (html_stream_write): don't write anything if the - html handle does not exist. - (html_stream_reset): implemented. close the current - html handle and begins a new html parser. - - * session.c (session_store_new): use static exception - here. - -2000-03-05 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Added a prototype message listing. - -2000-03-04 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Set up the column headers properly. - - * folder-browser.c: Show the folder_browser widget. - -2000-03-04 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Define ml_duplicate_value and ml_free_value - correctly. - -2000-03-04 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Use g_int_compare and g_str_compare as we should - be instead of g_int_equal and g_str_equal. - -2000-03-04 bertrand <bertrand@helixcode.com> - - * test-mail.c (main): replace the bonobo-active/gtk-main - by bonobo-main. - Include Gnorba headers. - (main): don't call the container creation routine - before we entered the main loop. Use idle for that. - -2000-03-04 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Change this to use the ETable widget itself - instead of building it from all the parts. - -2000-03-03 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Ref the table columns since we unref them at the - end. - -2000-03-01 Ettore Perazzoli <ettore@helixcode.com> - - * Makefile.am (INCLUDES): Add `$(top_srcdir)'. Also, the - `top_srcdir' includes must come first everything else to avoid - including installed headers instead of our fresh ones. - -2000-02-28 NotZed <NotZed@HelixCode.com> - - * Makefile.am (evolution_mail_LDADD): Fixed references to eutil. - -2000-02-24 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Changed to match new e_table_simple interface. - -2000-02-24 Dan Winship <danw@helixcode.com> - - * message-list.c (message_list_set_folder): update for CamelFolder - changes - -2000-02-24 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Changed this to not use the "x" and "y" - arguments to e-table-item. - -2000-02-23 Matt Loper <matt@helixcode.com> - - * message-list.c (message_list_set_folder): Check 'desc'riptions - of exceptions. - -2000-02-22 bertrand <Bertrand.Guiheneuf@aful.org> - - * message-list.c (message_list_set_folder): - fix to show a sample correct implementation. - -2000-02-21 Matt Loper <matt@helixcode.com> - - * Makefile.am: added -lunicode to evolution_mail_LDADD. - -2000-02-21 Dan Winship <danw@helixcode.com> - - * session.c (session_store_new): Pass a CamelAuthCallback - (evolution_auth_callback) to camel_session_new. - -2000-02-21 Dan Winship <danw@helixcode.com> - - * session.c (session_store_new): Update session_store_new to - deal with the fact that camel_session_get_store takes a - CamelException now. Doesn't actually do anything with the - exception yet, because nothing else does yet either. - -2000-02-19 Matt Loper <matt@helixcode.com> - - * .cvsignore: added test-mail. - -2000-02-14 Miguel de Icaza <miguel@gnu.org> - - * folder-browser.c (folder_browser_load_folder): New routine, - loads a camel folder. - (folder_browser_set_uri): redo. - - * session.c: new file. Implements SessionStores to keep track of - a Session/Store tuple. - -2000-02-13 Matt Loper <matt@helixcode.com> - - * html-stream.c (html_stream_new): Second param of gtk_html_begin - should be "", not NULL. - (html_stream_new): gtk_html_parse() is deprecated, so the call was - removed. - - * html-stream.h: HTMLStreamClass's parent changed to - CamelStreamClass, not CamelStream. - -2000-02-11 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Add the e-text directory to the includes list. - - * message-list.c: Change the call to e_cell_text_new, since - there's an added argument. - -2000-02-09 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Added libetext as libetable depends on it. - -2000-02-08 Iain Holmes <ih@csd.abdn.ac.uk> - - * Makefile.am: Changed the order of the compilation so the CORBA stuff - was made before it was needed. - -2000-01-19 Miguel de Icaza <miguel@gnu.org> - - * Started work on the mail display engine. - - * html-stream.c, html-stream.h: New files, they are CamelStreams - used to write to the GtkHTML widget. - diff --git a/mail/Mail.idl b/mail/Mail.idl deleted file mode 100644 index 1d12a39c5c..0000000000 --- a/mail/Mail.idl +++ /dev/null @@ -1,30 +0,0 @@ -/* - * mail.idl: Mail interfaces for Evolution - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.idl> - -module Evolution { - - interface MessageList : Bonobo::Unknown { - - void select_message (in long message_number); - void open_message (in long message_number); - }; - - /* - * FolderBrowser object. - * - * configuration of this widget is done trough - * Bonobo Properties - */ - interface FolderBrowser : Bonobo::Unknown { - MessageList get_message_list (); - }; -}; - diff --git a/mail/Makefile.am b/mail/Makefile.am deleted file mode 100644 index 936312eecd..0000000000 --- a/mail/Makefile.am +++ /dev/null @@ -1,75 +0,0 @@ -bin_PROGRAMS = evolution-mail test-mail test-sources - -providerdir = $(libdir)/evolution/camel-providers/$(VERSION) - -EXTRA_DIST = e-attchmt.png -pkgdata_DATA = e-attchmt.png - -INCLUDES = \ - -I$(top_srcdir)/widgets \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir) \ - -I$(top_builddir)/shell \ - $(BONOBO_HTML_GNOME_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" - -EVOLUTION_MAIL_CORBA_GENERATED = \ - Mail.h \ - Mail-common.c \ - Mail-skels.c \ - Mail-stubs.c - -evolution_mail_SOURCES = \ - $(EVOLUTION_MAIL_CORBA_GENERATED) \ - folder-browser.c \ - folder-browser.h \ - folder-browser-factory.c \ - folder-browser-factory.h \ - html-stream.c \ - html-stream.h \ - mail-display.h \ - mail-display.c \ - main.c \ - message-list.c \ - message-list.h \ - session.c \ - session.h - - -evolution_mail_LDADD = \ - ../shell/Evolution-common.o \ - ../shell/Evolution-stubs.o \ - ../shell/Evolution-skels.o \ - ../shell/evolution-service-repository.o \ - ../composer/libcomposer.la \ - ../widgets/e-table/libetable.a \ - ../widgets/e-text/libetext.a \ - ../camel/libcamel.la \ - ../e-util/libeutil.la \ - $(BONOBO_HTML_GNOME_LIBS) \ - -lunicode - -test_mail_SOURCES = \ - test-mail.c - -test_mail_LDADD = \ - $(BONOBO_HTML_GNOME_LIBS) - - -test_sources_SOURCES = \ - mail-sources.c - -test_sources_LDADD = \ - $(BONOBO_HTML_GNOME_LIBS) - -gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = evolution-mail.gnorba - -$(EVOLUTION_MAIL_CORBA_GENERATED): Mail.idl - orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Mail.idl - -EXTRA_DIST = Mail.idl evolution-mail.gnorba diff --git a/mail/e-attchmt.png b/mail/e-attchmt.png Binary files differdeleted file mode 100644 index b4bac8db67..0000000000 --- a/mail/e-attchmt.png +++ /dev/null diff --git a/mail/evolution-mail.gnorba b/mail/evolution-mail.gnorba deleted file mode 100644 index 7eb90dbc8a..0000000000 --- a/mail/evolution-mail.gnorba +++ /dev/null @@ -1,13 +0,0 @@ -[control-factory:evolution-mail] -type=exe -repo_id=IDL:GNOME/GenericFactory:1.0 -description=Evolution mail folder factory component. -location_info=evolution-mail - -[control:evolution-mail] -type=factory -repo_id=IDL:BonoboControl/evolution-mail:1.0 IDL:GNOME/Control:1.0 -description=Evolution mail folder display component. -location_info=control-factory:evolution-mail - - diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c deleted file mode 100644 index 3dd7a1eafd..0000000000 --- a/mail/folder-browser-factory.c +++ /dev/null @@ -1,238 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * folder-browser-factory.c: A Bonobo Control factory for Folder Browsers - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gnome.h> -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-control.h> -#include "e-util/e-util.h" -#include "e-util/e-gui-utils.h" -#include "folder-browser.h" -#include "main.h" -#include "shell/Evolution.h" -#include "shell/evolution-service-repository.h" -#include "composer/e-msg-composer.h" -#include <camel/camel-stream-fs.h> - - -static void -folder_browser_set_shell (EvolutionServiceRepository *sr, - Evolution_Shell shell, - void *closure) -{ - FolderBrowser *folder_browser; - CORBA_Environment ev; - - g_return_if_fail (closure); - g_return_if_fail (IS_FOLDER_BROWSER (closure)); - g_return_if_fail (shell != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - - folder_browser = FOLDER_BROWSER (closure); - printf ("I AM A FOLDER BROWSER AND I AM STORING THE SHELL\n"); - /* FIXME : ref the shell here */ - folder_browser->shell = shell; - - /* test the component->shell registration */ - Evolution_Shell_register_service (shell, Evolution_Shell_MAIL_STORE, "a_service", &ev); - - CORBA_exception_free (&ev); -} - -static void -folder_browser_control_add_service_repository_interface (BonoboControl *control, - GtkWidget *folder_browser) -{ - EvolutionServiceRepository *sr; - - /* - * create an implementation for the Evolution::ServiceRepository - * interface - */ - sr = evolution_service_repository_new (folder_browser_set_shell, - (void *)folder_browser); - - /* add the interface to the control */ - bonobo_object_add_interface (BONOBO_OBJECT (control), - BONOBO_OBJECT (sr)); -} - - -static int -development_warning () -{ - gint result; - GtkWidget *label, *warning_dialog; - - warning_dialog = gnome_dialog_new ( - "Don't do that", - "I know what I'm doing,\nI want to crash my mail files", - "I'll try it later", - NULL); - - label = gtk_label_new ( - _("This is a development version of Evolution.\n " - "Using the mail component on your mail files\n " - "is extremely hazardous.\n" - "Please backup all your mails before trying\n " - "this program. \n You have been warned\n")); - gtk_widget_show (label); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), - label, TRUE, TRUE, 0); - - result = gnome_dialog_run (GNOME_DIALOG (warning_dialog)); - - gtk_object_destroy (GTK_OBJECT (label)); - gtk_object_destroy (GTK_OBJECT (warning_dialog)); - - return result; -} - -static void -msg_composer_send_cb (EMsgComposer *composer, - gpointer data) -{ - CamelMimeMessage *message; - CamelStream *stream; - gint stdout_dup; - - message = e_msg_composer_get_message (composer); - - stdout_dup = dup (1); - stream = camel_stream_fs_new_with_fd (stdout_dup); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), - stream); - camel_stream_close (stream); - - gtk_object_unref (GTK_OBJECT (message)); - -#if 0 - gtk_widget_destroy (GTK_WIDGET (composer)); - gtk_main_quit (); -#endif -} - - -static void -msg_composer_cb (BonoboUIHandler *uih, void *user_data, const char *path) -{ - GtkWidget *composer; - - composer = e_msg_composer_new (); - gtk_signal_connect (GTK_OBJECT (composer), "send", GTK_SIGNAL_FUNC (msg_composer_send_cb), NULL); - gtk_widget_show (composer); -} - - -static void -control_add_menu (BonoboControl *control) -{ - Bonobo_UIHandler remote_uih; - BonoboUIHandler *uih; - - uih = bonobo_control_get_ui_handler (control); - g_assert (uih); - - remote_uih = bonobo_control_get_remote_ui_handler (control); - bonobo_ui_handler_set_container (uih, remote_uih); - - bonobo_ui_handler_menu_new_item (uih, - "/File/New", N_("_Mail"), NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, 0, 0, - msg_composer_cb, NULL); - -} - - -static void -control_activate_cb (BonoboControl *control, - gboolean activate, - gpointer user_data) -{ - control_add_menu (control); -} - - - -/* - * Creates the Folder Browser, wraps it in a Bonobo Control, and - * sets the Bonobo Control properties to point to the Folder Browser - * Properties - */ -static BonoboObject * -folder_browser_factory (BonoboGenericFactory *factory, void *closure) -{ - BonoboControl *control; - GtkWidget *folder_browser; - gint warning_result; - - - warning_result = development_warning (); - - if (warning_result) - folder_browser = gtk_label_new ("This should be the mail component"); - else { - folder_browser = folder_browser_new (); - folder_browser_set_uri (FOLDER_BROWSER (folder_browser), "inbox"); - } - - if (folder_browser == NULL) - return NULL; - - gtk_widget_show(folder_browser); - - control = bonobo_control_new (folder_browser); - - if (control == NULL){ - gtk_object_destroy (GTK_OBJECT (folder_browser)); - return NULL; - } - - gtk_signal_connect (GTK_OBJECT (control), "activate", control_activate_cb, NULL); - - - - - bonobo_control_set_property_bag (control, - FOLDER_BROWSER (folder_browser)->properties); - - /* for the moment, the control has the ability to register - * some services itself, but this should not last. - * - * It's not the way to do it, but we don't have the - * correct infrastructure in the shell now. - */ - folder_browser_control_add_service_repository_interface (control, folder_browser); - return BONOBO_OBJECT (control); -} - -void -folder_browser_factory_init (void) -{ - static BonoboGenericFactory *bonobo_folder_browser_factory = NULL; - - - if (bonobo_folder_browser_factory != NULL) - return; - - bonobo_folder_browser_factory = - bonobo_generic_factory_new ( - "control-factory:evolution-mail", - folder_browser_factory, NULL); - - if (bonobo_folder_browser_factory == NULL){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("We are sorry, Evolution's Folder Browser can not be initialized.")); - exit (1); - } -} diff --git a/mail/folder-browser.c b/mail/folder-browser.c deleted file mode 100644 index 9a3a8cee9c..0000000000 --- a/mail/folder-browser.c +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * folder-browser.c: Folder browser top level component - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gnome.h> -#include "e-util/e-util.h" -#include "camel/camel-exception.h" -#include "folder-browser.h" -#include "session.h" -#include "message-list.h" - - -#define PARENT_TYPE (gtk_table_get_type ()) - -static GtkObjectClass *folder_browser_parent_class; - - -#define PROPERTY_FOLDER_URI "folder_uri" -#define PROPERTY_MESSAGE_PREVIEW "message_preview" - - - -static void -folder_browser_destroy (GtkObject *object) -{ - FolderBrowser *folder_browser = FOLDER_BROWSER (object); - - if (folder_browser->uri) - g_free (folder_browser->uri); - - if (folder_browser->folder) - gtk_object_unref (GTK_OBJECT (folder_browser->folder)); - - if (folder_browser->message_list) - bonobo_object_unref (BONOBO_OBJECT (folder_browser->message_list)); - - folder_browser_parent_class->destroy (object); -} - -static void -folder_browser_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = folder_browser_destroy; - - folder_browser_parent_class = gtk_type_class (PARENT_TYPE); -} - -static gboolean -folder_browser_load_folder (FolderBrowser *fb, const char *name) -{ - CamelFolder *new_folder; - CamelException ex; - gboolean new_folder_exists = FALSE; - - - camel_exception_init (&ex); - new_folder = camel_store_get_folder (default_session->store, name, &ex); - - if (camel_exception_get_id (&ex)){ - printf ("Unable to get folder %s : %s\n", - name, - ex.desc?ex.desc:"unknown reason"); - return FALSE; - } - - /* if the folder does not exist, we don't want to show it */ - new_folder_exists = camel_folder_exists (new_folder, &ex); - if (camel_exception_get_id (&ex)) { - printf ("Unable to test for folder existence: %s\n", - ex.desc?ex.desc:"unknown reason"); - return FALSE; - } - - if (!new_folder_exists) { - gtk_object_unref (GTK_OBJECT (new_folder)); - return FALSE; - } - - - if (fb->folder) - gtk_object_unref (GTK_OBJECT (fb->folder)); - - fb->folder = new_folder; - - message_list_set_folder (fb->message_list, new_folder); - - return TRUE; -} - -#define EQUAL(a,b) (strcmp (a,b) == 0) - -void -folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri) -{ - /* FIXME: hardcoded uri */ - if (!folder_browser_load_folder (folder_browser, "inbox")) - return; - - if (folder_browser->uri) - g_free (folder_browser->uri); - - folder_browser->uri = g_strdup (uri); -} - -void -folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show_message_preview) -{ - if (folder_browser->preview_shown == show_message_preview) - return; - - g_warning ("FIXME: implement me"); -} - -static void -folder_browser_property_changed (BonoboPropertyBag *properties, - const char *name, - const char *type, - gpointer old_value, - gpointer new_value, - gpointer user_data) -{ - FolderBrowser *folder_browser = FOLDER_BROWSER (user_data); - - if (EQUAL (name, PROPERTY_FOLDER_URI)){ - folder_browser_set_uri (folder_browser, new_value); - return; - } else if (EQUAL (name, PROPERTY_MESSAGE_PREVIEW)){ - folder_browser_set_message_preview (folder_browser, *((gboolean *)new_value)); - } -} - -static void -folder_browser_properties_init (FolderBrowser *fb) -{ - fb->properties = bonobo_property_bag_new (); - - bonobo_property_bag_add ( - fb->properties, PROPERTY_FOLDER_URI, "string", - NULL, NULL, _("The URI that the Folder Browser will display"), 0); - bonobo_property_bag_add ( - fb->properties, PROPERTY_MESSAGE_PREVIEW, "boolean", - NULL, NULL, _("Whether a message preview should be shown"), 0); - - gtk_signal_connect (GTK_OBJECT (fb->properties), "value_changed", - folder_browser_property_changed, fb); -} - -static void -folder_browser_gui_init (FolderBrowser *fb) -{ - /* - * The panned container - */ - fb->vpaned = gtk_vpaned_new (); - gtk_widget_show (fb->vpaned); - - gtk_table_attach ( - GTK_TABLE (fb), fb->vpaned, - 0, 1, 0, 2, - GTK_FILL | GTK_EXPAND, - GTK_FILL | GTK_EXPAND, - 0, 0); - - fb->message_list_w = message_list_get_widget (fb->message_list); - gtk_paned_add1 (GTK_PANED (fb->vpaned), fb->message_list_w); - gtk_widget_show (fb->message_list_w); - - gtk_paned_add2 (GTK_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display)); - gtk_paned_set_position (GTK_PANED (fb->vpaned), 200); - - gtk_widget_show (GTK_WIDGET (fb->mail_display)); - gtk_widget_show (GTK_WIDGET (fb)); - -} - -static void -folder_browser_init (GtkObject *object) -{ -} - -static void -my_folder_browser_init (GtkObject *object) -{ - FolderBrowser *fb = FOLDER_BROWSER (object); - - /* - * Setup parent class fields. - */ - GTK_TABLE (fb)->homogeneous = FALSE; - gtk_table_resize (GTK_TABLE (fb), 1, 2); - - /* - * Our instance data - */ - fb->message_list = MESSAGE_LIST (message_list_new (fb)); - fb->mail_display = MAIL_DISPLAY (mail_display_new (fb)); - - folder_browser_properties_init (fb); - folder_browser_gui_init (fb); -} - -GtkWidget * -folder_browser_new (void) -{ - FolderBrowser *folder_browser = gtk_type_new (folder_browser_get_type ()); - - my_folder_browser_init (GTK_OBJECT (folder_browser)); - - printf ("Widget started\n"); - return GTK_WIDGET (folder_browser); -} - - -E_MAKE_TYPE (folder_browser, "FolderBrowser", FolderBrowser, folder_browser_class_init, folder_browser_init, PARENT_TYPE); - - diff --git a/mail/folder-browser.h b/mail/folder-browser.h deleted file mode 100644 index 04c3dbcb4a..0000000000 --- a/mail/folder-browser.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - - -#ifndef _FOLDER_BROWSER_H_ -#define _FOLDER_BROWSER_H_ - -#include "mail-types.h" -#include <gtk/gtktable.h> -#include "camel/camel-stream.h" -#include <bonobo/bonobo-property-bag.h> -#include "message-list.h" -#include "mail-display.h" -#include "shell/Evolution.h" - - -#define FOLDER_BROWSER_TYPE (folder_browser_get_type ()) -#define FOLDER_BROWSER(o) (GTK_CHECK_CAST ((o), FOLDER_BROWSER_TYPE, FolderBrowser)) -#define FOLDER_BROWSER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), FOLDER_BROWSER_TYPE, FolderBrowserClass)) -#define IS_FOLDER_BROWSER(o) (GTK_CHECK_TYPE ((o), FOLDER_BROWSER_TYPE)) -#define IS_FOLDER_BROWSER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), FOLDER_BROWSER_TYPE)) - - -struct _FolderBrowser { - GtkTable parent; - - BonoboPropertyBag *properties; - - Evolution_Shell shell; - - /* - * The current URI being displayed by the FolderBrowser - */ - char *uri; - CamelFolder *folder; - - MessageList *message_list; - GtkWidget *message_list_w; - MailDisplay *mail_display; - GtkWidget *vpaned; - gboolean preview_shown; - -}; - - -typedef struct { - GtkTableClass parent_class; -} FolderBrowserClass; - - - - -GtkType folder_browser_get_type (void); -GtkWidget *folder_browser_new (void); -void folder_browser_set_uri (FolderBrowser *folder_browser, - const char *uri); -void folder_browser_set_message_preview (FolderBrowser *folder_browser, - gboolean show_message_preview); - -#endif /* _FOLDER_BROWSER_H_ */ diff --git a/mail/html-stream.c b/mail/html-stream.c deleted file mode 100644 index bf88823a33..0000000000 --- a/mail/html-stream.c +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * html-stream.c: A CamelStream class that feeds data into a GtkHTML widget - * - * Authors: - * Miguel de Icaza (miguel@helixcode.com) - * Bertrand Guiheneuf (bg@aful.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include "html-stream.h" -#include "e-util/e-util.h" - -#define PARENT_TYPE camel_stream_get_type () - -static GtkObjectClass *html_stream_parent_class; - -/* - * CamelStream::read method - * - * Return 0 bytes read, as this is a write-only stream - */ -static gint -html_stream_read (CamelStream *stream, gchar *buffer, gint n) -{ - return 0; -} - -/* - * CamelStream::write method - * - * Writes @buffer into the HTML widget - */ -static gint -html_stream_write (CamelStream *stream, const gchar *buffer, gint n) -{ - HTMLStream *html_stream = HTML_STREAM (stream); - - if (html_stream->gtk_html_stream) - gtk_html_write (html_stream->gtk_html, html_stream->gtk_html_stream, buffer, n); - else - n = 0; - - return n; -} - -/* - * CamelStream::Reset method - * - * Reset the html widget that is, prepare it - * for a new display - */ -static void -html_stream_reset (CamelStream *stream) -{ - HTMLStream *html_stream = HTML_STREAM (stream); - - if (html_stream->gtk_html_stream) - gtk_html_end (html_stream->gtk_html, html_stream->gtk_html_stream, GTK_HTML_STREAM_OK); - - html_stream->gtk_html_stream = gtk_html_begin (html_stream->gtk_html, ""); -} - -/* - * CamelStream::available method - * - * Return 0, as this is only a write-stream - */ -static gint -html_stream_available (CamelStream *stream) -{ - return 0; -} - -/* - * CamelStream::eos method. - * - * We just return TRUE, as this is not a read-stream - */ -static gboolean -html_stream_eos (CamelStream *stream) -{ - return TRUE; -} - -static void -html_stream_close (CamelStream *stream) -{ - HTMLStream *html_stream = HTML_STREAM (stream); - - gtk_html_end (html_stream->gtk_html, html_stream->gtk_html_stream, GTK_HTML_STREAM_OK); - html_stream->gtk_html_stream = NULL; -} - -static void -html_stream_destroy (GtkObject *object) -{ -} - -static void -html_stream_class_init (GtkObjectClass *object_class) -{ - CamelStreamClass *stream_class = (CamelStreamClass *) object_class; - - html_stream_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = html_stream_destroy; - - stream_class->read = html_stream_read; - stream_class->write = html_stream_write; - stream_class->reset = html_stream_reset; - stream_class->available = html_stream_available; - stream_class->eos = html_stream_eos; - stream_class->close = html_stream_close; -} - -CamelStream * -html_stream_new (GtkHTML *html) -{ - HTMLStream *html_stream; - - g_return_val_if_fail (html != NULL, NULL); - g_return_val_if_fail (GTK_IS_HTML (html), NULL); - - html_stream = gtk_type_new (html_stream_get_type ()); - - gtk_object_ref (GTK_OBJECT (html)); - - html_stream->gtk_html_stream = gtk_html_begin (html, ""); - - html_stream->gtk_html = html; - - return CAMEL_STREAM (html_stream); -} - -E_MAKE_TYPE (html_stream, "HTMLStream", HTMLStream, html_stream_class_init, NULL, PARENT_TYPE); - - diff --git a/mail/html-stream.h b/mail/html-stream.h deleted file mode 100644 index ffa0f4751c..0000000000 --- a/mail/html-stream.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _HTML_STREAM_H_ -#define _HTML_STREAM_H_ 1 - -#include <gtkhtml/gtkhtml.h> -#include "camel/camel-stream.h" - -#define HTML_STREAM_TYPE (html_stream_get_type ()) -#define HTML_STREAM(obj) (GTK_CHECK_CAST((obj), HTML_STREAM_TYPE, HTMLStream)) -#define HTML_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), HTML_STREAM_TYPE, HTMLStreamClass)) -#define IS_HTML_STREAM(o) (GTK_CHECK_TYPE((o), HTML_STREAM_TYPE)) - -typedef struct { - CamelStream parent_object; - GtkHTML *gtk_html; - GtkHTMLStreamHandle *gtk_html_stream; -} HTMLStream; - -typedef struct { - CamelStreamClass parent_class; -} HTMLStreamClass; - - -GtkType html_stream_get_type (void); -CamelStream *html_stream_new (GtkHTML *html); - -#endif /* _HTML_STREAM_H_ */ diff --git a/mail/mail-component.c b/mail/mail-component.c deleted file mode 100644 index 66d223ab2c..0000000000 --- a/mail/mail-component.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * mail-component.c: The core of the mail component - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gnome.h> -#include <bonobo/bonobo-main.h> -#include "e-util/e-gui-utils.h" - -CORBA_Environment ev; -CORBA_ORB orb; - -static void -init_bonobo (int argc, char **argv) -{ - gnome_CORBA_init_with_popt_table ( - "evolution-mail-component", "1.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Mail Component: I could not initialize Bonobo")); - exit (1); - } -} - -static void -main (int argc, char *argv []) -{ - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - CORBA_exception_init (&ev); - - init_bonobo (argc, argv); - - mail_display_factory_init (); - - bonobo_main (); - - return 0; -} diff --git a/mail/mail-display.c b/mail/mail-display.c deleted file mode 100644 index 57da4b65f8..0000000000 --- a/mail/mail-display.c +++ /dev/null @@ -1,476 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * mail-display.c: Mail display widget - * - * Author: - * Miguel de Icaza - * Bertrand Guiheneuf (bg@aful.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gnome.h> -#include "e-util/e-util.h" -#include "mail-display.h" -#include "html-stream.h" -#include "camel/camel-formatter.h" - -/* corba/bonobo stuff */ -#include <bonobo.h> -#include <libgnorba/gnorba.h> -#include <bonobo/bonobo-stream-memory.h> - -#define PARENT_TYPE (gtk_table_get_type ()) - -static GtkObjectClass *mail_display_parent_class; - - - - -static gchar default_header_html_string[] = "\n\ -<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n\ -<html>\n\ -<head>\n\ - <meta name=\"GENERATOR\" content=\"Evolution Mail Component (Rhon Rhon release)\">\n\ -</head>\n\ -<body text=\"#000000\" bgcolor=\"#999999\">\n\ -<table CELLSPACING=0 WIDTH=\"100\%\">\n\ -<tr>\n\ -<td><b>From: </b></td>\n\ -<td><b>To: </b></td>\n\ -</tr>\n\ -\n\ -<tr>\n\ -<td><b>Subject: </b></td>\n\ -<td><b>Cc: </b></td>\n\ -</tr>\n\ -</table>\n\ -</body>\n\ -</html>\n\ -"; - - - -static gchar default_body_html_string[] = "\n\ -<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n\ -<html>\n\ -<head>\n\ - <meta name=\"GENERATOR\" content=\"Evolution Mail Component (Rhon Rhon release)\">\n\ -</head>\n\ -<body text=\"#000000\" bgcolor=\"#FFFFFF\">\n\ -<center>\n\ -Nothing to display in this view\n\ -</center>\n\ -</body>\n\ -</html>\n\ -"; - - -/*----------------------------------------------------------------------* - * Helper utility functions - *----------------------------------------------------------------------*/ - - -/* stuff to display Bonobo Components inside the html message - * body view */ -static gboolean -hydrate_persist_stream_from_gstring (Bonobo_PersistStream persist_stream, - GString* gstr) -{ - CORBA_Environment ev; - BonoboStream* mem_stream = - bonobo_stream_mem_create (gstr->str, gstr->len, TRUE); - CORBA_Object mem_stream_corba = - bonobo_object_corba_objref (BONOBO_OBJECT (mem_stream)); - - g_assert (persist_stream != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - - /* - * Load the file into the component using PersistStream. - */ - Bonobo_PersistStream_load (persist_stream, mem_stream_corba, &ev); - - bonobo_object_unref (BONOBO_OBJECT (mem_stream)); - - if (ev._major != CORBA_NO_EXCEPTION) { - gnome_warning_dialog (_("An exception occured while trying " - "to load data into the component with " - "PersistStream")); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - return TRUE; -} - - -static GString* -camel_stream_to_gstring (CamelStream* stream) -{ - gchar tmp_buffer[4097]; - GString *tmp_gstring = g_string_new (""); - - do { /* read next chunk of text */ - - gint nb_bytes_read; - - nb_bytes_read = camel_stream_read (stream, - tmp_buffer, - 4096); - tmp_buffer [nb_bytes_read] = '\0'; - - /* If there's any text, append it to the gstring */ - if (nb_bytes_read > 0) { - tmp_gstring = g_string_append (tmp_gstring, tmp_buffer); - } - - } while (!camel_stream_eos (stream)); - - return tmp_gstring; -} - -/*----------------------------------------------------------------------* - * Callbacks - *----------------------------------------------------------------------*/ - -static void -embeddable_destroy_cb (GtkObject *obj, gpointer user_data) -{ - BonoboWidget *be; /* bonobo embeddable */ - BonoboViewFrame *vf; /* the embeddable view frame */ - GtkWidget *w; /* the viewframe widget */ - BonoboObjectClient* server; - CORBA_Environment ev; - - - printf ("in the bonobo embeddable destroy callback\n"); - be = BONOBO_WIDGET (obj); - server = bonobo_widget_get_server (be); - - - - vf = bonobo_widget_get_view_frame (be); - bonobo_control_frame_control_deactivate ( - BONOBO_CONTROL_FRAME (vf)); - //w = bonobo_control_frame_get_widget (BONOBO_CONTROL_FRAME (vf)); - - //gtk_widget_destroy (w); - - CORBA_exception_init (&ev); - Bonobo_Unknown_unref ( - bonobo_object_corba_objref (BONOBO_OBJECT(server)), &ev); - CORBA_Object_release ( - bonobo_object_corba_objref (BONOBO_OBJECT(server)), &ev); - - CORBA_exception_free (&ev); - bonobo_object_destroy (BONOBO_OBJECT (vf)); - //gtk_object_unref (obj); -} - - - -/* - * As a page is loaded, when gtkhtml comes across <object> tags, this - * callback is invoked. The GtkHTMLEmbedded param is a GtkContainer; - * our job in this function is to simply add a child widget to it. - */ -static void -on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, void *unused) -{ - CamelStream *stream; - GString *camel_stream_gstr; - - GtkWidget *bonobo_embeddable; - BonoboObjectClient* server; - Bonobo_PersistStream persist; - CORBA_Environment ev; - gchar *uid = gtk_html_embedded_get_parameter (eb, "uid"); - - - /* Both the classid (which specifies which bonobo object to - * fire up) and the uid (which tells us where to find data to - * persist from) must be available; if one of them isn't, - * print an error and bail. */ - if (!uid || !eb->classid) { - printf ("on_object_requested: couldn't find %s%s%s\n", - uid?"a uid":"", - (!uid && !eb->classid)?" or ":"", - eb->classid?"a classid":""); - return; - } - printf ("object requested : %s\n", eb->classid); - printf ("UID = %s\n", uid); - - /* Try to get a server with goadid specified by eb->classid */ - bonobo_embeddable = bonobo_widget_new_subdoc (eb->classid, NULL); - gtk_signal_connect (GTK_OBJECT (bonobo_embeddable), - "destroy", embeddable_destroy_cb, NULL); - - server = bonobo_widget_get_server (BONOBO_WIDGET (bonobo_embeddable)); - if (!server) { - printf ("Couldn't get the server for the bonobo embeddable\n"); - return; - } - - /* The UID should be a pointer to a CamelStream */ - if (sscanf (uid, "camel://%p", &stream) != 1) { - printf ("Couldn't get a pointer from url \"%s\"\n", uid); - gtk_object_unref (GTK_OBJECT (bonobo_embeddable)); - - return; - } - - /* Try to get a PersistStream interface from the server; - if it doesn't support that interface, bail. */ - persist = (Bonobo_PersistStream) bonobo_object_client_query_interface ( - server, - "IDL:Bonobo/PersistStream:1.0", - NULL); - - if (persist == CORBA_OBJECT_NIL) { - gchar* msg = g_strdup_printf ( - _("The %s component doesn't support PersistStream!\n"), - uid); - - gnome_warning_dialog (msg); - gtk_object_unref (GTK_OBJECT (bonobo_embeddable)); - - g_free (msg); - return; - } - - /* Hydrate the PersistStream from the CamelStream */ - camel_stream_gstr = camel_stream_to_gstring (stream); - printf ("on_object_requested: The CamelStream has %d elements\n", - camel_stream_gstr->len); - hydrate_persist_stream_from_gstring (persist, camel_stream_gstr); - - /* Give our new window to the container */ - - gtk_widget_show (bonobo_embeddable); - gtk_container_add (GTK_CONTAINER(eb), bonobo_embeddable); - - /* Destroy the PersistStream object.*/ - CORBA_exception_init (&ev); - Bonobo_Unknown_unref (persist, &ev); - CORBA_Object_release (persist, &ev); - CORBA_exception_free (&ev); - - g_string_free (camel_stream_gstr, FALSE); -} - - -/** - * mail_display_set_message: - * @mail_display: the mail display object - * @mime_message: the input camel medium - * - * Makes the mail_display object show the contents of the medium - * param. This means feeding mail_display->body_stream and - * mail_display->headers_stream with html. - * - **/ -void -mail_display_set_message (MailDisplay *mail_display, - CamelMedium *medium) -{ - CamelFormatter *camel_formatter; - - /* okay, we should not create a formatter - * each time we need to display a message - * but I don't know how the formatter reacts - * to consecutive call to *_to_html - ber */ - camel_formatter = camel_formatter_new (); - - /* - * for the moment, camel-formatter deals only with - * mime messages, but in the future, it should be - * able to deal with any medium. - * It can work on pretty much data wrapper, but in - * fact, only the medium class has the distinction - * header / body - */ - if (CAMEL_IS_MIME_MESSAGE (medium)) { - - /* we were given a reference to the message in the last call - * to mail_display_set_message, free it now. */ - if (mail_display->current_message) - gtk_object_unref (GTK_OBJECT (mail_display->current_message)); - - mail_display->current_message = CAMEL_MIME_MESSAGE (medium); - /* - * reset the html stream to clean - * the gtkhtml widget - */ - camel_stream_reset (mail_display->body_stream); - camel_stream_reset (mail_display->headers_stream); - - /* - * convert the message into html - * and stream the result to the gtkhtml - * widgets - */ - camel_stream_write_string (mail_display->headers_stream, "\n\ -<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n\ -<html>\n\ -<head>\n\ - <meta name=\"GENERATOR\" content=\"Evolution Mail Component (Rhon Rhon release)\">\n\ -</head>\n\ -<body text=\"#000000\" bgcolor=\"#999999\">\n\ -<font>\n\ -");; - - camel_stream_write_string (mail_display->body_stream, "\n\ -<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n\ -<html>\n\ -<head>\n\ - <meta name=\"GENERATOR\" content=\"Evolution Mail Component (Rhon Rhon release)\">\n\ -</head>\n\ -<body text=\"#000000\" bgcolor=\"#FFFFFF\">\n\ -");; - - - camel_formatter_mime_message_to_html - (camel_formatter, - CAMEL_MIME_MESSAGE (medium), - mail_display->headers_stream, - mail_display->body_stream); - - - gtk_object_unref (GTK_OBJECT (camel_formatter)); - - camel_stream_write_string (mail_display->headers_stream, "\n\ -</font>\n\ -</body>\n\ -</html>\n\ -");; - - camel_stream_write_string (mail_display->body_stream, "\n\ -</body>\n\ -</html>\n\ -");; - - camel_stream_close (mail_display->body_stream); - camel_stream_close (mail_display->headers_stream); - - } -} - - -/*----------------------------------------------------------------------* - * Standard Gtk+ Class functions - *----------------------------------------------------------------------*/ - -static void -mail_display_init (GtkObject *object) -{ - MailDisplay *mail_display = MAIL_DISPLAY (object); - - /* create the headers html widget */ - mail_display->headers_html_widget = (GtkHTML *) gtk_html_new (); - mail_display->headers_stream = html_stream_new (mail_display->headers_html_widget); - gtk_widget_show (GTK_WIDGET (mail_display->headers_html_widget)); - - /* create the body html widget */ - mail_display->body_html_widget = (GtkHTML *) gtk_html_new (); - gtk_signal_connect (GTK_OBJECT (mail_display->body_html_widget), - "object_requested", - GTK_SIGNAL_FUNC (on_object_requested), - NULL); - - mail_display->body_stream = html_stream_new (mail_display->body_html_widget); - gtk_widget_show (GTK_WIDGET (mail_display->body_html_widget)); - - /* various other initializations */ - mail_display->current_message = NULL; -} - -static void -mail_display_destroy (GtkObject *object) -{ - /* MailDisplay *mail_display = MAIL_DISPLAY (object); */ - - mail_display_parent_class->destroy (object); -} - -static void -mail_display_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = mail_display_destroy; - mail_display_parent_class = gtk_type_class (PARENT_TYPE); -} - -GtkWidget * -mail_display_new (FolderBrowser *parent_folder_browser) -{ - MailDisplay *mail_display = gtk_type_new (mail_display_get_type ()); - GtkTable *table = GTK_TABLE (mail_display); - GtkWidget *scroll_wnd; - GtkWidget* frame_wnd = NULL; - - g_assert (parent_folder_browser); - - mail_display->parent_folder_browser = parent_folder_browser; - - /* the table has table with 1 column and 2 lines */ - table->homogeneous = FALSE; - - gtk_table_resize (table, 1, 2); - gtk_widget_show (GTK_WIDGET (mail_display)); - - - /* create a scrolled window and put the headers - * html widget inside */ - scroll_wnd = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_wnd), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_NEVER); - frame_wnd = gtk_frame_new (NULL); - gtk_frame_set_shadow_type ( - GTK_FRAME (frame_wnd), GTK_SHADOW_OUT); - gtk_widget_show (scroll_wnd); - gtk_container_add (GTK_CONTAINER (frame_wnd), scroll_wnd); - gtk_widget_show (frame_wnd); - gtk_container_add (GTK_CONTAINER (scroll_wnd), - GTK_WIDGET (mail_display->headers_html_widget)); - gtk_widget_set_usize (GTK_WIDGET (scroll_wnd), -1, 50); - /* add it on the top part of the table */ - gtk_table_attach (table, GTK_WIDGET (frame_wnd), - 0, 1, 0, 1, - GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); - - - /* create a scrolled window and put the body - * html widget inside */ - scroll_wnd = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_wnd), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_ALWAYS); - - gtk_widget_show (scroll_wnd); - gtk_container_add (GTK_CONTAINER (scroll_wnd), - GTK_WIDGET (mail_display->body_html_widget)); - - /* add it at the bottom part of the table */ - gtk_table_attach (table, GTK_WIDGET (scroll_wnd), - 0, 1, 1, 2, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - - /* write the default text to the html widgets */ - camel_stream_write_string (mail_display->headers_stream, default_header_html_string); - camel_stream_write_string (mail_display->body_stream, default_body_html_string); - - - return GTK_WIDGET (mail_display); -} - - - -E_MAKE_TYPE (mail_display, "MailDisplay", MailDisplay, mail_display_class_init, mail_display_init, PARENT_TYPE); - - - diff --git a/mail/mail-display.h b/mail/mail-display.h deleted file mode 100644 index 81f1bcb38f..0000000000 --- a/mail/mail-display.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - - - - - - - - - - - - -#ifndef _MAIL_DISPLAY_H_ -#define _MAIL_DISPLAY_H_ - -#include <gtk/gtktable.h> -#include <gtkhtml/gtkhtml.h> -#include "camel/camel-stream.h" -#include "camel/camel-mime-message.h" -#include "folder-browser.h" - - -#define MAIL_DISPLAY_TYPE (mail_display_get_type ()) -#define MAIL_DISPLAY(o) (GTK_CHECK_CAST ((o), MAIL_DISPLAY_TYPE, MailDisplay)) -#define MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_DISPLAY_TYPE, MailDisplayClass)) -#define IS_MAIL_DISPLAY(o) (GTK_CHECK_TYPE ((o), MAIL_DISPLAY_TYPE)) -#define IS_MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_DISPLAY_TYPE)) - -struct _MailDisplay { - GtkTable parent; - - FolderBrowser *parent_folder_browser; - - GtkHTML * headers_html_widget; - CamelStream * headers_stream; - - GtkHTML * body_html_widget; - CamelStream * body_stream; - - CamelMimeMessage *current_message; -}; - -typedef struct { - GtkTableClass parent_class; -} MailDisplayClass; - -GtkType mail_display_get_type (void); -GtkWidget * mail_display_new (FolderBrowser *parent_folder_browser); - -void mail_display_set_message (MailDisplay *mail_display, - CamelMedium *medium); - - - -#endif /* _MAIL_DISPLAY_H_ */ diff --git a/mail/mail-sources.c b/mail/mail-sources.c deleted file mode 100644 index 3e5fbaed91..0000000000 --- a/mail/mail-sources.c +++ /dev/null @@ -1,771 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-sources.c: Mail source selection wizard */ - -/* - * Author : - * Dan Winship <danw@helixcode.com> - * - * Copyright 2000 Helix Code, Inc. (http://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 Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include <sys/stat.h> - -#include <gnome.h> -#include <gtkhtml/gtkhtml.h> - -/* XXX */ -#define default_mail_path "/var/mail" - -struct { - char *protocol, *name, *description, *authname[4], *authproto[4]; - gboolean authpasswd[4]; -} providers[] = { - { "POP3", "Post Office Protocol, version 3", - "For connecting to POP3 servers. Some web mail providers and " - "proprietary email systems also provide POP3 interfaces.", - { "Password/APOP", "Kerberos 4" }, - { NULL, "KERBEROS_V4" }, - { TRUE, FALSE } - }, - { "IMAP", "Internet Mail Access Protocol", - "For connecting to IMAP servers. Allows you to keep all of " - "your mail on the IMAP server so that you can access it from " - "anywhere.", - { "Password/CRAM-MD5", "S/Key", "Kerberos 4", "GSSAPI" }, - { NULL, "SKEY", "KERBEROS_V4", "GSSAPI" }, - { TRUE, TRUE, FALSE, FALSE }, - } -}; -#define nproviders 2 - -struct msinfo { - GtkHTML *html; - GtkWidget *prev, *next; - int page; - - /* Locally-delivered mail. */ - gboolean get_local_mail, default_local_mail_path; - char *local_mail_path; - gboolean use_movemail; - - /* Remotely-delivered mail. */ - gboolean get_remote_mail; - int remote_provider; - char *remote_host, *remote_user, *remote_password; - int remote_auth; - gboolean remember_password; - gboolean copy_local; - - /* Local store. */ - gboolean store_local; - char *local_store_path; -}; - -static void display_intro (struct msinfo *msi); -static int finish_intro (struct msinfo *msi, int direction); -static void display_local (struct msinfo *msi); -static int finish_local (struct msinfo *msi, int direction); -static void display_remote (struct msinfo *msi); -static int finish_remote (struct msinfo *msi, int direction); -static void display_remconf (struct msinfo *msi); -static int finish_remconf (struct msinfo *msi, int direction); - -static struct { - void (*display) (struct msinfo *msi); - int (*finish) (struct msinfo *msi, int direction); -} pages[] = { - { display_intro, finish_intro }, - { display_local, finish_local }, -#if 0 - { display_movemail, finish_movemail }, -#endif - { display_remote, finish_remote }, - { display_remconf, finish_remconf }, - { NULL, NULL } -}; - - -/* Wrappers around gtkhtml */ - -static void -write_html (GtkHTML *html, GtkHTMLStreamHandle handle, const char *text) -{ - gtk_html_write (html, handle, text, strlen (text)); -} - -static GtkHTMLStreamHandle -start_html (GtkHTML *html) -{ - GtkHTMLStreamHandle handle; - - handle = gtk_html_begin (html, ""); - write_html (html, handle, "<body bgcolor=white>\n"); - return handle; -} - -void -end_html (GtkHTML *html, GtkHTMLStreamHandle handle) -{ - write_html (html, handle, "</body>"); - gtk_html_end (html, handle, GTK_HTML_STREAM_OK); -} - - -/* Button callbacks */ - -static void -prev_clicked (GtkButton *button, gpointer data) -{ - struct msinfo *msi = data; - - if (msi->page == 3) - gtk_widget_set_sensitive (msi->next, TRUE); - msi->page = pages[msi->page].finish (data, -1); - pages[msi->page].display (data); - if (msi->page == 0) - gtk_widget_set_sensitive (msi->prev, FALSE); -} - -static void -next_clicked (GtkButton *button, gpointer data) -{ - struct msinfo *msi = data; - - if (msi->page == 0) - gtk_widget_set_sensitive (msi->prev, TRUE); - msi->page = pages[msi->page].finish (data, 1); - pages[msi->page].display (data); - if (msi->page == 3) - gtk_widget_set_sensitive (msi->next, FALSE); -} - -static void -cancel_clicked (GtkButton *button, gpointer data) -{ - exit (1); -} - -static void -object_requested(GtkHTML *html, GtkHTMLEmbedded *eb) -{ - GtkWidget *w; - - w = gtk_object_get_data (GTK_OBJECT(html), eb->classid); - gtk_container_add (GTK_CONTAINER(eb), w); - gtk_widget_show_all (GTK_WIDGET(eb)); -} - - - -int -main (int argc, char **argv) -{ - struct msinfo *msi; - GtkWidget *window, *vbox, *frame, *scrolled, *hbbox; - GtkWidget *cancel; - int page; - - gtk_init (&argc, &argv); - gdk_imlib_init (); - gdk_rgb_init (); - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - - msi = g_new (struct msinfo, 1); - - /* Build window */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), - "Mail Source Configuration"); - gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); - - vbox = gtk_vbox_new (FALSE, 5); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); - gtk_container_add (GTK_CONTAINER (window), vbox); - - frame = gtk_frame_new (NULL); - gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); - - scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_ALWAYS); - gtk_container_add (GTK_CONTAINER (frame), scrolled); - - msi->html = GTK_HTML (gtk_html_new()); - gtk_html_set_editable (msi->html, FALSE); - gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (msi->html)); - gtk_signal_connect (GTK_OBJECT (msi->html), "object_requested", - GTK_SIGNAL_FUNC (object_requested), NULL); - - hbbox= gtk_hbutton_box_new (); - gtk_button_box_set_layout (GTK_BUTTON_BOX (hbbox), - GTK_BUTTONBOX_END); - gtk_box_pack_end (GTK_BOX (vbox), hbbox, FALSE, FALSE, 0); - - msi->prev = gnome_stock_button (GNOME_STOCK_BUTTON_PREV); - msi->next = gnome_stock_button (GNOME_STOCK_BUTTON_NEXT); - cancel = gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL); - - gtk_box_pack_start (GTK_BOX (hbbox), msi->prev, TRUE, FALSE, 0); - gtk_box_pack_end (GTK_BOX (hbbox), msi->next, TRUE, FALSE, 0); - gtk_box_pack_end (GTK_BOX (hbbox), cancel, TRUE, FALSE, 0); - - GTK_WIDGET_SET_FLAGS (msi->prev, GTK_CAN_DEFAULT); - GTK_WIDGET_SET_FLAGS (msi->next, GTK_CAN_DEFAULT); - GTK_WIDGET_SET_FLAGS (cancel, GTK_CAN_DEFAULT); - gtk_widget_grab_default (msi->next); - - gtk_signal_connect (GTK_OBJECT (msi->prev), "clicked", - prev_clicked, msi); - gtk_signal_connect (GTK_OBJECT (msi->next), "clicked", - next_clicked, msi); - gtk_signal_connect (GTK_OBJECT (cancel), "clicked", - cancel_clicked, NULL); - - msi->page = 0; - msi->get_local_mail = msi->default_local_mail_path = -1; - msi->use_movemail = -1; - msi->get_remote_mail = msi->store_local = -1; - msi->remember_password = msi->copy_local = -1; - msi->local_mail_path = msi->local_store_path = NULL; - msi->remote_provider = msi->remote_auth = -1; - msi->remote_host = msi->remote_user = msi->remote_password = NULL; - - display_intro (msi); - - gtk_widget_show_all (window); - gtk_main (); - exit (0); -} - -#define intro_text \ - "<h1>Evolution Mail Source Wizard</h1>\n" \ - "<p>Welcome to the Evolution Mail Source Wizard. This will " \ - "help you blah blah blah blah blah.</p>" - -static void -display_intro (struct msinfo *msi) -{ - GtkHTMLStreamHandle handle; - - handle = start_html (msi->html); - write_html (msi->html, handle, intro_text); - end_html (msi->html, handle); -} - -static int -finish_intro (struct msinfo *msi, int direction) -{ - return msi->page + direction; -} - -#define local_text_1 \ - "<h1>Local mail source</h1>\n<hr>\n" \ - "<p>First you need to tell Evolution whether or not you " \ - "receive mail locally, and if so, where.</p>\n" \ - "<p>Your default mail file on this system is <b>" - -#define local_text_2 \ - "</b>.</p>\n" - -#define local_text_3_file \ - "<p>That file exists, so you almost certainly want to use it " \ - "as a mail source.</p>\n" - -#define local_text_3_dir \ - "<p>That directory exists, but you currently have no mail " \ - "there. If you aren't sure whether or not you receive mail " \ - "on this machine, it's safest to leave it selected.</p>\n" - -#define local_text_3_none \ - "<p>However, that directory does not exist.</p>\n" - -#define local_text_label_1 \ - "Don't fetch local mail." - -#define local_text_label_2 \ - "Fetch local mail from the default location." - -#define local_text_label_3 \ - "Fetch local mail from an alternate location:" - -void -display_local (struct msinfo *msi) -{ - GtkHTMLStreamHandle handle; - struct stat st; - char *default_user_mail_path; - GtkWidget *radio, *text; - GSList *group = NULL; - - default_user_mail_path = g_strdup_printf ("%s/%s", default_mail_path, - getenv ("USER")); - - handle = start_html (msi->html); - write_html (msi->html, handle, local_text_1); - write_html (msi->html, handle, default_user_mail_path); - write_html (msi->html, handle, local_text_2); - - if (stat (default_mail_path, &st) == 0) { - if (stat (default_user_mail_path, &st) == 0) - write_html (msi->html, handle, local_text_3_file); - else - write_html (msi->html, handle, local_text_3_dir); - if (msi->get_local_mail == -1) - msi->get_local_mail = TRUE; - } else { - write_html (msi->html, handle, local_text_3_none); - if (msi->get_local_mail == -1) - msi->get_local_mail = FALSE; - } - g_free (default_user_mail_path); - - radio = gtk_radio_button_new_with_label (group, local_text_label_1); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - if (!msi->get_local_mail) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - gtk_object_set_data (GTK_OBJECT (msi->html), "local:no", radio); - write_html (msi->html, handle, - "<object classid=\"local:no\"></object><br>\n"); - - radio = gtk_radio_button_new_with_label (group, local_text_label_2); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - if (msi->get_local_mail && msi->default_local_mail_path) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - gtk_object_set_data (GTK_OBJECT (msi->html), "local:default", radio); - write_html (msi->html, handle, - "<object classid=\"local:default\"></object><br>\n"); - - radio = gtk_radio_button_new_with_label (group, local_text_label_3); - text = gtk_entry_new (); - if (msi->get_local_mail && !msi->default_local_mail_path) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - gtk_entry_set_text (GTK_ENTRY (text), msi->local_mail_path); - } - gtk_object_set_data (GTK_OBJECT (msi->html), "local:alt", radio); - gtk_object_set_data (GTK_OBJECT (msi->html), "local:text", text); - write_html (msi->html, handle, - "<object classid=\"local:alt\"></object> " - "<object classid=\"local:text\"></object>"); - - end_html (msi->html, handle); -} - -static int -finish_local (struct msinfo *msi, int direction) -{ - GtkWidget *radio, *text; - - radio = gtk_object_get_data (GTK_OBJECT (msi->html), "local:no"); - msi->get_local_mail = - !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)); - - g_free (msi->local_mail_path); - if (!msi->get_local_mail) - msi->local_mail_path = NULL; - else { - radio = gtk_object_get_data (GTK_OBJECT (msi->html), - "local:default"); - msi->default_local_mail_path = - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)); - if (msi->default_local_mail_path) - msi->local_mail_path = NULL; - else { - text = gtk_object_get_data (GTK_OBJECT (msi->html), - "local:text"); - msi->local_mail_path = - g_strdup (gtk_entry_get_text (GTK_ENTRY (text))); - } - } - - return msi->page + direction; -} - -#define remote_text_1 \ - "<h1>Remote mail source</h1>\n<hr>\n<p>Now you need to " \ - "configure a remote mail source, if you have one.</p>\n" \ - "<p>Evolution supports the following protocols for reading " \ - "mail from remote servers:</p>" - -#define remote_text_2 \ - "<p>To add a remote mail source, choose a protocol from " \ - "the list below and click \"Next\".</p>" - -#define remote_text_3_must \ - "<p>You have not configured a local mail source, so you " \ - "must configure a remote one.</p>" - -#define remote_label_none \ - "No remote mail source" - -void -display_remote (struct msinfo *msi) -{ - GtkHTMLStreamHandle handle; - char *table, *item, *button, *nolabel; - GtkWidget *widget; - int i; - GSList *group = NULL; - - handle = start_html (msi->html); - write_html (msi->html, handle, remote_text_1); - - /* Write the table of available providers */ - table = "<blockquote><table border=1>\n"; - write_html (msi->html, handle, table); - for (i = 0; i < nproviders; i++) { - table = g_strdup_printf ("<tr><th width=\"15%%\" " - "rowspan=2 valign=top>%s</th>" - "<td>%s</td></tr>\n" - "<tr><td>%s</td>\n", - providers[i].protocol, - providers[i].name, - providers[i].description); - write_html (msi->html, handle, table); - g_free (table); - } - table = "</table></blockquote>\n"; - write_html (msi->html, handle, table); - - write_html (msi->html, handle, remote_text_2); - if (!msi->get_local_mail) - write_html (msi->html, handle, remote_text_3_must); - - /* Write the list of configurable sources */ - write_html (msi->html, handle, "<blockquote>"); - if (msi->get_local_mail) { - widget = gtk_radio_button_new_with_label (NULL, - remote_label_none); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget)); - gtk_object_set_data (GTK_OBJECT (msi->html), "remote:no", - widget); - write_html (msi->html, handle, - "\n<object classid=\"remote:no\"></object><br>"); - } - - for (i = 0; i < nproviders; i++) { - button = g_strdup_printf ("remote:%s", providers[i].protocol); - widget = gtk_radio_button_new_with_label (group, providers[i].protocol); - if (msi->remote_provider == i) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), - TRUE); - } - group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget)); - gtk_object_set_data (GTK_OBJECT (msi->html), button, widget); - g_free (button); - - button = g_strdup_printf ("\n<object classid=\"remote:%s\">" - "</object><br>", - providers[i].protocol); - write_html (msi->html, handle, button); - g_free (button); - } - write_html (msi->html, handle, "</blockquote>"); - - end_html (msi->html, handle); -} - -static int -finish_remote (struct msinfo *msi, int direction) -{ - GtkToggleButton *radio; - char *button; - int i; - - radio = gtk_object_get_data (GTK_OBJECT (msi->html), "remote:no"); - msi->get_remote_mail = !radio || !gtk_toggle_button_get_active (radio); - if (msi->get_remote_mail) { - for (i = 0; i < nproviders; i++) { - button = g_strdup_printf ("remote:%s", - providers[i].protocol); - radio = gtk_object_get_data (GTK_OBJECT (msi->html), - button); - if (gtk_toggle_button_get_active (radio)) - break; - } - - msi->remote_provider = i; - } else if (direction == 1) - direction = 2; /* Skip remconf page. */ - - return msi->page + direction; -} - -#define remconf_text_title \ - "<h1>Configure a remote mail source: %s</h1><hr>" - -#define remconf_text_host_label "Server name:" -#define remconf_text_user_label "Account name:" -#define remconf_text_path_label "Path to mail on server:" -#define remconf_text_auth_label "Authentication method:" - -#define remconf_text_password \ - "<p>If you would like to have Evolution remember the password " \ - "for this account, enter it below. If you would rather be " \ - "prompted for the password when Evolution needs it, choose " \ - "one of the other options.</p>\n" - -#define remconf_text_password_remember "Remember my password" -#define remconf_text_password_confirm "Enter password again for confirmation" -#define remconf_text_password_once \ - "Prompt me for the password once each Evolution session." -#define remconf_text_password_forget \ - "Prompt me for the password every time it is needed." - -static void -resize_password (GtkWidget *html, GtkAllocation *alloc, gpointer data) -{ - GtkWidget *scrolled; - - scrolled = gtk_object_get_data (GTK_OBJECT (html), "remconf:htmlwin"); - gtk_widget_set_usize (scrolled, alloc->width - 20, 300); -} - -static void -frob_password (GtkMenuItem *menuitem, gpointer data) -{ - struct msinfo *msi = data; - GtkHTML *subhtml; - GtkHTMLStreamHandle handle; - GtkWidget *radio, *table, *text, *label; - GSList *group = NULL; - int id; - - id = GPOINTER_TO_UINT (gtk_object_get_data (GTK_OBJECT (menuitem), - "id")); - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:authproto", - GUINT_TO_POINTER (id)); - subhtml = gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:html"); - handle = start_html (subhtml); - if (providers[msi->remote_provider].authpasswd[id]) { - write_html (subhtml, handle, remconf_text_password); - - table = gtk_table_new (2, 2, FALSE); - radio = gtk_radio_button_new_with_label (NULL, remconf_text_password_remember); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:remember", - radio); - gtk_table_attach (GTK_TABLE (table), radio, 0, 1, 0, 1, - GTK_FILL, GTK_SHRINK, 0, 0); - text = gtk_entry_new (); - gtk_entry_set_visibility (GTK_ENTRY (text), FALSE); - if (msi->remote_password) - gtk_entry_set_text (GTK_ENTRY (text), msi->remote_password); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:passwd1", - text); - gtk_table_attach (GTK_TABLE (table), text, 1, 2, 0, 1, - GTK_EXPAND, GTK_SHRINK, 0, 0); - label = gtk_label_new (remconf_text_password_confirm); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, - GTK_SHRINK, GTK_SHRINK, 5, 0); - text = gtk_entry_new (); - gtk_entry_set_visibility (GTK_ENTRY (text), FALSE); - if (msi->remote_password) - gtk_entry_set_text (GTK_ENTRY (text), msi->remote_password); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:passwd2", - text); - gtk_table_attach (GTK_TABLE (table), text, 1, 2, 1, 2, - GTK_EXPAND, GTK_SHRINK, 0, 0); - - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:table", table); - - write_html (subhtml, handle, "<object classid=\"sub:table\">" - "</object>\n"); - - radio = gtk_radio_button_new_with_label (group, remconf_text_password_once); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:once", - radio); - write_html (subhtml, handle, "<object classid=\"sub:once\">" - "</object>\n"); - - radio = gtk_radio_button_new_with_label (group, remconf_text_password_forget); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:forget", - radio); - write_html (subhtml, handle, "<object classid=\"sub:forget\">" - "</object>\n"); - } else { - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:remember", NULL); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:once", NULL); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:forget", NULL); - } - end_html (subhtml, handle); -} - -void -display_remconf (struct msinfo *msi) -{ - GtkHTMLStreamHandle handle; - char *text; - int prov = msi->remote_provider; - GtkWidget *widget, *menu, *menuitem, *mi1 = NULL; - GtkWidget *scrolled, *subhtml; - - handle = start_html (msi->html); - - text = g_strdup_printf (remconf_text_title, providers[prov].protocol); - write_html (msi->html, handle, text); - g_free (text); - - write_html (msi->html, handle, "<table>\n"); - - if (1) { - write_html (msi->html, handle, "<tr><td>"); - write_html (msi->html, handle, remconf_text_host_label); - widget = gtk_entry_new (); - if (msi->remote_host) { - gtk_entry_set_text (GTK_ENTRY (widget), - msi->remote_host); - } - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:host", - widget); - write_html (msi->html, handle, "</td><td><object " - "classid=\"remconf:host\"></object></td></tr>"); - } - - if (1) { - write_html (msi->html, handle, "<tr><td>"); - write_html (msi->html, handle, remconf_text_user_label); - widget = gtk_entry_new (); - if (msi->remote_user) { - gtk_entry_set_text (GTK_ENTRY (widget), - msi->remote_user); - } - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:user", - widget); - write_html (msi->html, handle, "</td><td><object " - "classid=\"remconf:user\"></object></td></tr>"); - } - - if (0) { - write_html (msi->html, handle, "<tr><td>"); - write_html (msi->html, handle, remconf_text_path_label); - widget = gtk_entry_new (); -#if 0 - if (msi->remote_path) { - gtk_entry_set_text (GTK_ENTRY (widget), - msi->remote_path); - } -#endif - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:path", - widget); - write_html (msi->html, handle, "</td><td><object " - "classid=\"remconf:path\"></object></td></tr>"); - } - - if (1) { - int i; - - write_html (msi->html, handle, "<tr><td>"); - write_html (msi->html, handle, remconf_text_auth_label); - menu = gtk_menu_new (); - for (i = 0; i < 4 && providers[prov].authname[i]; i++) { - menuitem = gtk_menu_item_new_with_label (providers[prov].authname[i]); - gtk_widget_show (menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (frob_password), - msi); - gtk_object_set_data (GTK_OBJECT (menuitem), "id", - GUINT_TO_POINTER (i)); - if (!mi1) - mi1 = menuitem; - gtk_menu_append (GTK_MENU (menu), menuitem); - } - widget = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu); - gtk_option_menu_set_history (GTK_OPTION_MENU (widget), - msi->remote_auth ? - msi->remote_auth : 0); - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:auth", - widget); - write_html (msi->html, handle, "</td><td><object " - "classid=\"remconf:auth\"></object></td></tr>"); - } - write_html (msi->html, handle, "</table>\n"); - - subhtml = gtk_html_new (); - gtk_html_set_editable (GTK_HTML (subhtml), FALSE); - gtk_signal_connect (GTK_OBJECT (subhtml), "object_requested", - GTK_SIGNAL_FUNC (object_requested), NULL); - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:html", - subhtml); - frob_password (GTK_MENU_ITEM (mi1), msi); - scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_NEVER, GTK_POLICY_NEVER); - gtk_container_add (GTK_CONTAINER (scrolled), subhtml); - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:htmlwin", - scrolled); - write_html (msi->html, handle, "<object classid=\"remconf:htmlwin\">" - "</object>\n"); - write_html (msi->html, handle, "<p>foo</p>"); - - gtk_signal_connect (GTK_OBJECT (msi->html), "size-allocate", - GTK_SIGNAL_FUNC (resize_password), NULL); - - end_html (msi->html, handle); -} - -static int -finish_remconf (struct msinfo *msi, int direction) -{ - GtkEntry *host, *user, *passwd1, *passwd2; - char *data; - GtkWidget *menu, *menuitem; - GtkObject *subhtml; - GtkToggleButton *radio; - - gtk_signal_disconnect_by_func (GTK_OBJECT (msi->html), - GTK_SIGNAL_FUNC (resize_password), - NULL); - - host = gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:host"); - data = gtk_entry_get_text (GTK_ENTRY (host)); - if (data && *data) - msi->remote_host = g_strdup (data); - - user = gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:user"); - data = gtk_entry_get_text (GTK_ENTRY (user)); - if (data && *data) - msi->remote_user = g_strdup (data); - - msi->remote_auth = GPOINTER_TO_UINT (gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:authproto")); - - subhtml = gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:html"); - radio = gtk_object_get_data (subhtml, "sub:remember"); - if (radio && gtk_toggle_button_get_active (radio)) { - passwd1 = gtk_object_get_data (subhtml, "sub:passwd1"); - passwd2 = gtk_object_get_data (subhtml, "sub:passwd2"); - - /* XXX compare */ - data = gtk_entry_get_text (GTK_ENTRY (passwd1)); - printf ("%s\n", data); - if (data && *data) { - msi->remote_password = g_strdup (data); - msi->remember_password = TRUE; - } - } else { - radio = gtk_object_get_data (subhtml, "sub:once"); - msi->remember_password = gtk_toggle_button_get_active (radio); - } - - return msi->page + direction; -} diff --git a/mail/mail-types.h b/mail/mail-types.h deleted file mode 100644 index c5b690563d..0000000000 --- a/mail/mail-types.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Copyright 2000 Helix Code, Inc. (http://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 Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef MAIL_TYPES_H -#define MAIL_TYPES_H 1 - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - - -typedef struct _FolderBrowser FolderBrowser; -typedef struct _MessageList MessageList; -typedef struct _MailDisplay MailDisplay; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_TYPES_H */ diff --git a/mail/main.c b/mail/main.c deleted file mode 100644 index 2dceb6644e..0000000000 --- a/mail/main.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * mail-component.c: The core of the mail component - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gnome.h> -#include <libgnorba/gnorba.h> -#include <bonobo/bonobo-main.h> -#include "e-util/e-gui-utils.h" -#include "main.h" - -CORBA_ORB orb; - -static void -init_bonobo (int argc, char **argv) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - gnome_CORBA_init_with_popt_table ( - "evolution-mail-component", "1.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Mail Component: I could not initialize Bonobo")); - exit (1); - } - - CORBA_exception_free (&ev); -} - -int -main (int argc, char *argv []) -{ - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - init_bonobo (argc, argv); - - session_init (); - - folder_browser_factory_init (); - - bonobo_main (); - - return 0; -} - - - - diff --git a/mail/main.h b/mail/main.h deleted file mode 100644 index 2cb17b5e10..0000000000 --- a/mail/main.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _MAIL_MAIN_H_ -#define _MAIL_MAIN_H_ - -void folder_browser_factory_init (void); - -#endif /* _MAIL_MAIN_H_ */ diff --git a/mail/message-list.c b/mail/message-list.c deleted file mode 100644 index db5ea0ea26..0000000000 --- a/mail/message-list.c +++ /dev/null @@ -1,687 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * message-list.c: Displays the messages. - * Implements CORBA's Evolution::MessageList - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * Bertrand Guiheneuf (bg@aful.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gnome.h> -#include <bonobo/bonobo-main.h> -#include "e-util/e-util.h" -#include "camel/camel-exception.h" -#include "camel/camel-folder-summary.h" -#include "message-list.h" -#include "Mail.h" -#include "widgets/e-table/e-table-header-item.h" -#include "widgets/e-table/e-table-item.h" - -/* - * Default sizes for the ETable display - * - */ -#define N_CHARS(x) (CHAR_WIDTH * (x)) - -#define COL_ICON_WIDTH 16 -#define COL_CHECK_BOX_WIDTH 16 -#define COL_FROM_WIDTH N_CHARS(24) -#define COL_FROM_WIDTH_MIN 32 -#define COL_SUBJECT_WIDTH N_CHARS(30) -#define COL_SUBJECT_WIDTH_MIN 32 -#define COL_SENT_WIDTH N_CHARS(20) -#define COL_SENT_WIDTH_MIN 32 -#define COL_RECEIVE_WIDTH N_CHARS(20) -#define COL_RECEIVE_WIDTH_MIN 32 -#define COL_TO_WIDTH N_CHARS(24) -#define COL_TO_WIDTH_MIN 32 -#define COL_SIZE_WIDTH N_CHARS(6) -#define COL_SIZE_WIDTH_MIN 32 - -#define PARENT_TYPE (bonobo_object_get_type ()) - -static BonoboObjectClass *message_list_parent_class; -static POA_Evolution_MessageList__vepv evolution_message_list_vepv; - -static void -on_row_selection_cmd (ETable *table, - int row, - gboolean selected, - gpointer user_data); - - - -/* select a message and display it */ -static void -select_msg (MessageList *message_list, gint row) -{ - CamelException ex; - CamelMimeMessage *message = NULL; - - camel_exception_init (&ex); - - if (camel_folder_has_uid_capability (message_list->folder)) { - GPtrArray *msg_info_array; - CamelMessageInfo *msg_info; - - msg_info_array = camel_folder_summary_get_message_info - (message_list->folder_summary, row, 1); - - if (msg_info_array) { - msg_info = msg_info_array->pdata[0]; - - message = camel_folder_get_message_by_uid (message_list->folder, - msg_info->uid, - &ex); - if (camel_exception_get_id (&ex)) { - printf ("Unable to get message: %s\n", - ex.desc?ex.desc:"unknown_reason"); - return; - } - } - - g_ptr_array_free (msg_info_array, TRUE); - - printf ("Message = %p\n", message); - if (message) - mail_display_set_message (message_list->parent_folder_browser->mail_display, - CAMEL_MEDIUM (message)); - } - -} - -/* - * SimpleTableModel::col_count - */ -static int -ml_col_count (ETableModel *etm, void *data) -{ - return COL_LAST; -} - -/* - * SimpleTableModel::row_count - */ -static int -ml_row_count (ETableModel *etm, void *data) -{ - MessageList *message_list = data; - CamelException ex; - int v; - - if (!message_list->folder) - return 0; - - camel_exception_init (&ex); - - v = camel_folder_get_message_count (message_list->folder, &ex); - if (camel_exception_get_id (&ex)) - v = 0; - - - /* in the case where no message is available, return 1 - * however, cause we want to be able to show a text */ - return (v ? v:1); - -} - -static void * -ml_value_at (ETableModel *etm, int col, int row, void *data) -{ - static char buffer [10]; - MessageList *message_list = data; - CamelFolderSummary *summary; - GPtrArray *msg_info_array; - CamelMessageInfo *msg_info; - CamelException ex; - void *retval = NULL; - - camel_exception_init (&ex); - - summary = message_list->folder_summary; - if (!summary) - goto nothing_to_see; - - - /* retrieve the message information array */ - msg_info_array = camel_folder_summary_get_message_info (summary, - row, 1); - - /* - * in the case where it is zero message long - * display nothing - */ - if (msg_info_array->len == 0) - goto nothing_to_see; - - msg_info = msg_info_array->pdata[0]; - - - switch (col){ - case COL_ONLINE_STATUS: - retval = GINT_TO_POINTER (0); - break; - - case COL_MESSAGE_STATUS: - retval = GINT_TO_POINTER (1); - break; - - case COL_PRIORITY: - retval = GINT_TO_POINTER (1); - break; - - case COL_ATTACHMENT: - retval = GINT_TO_POINTER (0); - break; - - case COL_FROM: - if (msg_info->sender) - retval = msg_info->sender; - else - retval = ""; - break; - - case COL_SUBJECT: - if (msg_info->subject) - retval = msg_info->subject; - else - retval = ""; - break; - - case COL_SENT: - retval = "sent"; - break; - - case COL_RECEIVE: - retval = "receive"; - break; - - case COL_TO: - retval = "dudes@server"; - break; - - case COL_SIZE: - sprintf (buffer, "%d", msg_info->size); - retval = buffer; - break; - - default: - g_assert_not_reached (); - } - - g_ptr_array_free (msg_info_array, TRUE); - return retval; - - - nothing_to_see : - /* - * in the case there is nothing to look at, - * notify the user. - */ - g_ptr_array_free (msg_info_array, TRUE); - if (col == COL_SUBJECT) - return "No item in this view"; - else - return NULL; -} - -static void -ml_set_value_at (ETableModel *etm, int col, int row, const void *value, void *data) -{ -} - -static gboolean -ml_is_cell_editable (ETableModel *etm, int col, int row, void *data) -{ - return FALSE; -} - -static void * -ml_duplicate_value (ETableModel *etm, int col, const void *value, void *data) -{ - switch (col){ - case COL_ONLINE_STATUS: - case COL_MESSAGE_STATUS: - case COL_PRIORITY: - case COL_ATTACHMENT: - return value; - - case COL_FROM: - case COL_SUBJECT: - case COL_SENT: - case COL_RECEIVE: - case COL_TO: - case COL_SIZE: - return g_strdup(value); - default: - g_assert_not_reached (); - } - return NULL; -} - -static void -ml_free_value (ETableModel *etm, int col, void *value, void *data) -{ - switch (col){ - case COL_ONLINE_STATUS: - case COL_MESSAGE_STATUS: - case COL_PRIORITY: - case COL_ATTACHMENT: - break; - - case COL_FROM: - case COL_SUBJECT: - case COL_SENT: - case COL_RECEIVE: - case COL_TO: - case COL_SIZE: - g_free(value); - break; - default: - g_assert_not_reached (); - } -} - -static void -ml_thaw (ETableModel *etm, void *data) -{ - e_table_model_changed(etm); -} - -static void -message_list_init_renderers (MessageList *message_list) -{ - gchar *attachment_path; - GdkPixbuf *image; - - g_assert (message_list); - g_assert (message_list->table_model); - - message_list->render_text = e_cell_text_new ( - message_list->table_model, - NULL, GTK_JUSTIFY_LEFT, FALSE); - - message_list->render_online_status = e_cell_checkbox_new (); - message_list->render_message_status = e_cell_checkbox_new (); -#if 1 - message_list->render_attachment = e_cell_checkbox_new (); -#else - /* - * if we want to use a pixmap, use this code - */ - attachment_path = gnome_unconditional_datadir_file ("evolution/e-attchmt.png"); - image = gdk_pixbuf_new_from_file (attachment_path); - message_list->render_attachment = e_cell_toggle_new (0, 1, &image); - g_free (attachment_path); -#endif - - /* - * FIXME: We need a real renderer here - */ - message_list->render_priority = e_cell_checkbox_new (); -} - -#define CHAR_WIDTH 10 -static void -message_list_init_header (MessageList *message_list) -{ - int i; - - /* - * FIXME: - * - * Use the font metric to compute this. - */ - - message_list->header_model = e_table_header_new (); - gtk_object_ref(GTK_OBJECT(message_list->header_model)); - gtk_object_sink(GTK_OBJECT(message_list->header_model)); - - message_list->table_cols [COL_ONLINE_STATUS] = - e_table_col_new (COL_ONLINE_STATUS, _("Online status"), - COL_CHECK_BOX_WIDTH, COL_CHECK_BOX_WIDTH, - message_list->render_online_status, - g_int_compare, FALSE); - - message_list->table_cols [COL_MESSAGE_STATUS] = - e_table_col_new (COL_MESSAGE_STATUS, _("Message status"), - COL_CHECK_BOX_WIDTH, COL_CHECK_BOX_WIDTH, - message_list->render_message_status, - g_int_compare, FALSE); - - message_list->table_cols [COL_PRIORITY] = - e_table_col_new (COL_PRIORITY, _("Priority"), - COL_CHECK_BOX_WIDTH, COL_CHECK_BOX_WIDTH, - message_list->render_priority, - g_int_compare, FALSE); - - message_list->table_cols [COL_ATTACHMENT] = - e_table_col_new (COL_ATTACHMENT, _("Attachment"), - COL_ICON_WIDTH, COL_ICON_WIDTH, - message_list->render_attachment, - g_int_compare, FALSE); - - message_list->table_cols [COL_FROM] = - e_table_col_new (COL_FROM, _("From"), - COL_FROM_WIDTH, COL_FROM_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - message_list->table_cols [COL_SUBJECT] = - e_table_col_new (COL_SUBJECT, _("Subject"), - COL_SUBJECT_WIDTH, COL_SUBJECT_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - message_list->table_cols [COL_SENT] = - e_table_col_new (COL_SENT, _("Sent"), - COL_SENT_WIDTH, COL_SENT_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - message_list->table_cols [COL_RECEIVE] = - e_table_col_new (COL_RECEIVE, _("Receive"), - COL_RECEIVE_WIDTH, COL_RECEIVE_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - message_list->table_cols [COL_TO] = - e_table_col_new (COL_TO, _("To"), - COL_TO_WIDTH, COL_TO_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - message_list->table_cols [COL_SIZE] = - e_table_col_new (COL_SIZE, _("Size"), - COL_SIZE_WIDTH, COL_SIZE_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - /* - * Dummy init: It setups the headers to match the order in which - * they are defined. In the future e-table widget will take care - * of this. - */ - for (i = 0; i < COL_LAST; i++) { - gtk_object_ref(GTK_OBJECT(message_list->table_cols [i])); - e_table_header_add_column (message_list->header_model, - message_list->table_cols [i], i); - } -} - - - - - -/* - * GtkObject::init - */ -static void -message_list_init (GtkObject *object) -{ - MessageList *message_list = MESSAGE_LIST (object); - - message_list->table_model = e_table_simple_new ( - ml_col_count, ml_row_count, ml_value_at, - ml_set_value_at, ml_is_cell_editable, ml_duplicate_value, ml_free_value, - ml_thaw, message_list); - - message_list_init_renderers (message_list); - message_list_init_header (message_list); - printf ("headers intialized\n"); - - /* - * The etable - */ - - message_list->etable = e_table_new (message_list->header_model, message_list->table_model, "<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> <column> 5 </column> <column> 6 </column> <column> 7 </column> <column> 8 </column> <column> 9 </column> </columns-shown> <grouping> <group column=\"4\" ascending=\"1\"> <leaf column=\"5\" ascending=\"1\"/> </group> </grouping> </ETableSpecification>"); - - gtk_signal_connect(GTK_OBJECT(message_list->etable), "row_selection", - GTK_SIGNAL_FUNC(on_row_selection_cmd), message_list); - - gtk_widget_show(message_list->etable); - - gtk_object_ref(message_list->table_model); - gtk_object_sink(message_list->table_model); - - /* - * We do own the Etable, not some widget container - */ - gtk_object_ref (GTK_OBJECT (message_list->etable)); - gtk_object_sink (GTK_OBJECT (message_list->etable)); -} - -static void -message_list_destroy (GtkObject *object) -{ - MessageList *message_list = MESSAGE_LIST (object); - int i; - - - gtk_object_unref (GTK_OBJECT (message_list->table_model)); - gtk_object_unref (GTK_OBJECT (message_list->header_model)); - - /* - * Renderers - */ - gtk_object_unref (GTK_OBJECT (message_list->render_text)); - gtk_object_unref (GTK_OBJECT (message_list->render_online_status)); - gtk_object_unref (GTK_OBJECT (message_list->render_message_status)); - gtk_object_unref (GTK_OBJECT (message_list->render_priority)); - gtk_object_unref (GTK_OBJECT (message_list->render_attachment)); - - gtk_object_unref (GTK_OBJECT (message_list->etable)); - - for (i = 0; i < COL_LAST; i++) - gtk_object_unref (GTK_OBJECT (message_list->table_cols [i])); - - GTK_OBJECT_CLASS (message_list_parent_class)->destroy (object); -} - -/* - * CORBA method: Evolution::MessageList::select_message - */ -static void -MessageList_select_message (PortableServer_Servant _servant, - const CORBA_long message_number, - CORBA_Environment *ev) -{ - printf ("FIXME: select message method\n"); -} - -/* - * CORBA method: Evolution::MessageList::open_message - */ -static void -MessageList_open_message (PortableServer_Servant _servant, - const CORBA_long message_number, - CORBA_Environment *ev) -{ - printf ("FIXME: open message method\n"); -} - -static POA_Evolution_MessageList__epv * -evolution_message_list_get_epv (void) -{ - POA_Evolution_MessageList__epv *epv; - - epv = g_new0 (POA_Evolution_MessageList__epv, 1); - - epv->select_message = MessageList_select_message; - epv->open_message = MessageList_open_message; - - return epv; -} - -static void -message_list_corba_class_init (void) -{ - evolution_message_list_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - evolution_message_list_vepv.Evolution_MessageList_epv = evolution_message_list_get_epv (); -} - -/* - * GtkObjectClass::init - */ -static void -message_list_class_init (GtkObjectClass *object_class) -{ - message_list_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = message_list_destroy; - - message_list_corba_class_init (); -} - -static void -message_list_construct (MessageList *message_list, Evolution_MessageList corba_message_list) -{ - bonobo_object_construct (BONOBO_OBJECT (message_list), corba_message_list); -} - -static Evolution_MessageList -create_corba_message_list (BonoboObject *object) -{ - POA_Evolution_MessageList *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_MessageList *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &evolution_message_list_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_MessageList__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION){ - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_MessageList) bonobo_object_activate_servant (object, servant); -} - -BonoboObject * -message_list_new (FolderBrowser *parent_folder_browser) -{ - Evolution_MessageList corba_object; - MessageList *message_list; - - g_assert (parent_folder_browser); - - message_list = gtk_type_new (message_list_get_type ()); - - corba_object = create_corba_message_list (BONOBO_OBJECT (message_list)); - if (corba_object == CORBA_OBJECT_NIL){ - gtk_object_destroy (GTK_OBJECT (message_list)); - return NULL; - } - - message_list->parent_folder_browser = parent_folder_browser; - - message_list_construct (message_list, corba_object); - - return BONOBO_OBJECT (message_list); -} - -void -message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) -{ - CamelException ex; - gboolean folder_exists; - - g_return_if_fail (message_list != NULL); - g_return_if_fail (camel_folder != NULL); - g_return_if_fail (IS_MESSAGE_LIST (message_list)); - g_return_if_fail (CAMEL_IS_FOLDER (camel_folder)); - g_return_if_fail (camel_folder_has_summary_capability (camel_folder)); - - - camel_exception_init (&ex); - - if (message_list->folder) - gtk_object_unref (GTK_OBJECT (message_list->folder)); - - message_list->folder = camel_folder; - - folder_exists = camel_folder_exists (camel_folder, NULL); - - if (camel_exception_get_id (&ex)) { - printf ("Unable to test for folder existence: %s\n", - ex.desc?ex.desc:"unknown reason"); - return; - } - - if (!folder_exists) { - g_warning ("Folder does not exist, creating it\n"); - /* - if you don't want the directory to be created - automatically here remove this. - */ - camel_folder_create (camel_folder, &ex); - if (camel_exception_get_id (&ex)) { - printf ("Unable to create folder: %s\n", - ex.desc?ex.desc:"unknown_reason"); - return; - } - - } - - - camel_folder_open (camel_folder, FOLDER_OPEN_RW, &ex); - if (camel_exception_get_id (&ex)) { - printf ("Unable to open folder: %s\n", - ex.desc?ex.desc:"unknown_reason"); - return; - } - - message_list->folder_summary = - camel_folder_get_summary (camel_folder, &ex); - - - if (camel_exception_get_id (&ex)) { - printf ("Unable to get summary: %s\n", - ex.desc?ex.desc:"unknown_reason"); - return; - } - - - - gtk_object_ref (GTK_OBJECT (camel_folder)); - - printf ("Modelo cambio!\n"); - e_table_model_changed (message_list->table_model); - - select_msg (message_list, 0); -} - -GtkWidget * -message_list_get_widget (MessageList *message_list) -{ - return message_list->etable; -} - -E_MAKE_TYPE (message_list, "MessageList", MessageList, message_list_class_init, message_list_init, PARENT_TYPE); - - - - -static void -on_row_selection_cmd (ETable *table, - int row, - gboolean selected, - gpointer user_data) -{ - MessageList *message_list; - - message_list = MESSAGE_LIST (user_data); - - if ( selected ) { - g_print ("Row %d selected\n", row); - select_msg (message_list, row); - } else { - g_print ("Row %d unselected\n", row); - } -} - diff --git a/mail/message-list.h b/mail/message-list.h deleted file mode 100644 index f045037313..0000000000 --- a/mail/message-list.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _MESSAGE_LIST_H_ -#define _MESSAGE_LIST_H_ - -#include "mail-types.h" -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-object.h> -#include "camel/camel-folder.h" -#include "e-table/e-table.h" -#include "e-table/e-table-simple.h" -#include "e-table/e-cell-text.h" -#include "e-table/e-cell-toggle.h" -#include "e-table/e-cell-checkbox.h" -#include "folder-browser.h" - - -#define MESSAGE_LIST_TYPE (message_list_get_type ()) -#define MESSAGE_LIST(o) (GTK_CHECK_CAST ((o), MESSAGE_LIST_TYPE, MessageList)) -#define MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MESSAGE_LIST_TYPE, MessageListClass)) -#define IS_MESSAGE_LIST(o) (GTK_CHECK_TYPE ((o), MESSAGE_LIST_TYPE)) -#define IS_MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MESSAGE_LIST_TYPE)) - -typedef struct _Renderer Renderer; - - -enum { - COL_ONLINE_STATUS, - COL_MESSAGE_STATUS, - COL_PRIORITY, - COL_ATTACHMENT, - COL_FROM, - COL_SUBJECT, - COL_SENT, - COL_RECEIVE, - COL_TO, - COL_SIZE, - - COL_LAST -}; - -struct _MessageList { - BonoboObject parent; - - /* the folder browser that contains the - * this message list */ - FolderBrowser *parent_folder_browser; - - ETableModel *table_model; - ETableHeader *header_model; - ETableCol *table_cols [COL_LAST]; - - ECell *render_text; - ECell *render_online_status; - ECell *render_message_status; - ECell *render_priority; - ECell *render_attachment; - - GtkWidget *etable; - - CamelFolder *folder; - CamelFolderSummary *folder_summary; - -} ; - -typedef struct { - BonoboObjectClass parent_class; -} MessageListClass; - -GtkType message_list_get_type (void); -BonoboObject *message_list_new (FolderBrowser *parent_folder_browser); -void message_list_set_folder (MessageList *message_list, - CamelFolder *camel_folder); -GtkWidget *message_list_get_widget (MessageList *message_list); - -#endif /* _MESSAGE_LIST_H_ */ diff --git a/mail/session.c b/mail/session.c deleted file mode 100644 index 1005d9cd4e..0000000000 --- a/mail/session.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * session.c: handles the session infomration and resource manipulation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 2000 Helix Code, Inc. http://www.helixcode.com - */ -#include <config.h> -#include <gnome.h> -#include "session.h" -#include "e-util/e-setup.h" -#include "camel/camel.h" - -SessionStore *default_session; - -static void -request_callback (gchar *string, gpointer data) -{ - char **ans = data; - - if (string) - *ans = g_strdup(string); - else - *ans = NULL; -} - -static char * -evolution_auth_callback (char *prompt, gboolean secret, - CamelService *service, char *item, - CamelException *ex) -{ - GtkWidget *dialog; - char *ans; - - /* XXX look up stored passwords */ - - /* XXX parent window? */ - dialog = gnome_request_dialog (secret, prompt, NULL, 0, - request_callback, &ans, NULL); - if (!dialog) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - "Could not create dialog box."); - return NULL; - } - if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == -1 || - ans == NULL) { - camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, - "User cancelled query."); - return NULL; - } - - return ans; -} - -static void -session_providers_init (void) -{ - camel_provider_register_as_module (CAMEL_PROVIDERDIR "/libcamelmbox.so"); -} - -SessionStore * -session_store_new (const char *uri) -{ - SessionStore *ss = g_new (SessionStore, 1); - CamelException ex; - - ss->session = camel_session_new (evolution_auth_callback); - camel_exception_init (&ex); - ss->store = camel_session_get_store (ss->session, uri, &ex); - - - g_assert (ss->session); - g_assert (ss->store); - - return ss; -} - -void -session_store_destroy (SessionStore *ss) -{ - g_assert (ss != NULL); - - gtk_object_unref (GTK_OBJECT (ss->store)); - gtk_object_unref (GTK_OBJECT (ss->session)); - - g_free (ss); -} - -static void -init_default_session (void) -{ - char *url; - - url = g_strconcat ("mbox://", evolution_folders_dir, NULL); - default_session = session_store_new (url); - g_free (url); -} - -void -session_init (void) -{ - e_setup_base_dir (); - camel_init (); - session_providers_init (); - - init_default_session (); -} - - diff --git a/mail/session.h b/mail/session.h deleted file mode 100644 index 8b870f0383..0000000000 --- a/mail/session.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef EVOLUTION_MAIL_SESSION_H -#define EVOLUTION_MAIL_SESSION_H - -#include <camel/camel-store.h> -#include <camel/camel-session.h> -typedef struct { - CamelSession *session; - CamelStore *store; -} SessionStore; - -SessionStore *session_store_new (const char *uri); -void session_store_destroy (SessionStore *ss); -void session_init (void); - -extern SessionStore *default_session; - -#endif /* EVOLUTION_MAIL_SESSION_H */ diff --git a/mail/test-mail.c b/mail/test-mail.c deleted file mode 100644 index 94102da1d3..0000000000 --- a/mail/test-mail.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Tests the mail summary display bonobo component - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include <gnome.h> -#include <bonobo.h> -#include <libgnorba/gnorba.h> - -static guint -create_container (void) -{ - GtkWidget *window, *control; - BonoboUIHandler *uih; - - gdk_rgb_init (); - - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize (GTK_WIDGET (window), 640, 480); - gtk_widget_show (GTK_WIDGET (window)); - - uih = bonobo_ui_handler_new (); - control = bonobo_widget_new_control ("control:evolution-mail", - bonobo_object_corba_objref (BONOBO_OBJECT (uih))); - - - if (control == NULL){ - printf ("Could not launch mail control\n"); - exit (1); - } - gtk_container_add (GTK_CONTAINER (window), control); - - gtk_widget_show (window); - gtk_widget_show (control); - - - return FALSE; -} - -int -main (int argc, char *argv []) -{ - CORBA_Environment ev; - CORBA_ORB orb; - - CORBA_exception_init (&ev); - - gnome_CORBA_init ("sample-control-container", "1.0", &argc, argv, 0, &ev); - - CORBA_exception_free (&ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) - g_error ("Could not initialize Bonobo\n"); - - - - gtk_idle_add ((GtkFunction) create_container, NULL); - - /* - * Main loop - */ - bonobo_main (); - - return 0; -} |