diff options
author | Arturo Espinosa <unammx@src.gnome.org> | 2000-01-25 16:43:24 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 2000-01-25 16:43:24 +0800 |
commit | 670f57583d84d4c8f0195d3eefbef93920c6e9d9 (patch) | |
tree | 5a99fdf111ee22bd689c42b3f0c36c22a44a41fc /mail | |
parent | ed7345eec736a39e3e37a4e76a0bdba7157270b7 (diff) | |
download | gsoc2013-evolution-670f57583d84d4c8f0195d3eefbef93920c6e9d9.tar gsoc2013-evolution-670f57583d84d4c8f0195d3eefbef93920c6e9d9.tar.gz gsoc2013-evolution-670f57583d84d4c8f0195d3eefbef93920c6e9d9.tar.bz2 gsoc2013-evolution-670f57583d84d4c8f0195d3eefbef93920c6e9d9.tar.lz gsoc2013-evolution-670f57583d84d4c8f0195d3eefbef93920c6e9d9.tar.xz gsoc2013-evolution-670f57583d84d4c8f0195d3eefbef93920c6e9d9.tar.zst gsoc2013-evolution-670f57583d84d4c8f0195d3eefbef93920c6e9d9.zip |
More work
svn path=/trunk/; revision=1628
Diffstat (limited to 'mail')
-rw-r--r-- | mail/Mail.idl | 30 | ||||
-rw-r--r-- | mail/Makefile.am | 16 | ||||
-rw-r--r-- | mail/folder-browser.c | 90 | ||||
-rw-r--r-- | mail/folder-browser.h | 31 | ||||
-rw-r--r-- | mail/mail-component.c | 48 | ||||
-rw-r--r-- | mail/mail-display.c | 68 | ||||
-rw-r--r-- | mail/mail-display.h | 7 | ||||
-rw-r--r-- | mail/main.c | 41 | ||||
-rw-r--r-- | mail/message-list.c | 394 | ||||
-rw-r--r-- | mail/message-list.h | 60 |
10 files changed, 780 insertions, 5 deletions
diff --git a/mail/Mail.idl b/mail/Mail.idl new file mode 100644 index 0000000000..74c6ba74d4 --- /dev/null +++ b/mail/Mail.idl @@ -0,0 +1,30 @@ +/* + * 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 : GNOME::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 : GNOME::Unknown { + MessageList get_message_list (); + }; +}; + diff --git a/mail/Makefile.am b/mail/Makefile.am index 5b286d2907..d53afb67b0 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -8,13 +8,27 @@ INCLUDES = \ -I$(srcdir)/../widgets \ $(BONOBO_GNOME_CFLAGS) +EVOLUTION_CORBA_GENERATED = \ + Mail.h \ + Mail-common.c \ + Mail-skels.c \ + Mail-stubs.c + evolution_mail_SOURCES = \ html-stream.c \ html-stream.h \ mail-display.h \ mail-display.c \ - main.c + main.c \ + message-list.c \ + message-list.h \ + $(EVOLUTION_CORBA_GENERATED) evolution_mail_LDADD = \ ../e-util/libeutil.a \ $(BONOBO_GNOME_LIBS) + +$(EVOLUTION_MAIL_CORBA_GENERATED): Mail.idl + orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Mail.idl + +EXTRA_DIST = Mail.idl diff --git a/mail/folder-browser.c b/mail/folder-browser.c new file mode 100644 index 0000000000..63cf7566fb --- /dev/null +++ b/mail/folder-browser.c @@ -0,0 +1,90 @@ +/* + * folder-browser.c: Folder browser top level component + * + * Author: + * Miguel de Icaza (miguel@kernel.org) + * + * (C) 2000 Helix Code, Inc. + */ + +#include <config.h> +#include "folder-browser.h" + +#define PARENT_TYPE (gtk_table_get_type ()) + +static GtkObjectClass *folder_browser_parent_class; + +#define PROPERTY_FOLDER_URI "folder_uri" + +static void +folder_browser_destroy (GtkObject *object) +{ + FolderBrowser *folder_browser = FOLDER_BROWSER (object); + + 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); +} + +#define EQUAL(a,b) (strcmp (a,b) == 0) + +void +folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri) +{ + g_free (folder_browser->uri); + folder_browser->uri = g_strudp (uri); +} + +static void +folder_browser_property_changed (GnomePropertyBag *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; + } +} + +static void +folder_browser_init (GtkObject *object) +{ + FolderBrowser *fb = FOLDER_BROWSER (object); + + fb->properties = gnome_property_bag_new (); + + gnome_property_bag_add ( + fb->properties, PROPERTY_FOLDER_URI, "string", + NULL, NULL, _("The URI that the Folder Browser will display", 0); + + gtk_signal_connect (GTK_OBJECT (fb->properties), "value_changed", + property_changed, fb); +} + +GtkWidget * +folder_browser_new (void) +{ + FolderBrowser *folder_browser = gtk_type_new (folder_browser_get_type ()); + GtkTable *table = GTK_TABLE (folder_browser); + + table->homogeous = FALSE; + gtk_table_resize (table, 1, 2); + + 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 new file mode 100644 index 0000000000..a81585e3ab --- /dev/null +++ b/mail/folder-browser.h @@ -0,0 +1,31 @@ +#ifndef _FOLDER_BROWSER_H_ +#define _FOLDER_BROWSER_H_ + +#include <gtk/gtktable.h> +#include "camel/camel-stream.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)) + +typedef struct { + GtkTable parent; + + GnomePropertyBag *properties; + + /* + * The current URI being displayed by the FolderBrowser + */ + char *uri; +} FolderBrowser; + +typedef struct { + GtkTableClass parent_class; +} FolderBrowserClass; + +GtkType folder_browser_get_type (void); +GtkWidget *folder_browser_new (void); + +#endif /* _FOLDER_BROWSER_H_ */ diff --git a/mail/mail-component.c b/mail/mail-component.c new file mode 100644 index 0000000000..764be4be38 --- /dev/null +++ b/mail/mail-component.c @@ -0,0 +1,48 @@ +/* + * 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/gnome-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 new file mode 100644 index 0000000000..2e3ac52fd2 --- /dev/null +++ b/mail/mail-display.c @@ -0,0 +1,68 @@ +/* + * mail-display.c: Mail display widget + * + * Author: + * Miguel de Icaza + * + * (C) 2000 Helix Code, Inc. + */ +#include <config.h> +#include <gnome.h> +#include "e-util/e-util.h" +#include "mail-display.h" + +#define PARENT_TYPE (gtk_table_get_type ()) + +static GtkObjectClass *mail_display_parent_class; + +static void +mail_display_init (GtkObject *object) +{ + MailDisplay *mail_display = MAIL_DISPLAY (object); + + mail_display->html = gtk_html_new (); + gtk_widget_show (mail_display->html); +} + +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 (void) +{ + MailDisplay *mail_display = gtk_type_new (mail_display_get_type ()); + GtkTable *table = GTK_TABLE (mail_display); + + table->homogeous = FALSE; + gtk_table_resize (table, 1, 2); + + gtk_table_attach (table, mail_display->html, + 0, 1, 1, 2, + GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL); + return GTK_WIDGET (mail_display); +} + +CamelStream * +mail_display_get_stream (MailDisplay *mail_display) +{ + g_return_val_if_fail (mail_display != NULL, NULL); + g_return_val_if_fail (IS_MAIL_DISPLAY (mail_display), NULL); + + return html_stream_new (mail_display->html); +} + +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 index 43d685142b..212592e620 100644 --- a/mail/mail-display.h +++ b/mail/mail-display.h @@ -2,6 +2,7 @@ #define _MAIL_DISPLAY_H_ #include <gtk/gtktable.h> +#include "camel/camel-stream.h" #define MAIL_DISPLAY_TYPE (mail_display_get_type ()) #define MAIL_DISPLAY(o) (GTK_CHECK_CAST ((o), MAIL_DISPLAY_TYPE, MailDisplay)) @@ -19,5 +20,9 @@ typedef struct { GtkTableClass parent_class; } MailDisplayClass; -GtkType mail_display_get_type (void); +GtkType mail_display_get_type (void); +GtkWidget *mail_display_new (void); + +CamelStream *mail_display_get_stream (MailDisplay *display); + #endif /* _MAIL_DISPLAY_H_ */ diff --git a/mail/main.c b/mail/main.c index b6b0f2e1bc..c8ab65b7a4 100644 --- a/mail/main.c +++ b/mail/main.c @@ -1,14 +1,49 @@ /* - * main.c: Evolution mail reading component + * mail-component.c: The core of the mail component * - * Authors: + * Author: * Miguel de Icaza (miguel@helixcode.com) * * (C) 2000 Helix Code, Inc. */ #include <config.h> #include <gnome.h> +#include <bonobo/gnome-main.h> +#include "e-util/e-gui-utils.h" +#include "main.h" -main () +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_folder_browser_factory_init (); + + bonobo_main (); + + return 0; } diff --git a/mail/message-list.c b/mail/message-list.c new file mode 100644 index 0000000000..07959d818e --- /dev/null +++ b/mail/message-list.c @@ -0,0 +1,394 @@ +/* + * message-list.c: Displays the messages. + * Implements CORBA's Evolution::MessageList + * + * Author: + * Miguel de Icaza (miguel@helixcode.com) + * + * (C) 2000 Helix Code, Inc. + */ +#include <config.h> +#include <gnome.h> +#include <bonobo/gnome-main.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 "message-list.h" +#include "Mail.h" + +/* + * Default sizes for the ETable display + * + */ +#define N_CHARS(x) (CHAR_WIDTH * (x)) + +#define COL_ICON_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 (gnome_object_get_type ()) + +static GnomeObjectClass *message_list_parent_class; +static POA_Evolution_MessageList__vepv evolution_message_list_vepv; + +/* + * 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; + + return camel_folder_get_message_count (message_list->folder, &ex); +} + +static void * +ml_value_at (ETableModel *etm, int col, int row, void *data) +{ + static char buffer [10]; + + switch (col){ + case COL_ONLINE_STATUS: + return GINT_TO_POINTER (0); + + case COL_MESSAGE_STATUS: + return GINT_TO_POINTER (1); + + case COL_PRIORITY: + return GINT_TO_POINTER (10); + + case COL_ATTACHMENT: + return GINT_TO_POINTER (0); + + case COL_FROM: + return "miguel@dudical.com"; + + case COL_SUBJECT: + return "MONEY FAST!"; + + case COL_SENT: + return "sent"; + + case COL_RECEIVE: + return "receive"; + + case COL_TO: + return "dudes@server"; + + case COL_SIZE: + sprintf (buffer, "%d", 20); + return buffer; + + default: + g_assert_not_reached (); + } + 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 +message_list_init_renderers (MessageList *message_list) +{ + 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); + + message_list->render_online_status = e_cell_checkbox_new (); + message_list->render_message_status = e_cell_checkbox_new (); + message_list->render_priority = e_cell_checkbox_new (); + message_list->render_attachment = e_cell_checkbox_new (); +} + +static void +message_list_init_header (MessageList *message_list) +{ + /* + * FIXME: + * + * Use the font metric to compute this. + */ +#define CHAR_WIDTH 10 + + message_list->header_model = e_table_header_new (); + + message_list->table_cols [COL_ONLINE_STATUS] = + e_table_col_new (COL_ONLINE_STATUS, _("Online status"), + COL_ICON_WIDTH, COL_ICON_WIDTH, + message_list->render_online_status, + g_int_equal, FALSE); + + message_list->table_cols [COL_MESSAGE_STATUS] = + e_table_col_new (COL_MESSAGE_STATUS, _("Message status"), + COL_ICON_WIDTH, COL_ICON_WIDTH, + message_list->render_message_status, + g_int_equal, FALSE); + + message_list->table_cols [COL_PRIORITY] = + e_table_col_new (COL_PRIORITY, _("Priority"), + COL_ICON_WIDTH, COL_ICON_WIDTH, + message_list->render_priority, + g_int_equal, 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_equal, 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_equal, 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_equal, TRUE); + + message_list->table_cols [COL_SENT] = + e_table_col_new (COL_SENT, _("Sent"), + COL_SUBJECT_WIDTH, COL_SENT_WIDTH_MIN, + message_list->render_text, + g_str_equal, TRUE); + + message_list->table_cols [COL_RECEIVE] = + e_table_col_new (COL_SENT, _("Receive"), + COL_RECEIVE_WIDTH, COL_RECEIVE_WIDTH_MIN, + message_list->render_text, + g_str_equal, 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_equal, 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_equal, TRUE); +} + +/* + * 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, message_list); + + message_list_init_renderers (message_list); + message_list_init_header (message_list); + + /* + * The etable + */ + + message_list->etable = e_table_new ( + message_list->header_model, + message_list->table_model, + "1,2,3,4,5,6,7", NULL); + + /* + * 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.GNOME_Unknown_epv = gnome_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) +{ + gnome_object_construct (GNOME_OBJECT (message_list), corba_message_list); +} + +static Evolution_MessageList +create_corba_message_list (GnomeObject *object) +{ + POA_Evolution_MessageList *servant; + CORBA_Environment ev; + + servant = (POA_Evolution_MessageList *) g_new0 (GnomeObjectServant, 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) gnome_object_activate_servant (object, servant); +} + +GnomeObject * +message_list_new (void) +{ + Evolution_MessageList corba_object; + MessageList *message_list; + + message_list = gtk_type_new (message_list_get_type ()); + + corba_object = create_corba_message_list (GNOME_OBJECT (message_list)); + if (corba_object == CORBA_OBJECT_NIL){ + gtk_object_destroy (GTK_OBJECT (message_list)); + return NULL; + } + + message_list_construct (message_list, corba_object); + + return GNOME_OBJECT (message_list); +} + +void +message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) +{ + 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_has_summary_capability (camel_folder)); + + if (message_list->folder) + gtk_object_unref (GTK_OBJECT (message_list->folder)); + + message_list->folder = camel_folder; + message_list->folder_summary = camel_folder_get_summary (camel_folder); + + gtk_object_ref (GTK_OBJECT (camel_folder)); + + e_table_model_changed (message_list->table_model); +} + +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); diff --git a/mail/message-list.h b/mail/message-list.h new file mode 100644 index 0000000000..44ba575a51 --- /dev/null +++ b/mail/message-list.h @@ -0,0 +1,60 @@ +#ifndef _MESSAGE_LIST_H_ +#define _MESSAGE_LIST_H_ + +#include <bonobo/gnome-main.h> +#include <bonobo/gnome-object.h> +#include "camel/camel-folder.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 +}; + +typedef struct { + GnomeObject parent; + + 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; +} MessageList; + +typedef struct { + GnomeObjectClass parent_class; +} MessageListClass; + +GtkType message_list_get_type (void); +GnomeObject *message_list_new (void); +void message_list_set_folder (MessageList *message_list, + CamelFolder *camel_folder); +GtkWidget *message_list_get_widget (MessageList *message_list); + +#endif /* _MESSAGE_LIST_H_ */ |