From f69d5ec14310f4903a8b88224f7c82cfa1de014a Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Wed, 22 Nov 2000 00:34:39 +0000 Subject: Big patch. Evolution-services rewrite, services updated for new system, Big patch. Evolution-services rewrite, services updated for new system, Fixes to Executive Summary and other things. See some changelogs svn path=/trunk/; revision=6644 --- mail/ChangeLog | 14 +++++++ mail/GNOME_Evolution_Mail.oaf.in | 4 +- mail/GNOME_Evolution_Mail.oafinfo | 4 +- mail/component-factory.c | 25 ++++++------ mail/evolution-mail.oafinfo | 4 +- mail/mail-config-gui.c | 3 -- mail/mail-display.c | 1 + mail/mail-summary.c | 82 ++++++++++++++++++++++++++++++++------- 8 files changed, 103 insertions(+), 34 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 8d36c02498..e4959004ba 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +2000-11-21 Iain Holmes + + * mail-config-gui.c (mail_config): Don't use the "delete-event" + signal. + +2000-11-21 Iain Holmes + + * mail-display.c (pixbuf_for_mime_type): free fm_icon. + + * component-factory (summary_fn): Remove the configure param. + (factory_destroy): Made into a generic function so that the + summary_factory can be ref-counted as well as the normal + factory. + 2000-11-21 Dan Winship * Makefile.am: add GPGME_CFLAGS and GPGME_LIBS diff --git a/mail/GNOME_Evolution_Mail.oaf.in b/mail/GNOME_Evolution_Mail.oaf.in index b187ffc121..eba585cca8 100644 --- a/mail/GNOME_Evolution_Mail.oaf.in +++ b/mail/GNOME_Evolution_Mail.oaf.in @@ -58,7 +58,7 @@ location="evolution-mail"> - + - + - + - + #include "mail-summary.h" CamelFolder *drafts_folder = NULL; @@ -161,17 +160,17 @@ free_storage (gpointer service, gpointer storage, gpointer data) static void factory_destroy (BonoboEmbeddable *embeddable, - gpointer dummy) + BonoboObject *destroy_factory) { running_objects--; if (running_objects > 0) return; - if (factory) - bonobo_object_unref (BONOBO_OBJECT (factory)); + if (destroy_factory) + bonobo_object_unref (BONOBO_OBJECT (destroy_factory)); else g_warning ("Serious ref counting error"); - factory = NULL; + destroy_factory = NULL; g_hash_table_foreach (storages_hash, free_storage, NULL); g_hash_table_destroy (storages_hash); @@ -183,11 +182,16 @@ factory_destroy (BonoboEmbeddable *embeddable, static BonoboObject * summary_fn (BonoboGenericFactory *factory, void *closure) { - ExecutiveSummaryComponent *summary_component; + BonoboObject *summary_component_factory; - summary_component = executive_summary_component_new (create_summary_view, - NULL, NULL); - return BONOBO_OBJECT (summary_component); + running_objects++; + + summary_component_factory = executive_summary_component_factory_new (create_summary_view, + NULL); + gtk_signal_connect (GTK_OBJECT (summary_component_factory), "destroy", + GTK_SIGNAL_FUNC (factory_destroy), summary_factory); + + return summary_component_factory; } static BonoboObject * @@ -205,7 +209,7 @@ factory_fn (BonoboGenericFactory *factory, void *closure) NULL); gtk_signal_connect (GTK_OBJECT (shell_component), "destroy", - GTK_SIGNAL_FUNC (factory_destroy), NULL); + GTK_SIGNAL_FUNC (factory_destroy), factory); gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", GTK_SIGNAL_FUNC (owner_set_cb), NULL); gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset", @@ -222,7 +226,6 @@ component_factory_init (void) factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL); summary_factory = bonobo_generic_factory_new (SUMMARY_FACTORY_ID, summary_fn, NULL); - storages_hash = g_hash_table_new (NULL, NULL); if (factory == NULL) { diff --git a/mail/evolution-mail.oafinfo b/mail/evolution-mail.oafinfo index b187ffc121..eba585cca8 100644 --- a/mail/evolution-mail.oafinfo +++ b/mail/evolution-mail.oafinfo @@ -58,7 +58,7 @@ location="evolution-mail"> - + - + dialog), "destroy", GTK_SIGNAL_FUNC (mail_config_close), dialog); - gtk_signal_connect (GTK_OBJECT (dialog->dialog), "delete_event", - GTK_SIGNAL_FUNC (mail_config_close), - dialog); gtk_widget_show (dialog->dialog); } diff --git a/mail/mail-display.c b/mail/mail-display.c index 2934500f63..334933e03d 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -365,6 +365,7 @@ pixbuf_for_mime_type (const char *mime_type) fm_icon = g_strdup_printf ("mc/%s", icon_name); filename = gnome_pixmap_file (fm_icon); } + g_free (fm_icon); } } diff --git a/mail/mail-summary.c b/mail/mail-summary.c index 34f9af55ab..cfbeea9ad5 100644 --- a/mail/mail-summary.c +++ b/mail/mail-summary.c @@ -26,6 +26,7 @@ #endif #include +#include #include "camel.h" #include @@ -40,7 +41,7 @@ #include "filter/vfolder-context.h" #include -#include +#include typedef struct { CamelFolder *folder; @@ -51,12 +52,15 @@ typedef struct { } FolderSummary; typedef struct { - ExecutiveSummaryComponent *component; - ExecutiveSummaryComponentView *view; + BonoboObject *component; + BonoboObject *view; GHashTable *folder_to_summary; FolderSummary **folders; int numfolders; + + char *title; + char *icon; } MailSummary; #define SUMMARY_IN() g_print ("IN: %s: %d\n", __FUNCTION__, __LINE__); @@ -78,6 +82,11 @@ GIOChannel *summary_chan_reader = NULL; static void do_changed (MailSummary *summary); +enum { + PROPERTY_TITLE, + PROPERTY_ICON +}; + /* Read a message from the pipe */ static gboolean read_msg (GIOChannel *source, @@ -141,7 +150,12 @@ summary_free (MailSummary *summary) } g_free (summary->folders); + g_free (summary->title); + g_free (summary->icon); + g_hash_table_destroy (summary->folder_to_summary); + bonobo_object_unref (summary->view); + bonobo_object_unref (summary->component); } static void @@ -194,7 +208,7 @@ do_changed (MailSummary *summary) char *ret_html; ret_html = generate_html_summary (summary); - executive_summary_component_view_set_html(summary->view, ret_html); + executive_summary_html_view_set_html(summary->view, (const char *) ret_html); g_free (ret_html); } @@ -345,18 +359,40 @@ generate_folder_summaries (MailSummary *summary) gtk_object_destroy (GTK_OBJECT (context)); } -void -create_summary_view (ExecutiveSummaryComponent *component, - ExecutiveSummaryComponentView *view, +static void +get_property (BonoboPropertyBag *bag, + BonoboArg *arg, + guint arg_id, + gpointer user_data) +{ + MailSummary *summary = (MailSummary *) user_data; + + switch (arg_id) { + case PROPERTY_TITLE: + BONOBO_ARG_SET_STRING (arg, summary->title); + break; + + case PROPERTY_ICON: + BONOBO_ARG_SET_STRING (arg, summary->icon); + break; + + default: + break; + } +} + +BonoboObject * +create_summary_view (ExecutiveSummaryComponentFactory *_factory, void *closure) { + BonoboObject *component, *view, *bag; char *html; MailSummary *summary; summary = g_new (MailSummary, 1); - summary->component = component; summary->folder_to_summary = g_hash_table_new (NULL, NULL); - summary->view = view; + summary->title = g_strdup ("Mail Summary"); + summary->icon = g_strdup ("envelope.png"); generate_folder_summaries (summary); @@ -364,10 +400,28 @@ create_summary_view (ExecutiveSummaryComponent *component, check_compipes (); - 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); + component = executive_summary_component_new (); + summary->component = component; + + view = executive_summary_html_view_new (); + executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (view), + html); + bonobo_object_add_interface (component, view); + summary->view = view; + + bag = bonobo_property_bag_new (get_property, NULL, summary); + bonobo_property_bag_add (BONOBO_PROPERTY_BAG (bag), + "window_title", PROPERTY_TITLE, + BONOBO_ARG_STRING, NULL, + "The title of this component's window", + BONOBO_PROPERTY_READABLE); + bonobo_property_bag_add (BONOBO_PROPERTY_BAG (bag), + "window_icon", PROPERTY_ICON, + BONOBO_ARG_STRING, NULL, + "The icon for this component's window", + BONOBO_PROPERTY_READABLE); + bonobo_object_add_interface (component, bag); g_free (html); + + return component; } -- cgit