aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/Makefile.am5
-rw-r--r--mail/component-factory.c13
-rw-r--r--mail/mail-summary.c62
-rw-r--r--mail/mail-summary.h36
5 files changed, 95 insertions, 30 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 382a488db4..ea8e01e1ea 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2000-10-25 Iain Holmes <iain@helixcode.com>
+
+ * mail-summary.[ch]: Updated for the new ExecutiveSummary code.
+
+ * Makefile.am: Added the summary files and the evolution-services CFLAGS
+ and LIB stuff.
+
+ * component-factory.c: Re-enabled the summary stuff.
+
2000-10-25 Dan Winship <danw@helixcode.com>
* main.c (main): Pass send/postpone signal handler functions to
diff --git a/mail/Makefile.am b/mail/Makefile.am
index b0680a10e3..28f0eb858c 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -12,6 +12,8 @@ INCLUDES = \
-I$(top_srcdir)/camel \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
+ -I$(top_builddir)/executive-summary \
+ -I$(top_srcdir)/executive-summary \
$(EXTRA_GNOME_CFLAGS) \
$(BONOBO_HTML_GNOME_CFLAGS) \
$(GNOME_VFS_CFLAGS) \
@@ -67,6 +69,8 @@ evolution_mail_SOURCES = \
mail-ops.h \
mail-search-dialogue.c \
mail-search-dialogue.h \
+ mail-summary.c \
+ mail-summary.h \
mail-threads.c \
mail-threads.h \
mail-tools.c \
@@ -95,6 +99,7 @@ evolution_mail_LDADD = \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/libibex/libibex.la \
$(top_builddir)/filter/libfilter.la \
+ $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
$(BONOBO_VFS_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
$(GTKHTML_LIBS) \
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 2bf099a2f2..c1b09fed5e 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -43,10 +43,8 @@
#include "component-factory.h"
-#ifdef WANT_THE_EXECUTIVE_SUMMARY
#include <executive-summary/evolution-services/executive-summary-component.h>
#include "mail-summary.h"
-#endif
CamelFolder *drafts_folder = NULL;
CamelFolder *outbox_folder = NULL;
@@ -182,17 +180,15 @@ factory_destroy (BonoboEmbeddable *embeddable,
gtk_main_quit ();
}
-#ifdef WANT_THE_EXECUTIVE_SUMMARY
static BonoboObject *
summary_fn (BonoboGenericFactory *factory, void *closure)
{
ExecutiveSummaryComponent *summary_component;
- summary_component = executive_summary_component_new (
- NULL, create_summary_view, NULL, NULL);
+ summary_component = executive_summary_component_new (create_summary_view,
+ NULL, NULL);
return BONOBO_OBJECT (summary_component);
}
-#endif
static BonoboObject *
factory_fn (BonoboGenericFactory *factory, void *closure)
@@ -225,9 +221,7 @@ component_factory_init (void)
return;
factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL);
-#ifdef WANT_THE_EXECUTIVE_SUMMARY
summary_factory = bonobo_generic_factory_new (SUMMARY_FACTORY_ID, summary_fn, NULL);
-#endif
storages_hash = g_hash_table_new (g_str_hash, g_str_equal);
@@ -237,12 +231,11 @@ component_factory_init (void)
exit (1);
}
-#ifdef WANT_THE_EXECUTIVE_SUMMARY
if (summary_factory == NULL) {
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize Evolution's mail summary component."));
}
-#endif
+
if (storages_hash == NULL) {
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize Evolution's mail storage hash."));
diff --git a/mail/mail-summary.c b/mail/mail-summary.c
index 7fb59c5fd3..560fba8a05 100644
--- a/mail/mail-summary.c
+++ b/mail/mail-summary.c
@@ -29,7 +29,7 @@
#include "camel.h"
#include <gnome.h>
-#include "mail.h" /* YUCK FIXME */
+#include "mail.h"
#include "mail-tools.h"
#include "mail-ops.h"
#include "mail-vfolder.h"
@@ -41,7 +41,8 @@
#include "filter/vfolder-context.h"
-#include <executive-summary/evolution-services/executive-summary-component.h>
+#include <evolution-services/executive-summary-component.h>
+#include <evolution-services/executive-summary-component-view.h>
typedef struct {
CamelFolder *folder;
@@ -52,12 +53,11 @@ typedef struct {
typedef struct {
ExecutiveSummaryComponent *component;
+ ExecutiveSummaryComponentView *view;
GHashTable *folder_to_summary;
FolderSummary **folders;
int numfolders;
-
- char *html;
} MailSummary;
#define SUMMARY_IN() g_print ("IN: %s: %d\n", __FUNCTION__, __LINE__);
@@ -125,6 +125,33 @@ check_compipes (void)
}
}
+static void
+folder_free (FolderSummary *folder)
+{
+ g_free (folder->name);
+}
+
+static void
+summary_free (MailSummary *summary)
+{
+ int i;
+
+ for (i = 0; i < summary->numfolders; i++){
+ folder_free (summary->folders[i]);
+ }
+
+ g_free (summary->folders);
+ g_hash_table_destroy (summary->folder_to_summary);
+}
+
+static void
+view_destroy_cb (GtkObject *object,
+ MailSummary *summary)
+{
+ summary_free (summary);
+ g_free (summary);
+}
+
static char *
generate_html_summary (MailSummary *summary)
{
@@ -167,7 +194,7 @@ do_changed (MailSummary *summary)
char *ret_html;
ret_html = generate_html_summary (summary);
- executive_summary_component_update (summary->component, ret_html);
+ executive_summary_component_view_set_html(summary->view, ret_html);
g_free (ret_html);
}
@@ -252,7 +279,7 @@ generate_folder_summarys (MailSummary *summary)
g_free (system);
rule = NULL;
- while ((rule = rule_context_next_rule ((RuleContext *)context, rule))){
+ while ((rule = rule_context_next_rule ((RuleContext *)context, rule, NULL))){
g_print ("rule->name: %s\n", rule->name);
numfolders++;
}
@@ -285,7 +312,7 @@ generate_folder_summarys (MailSummary *summary)
ex = camel_exception_new ();
fs = summary->folders[i] = g_new (FolderSummary, 1);
- rule = rule_context_next_rule ((RuleContext *)context, rule);
+ rule = rule_context_next_rule ((RuleContext *)context, rule, NULL);
fs->name = g_strdup (rule->name);
uri = g_strconcat ("vfolder:", rule->name, NULL);
@@ -315,28 +342,29 @@ generate_folder_summarys (MailSummary *summary)
gtk_object_destroy (GTK_OBJECT (context));
}
-char *
+void
create_summary_view (ExecutiveSummaryComponent *component,
- char **title,
- char **icon,
+ ExecutiveSummaryComponentView *view,
void *closure)
{
- char *ret_html;
+ char *html;
MailSummary *summary;
- /* Strdup the title and icon */
- *title = g_strdup ("Mailbox summary");
- *icon = g_strdup ("envelope.png");
-
summary = g_new (MailSummary, 1);
summary->component = component;
summary->folder_to_summary = g_hash_table_new (NULL, NULL);
+ summary->view = view;
generate_folder_summarys (summary);
- ret_html = generate_html_summary (summary);
+ html = generate_html_summary (summary);
check_compipes ();
- return ret_html;
+ executive_summary_component_view_construct (view, component, NULL, html,
+ _("Mailbox summary"),
+ "envelope.png");
+ gtk_signal_connect (GTK_OBJECT (view), "destroy",
+ GTK_SIGNAL_FUNC (view_destroy_cb), summary);
+ g_free (html);
}
diff --git a/mail/mail-summary.h b/mail/mail-summary.h
index 52c64cfb52..f9f72d9cc7 100644
--- a/mail/mail-summary.h
+++ b/mail/mail-summary.h
@@ -1,3 +1,33 @@
-char * create_summary_view (ExecutiveSummaryComponent *component,
- char **title,
- void *closure);
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* mail-summary.h
+ *
+ * Authors: Iain Holmes <iain@helixcode.com>
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * 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_SUMMARY_H__
+#define __MAIL_SUMMARY_H__
+
+#include <evolution-services/executive-summary-component-view.h>
+
+void create_summary_view (ExecutiveSummaryComponent *component,
+ ExecutiveSummaryComponentView *view,
+ void *closure);
+
+#endif