From c2ae364efc8192c1416660b38502995e934174c4 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Sat, 29 Jan 2000 12:29:44 +0000 Subject: More work. Not funny that e-table does not display. More work. Not funny that e-table does not display. Miguel. svn path=/trunk/; revision=1654 --- mail/Makefile.am | 13 +++++- mail/folder-browser-factory.c | 2 +- mail/folder-browser.c | 98 +++++++++++++++++++++++++++++++++++++------ mail/folder-browser.h | 12 +++++- mail/message-list.c | 87 +++++++++++++++++++++++++++++++++----- mail/message-list.h | 5 +++ 6 files changed, 189 insertions(+), 28 deletions(-) diff --git a/mail/Makefile.am b/mail/Makefile.am index 40ae196396..b5b4e38dc9 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = evolution-mail +bin_PROGRAMS = evolution-mail test-mail INCLUDES = \ -DEVOLUTION_VERSION=\""$(VERSION)"\" \ @@ -34,7 +34,16 @@ evolution_mail_LDADD = \ ../e-util/libeutil.a \ $(BONOBO_HTML_GNOME_LIBS) +test_mail_SOURCES = \ + test-mail.c + +test_mail_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 +EXTRA_DIST = Mail.idl evolution-mail.gnorba diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index ed4f8b580c..fd696395b8 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -55,7 +55,7 @@ folder_browser_factory_init (void) bonobo_folder_browser_factory = bonobo_generic_factory_new ( - "Evolution:FolderBrowser:1.0", + "GOADID:Evolution:FolderBrowserFactory:1.0", folder_browser_factory, NULL); if (bonobo_folder_browser_factory == NULL){ diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 880ae59a65..c74d49ced7 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -8,19 +8,28 @@ */ #include +#include +#include "e-util/e-util.h" #include "folder-browser.h" #define PARENT_TYPE (gtk_table_get_type ()) static GtkObjectClass *folder_browser_parent_class; -#define PROPERTY_FOLDER_URI "folder_uri" +#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->message_list) + bonobo_object_unref (BONOBO_OBJECT (folder_browser->message_list)); + folder_browser_parent_class->destroy (object); } @@ -37,10 +46,21 @@ folder_browser_class_init (GtkObjectClass *object_class) void folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri) { - g_free (folder_browser->uri); - folder_browser->uri = g_strudp (uri); + 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, @@ -54,33 +74,87 @@ folder_browser_property_changed (BonoboPropertyBag *properties, 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_init (GtkObject *object) +folder_browser_properties_init (FolderBrowser *fb) { - FolderBrowser *fb = FOLDER_BROWSER (object); - 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); + 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", - property_changed, fb); + 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); +#if 0 + gtk_paned_add2 (GTK_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display)); + gtk_widget_show (GTK_WIDGET (fb->mail_display)); + gtk_widget_show (GTK_WIDGET (fb)); +#endif +} + +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->mail_display = MAIL_DISPLAY (mail_display_new ()); + + 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 ()); - GtkTable *table = GTK_TABLE (folder_browser); - - table->homogeous = FALSE; - gtk_table_resize (table, 1, 2); + my_folder_browser_init (GTK_OBJECT (folder_browser)); + + printf ("Widget started\n"); return GTK_WIDGET (folder_browser); } diff --git a/mail/folder-browser.h b/mail/folder-browser.h index b329575445..2e6fb8d1a4 100644 --- a/mail/folder-browser.h +++ b/mail/folder-browser.h @@ -4,6 +4,8 @@ #include #include "camel/camel-stream.h" #include +#include "message-list.h" +#include "mail-display.h" #define FOLDER_BROWSER_TYPE (folder_browser_get_type ()) #define FOLDER_BROWSER(o) (GTK_CHECK_CAST ((o), FOLDER_BROWSER_TYPE, FolderBrowser)) @@ -19,8 +21,12 @@ typedef struct { /* * The current URI being displayed by the FolderBrowser */ - char *uri; - + char *uri; + MessageList *message_list; + GtkWidget *message_list_w; + MailDisplay *mail_display; + GtkWidget *vpaned; + gboolean preview_shown; } FolderBrowser; typedef struct { @@ -31,5 +37,7 @@ 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/message-list.c b/mail/message-list.c index 7b7683ced0..f2adb6b122 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -10,12 +10,6 @@ #include #include #include -#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 "e-util/e-util.h" #include "message-list.h" #include "Mail.h" @@ -62,6 +56,9 @@ ml_row_count (ETableModel *etm, void *data) { MessageList *message_list = data; CamelException ex; + + if (!message_list->folder) + return 0; return camel_folder_get_message_count (message_list->folder, &ex); } @@ -208,6 +205,77 @@ message_list_init_header (MessageList *message_list) g_str_equal, TRUE); } +static void +set_header_size (GnomeCanvas *canvas, GtkAllocation *alloc) +{ + printf ("Here\n"); + gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); +} + +static void +set_content_size (GnomeCanvas *canvas, GtkAllocation *alloc) +{ + printf ("Here2\n"); + gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); +} + +static GtkWidget * +make_etable (MessageList *message_list) +{ + GtkTable *t; + GtkWidget *header, *content; + + t = (GtkTable *) gtk_table_new (0, 0, 0); + gtk_widget_show (GTK_WIDGET (t)); + + gtk_widget_push_visual (gdk_rgb_get_visual ()); + gtk_widget_push_colormap (gdk_rgb_get_cmap ()); + + header = gnome_canvas_new (); + gtk_signal_connect (GTK_OBJECT (header), "size_allocate", + GTK_SIGNAL_FUNC (set_header_size), NULL); + gtk_widget_set_usize (header, 300, 20); + gtk_widget_show (header); + content = gnome_canvas_new (); + gtk_widget_set_usize (content, 300, 20); + gtk_signal_connect (GTK_OBJECT (content), "size_allocate", + GTK_SIGNAL_FUNC (set_content_size), NULL); + gtk_widget_show (content); + + gtk_widget_pop_colormap (); + gtk_widget_pop_visual (); + + gnome_canvas_item_new ( + gnome_canvas_root (GNOME_CANVAS (header)), + e_table_header_item_get_type (), + "ETableHeader", message_list->header_model, + "x", 0, + "y", 0, + NULL); + + gnome_canvas_item_new ( + gnome_canvas_root (GNOME_CANVAS (content)), + e_table_item_get_type (), + "ETableHeader", message_list->header_model, + "ETableModel", message_list->table_model, + "x", (double) 0, + "y", (double) 0, + "drawgrid", TRUE, + "drawfocus", TRUE, + "spreadsheet", TRUE, + NULL); + + gtk_table_attach (t, header, + 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); + + gtk_table_attach (t, content, + 0, 1, 1, 2, + GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); + + + return t; +} + /* * GtkObject::init */ @@ -226,11 +294,8 @@ message_list_init (GtkObject *object) /* * The etable */ - - message_list->etable = e_table_new ( - message_list->header_model, - message_list->table_model, - "1,2,3,4,5,6,7", NULL); + + message_list->etable = make_etable (message_list); /* * We do own the Etable, not some widget container diff --git a/mail/message-list.h b/mail/message-list.h index ee1233e922..40cc924e24 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -4,6 +4,11 @@ #include #include #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" #define MESSAGE_LIST_TYPE (message_list_get_type ()) #define MESSAGE_LIST(o) (GTK_CHECK_CAST ((o), MESSAGE_LIST_TYPE, MessageList)) -- cgit v1.2.3