aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--my-evolution/ChangeLog32
-rw-r--r--my-evolution/Makefile.am2
-rw-r--r--my-evolution/component-factory.c14
-rw-r--r--my-evolution/e-summary-factory.c5
-rw-r--r--my-evolution/e-summary-factory.h5
-rw-r--r--my-evolution/e-summary-offline-handler.c219
-rw-r--r--my-evolution/e-summary-offline-handler.h55
-rw-r--r--my-evolution/e-summary-rdf.c101
-rw-r--r--my-evolution/e-summary-weather.c104
-rw-r--r--my-evolution/e-summary.c71
-rw-r--r--my-evolution/e-summary.h35
11 files changed, 636 insertions, 7 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog
index 8935cd8a09..9bffe15343 100644
--- a/my-evolution/ChangeLog
+++ b/my-evolution/ChangeLog
@@ -1,3 +1,35 @@
+2001-06-30 Iain Holmes <iain@ximian.com>
+
+ * e-summary-rdf.c (tree_walk): Remove spewage.
+ (e_summary_rdf_count):
+ (e_summary_rdf_add):
+ (make_connection):
+ (e_summary_rdf_set_online): Callbacks for the online_handler stuff.
+ (e_summary_rdf_init): Setup the offline handler stuff.
+ (close_callback): Update the number of onlines there are.
+
+ * e-summary-weather.c (close_callback): Update the number of onlines.
+ (e_summary_weather_count): Count the number of active downloads.
+ (e_summary_weather_add): Make a list of active downloads.
+ (make_connection): Make connection data.
+ (e_summary_weather_set_online): Set if the component is online or not.
+ (e_summary_weather_init): Setup the offline handler stuff.
+
+ * e-summary.c (e_summary_count_connections): Call all the callbacks
+ in the various modules that have online data and count the number of
+ connections.
+ (e_summary_add_connections): Make a list of them all.
+ (e_summary_set_online): Set the online status for each registered
+ module.
+ (e_summary_add_online_connection): Register a new module.
+
+ * e-summary-offline-handler.[ch]: BonoboXObject implementing the
+ GNOME::Evolution::Offline interface.
+
+ * e-summary-factory.c (factory_fn): Create an offline handler.
+
+ * Makefile.am: Compile e-summary-offline-handler.[ch]
+
2001-06-30 Zbigniew Chyla <cyba@gnome.pl>
* e-summary-calendar.c (generate_html):
diff --git a/my-evolution/Makefile.am b/my-evolution/Makefile.am
index af1b39fc10..f52d7b3741 100644
--- a/my-evolution/Makefile.am
+++ b/my-evolution/Makefile.am
@@ -40,6 +40,8 @@ evolution_executive_summary_SOURCES = \
e-summary-factory.h \
e-summary-mail.c \
e-summary-mail.h \
+ e-summary-offline-handler.c \
+ e-summary-offline-handler.h \
e-summary-preferences.c \
e-summary-rdf.h \
e-summary-rdf.c \
diff --git a/my-evolution/component-factory.c b/my-evolution/component-factory.c
index 72f8c4d3c2..d41c059440 100644
--- a/my-evolution/component-factory.c
+++ b/my-evolution/component-factory.c
@@ -18,6 +18,7 @@
#include <shell/Evolution.h>
#include "e-summary-factory.h"
+#include "e-summary-offline-handler.h"
#include "component-factory.h"
#include <gal/widgets/e-gui-utils.h>
@@ -42,16 +43,21 @@ create_view (EvolutionShellComponent *shell,
void *closure)
{
EvolutionShellClient *shell_client;
+ ESummaryOfflineHandler *offline_handler;
GNOME_Evolution_Shell corba_shell;
BonoboControl *control;
+
if (g_strcasecmp (folder_type, "My Evolution") != 0) {
return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
}
+ offline_handler = gtk_object_get_data (GTK_OBJECT (shell),
+ "offline-handler");
shell_client = evolution_shell_component_get_owner (shell);
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
- control = e_summary_factory_new_control (physical_uri, corba_shell);
+ control = e_summary_factory_new_control (physical_uri, corba_shell,
+ offline_handler);
if (!control)
return EVOLUTION_SHELL_COMPONENT_NOTFOUND;
@@ -96,6 +102,7 @@ factory_fn (BonoboGenericFactory *factory,
void *closure)
{
EvolutionShellComponent *shell_component;
+ ESummaryOfflineHandler *offline_handler;
running_objects++;
@@ -112,6 +119,11 @@ factory_fn (BonoboGenericFactory *factory,
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset",
GTK_SIGNAL_FUNC (owner_unset_cb), NULL);
+ offline_handler = e_summary_offline_handler_new ();
+ gtk_object_set_data (GTK_OBJECT (shell_component), "offline-handler",
+ offline_handler);
+ bonobo_object_add_interface (BONOBO_OBJECT (shell_component), BONOBO_OBJECT (offline_handler));
+
return BONOBO_OBJECT (shell_component);
}
diff --git a/my-evolution/e-summary-factory.c b/my-evolution/e-summary-factory.c
index b7dde3c861..7afd677d95 100644
--- a/my-evolution/e-summary-factory.c
+++ b/my-evolution/e-summary-factory.c
@@ -19,6 +19,7 @@
#include "e-summary.h"
#include "e-summary-factory.h"
+#include "e-summary-offline-handler.h"
#include "e-summary-preferences.h"
#include "evolution-shell-component-utils.h" /* For E_PIXMAP */
@@ -108,7 +109,8 @@ control_destroy_cb (BonoboControl *control,
BonoboControl *
e_summary_factory_new_control (const char *uri,
- const GNOME_Evolution_Shell shell)
+ const GNOME_Evolution_Shell shell,
+ ESummaryOfflineHandler *handler)
{
BonoboControl *control;
GtkWidget *summary;
@@ -118,6 +120,7 @@ e_summary_factory_new_control (const char *uri,
return NULL;
}
+ e_summary_offline_handler_set_summary (handler, E_SUMMARY (summary));
gtk_widget_show (summary);
control = bonobo_control_new (summary);
diff --git a/my-evolution/e-summary-factory.h b/my-evolution/e-summary-factory.h
index 970f81d22e..858bca9956 100644
--- a/my-evolution/e-summary-factory.h
+++ b/my-evolution/e-summary-factory.h
@@ -9,7 +9,10 @@
#ifndef __E_SUMMARY_FACTORY_H__
#define __E_SUMMARY_FACTORY_H__
+#include "e-summary-offline-handler.h"
+
BonoboControl *e_summary_factory_new_control (const char *uri,
- const GNOME_Evolution_Shell shell);
+ const GNOME_Evolution_Shell shell,
+ ESummaryOfflineHandler *handler);
#endif
diff --git a/my-evolution/e-summary-offline-handler.c b/my-evolution/e-summary-offline-handler.c
new file mode 100644
index 0000000000..8feaec10c1
--- /dev/null
+++ b/my-evolution/e-summary-offline-handler.c
@@ -0,0 +1,219 @@
+/*
+ * e-summary-offline-handler.c:
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Authors: Ettore Perazzoli <ettore@ximian.com>
+ * Dan Winship <danw@ximian.com>
+ * Iain Holmes <iain@ximian.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-summary-offline-handler.h"
+#include "e-summary.h"
+
+#include <bonobo/bonobo-exception.h>
+#include <gtk/gtkmain.h>
+#include <gal/util/e-util.h>
+
+#define PARENT_TYPE bonobo_x_object_get_type ()
+static BonoboXObjectClass *parent_class = NULL;
+
+struct _ESummaryOfflineHandlerPriv {
+ ESummary *summary;
+ GNOME_Evolution_OfflineProgressListener listener_interface;
+};
+
+static GNOME_Evolution_ConnectionList *
+create_connection_list (ESummary *summary)
+{
+ GNOME_Evolution_ConnectionList *list;
+ GList *connections, *p;
+
+ list = GNOME_Evolution_ConnectionList__alloc ();
+ list->_length = 0;
+ list->_maximum = e_summary_count_connections (summary);
+ list->_buffer = CORBA_sequence_GNOME_Evolution_Connection_allocbuf (list->_maximum);
+
+ connections = e_summary_add_connections (summary);
+ for (p = connections; p; p = p->next) {
+ ESummaryConnectionData *data;
+
+ data = p->data;
+ list->_buffer[list->_length].hostName = CORBA_string_dup (data->hostname);
+ list->_buffer[list->_length].type = CORBA_string_dup (data->type);
+ list->_length++;
+
+ g_free (data->hostname);
+ g_free (data->type);
+ g_free (data);
+ }
+ g_list_free (connections);
+
+ return list;
+}
+
+/* GNOME::Evolution::Offline methods. */
+static CORBA_boolean
+impl__get_isOffline (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ ESummaryOfflineHandler *offline_handler;
+
+ offline_handler = E_SUMMARY_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
+ return offline_handler->priv->summary->online;
+}
+
+static void
+impl_prepareForOffline (PortableServer_Servant servant,
+ GNOME_Evolution_ConnectionList **active_connection_list,
+ CORBA_Environment *ev)
+{
+ ESummaryOfflineHandler *offline_handler;
+ ESummaryOfflineHandlerPriv *priv;
+
+ offline_handler = E_SUMMARY_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
+ priv = offline_handler->priv;
+
+ *active_connection_list = create_connection_list (priv->summary);
+}
+
+static void
+went_offline (ESummary *summary,
+ void *data)
+{
+ ESummaryOfflineHandler *offline_handler = data;
+ ESummaryOfflineHandlerPriv *priv;
+ CORBA_Environment ev;
+ GNOME_Evolution_ConnectionList *connection_list;
+
+ g_return_if_fail (summary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (summary));
+ g_return_if_fail (offline_handler != NULL);
+
+ priv = offline_handler->priv;
+ connection_list = create_connection_list (summary);
+
+ CORBA_exception_init (&ev);
+
+ g_warning ("Went offline");
+ GNOME_Evolution_OfflineProgressListener_updateProgress (priv->listener_interface, connection_list, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Error updating offline progress");
+ }
+
+ CORBA_exception_free (&ev);
+}
+
+static void
+impl_goOffline (PortableServer_Servant servant,
+ const GNOME_Evolution_OfflineProgressListener progress_listener,
+ CORBA_Environment *ev)
+{
+ ESummaryOfflineHandler *offline_handler;
+ ESummaryOfflineHandlerPriv *priv;
+
+ offline_handler = E_SUMMARY_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
+ priv = offline_handler->priv;
+
+ priv->listener_interface = CORBA_Object_duplicate (progress_listener, ev);
+
+ e_summary_set_online (priv->summary, FALSE, went_offline, offline_handler);
+}
+
+static void
+impl_goOnline (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ ESummaryOfflineHandler *offline_handler;
+
+ offline_handler = E_SUMMARY_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
+ e_summary_set_online (offline_handler->priv->summary, TRUE, NULL, NULL);
+}
+
+/* GtkObject methods */
+static void
+impl_destroy (GtkObject *object)
+{
+ ESummaryOfflineHandler *offline_handler;
+ ESummaryOfflineHandlerPriv *priv;
+
+ offline_handler = E_SUMMARY_OFFLINE_HANDLER (object);
+ priv = offline_handler->priv;
+
+ if (priv == NULL) {
+ return;
+ }
+
+ if (priv->listener_interface != CORBA_OBJECT_NIL) {
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+ CORBA_Object_release (priv->listener_interface, &ev);
+ CORBA_exception_free (&ev);
+ }
+
+ gtk_object_unref (GTK_OBJECT (priv->summary));
+
+ offline_handler->priv = NULL;
+ g_free (priv);
+
+ if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) {
+ GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ }
+}
+
+static void
+e_summary_offline_handler_class_init (ESummaryOfflineHandlerClass *klass)
+{
+ GtkObjectClass *object_class;
+ POA_GNOME_Evolution_Offline__epv *epv;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = impl_destroy;
+
+ epv = &klass->epv;
+ epv->_get_isOffline = impl__get_isOffline;
+ epv->prepareForOffline = impl_prepareForOffline;
+ epv->goOffline = impl_goOffline;
+ epv->goOnline = impl_goOnline;
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+}
+
+static void
+e_summary_offline_handler_init (ESummaryOfflineHandler *offline_handler)
+{
+ ESummaryOfflineHandlerPriv *priv;
+
+ priv = g_new0 (ESummaryOfflineHandlerPriv, 1);
+
+ offline_handler->priv = priv;
+}
+
+ESummaryOfflineHandler *
+e_summary_offline_handler_new (void)
+{
+ ESummaryOfflineHandler *new;
+
+ new = gtk_type_new (e_summary_offline_handler_get_type ());
+
+ return new;
+}
+
+void
+e_summary_offline_handler_set_summary (ESummaryOfflineHandler *handler,
+ ESummary *summary)
+{
+ g_return_if_fail (handler != NULL);
+ g_return_if_fail (summary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (summary));
+
+ handler->priv->summary = summary;
+ gtk_object_ref (GTK_OBJECT (summary));
+}
+
+BONOBO_X_TYPE_FUNC_FULL (ESummaryOfflineHandler, GNOME_Evolution_Offline, PARENT_TYPE, e_summary_offline_handler);
diff --git a/my-evolution/e-summary-offline-handler.h b/my-evolution/e-summary-offline-handler.h
new file mode 100644
index 0000000000..a8c242afbf
--- /dev/null
+++ b/my-evolution/e-summary-offline-handler.h
@@ -0,0 +1,55 @@
+/*
+ * e-summary-offline-handler.h:
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Authors: Iain Holmes <iain@ximian.com>
+ */
+
+#ifndef __E_SUMMARY_OFFLINE_HANDLER_H__
+#define __E_SUMMARY_OFFLINE_HANDLER_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <bonobo/bonobo-xobject.h>
+#include "e-summary.h"
+#include "Evolution.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif
+
+#define E_SUMMARY_TYPE_OFFLINE_HANDLER (e_summary_offline_handler_get_type ())
+#define E_SUMMARY_OFFLINE_HANDLER(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_TYPE_OFFLINE_HANDLER, ESummaryOfflineHandler))
+#define E_SUMMARY_OFFLINE_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SUMMARY_TYPE_OFFLINE_HANDLER, ESummaryOfflineHandlerClass))
+
+
+typedef struct _ESummaryOfflineHandler ESummaryOfflineHandler;
+typedef struct _ESummaryOfflineHandlerPriv ESummaryOfflineHandlerPriv;
+typedef struct _ESummaryOfflineHandlerClass ESummaryOfflineHandlerClass;
+
+struct _ESummaryOfflineHandler {
+ BonoboXObject parent;
+
+ ESummaryOfflineHandlerPriv *priv;
+};
+
+struct _ESummaryOfflineHandlerClass {
+ BonoboXObjectClass parent_class;
+
+ POA_GNOME_Evolution_Offline__epv epv;
+};
+
+
+GtkType e_summary_offline_handler_get_type (void);
+ESummaryOfflineHandler *e_summary_offline_handler_new (void);
+void e_summary_offline_handler_set_summary (ESummaryOfflineHandler *handler,
+ ESummary *summary);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/my-evolution/e-summary-rdf.c b/my-evolution/e-summary-rdf.c
index 0cd7bb8c33..435268df04 100644
--- a/my-evolution/e-summary-rdf.c
+++ b/my-evolution/e-summary-rdf.c
@@ -25,10 +25,12 @@
#include "e-summary.h"
struct _ESummaryRDF {
+ ESummaryConnection *connection;
GList *rdfs;
char *html;
guint32 timeout;
+ gboolean online;
};
typedef struct _RDF {
@@ -164,7 +166,6 @@ tree_walk (xmlNodePtr root,
wipe_trackers = FALSE;
} else {
limit = r->summary->preferences->limit;
- g_print ("Limit: %d\n", limit);
wipe_trackers = r->summary->preferences->wipe_trackers;
}
@@ -321,9 +322,16 @@ close_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
RDF *r)
{
+ ESummary *summary;
char *xml;
xmlDocPtr doc;
+ summary = r->summary;
+ if (summary->rdf->connection->callback) {
+ ESummaryConnection *connection = summary->rdf->connection;
+ connection->callback (summary, connection->callback_closure);
+ }
+
if (r->handle == NULL) {
g_free (r->buffer);
g_string_free (r->string, TRUE);
@@ -455,11 +463,91 @@ e_summary_rdf_protocol (ESummary *summary,
display_doc (r);
}
+static int
+e_summary_rdf_count (ESummary *summary,
+ void *data)
+{
+ ESummaryRDF *rdf;
+ GList *p;
+ int count = 0;
+
+ rdf = summary->rdf;
+ for (p = rdf->rdfs; p; p = p->next) {
+ RDF *r = p->data;
+
+ if (r->handle != NULL) {
+ count++;
+ }
+ }
+
+ return count;
+}
+
+static ESummaryConnectionData *
+make_connection (RDF *r)
+{
+ ESummaryConnectionData *d;
+
+ d = g_new (ESummaryConnectionData, 1);
+ d->hostname = g_strdup (r->uri);
+ d->type = g_strdup ("RDF Summary");
+
+ return d;
+}
+
+static GList *
+e_summary_rdf_add (ESummary *summary,
+ void *data)
+{
+ ESummaryRDF *rdf;
+ GList *p, *connections = NULL;
+
+ rdf = summary->rdf;
+ for (p = rdf->rdfs; p; p = p->next) {
+ RDF *r = p->data;
+
+ if (r->handle != NULL) {
+ ESummaryConnectionData *d;
+
+ d = make_connection (r);
+ connections = g_list_prepend (connections, d);
+ }
+ }
+
+ return connections;
+}
+
+static void
+e_summary_rdf_set_online (ESummary *summary,
+ gboolean online,
+ void *data)
+{
+ ESummaryRDF *rdf;
+
+ rdf = summary->rdf;
+ if (rdf->online == online) {
+ return;
+ }
+
+ if (online == TRUE) {
+ e_summary_rdf_update (summary);
+ rdf->timeout = gtk_timeout_add (summary->preferences->rdf_refresh_time * 1000,
+ (GtkFunction) e_summary_rdf_update,
+ summary);
+ } else {
+ gtk_timeout_remove (rdf->timeout);
+ rdf->timeout = 0;
+ }
+
+ rdf->online = online;
+}
+
void
e_summary_rdf_init (ESummary *summary)
{
ESummaryPrefs *prefs;
ESummaryRDF *rdf;
+ ESummaryConnection *connection;
int timeout;
g_return_if_fail (summary != NULL);
@@ -469,6 +557,17 @@ e_summary_rdf_init (ESummary *summary)
rdf = g_new0 (ESummaryRDF, 1);
summary->rdf = rdf;
+ connection = g_new (ESummaryConnection, 1);
+ connection->count = e_summary_rdf_count;
+ connection->add = e_summary_rdf_add;
+ connection->set_online = e_summary_rdf_set_online;
+ connection->closure = NULL;
+ connection->callback = NULL;
+ connection->callback_closure = NULL;
+
+ rdf->connection = connection;
+ e_summary_add_online_connection (summary, connection);
+
e_summary_add_protocol_listener (summary, "rdf", e_summary_rdf_protocol, rdf);
if (prefs == NULL) {
e_summary_rdf_add_uri (summary, "http://news.gnome.org/gnome-news/rdf");
diff --git a/my-evolution/e-summary-weather.c b/my-evolution/e-summary-weather.c
index ed8847f1eb..8f97c813c1 100644
--- a/my-evolution/e-summary-weather.c
+++ b/my-evolution/e-summary-weather.c
@@ -27,10 +27,13 @@
#include "metar.h"
struct _ESummaryWeather {
+ ESummaryConnection *connection;
GList *weathers;
char *html;
guint32 timeout;
+
+ gboolean online;
};
static GHashTable *locations_hash = NULL;
@@ -210,9 +213,16 @@ close_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
Weather *w)
{
+ ESummary *summary;
char *html, *metar, *end;
char *search_str;
+ summary = w->summary;
+ if (summary->weather->connection->callback) {
+ ESummaryConnection *connection = summary->weather->connection;
+ connection->callback (summary, connection->callback_closure);
+ }
+
if (w->handle == NULL) {
g_free (w->buffer);
g_string_free (w->string, TRUE);
@@ -242,8 +252,6 @@ close_callback (GnomeVFSAsyncHandle *handle,
}
*end = '\0';
- g_warning ("Parsing %s", metar);
-
parse_metar (metar, w);
g_free (html);
g_free (search_str);
@@ -420,11 +428,91 @@ e_summary_weather_protocol (ESummary *summary,
}
+static int
+e_summary_weather_count (ESummary *summary,
+ void *data)
+{
+ ESummaryWeather *weather;
+ GList *p;
+ int count = 0;
+
+ weather = summary->weather;
+ for (p = weather->weathers; p; p = p->next) {
+ Weather *w = p->data;
+
+ if (w->handle != NULL) {
+ count++;
+ }
+ }
+
+ return count;
+}
+
+static ESummaryConnectionData *
+make_connection (Weather *w)
+{
+ ESummaryConnectionData *data;
+
+ data = g_new (ESummaryConnectionData, 1);
+ data->hostname = g_strdup (w->location);
+ data->type = g_strdup ("Weather");
+
+ return data;
+}
+
+static GList *
+e_summary_weather_add (ESummary *summary,
+ void *data)
+{
+ ESummaryWeather *weather;
+ GList *p, *connections = NULL;
+
+ weather = summary->weather;
+ for (p = weather->weathers; p; p = p->next) {
+ Weather *w = p->data;
+
+ if (w->handle != NULL) {
+ ESummaryConnectionData *d;
+
+ d = make_connection (w);
+ connections = g_list_prepend (connections, d);
+ }
+ }
+
+ return connections;
+}
+
+static void
+e_summary_weather_set_online (ESummary *summary,
+ gboolean online,
+ void *data)
+{
+ ESummaryWeather *weather;
+
+ weather = summary->weather;
+ if (weather->online == online) {
+ return;
+ }
+
+ if (online == TRUE) {
+ e_summary_weather_update (summary);
+ weather->timeout = gtk_timeout_add (summary->preferences->weather_refresh_time * 1000,
+ (GtkFunction) e_summary_weather_update,
+ summary);
+ } else {
+ gtk_timeout_remove (weather->timeout);
+ weather->timeout = 0;
+ }
+
+ weather->online = online;
+}
+
void
e_summary_weather_init (ESummary *summary)
{
ESummaryPrefs *prefs;
ESummaryWeather *weather;
+ ESummaryConnection *connection;
int timeout;
g_return_if_fail (summary != NULL);
@@ -436,8 +524,20 @@ e_summary_weather_init (ESummary *summary)
prefs = summary->preferences;
weather = g_new0 (ESummaryWeather, 1);
+ weather->online = TRUE;
summary->weather = weather;
+ connection = g_new (ESummaryConnection, 1);
+ connection->count = e_summary_weather_count;
+ connection->add = e_summary_weather_add;
+ connection->set_online = e_summary_weather_set_online;
+ connection->closure = NULL;
+ connection->callback = NULL;
+ connection->callback_closure = NULL;
+
+ weather->connection = connection;
+ e_summary_add_online_connection (summary, connection);
+
e_summary_add_protocol_listener (summary, "weather", e_summary_weather_protocol, weather);
if (prefs == NULL) {
diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c
index 8504fdaf64..830cad4220 100644
--- a/my-evolution/e-summary.c
+++ b/my-evolution/e-summary.c
@@ -70,6 +70,8 @@ struct _ESummaryPrivate {
GtkWidget *html;
GHashTable *protocol_hash;
+
+ GList *connections;
};
typedef struct _ProtocolListener {
@@ -139,7 +141,7 @@ e_summary_draw (ESummary *summary)
g_string_append (string, HTML_5);
stream = gtk_html_begin (GTK_HTML (summary->priv->html));
- GTK_HTML (summary->priv->html)->engine->newPage = FALSE;
+/* GTK_HTML (summary->priv->html)->engine->newPage = FALSE; */
gtk_html_write (GTK_HTML (summary->priv->html), stream, string->str, strlen (string->str));
gtk_html_end (GTK_HTML (summary->priv->html), stream, GTK_HTML_STREAM_OK);
@@ -364,6 +366,7 @@ e_summary_init (ESummary *summary)
TRUE, TRUE, 0);
priv->protocol_hash = NULL;
+ priv->connections = NULL;
summary->prefs_window = NULL;
e_summary_preferences_init (summary);
@@ -576,3 +579,69 @@ e_summary_reconfigure (ESummary *summary)
e_summary_calendar_reconfigure (summary);
}
}
+
+int
+e_summary_count_connections (ESummary *summary)
+{
+ GList *p;
+ int count = 0;
+
+ for (p = summary->priv->connections; p; p = p->next) {
+ ESummaryConnection *c;
+
+ c = p->data;
+ count += c->count (summary, c->closure);
+ }
+
+ return count;
+}
+
+GList *
+e_summary_add_connections (ESummary *summary)
+{
+ GList *p;
+ GList *connections = NULL;
+
+ for (p = summary->priv->connections; p; p = p->next) {
+ ESummaryConnection *c;
+ GList *r;
+
+ c = p->data;
+ r = c->add (summary, c->closure);
+
+ connections = g_list_concat (connections, r);
+ }
+
+ return connections;
+}
+
+void
+e_summary_set_online (ESummary *summary,
+ gboolean online,
+ ESummaryOnlineCallback callback,
+ void *closure)
+{
+ GList *p;
+
+ for (p = summary->priv->connections; p; p = p->next) {
+ ESummaryConnection *c;
+
+ c = p->data;
+ c->callback = callback;
+ c->callback_closure = closure;
+
+ c->set_online (summary, online, c->closure);
+ }
+}
+
+void
+e_summary_add_online_connection (ESummary *summary,
+ ESummaryConnection *connection)
+{
+ g_return_if_fail (summary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (summary));
+ g_return_if_fail (connection != NULL);
+
+ summary->priv->connections = g_list_prepend (summary->priv->connections,
+ connection);
+}
diff --git a/my-evolution/e-summary.h b/my-evolution/e-summary.h
index 45d1905678..1ba2ee18b7 100644
--- a/my-evolution/e-summary.h
+++ b/my-evolution/e-summary.h
@@ -27,10 +27,36 @@
typedef struct _ESummaryPrivate ESummaryPrivate;
typedef struct _ESummaryClass ESummaryClass;
typedef struct _ESummaryPrefs ESummaryPrefs;
+typedef struct _ESummaryConnection ESummaryConnection;
+typedef struct _ESummaryConnectionData ESummaryConnectionData;
typedef void (* ESummaryProtocolListener) (ESummary *summary,
const char *uri,
void *closure);
+typedef int (* ESummaryConnectionCount) (ESummary *summary,
+ void *closure);
+typedef GList *(* ESummaryConnectionAdd) (ESummary *summary,
+ void *closure);
+typedef void (* ESummaryConnectionSetOnline) (ESummary *summary,
+ gboolean online,
+ void *closure);
+typedef void (*ESummaryOnlineCallback) (ESummary *summary,
+ void *closure);
+
+struct _ESummaryConnection {
+ ESummaryConnectionCount count;
+ ESummaryConnectionAdd add;
+ ESummaryConnectionSetOnline set_online;
+ ESummaryOnlineCallback callback;
+
+ void *closure;
+ void *callback_closure;
+};
+
+struct _ESummaryConnectionData {
+ char *hostname;
+ char *type;
+};
struct _ESummaryPrefs {
@@ -70,6 +96,7 @@ struct _ESummary {
GNOME_Evolution_ShellView shell_view_interface;
GtkWidget *prefs_window;
+ gboolean online;
};
struct _ESummaryClass {
@@ -92,4 +119,12 @@ void e_summary_add_protocol_listener (ESummary *summary,
ESummaryProtocolListener listener,
void *closure);
void e_summary_reconfigure (ESummary *summary);
+int e_summary_count_connections (ESummary *summary);
+GList *e_summary_add_connections (ESummary *summary);
+void e_summary_set_online (ESummary *summary,
+ gboolean online,
+ ESummaryOnlineCallback callback,
+ void *closure);
+void e_summary_add_online_connection (ESummary *summary,
+ ESummaryConnection *connection);
#endif