aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2000-11-22 08:34:39 +0800
committerIain Holmes <iain@src.gnome.org>2000-11-22 08:34:39 +0800
commitf69d5ec14310f4903a8b88224f7c82cfa1de014a (patch)
treedc66bdbfc7f7859e5d4ab33dc71354da56725fcb
parent615a467b605dfbbdbab66d6edd64f8c298993397 (diff)
downloadgsoc2013-evolution-f69d5ec14310f4903a8b88224f7c82cfa1de014a.tar
gsoc2013-evolution-f69d5ec14310f4903a8b88224f7c82cfa1de014a.tar.gz
gsoc2013-evolution-f69d5ec14310f4903a8b88224f7c82cfa1de014a.tar.bz2
gsoc2013-evolution-f69d5ec14310f4903a8b88224f7c82cfa1de014a.tar.lz
gsoc2013-evolution-f69d5ec14310f4903a8b88224f7c82cfa1de014a.tar.xz
gsoc2013-evolution-f69d5ec14310f4903a8b88224f7c82cfa1de014a.tar.zst
gsoc2013-evolution-f69d5ec14310f4903a8b88224f7c82cfa1de014a.zip
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
-rw-r--r--art/Makefile.am4
-rw-r--r--art/service-down-disabled.pngbin0 -> 155 bytes
-rw-r--r--art/service-left-disabled.pngbin0 -> 147 bytes
-rw-r--r--art/service-right-disabled.pngbin0 -> 143 bytes
-rw-r--r--art/service-up-disabled.pngbin0 -> 144 bytes
-rw-r--r--composer/ChangeLog15
-rw-r--r--composer/e-msg-composer-attachment-bar.c76
-rw-r--r--executive-summary/ChangeLog128
-rw-r--r--executive-summary/Makefile.am2
-rw-r--r--executive-summary/component/Makefile.am1
-rw-r--r--executive-summary/component/e-summary-factory.c89
-rw-r--r--executive-summary/component/e-summary-factory.h4
-rw-r--r--executive-summary/component/e-summary-url.c206
-rw-r--r--executive-summary/component/e-summary.c911
-rw-r--r--executive-summary/component/e-summary.h55
-rw-r--r--executive-summary/evolution-services/Makefile.am15
-rw-r--r--executive-summary/evolution-services/executive-summary-component-client.c158
-rw-r--r--executive-summary/evolution-services/executive-summary-component-client.h3
-rw-r--r--executive-summary/evolution-services/executive-summary-component-factory-client.c181
-rw-r--r--executive-summary/evolution-services/executive-summary-component-factory-client.h57
-rw-r--r--executive-summary/evolution-services/executive-summary-component-view.c64
-rw-r--r--executive-summary/evolution-services/executive-summary-component-view.h18
-rw-r--r--executive-summary/evolution-services/executive-summary-component.c434
-rw-r--r--executive-summary/evolution-services/executive-summary-component.h49
-rw-r--r--executive-summary/evolution-services/executive-summary-html-view.c244
-rw-r--r--executive-summary/evolution-services/executive-summary-html-view.h57
-rw-r--r--executive-summary/evolution-services/executive-summary.c6
-rw-r--r--executive-summary/evolution-services/executive-summary.h1
-rw-r--r--executive-summary/idl/Executive-Summary.idl1
-rw-r--r--executive-summary/idl/HtmlView.idl23
-rw-r--r--executive-summary/idl/Summary.idl38
-rw-r--r--executive-summary/idl/SummaryComponent.idl35
-rw-r--r--executive-summary/test-service/GNOME_Evolution_Summary_rdf.oaf.in27
-rw-r--r--executive-summary/test-service/GNOME_Evolution_Summary_rdf.oafinfo27
-rw-r--r--executive-summary/test-service/GNOME_Evolution_Summary_test.oaf.in30
-rw-r--r--executive-summary/test-service/GNOME_Evolution_Summary_test.oafinfo30
-rw-r--r--executive-summary/test-service/Makefile.am20
-rw-r--r--executive-summary/test-service/main.c271
-rw-r--r--executive-summary/test-service/rdf-summary.c393
-rw-r--r--executive-summary/test-service/rdf-summary.oafinfo27
-rw-r--r--executive-summary/test-service/test-service.oafinfo30
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/GNOME_Evolution_Mail.oaf.in4
-rw-r--r--mail/GNOME_Evolution_Mail.oafinfo4
-rw-r--r--mail/component-factory.c25
-rw-r--r--mail/evolution-mail.oafinfo4
-rw-r--r--mail/mail-config-gui.c3
-rw-r--r--mail/mail-display.c1
-rw-r--r--mail/mail-summary.c82
49 files changed, 2797 insertions, 1070 deletions
diff --git a/art/Makefile.am b/art/Makefile.am
index 7a5cd77d59..9394067780 100644
--- a/art/Makefile.am
+++ b/art/Makefile.am
@@ -21,9 +21,13 @@ images_DATA = \
service-close.png \
service-configure.png \
service-down.png \
+ service-down-disabled.png \
service-left.png \
+ service-left-disabled.png \
service-right.png \
+ service-right-disabled.png \
service-up.png \
+ service-up-disabled.png \
splash.png
buttonsdir = $(datadir)/images/evolution/buttons
diff --git a/art/service-down-disabled.png b/art/service-down-disabled.png
new file mode 100644
index 0000000000..061a4dd967
--- /dev/null
+++ b/art/service-down-disabled.png
Binary files differ
diff --git a/art/service-left-disabled.png b/art/service-left-disabled.png
new file mode 100644
index 0000000000..4fcd355f43
--- /dev/null
+++ b/art/service-left-disabled.png
Binary files differ
diff --git a/art/service-right-disabled.png b/art/service-right-disabled.png
new file mode 100644
index 0000000000..93b803b56f
--- /dev/null
+++ b/art/service-right-disabled.png
Binary files differ
diff --git a/art/service-up-disabled.png b/art/service-up-disabled.png
new file mode 100644
index 0000000000..a42473a090
--- /dev/null
+++ b/art/service-up-disabled.png
Binary files differ
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 850a27fabf..b3a2052b6c 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,18 @@
+2000-11-03 Iain Holmes <iain@helixcode.com>
+
+ * e-msg-composer-attachment-bar.c (update): Pass NULL
+ instead of icon_name to the e_icon_list_append_pixbuf
+ function.
+ (init) Take the font size into account when setting the
+ height of the bar.
+
+2000-11-02 Iain Holmes <iain@helixcode.com>
+
+ * e-msg-composer-attachment-bar.c (update): Use the
+ pixbuf_for_mime_type function to get the icon.
+ (pixbuf_for_mime_type): Functino that searches nautilus/
+ and mc/ for icon files.
+
2000-11-15 Radek Doulik <rodo@helixcode.com>
* e-msg-composer.c (prepare_engine): update namespace
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index 85a1d4ca81..7eeb601237 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -179,6 +179,44 @@ remove_attachment (EMsgComposerAttachmentBar *bar,
/* Icon list contents handling. */
+static GdkPixbuf *
+pixbuf_for_mime_type (const char *mime_type)
+{
+ const char *icon_name;
+ char *filename = NULL;
+ GdkPixbuf *pixbuf;
+
+ icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename");
+ if (icon_name) {
+ if (*icon_name == '/') {
+ pixbuf = gdk_pixbuf_new_from_file (icon_name);
+ if (pixbuf)
+ return pixbuf;
+ }
+
+ filename = gnome_pixmap_file (icon_name);
+ if (!filename) {
+ char *fm_icon;
+
+ fm_icon = g_strdup_printf ("nautilus/%s", icon_name);
+ filename = gnome_pixmap_file (fm_icon);
+ if (!filename) {
+ fm_icon = g_strdup_printf ("mc/%s", icon_name);
+ filename = gnome_pixmap_file (fm_icon);
+ }
+ g_free (fm_icon);
+ }
+ }
+
+ if (!filename)
+ filename = gnome_pixmap_file ("gnome-unknown.png");
+
+ pixbuf = gdk_pixbuf_new_from_file (filename);
+ g_free (filename);
+
+ return pixbuf;
+}
+
static void
update (EMsgComposerAttachmentBar *bar)
{
@@ -196,7 +234,7 @@ update (EMsgComposerAttachmentBar *bar)
/* FIXME could be faster, but we don't care. */
for (p = priv->attachments; p != NULL; p = p->next) {
EMsgComposerAttachment *attachment;
- const gchar *icon_name, *desc;
+ const gchar *desc;
gchar *size_string, *label, *mime_type;
GMimeContentField *content_type;
GdkPixbuf *pixbuf;
@@ -207,14 +245,6 @@ update (EMsgComposerAttachmentBar *bar)
mime_type = g_strdup_printf ("%s/%s", content_type->type,
content_type->subtype);
- icon_name = gnome_vfs_mime_get_value (mime_type,
- "icon-filename");
- g_free (mime_type);
-
- /* FIXME we need some better default icon. */
- if (icon_name == NULL)
- icon_name = gnome_vfs_mime_get_value ("text/plain",
- "icon-filename");
/* Get the image out of the attachment
and create a thumbnail for it */
@@ -308,26 +338,16 @@ update (EMsgComposerAttachmentBar *bar)
label = g_strdup (desc);
if (image) {
- e_icon_list_append_pixbuf (icon_list, attachment->pixbuf_cache, icon_name, label);
+ e_icon_list_append_pixbuf (icon_list, attachment->pixbuf_cache, NULL, label);
} else {
- if (icon_name)
- pixbuf = gdk_pixbuf_new_from_file (icon_name);
- else
- pixbuf = NULL;
-
- /* Get the default */
- if (pixbuf == NULL) {
- icon_name = gnome_vfs_mime_get_value ("text/plain",
- "icon-filename");
- if (icon_name != NULL)
- pixbuf = gdk_pixbuf_new_from_file (icon_name);
- }
+ pixbuf = pixbuf_for_mime_type (mime_type);
e_icon_list_append_pixbuf (icon_list, pixbuf,
- icon_name, label);
+ NULL, label);
if (pixbuf)
gdk_pixbuf_unref (pixbuf);
}
+ g_free (mime_type);
g_free (label);
}
@@ -586,7 +606,8 @@ static void
init (EMsgComposerAttachmentBar *bar)
{
EMsgComposerAttachmentBarPrivate *priv;
- guint icon_size;
+ guint icon_size, icon_height;
+ GdkFont *font;
priv = g_new (EMsgComposerAttachmentBarPrivate, 1);
@@ -601,9 +622,12 @@ init (EMsgComposerAttachmentBar *bar)
/* FIXME partly hardcoded. We should compute height from the font, and
allow at least 2 lines for every item. */
icon_size = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING;
- icon_size += 24;
- gtk_widget_set_usize (GTK_WIDGET (bar), icon_size * 4, icon_size);
+ font = GTK_WIDGET (bar)->style->font;
+ icon_height = icon_size + ((font->ascent + font->descent) * 2);
+ icon_size += 24;
+
+ gtk_widget_set_usize (GTK_WIDGET (bar), icon_size * 4, icon_height);
}
diff --git a/executive-summary/ChangeLog b/executive-summary/ChangeLog
index 4674ca6635..5ff2ff374f 100644
--- a/executive-summary/ChangeLog
+++ b/executive-summary/ChangeLog
@@ -1,3 +1,130 @@
+2000-17-10 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (make_control_html): Set the configure button
+ active if there is a Bonobo_PropertyControl object associated with the
+ window.
+
+ * Makefile.am: Remove the widgets subdirectory.
+
+2000-16-10 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_display_window): Use the property
+ bag to get the window title and icon.
+
+ * test-service/main.c: (create_view): Add a PropertyBag to the object.
+ (set_property): Set the properties.
+ (get_property): Get the properties.
+
+2000-15-10 Iain Holmes <iain@helixcode.com>
+
+ * evolution-services/executive-summary-component-factory-client.[ch]:
+ A client for the factory stuff.
+
+2000-14-10 Iain Holmes <iain@helixcode.com>
+
+ * evolution-services/executive-summary-html-view.[ch]: Implementation
+ of the HtmlView interface.
+
+ * component/e-summary-factory.c
+ (e_summary_factory_embed_service_from_id): Rewrote to use the new
+ component_factory.
+
+ * component/e-summary.c (e_summary_add_service): Rewrote to use
+ the new component stuff. Lots of queryInterfaces :)
+ (e_summary_window_free): Rewrote.
+
+ * test-service/main.c: Rewrote completely as an example of the
+ new services.
+
+2000-13-10 Iain Holmes <iain@helixcode.com>
+
+ * evolution-services/executive-summary-component.c:
+ Created the ExecutiveSummaryComponentFactory type, that implements
+ GNOME/Evolution/Summary/ComponentFactory. Changed the way
+ GNOME/Evolution/Summary/Component is implemented.
+
+ * idl/SummaryComponent.idl: Removed all methods from Component
+ execpt setOwner and unsetOwner. Added ComponentFactory interface
+ with a createView method.
+
+ * idl/HtmlView.idl: New interface for HTML services. One method
+ getHtml.
+
+2000-11-10 Iain Holmes <iain@helixcode.com>
+
+ * evolution-services/executive-summary-component-view.c
+ (executive_summary_component_view_set_title): Removed the
+ "wrong side" warning.
+
+ * component/e-summary-factory.c (set_icon): Change the view's
+ icon.
+ (e_summary_factory_embed_service_from_id): Connect to the set_icon
+ signal.
+
+2000-11-09 Iain Holmes <iain@helixcode.com>
+
+ * test-service/rdf-summary.c: Made Alan Cox's rdf-engine.c from
+ Portaloo into a summary component.
+
+2000-11-08 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_window_free): Remove the view
+ from the id_to_view hash table.
+ (make_control_html): Fix the bottom row comparison.
+
+2000-11-07 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_load_state): Load the HTML
+ page for the background.
+ (load_html_page): Use GnomeVFS to load this page, and split it
+ into a header and footer.
+ (e_summary_rebuild_page): If a header and footer exist, use them
+ otherwise just load the default.
+
+2000-11-06 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (on_object_requested): Load a bonobo
+ service and try to get it to display (Not working yet).
+
+2000-11-04 Iain Holmes <iain@helixcode.com>
+
+ * test-service/test-bonobo.c: New file to test Bonobo control
+ based services.
+
+ * test-service/test-service.oafinfo: Added the details for the
+ test-bonobo service.
+
+2000-11-03 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (make_control_html): Make a neater
+ function to create the window controls. Check if a window can
+ be moved in a certain direction before making a link.
+
+ * evolution-services/executive-summary-component-view.c: Added a
+ GtkWidget to the private structure to store the control's widget.
+
+2000-11-03 Iain Holmes <iain@helixcode.com>
+
+ * evolution-services/executive-summary-component-view.c:
+ (executive_summary_component_view_class_init): Add a "configure"
+ signal.
+
+ * evolution-services/executive-summary-component-view.h: Add the
+ default handler in the class type.
+
+ * idl/SummaryComponent.idl: Add an id to the configure method.
+
+ * evolution-services/executive-summary-component-client.[ch]:
+ executive_summary_component_client_configure: Takes a View param.
+
+ * component/e-summary-factory.c: Connect to the configure signal
+ of the created view and call the configure method.
+
+ * component/e-summary-url.c: When the [?] is clicked, emit the
+ configure signal.
+
+ * test-service/main.c: Connect the configure signal to something.
+
2000-11-21 Radek Doulik <rodo@helixcode.com>
* component/e-summary.c (e_summary_rebuild_page): use html_engine_is_selection_active
@@ -17,6 +144,7 @@
* component/Makefile.am: Regenerate the idl-generated files
if composer idl changes.
+>>>>>>> 1.18
2000-11-03 Federico Mena Quintero <federico@helixcode.com>
* evolution-services/Makefile.am: Clean the idl-generated files
diff --git a/executive-summary/Makefile.am b/executive-summary/Makefile.am
index 3c14ed5593..a938c0ed18 100644
--- a/executive-summary/Makefile.am
+++ b/executive-summary/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = idl widgets evolution-services component test-service
+SUBDIRS = idl evolution-services component test-service
oafdir = $(datadir)/oaf
oaf_DATA = evolution-executive-summary.oafinfo
diff --git a/executive-summary/component/Makefile.am b/executive-summary/component/Makefile.am
index 937b58c8fa..ba77a68238 100644
--- a/executive-summary/component/Makefile.am
+++ b/executive-summary/component/Makefile.am
@@ -61,7 +61,6 @@ evolution_executive_summary_LDADD = \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
- $(top_builddir)/executive-summary/widgets/libesummary-widgets.a \
$(BONOBO_VFS_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
$(GTKHTML_LIBS) \
diff --git a/executive-summary/component/e-summary-factory.c b/executive-summary/component/e-summary-factory.c
index cf4f010fdc..3f3a3bba89 100644
--- a/executive-summary/component/e-summary-factory.c
+++ b/executive-summary/component/e-summary-factory.c
@@ -42,11 +42,9 @@
#include "e-summary.h"
#include "Evolution.h"
-#include <evolution-services/executive-summary-component-client.h>
#include <evolution-services/Executive-Summary.h>
-#include <evolution-services/executive-summary.h>
#include <evolution-services/executive-summary-component.h>
-#include <evolution-services/executive-summary-component-view.h>
+#include <evolution-services/executive-summary-component-factory-client.h>
static GList *control_list = NULL;
@@ -170,51 +168,6 @@ control_destroy_cb (BonoboControl *control,
gtk_object_destroy (GTK_OBJECT (esummary));
}
-static void
-update (ExecutiveSummary *summary,
- int id,
- const char *html,
- ESummary *esummary)
-{
- ExecutiveSummaryComponentView *view;
-
- view = e_summary_view_from_id (esummary, id);
- executive_summary_component_view_set_html (view, html);
- e_summary_update_window (esummary, summary, html);
-}
-
-static void
-set_title (ExecutiveSummary *summary,
- int id,
- const char *title,
- ESummary *esummary)
-{
- ExecutiveSummaryComponentView *view;
-
- view = e_summary_view_from_id (esummary, id);
- executive_summary_component_view_set_title (view, title);
-}
-
-static void
-flash (ExecutiveSummary *summary,
- int id,
- gpointer user_data)
-{
- g_print ("FLASH!\n");
-}
-
-static void
-view_destroyed (ExecutiveSummaryComponentView *view,
- ExecutiveSummaryComponentClient *client)
-{
- int id;
-
- g_print ("%s\n", __FUNCTION__);
- id = executive_summary_component_view_get_id (view);
- g_print ("%d\n", id);
- executive_summary_component_client_destroy_view (client, view);
-}
-
/* A ********very********
temporary function to embed something
*/
@@ -222,7 +175,7 @@ void
embed_service (GtkWidget *widget,
ESummary *esummary)
{
- char *required_interfaces[2] = {"IDL:GNOME/Evolution:SummaryComponent:1.0",
+ char *required_interfaces[2] = {"IDL:GNOME/Evolution:Summary:ComponentFactory:1.0",
NULL};
char *obj_id;
@@ -234,37 +187,23 @@ embed_service (GtkWidget *widget,
e_summary_factory_embed_service_from_id (esummary, obj_id);
}
-void
+ESummaryWindow *
e_summary_factory_embed_service_from_id (ESummary *esummary,
const char *obj_id)
{
- ExecutiveSummaryComponentClient *client;
- ExecutiveSummary *summary;
- ExecutiveSummaryComponentView *view;
- int id;
-
- client = executive_summary_component_client_new (obj_id);
+ GNOME_Evolution_Summary_Component component;
+ ExecutiveSummaryComponentFactoryClient *client;
+ ESummaryWindow *window;
+ CORBA_Environment ev;
+
+ client = executive_summary_component_factory_client_new (obj_id);
+
+ component = executive_summary_component_factory_client_create_view (client);
- g_return_if_fail (client != NULL);
-
- /* Set the owner */
- summary = EXECUTIVE_SUMMARY (executive_summary_new ());
- executive_summary_component_client_set_owner (client, summary);
- gtk_signal_connect (GTK_OBJECT (summary), "flash",
- GTK_SIGNAL_FUNC (flash), esummary);
- gtk_signal_connect (GTK_OBJECT (summary), "set_title",
- GTK_SIGNAL_FUNC (set_title), esummary);
- gtk_signal_connect (GTK_OBJECT (summary), "update",
- GTK_SIGNAL_FUNC (update), esummary);
-
- /* Create view */
- id = executive_summary_component_create_unique_id ();
- view = executive_summary_component_client_create_view (client, id);
- gtk_signal_connect (GTK_OBJECT (view), "destroy",
- GTK_SIGNAL_FUNC (view_destroyed), client);
-
- e_summary_add_service (esummary, summary, view, obj_id);
+ window = e_summary_add_service (esummary, component, obj_id);
e_summary_rebuild_page (esummary);
+
+ return window;
}
BonoboControl *
diff --git a/executive-summary/component/e-summary-factory.h b/executive-summary/component/e-summary-factory.h
index 4c704e46ee..a9489d06a4 100644
--- a/executive-summary/component/e-summary-factory.h
+++ b/executive-summary/component/e-summary-factory.h
@@ -29,7 +29,7 @@
BonoboControl *e_summary_factory_new_control (const char *uri,
const GNOME_Evolution_Shell shell);
-void e_summary_factory_embed_service_from_id (ESummary *esummary,
- const char *obj_id);
+ESummaryWindow *e_summary_factory_embed_service_from_id (ESummary *esummary,
+ const char *obj_id);
#endif
diff --git a/executive-summary/component/e-summary-url.c b/executive-summary/component/e-summary-url.c
index 9dfff28713..f99db8b42e 100644
--- a/executive-summary/component/e-summary-url.c
+++ b/executive-summary/component/e-summary-url.c
@@ -39,7 +39,6 @@
#include "e-summary-url.h"
#include "e-summary-util.h"
-#include <evolution-services/executive-summary-component-view.h>
#include "Composer.h"
typedef enum _ESummaryProtocol {
@@ -101,7 +100,8 @@ e_summary_url_request (GtkHTML *html,
gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
return;
}
-
+
+ g_print ("Filename: %s\n", filename);
result = gnome_vfs_open (&handle, filename, GNOME_VFS_OPEN_READ);
if (result != GNOME_VFS_OK) {
@@ -143,10 +143,10 @@ parse_uri (const char *uri,
ESummaryProtocol protocol,
ESummary *esummary)
{
- ExecutiveSummaryComponentView *view;
char *parsed;
char *p;
- int id;
+ int address;
+ ESummaryWindow *window;
switch (protocol) {
@@ -184,39 +184,39 @@ parse_uri (const char *uri,
break;
case PROTOCOL_CLOSE:
- id = atoi (uri + 8);
- view = e_summary_view_from_id (esummary, id);
- parsed = g_strdup (executive_summary_component_view_get_title (view));
+ address = atoi (uri + 8);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ parsed = g_strdup (window->title);
break;
case PROTOCOL_LEFT:
- id = atoi (uri + 7);
- view = e_summary_view_from_id (esummary, id);
- parsed = g_strdup (executive_summary_component_view_get_title (view));
+ address = atoi (uri + 7);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ parsed = g_strdup (window->title);
break;
case PROTOCOL_RIGHT:
- id = atoi (uri + 8);
- view = e_summary_view_from_id (esummary, id);
- parsed = g_strdup (executive_summary_component_view_get_title (view));
+ address = atoi (uri + 8);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ parsed = g_strdup (window->title);
break;
case PROTOCOL_UP:
- id = atoi (uri + 5);
- view = e_summary_view_from_id (esummary, id);
- parsed = g_strdup (executive_summary_component_view_get_title (view));
+ address = atoi (uri + 5);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ parsed = g_strdup (window->title);
break;
case PROTOCOL_DOWN:
- id = atoi (uri + 7);
- view = e_summary_view_from_id (esummary, id);
- parsed = g_strdup (executive_summary_component_view_get_title (view));
+ address = atoi (uri + 7);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ parsed = g_strdup (window->title);
break;
case PROTOCOL_CONFIGURE:
- id = atoi (uri + 12);
- view = e_summary_view_from_id (esummary, id);
- parsed = g_strdup (executive_summary_component_view_get_title (view));
+ address = atoi (uri + 12);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ parsed = g_strdup (window->title);
break;
case PROTOCOL_NONE:
@@ -325,10 +325,9 @@ e_summary_url_click (GtkWidget *widget,
ESummary *esummary)
{
ESummaryProtocol protocol;
- ExecutiveSummaryComponentView *view;
- gpointer window; /* FIXME */
char *parsed;
- int id;
+ int address;
+ ESummaryWindow *window;
protocol = get_protocol (url);
@@ -352,22 +351,20 @@ e_summary_url_click (GtkWidget *widget,
case PROTOCOL_CLOSE:
/* Close the window. */
- id = atoi (url + 8);
- view = e_summary_view_from_id (esummary, id);
- if (view == NULL)
+ address = atoi (url + 8);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ if (window->iid == NULL)
return;
- window = e_summary_window_from_view (esummary, view);
- e_summary_window_remove_from_ht (window, esummary);
- e_summary_window_free (window, esummary);
+ e_summary_remove_window (esummary, window);
e_summary_rebuild_page (esummary);
break;
case PROTOCOL_CONFIGURE:
/* Configure the window. . . */
- id = atoi (url + 12);
- view = e_summary_view_from_id (esummary, id);
- if (view == NULL)
+ address = atoi (url + 12);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ if (window->iid == NULL)
return;
/* Issue the configure command some how :) */
@@ -375,50 +372,41 @@ e_summary_url_click (GtkWidget *widget,
case PROTOCOL_LEFT:
/* Window left */
- id = atoi (url + 7);
- view = e_summary_view_from_id (esummary, id);
-
- if (view == NULL)
+ address = atoi (url + 7);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ if (window->iid == NULL)
return;
- window = e_summary_window_from_view (esummary, view);
-
e_summary_window_move_left (esummary, window);
e_summary_rebuild_page (esummary);
break;
case PROTOCOL_RIGHT:
- id = atoi (url + 8);
- view = e_summary_view_from_id (esummary, id);
- if (view == NULL)
+ address = atoi (url + 8);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ if (window->iid == NULL)
return;
- window = e_summary_window_from_view (esummary, view);
-
e_summary_window_move_right (esummary, window);
e_summary_rebuild_page (esummary);
break;
case PROTOCOL_UP:
- id = atoi (url + 5);
- view = e_summary_view_from_id (esummary, id);
- if (view == NULL)
+ address = atoi (url + 5);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ if (window->iid == NULL)
return;
- window = e_summary_window_from_view (esummary, view);
-
e_summary_window_move_up (esummary, window);
e_summary_rebuild_page (esummary);
break;
case PROTOCOL_DOWN:
- id = atoi (url + 7);
- view = e_summary_view_from_id (esummary, id);
- if (view == NULL)
+ address = atoi (url + 7);
+ window = (ESummaryWindow *) GINT_TO_POINTER (address);
+ if (window->iid == NULL)
return;
- window = e_summary_window_from_view (esummary, view);
-
e_summary_window_move_down (esummary, window);
e_summary_rebuild_page (esummary);
break;
@@ -437,16 +425,75 @@ e_summary_url_click (GtkWidget *widget,
g_free (parsed);
}
+static void
+parse_mail_url (char *url,
+ GList **cc,
+ GList **bcc,
+ char **subject)
+{
+ char **options;
+ int i = 0;
+
+ options = g_strsplit (url, "&", 0);
+ while (options[i] != NULL) {
+ char **params;
+
+ params = g_strsplit (options[i], "=", 2);
+ if (strcmp (params[0], "subject") == 0) {
+ *subject = g_strdup (params[1]);
+ } else if (strcmp (params[0], "cc") == 0) {
+ *cc = g_list_prepend (*cc, g_strdup (params[1]));
+ } else if (strcmp (params[1], "bcc") == 0) {
+ *bcc = g_list_prepend (*bcc, g_strdup (params[1]));
+ }
+
+ g_strfreev (params);
+ i++;
+ }
+
+ g_strfreev (options);
+ /* Reverse the list so it's in the correct order */
+ *cc = g_list_reverse (*cc);
+ *bcc = g_list_reverse (*bcc);
+}
+
+static void
+recipients_from_list (GNOME_Evolution_Composer_RecipientList *recipients,
+ GList *list)
+{
+ GList *t;
+ int i;
+
+ for (i = 0, t = list; t; i++, t = t->next) {
+ GNOME_Evolution_Composer_Recipient *recipient;
+ char *address = (char *)t->data;
+
+ recipient = recipients->_buffer + i;
+ recipient->name = CORBA_string_dup ("");
+ recipient->address = CORBA_string_dup (address ? address : "");
+ }
+}
+
+static void
+free_list (GList *list)
+{
+ for (; list; list = list->next) {
+ g_free (list->data);
+ }
+}
+
gboolean
e_summary_url_mail_compose (ESummary *esummary,
const char *url)
{
CORBA_Object composer;
CORBA_Environment ev;
+ char *full_address, *address, *proto, *q;
GNOME_Evolution_Composer_RecipientList *to, *cc, *bcc;
GNOME_Evolution_Composer_Recipient *recipient;
- char *address, *proto;
CORBA_char *subject;
+ GList *gcc = NULL, *gbcc = NULL;
+ char *gsubject = NULL;
CORBA_exception_init (&ev);
@@ -459,12 +506,20 @@ e_summary_url_mail_compose (ESummary *esummary,
}
if ( (proto = strstr (url, "://")) != NULL){
- address = proto + 3;
+ full_address = proto + 3;
} else {
if (strncmp (url, "mailto:", 7) == 0)
- address = (char *) (url + 7);
+ full_address = (char *) (url + 7);
else
- address = (char *) url;
+ full_address = (char *) url;
+ }
+
+ q = strchr (full_address, '?');
+ if (q != NULL) {
+ address = g_strndup (full_address, q - full_address);
+ parse_mail_url (q + 1, &gcc, &gbcc, &gsubject);
+ } else {
+ address = g_strdup (full_address);
}
to = GNOME_Evolution_Composer_RecipientList__alloc ();
@@ -475,31 +530,48 @@ e_summary_url_mail_compose (ESummary *esummary,
recipient = to->_buffer;
recipient->name = CORBA_string_dup ("");
recipient->address = CORBA_string_dup (address?address:"");
-
+ g_free (address);
+
/* FIXME: Get these out of the URL */
cc = GNOME_Evolution_Composer_RecipientList__alloc ();
- cc->_length = 0;
- cc->_maximum = 0;
+ cc->_length = g_list_length (gcc);
+ cc->_maximum = cc->_length;
cc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (cc->_maximum);
+ recipients_from_list (cc, gcc);
+ free_list (gcc);
+ g_list_free (gcc);
+
bcc = GNOME_Evolution_Composer_RecipientList__alloc ();
- bcc->_length = 0;
- bcc->_maximum = 0;
+ bcc->_length = g_list_length (gbcc);
+ bcc->_maximum = bcc->_length;
bcc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (bcc->_maximum);
- subject = CORBA_string_dup ("");
-
+ recipients_from_list (bcc, gbcc);
+ free_list (gbcc);
+ g_list_free (gbcc);
+
+ subject = CORBA_string_dup (gsubject ? gsubject : "");
+ g_free (gsubject);
+
CORBA_exception_init (&ev);
GNOME_Evolution_Composer_setHeaders (composer, to, cc, bcc, subject, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
CORBA_free (to);
+ CORBA_free (cc);
+ CORBA_free (bcc);
+ CORBA_free (subject);
+
g_warning ("%s(%d): Error setting headers", __FUNCTION__, __LINE__);
return FALSE;
}
CORBA_free (to);
-
+ CORBA_free (cc);
+ CORBA_free (bcc);
+ CORBA_free (subject);
+
CORBA_exception_init (&ev);
GNOME_Evolution_Composer_show (composer, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c
index f8de1752be..e9bf104fd1 100644
--- a/executive-summary/component/e-summary.c
+++ b/executive-summary/component/e-summary.c
@@ -34,6 +34,8 @@
#include <gtkhtml/htmlengine.h>
#include <gtkhtml/htmlselection.h>
#include <gal/util/e-util.h>
+#include <gal/widgets/e-gui-utils.h>
+#include <libgnomevfs/gnome-vfs.h>
#include "e-summary.h"
#include "e-summary-factory.h"
@@ -42,6 +44,10 @@
#define PARENT_TYPE (gtk_vbox_get_type ())
+#define STORAGE_TYPE "efs"
+#define IID_FILE "oaf.id"
+#define DATA_FILE "data"
+
/* From component-factory.c */
extern char *evolution_dir;
@@ -54,15 +60,17 @@ struct _ESummaryPrivate {
GtkWidget *html_scroller;
GtkWidget *html;
- GHashTable *id_to_view;
- GHashTable *view_to_window;
- GHashTable *summary_to_window;
- GList *window_list;
-
guint idle;
GtkHTMLStream *stream;
gboolean grabbed;
+
+ GList *window_list;
+
+ char *header;
+ int header_len;
+ char *footer;
+ int footer_len;
};
static gboolean on_object_requested (GtkHTML *html,
@@ -72,23 +80,29 @@ static void e_summary_save_state (ESummary *esummary,
const char *path);
static void e_summary_load_state (ESummary *esummary,
const char *path);
-
-/* GtkObject methods */
-static void
-s2w_foreach (gpointer *key,
- gpointer *value,
- ESummary *esummary)
-{
- e_summary_window_free ((ESummaryWindow *) value, esummary);
- g_free (value);
-}
+/* Used to distinguish dead windows */
+static ESummaryWindow dead_window = {
+ CORBA_OBJECT_NIL,
+ CORBA_OBJECT_NIL,
+ CORBA_OBJECT_NIL,
+ CORBA_OBJECT_NIL,
+ CORBA_OBJECT_NIL,
+ CORBA_OBJECT_NIL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+/* GtkObject methods */
static void
e_summary_destroy (GtkObject *object)
{
ESummary *esummary = E_SUMMARY (object);
ESummaryPrivate *priv;
+ GList *l;
char *prefix;
priv = esummary->private;
@@ -99,12 +113,12 @@ e_summary_destroy (GtkObject *object)
e_summary_save_state (esummary, prefix);
g_free (prefix);
- g_hash_table_foreach (priv->summary_to_window,
- (GHFunc) s2w_foreach, esummary);
- g_hash_table_destroy (priv->summary_to_window);
- g_hash_table_destroy (priv->id_to_view);
- g_hash_table_destroy (priv->view_to_window);
+ for (l = priv->window_list; l; l = l->next)
+ e_summary_window_free (l->data);
+ g_list_free (priv->window_list);
+ g_free (priv->header);
+ g_free (priv->footer);
g_free (esummary->private);
esummary->private = NULL;
@@ -120,51 +134,64 @@ e_summary_class_init (GtkObjectClass *object_class)
}
static void
-e_summary_start_load (ESummary *summary)
+e_summary_start_load (ESummary *esummary)
{
ESummaryPrivate *priv;
- char *header = "<html><body bgcolor=\"#ffffff\">";
- priv = summary->private;
+ g_return_if_fail (esummary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (esummary));
+
+ priv = esummary->private;
priv->stream = gtk_html_begin (GTK_HTML (priv->html));
/* Hack to stop page returning to the top */
GTK_HTML (priv->html)->engine->newPage = FALSE;
-
- gtk_html_write (GTK_HTML (priv->html), priv->stream,
- header, strlen (header));
}
static void
-load_default (ESummary *summary)
+load_default_header (ESummary *esummary)
{
ESummaryPrivate *priv;
- char *def = "<table width=\"100%\"><tr><td align=\"right\">"
+ char *def = "<html><body bgcolor=\"#ffffff\">"
+ "<table width=\"100%\"><tr><td align=\"right\">"
"<img src=\"ccsplash.png\"></td></tr></table>"
"<table><tr><td><a href=\"exec://bug-buddy\"><img src=\"file://gnome-spider.png\" width=\"24\" height=\"24\" border=\"0\">"
"</a></td><td><a href=\"exec://bug-buddy\">Submit a bug report"
"</a></td></tr></table><hr>";
- g_return_if_fail (summary != NULL);
- g_return_if_fail (IS_E_SUMMARY (summary));
+ g_return_if_fail (esummary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (esummary));
- priv = summary->private;
+ priv = esummary->private;
g_return_if_fail (priv->stream != NULL);
gtk_html_write (GTK_HTML (priv->html), priv->stream, def, strlen (def));
}
-
static void
-e_summary_end_load (ESummary *summary)
+load_default_footer (ESummary *esummary)
{
ESummaryPrivate *priv;
char *footer = "<hr><p align=\"right\">All Executive Summary comments to <a href=\"mailto:iain@helixcode.com\">Iain Holmes (iain@helixcode.com)</a></p></body></html>";
- priv = summary->private;
+ g_return_if_fail (esummary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (esummary));
+
+ priv = esummary->private;
gtk_html_write (GTK_HTML (priv->html), priv->stream,
footer, strlen (footer));
+}
+
+static void
+e_summary_end_load (ESummary *esummary)
+{
+ ESummaryPrivate *priv;
+
+ g_return_if_fail (esummary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (esummary));
+
+ priv = esummary->private;
gtk_html_end (GTK_HTML (priv->html), priv->stream, GTK_HTML_STREAM_OK);
priv->stream = NULL;
@@ -195,7 +222,7 @@ e_summary_init (ESummary *esummary)
GTK_SIGNAL_FUNC (on_object_requested), esummary);
gtk_signal_connect (GTK_OBJECT (priv->html), "link-clicked",
GTK_SIGNAL_FUNC (e_summary_url_click), esummary);
- gtk_signal_connect (GTK_OBJECT (priv->html), "on_url",
+ gtk_signal_connect (GTK_OBJECT (priv->html), "on-url",
GTK_SIGNAL_FUNC (e_summary_url_over), esummary);
gtk_container_add (GTK_CONTAINER (priv->html_scroller), priv->html);
@@ -206,11 +233,6 @@ e_summary_init (ESummary *esummary)
/* Pack stuff */
gtk_box_pack_start (GTK_BOX (esummary), priv->html_scroller,
TRUE, TRUE, 0);
-
- /* Init hashtables */
- priv->summary_to_window = g_hash_table_new (NULL, NULL);
- priv->id_to_view = g_hash_table_new (NULL, NULL);
- priv->view_to_window = g_hash_table_new (NULL, NULL);
}
E_MAKE_TYPE (e_summary, "ESummary", ESummary, e_summary_class_init,
@@ -237,40 +259,172 @@ e_summary_new (const GNOME_Evolution_Shell shell)
return GTK_WIDGET (esummary);
}
+#if 0
+static void
+control_unrealize (GtkHTMLEmbedded *eb,
+ GtkWidget *widget)
+{
+ g_print ("Removing\n");
+}
+
+static void
+being_unrealized (GtkWidget *widget,
+ GtkHTMLEmbedded *eb)
+{
+ g_warning ("Widget is being unrealized");
+ gtk_container_remove (GTK_CONTAINER (eb), widget);
+}
+
+static void
+being_realized (GtkWidget *widget,
+ gpointer user_data)
+{
+ gdk_window_ref (widget->window);
+}
+#endif
+
static gboolean
on_object_requested (GtkHTML *html,
GtkHTMLEmbedded *eb,
- ESummary *summary)
+ ESummary *esummary)
{
- ESummaryWindow *window;
- int type;
+#if 0
+ static GtkWidget *widget = NULL;
+ int id;
- if (sscanf (eb->classid, "cid:%d-%p", &type, &window) != 2) {
- g_warning ("Could not get the window reference\n");
+ if (sscanf (eb->classid, "cid:%d", &id) != 1) {
+ g_warning ("Could not get the view id: eb->classid = %s",
+ eb->classid);
return FALSE;
}
- switch (type) {
- case 1:
- g_assert_not_reached ();
- break;
-
- case 2:
- g_warning ("Bonobo services are not supported in this version.");
- break;
+ if (widget == NULL || !GTK_IS_WIDGET (widget)) {
+ g_print ("Create new\n");
+ widget = executive_summary_component_view_get_widget (view);
+/* widget = gtk_button_new_with_label ("Hello?"); */
+ gtk_signal_connect (GTK_OBJECT (widget), "realize",
+ GTK_SIGNAL_FUNC (being_realized), NULL);
+ gtk_signal_connect (GTK_OBJECT (widget), "unrealize",
+ GTK_SIGNAL_FUNC (being_unrealized), eb);
+ g_print ("New widget: %p\n", GTK_BIN (widget)->child);
+ } else {
+ g_print ("No new\n");
+ }
- default:
- g_assert_not_reached ();
+ if (widget == NULL) {
+ g_warning ("View %d has no GtkWidget.", id);
+ return FALSE;
}
+ gtk_signal_connect (GTK_OBJECT (eb), "unrealize",
+ GTK_SIGNAL_FUNC (control_unrealize), widget);
+ gtk_widget_show_all (widget);
+ gtk_widget_ref (widget);
+
+ if (widget->parent == NULL)
+ gtk_container_add (GTK_CONTAINER (eb), widget);
+
return TRUE;
+#endif
+}
+
+/* Generates the window controls and works out
+ if they should be disabled or not */
+static char *
+make_control_html (ESummaryWindow *window,
+ int row,
+ int col,
+ int numwindows)
+{
+ char *html, *tmp;
+ int id = GPOINTER_TO_INT (window);
+ gboolean u, d, l, r, config;
+
+ u = d = l = r = config = TRUE;
+
+ if (window->propertycontrol == CORBA_OBJECT_NIL)
+ config = FALSE;
+
+ if (row == 0) /* Top row */
+ u = FALSE;
+
+ if (row >= numwindows - 3) /* Bottom row */
+ d = FALSE;
+
+ if (col == 0) /* Leftmost column */
+ l = FALSE;
+
+ if (col == 2 || ((row * 3) + col) == numwindows - 1) /* Rightmost column */
+ r = FALSE;
+
+ html = g_strdup_printf ("<table><tr><td><a href=\"close://%d\">"
+ "<img src=\"service-close.png\" border=\"0\">"
+ "</a></td><td>", id);
+
+ tmp = html;
+ if (!config) {
+ html = g_strdup_printf ("%s<img src=\"service-configure.png\">"
+ "</td></tr><tr><td>", tmp);
+ } else {
+ html = g_strdup_printf ("%s<a href=\"configure://%d\">"
+ "<img src=\"service-configure.png\" border=\"0\">"
+ "</a></td></tr><tr><td>", tmp, id);
+ }
+ g_free (tmp);
+
+ tmp = html;
+ if (!l) {
+ html = g_strdup_printf ("%s<img src=\"service-left-disabled.png\">"
+ "</td><td>", tmp);
+ } else {
+ html = g_strdup_printf ("%s<a href=\"left://%d\">"
+ "<img src=\"service-left.png\" border=\"0\">"
+ "</a></td><td>", tmp, id);
+ }
+ g_free (tmp);
+
+ tmp = html;
+ if (!r) {
+ html = g_strdup_printf ("%s<img src=\"service-right-disabled.png\">"
+ "</td></tr><tr><td>", tmp);
+ } else {
+ html = g_strdup_printf ("%s<a href=\"right://%d\">"
+ "<img src=\"service-right.png\" border=\"0\">"
+ "</a></td></tr><tr><td>", tmp, id);
+ }
+ g_free (tmp);
+
+ tmp = html;
+ if (!d) {
+ html = g_strdup_printf ("%s<img src=\"service-down-disabled.png\">"
+ "</td><td>", tmp);
+ } else {
+ html = g_strdup_printf ("%s<a href=\"down://%d\">"
+ "<img src=\"service-down.png\" border=\"0\">"
+ "</a></td><td>", tmp, id);
+ }
+ g_free (tmp);
+
+ tmp = html;
+ if (!u) {
+ html = g_strdup_printf ("%s<img src=\"service-up-disabled.png\">"
+ "</td></tr></table>", tmp);
+ } else {
+ html = g_strdup_printf ("%s<a href=\"up://%d\">"
+ "<img src=\"service-up.png\" border=\"0\">"
+ "</a></td></tr></table>", tmp, id);
+ }
+ g_free (tmp);
+
+ return html;
}
static void
e_summary_display_window (ESummary *esummary,
ESummaryWindow *window,
int row,
- int col)
+ int col,
+ int numwindows)
{
ESummaryPrivate *priv;
char *footer = "</td></tr></table>";
@@ -280,52 +434,50 @@ e_summary_display_window (ESummary *esummary,
"edeeeb"};
char *title_colour[2] = {"bac1b6",
"cdd1c7"};
- const char *title, *icon, *html;
- int id;
priv = esummary->private;
- title = executive_summary_component_view_get_title (window->view);
- icon = executive_summary_component_view_get_icon (window->view);
- html = executive_summary_component_view_get_html (window->view);
- id = executive_summary_component_view_get_id (window->view);
-
- /** FIXME: Make this faster by caching it? */
-
- control_html = g_strdup_printf
- ("<table width=\"32\" height=\"48\"><tr><td>"
- "<a href=\"close://%d\"><img border=\"0\" src=\"service-close.png\"></a></td>"
- "<td><a href=\"configure://%d\"><img border=\"0\" src=\"service-configure.png\"></a></td></tr>"
- "<tr><td><a href=\"left://%d\"><img border=\"0\" src=\"service-left.png\"></a></td>"
- "<td><a href=\"right://%d\"><img border=\"0\" src=\"service-right.png\"></a></td></tr>"
- "<tr><td><a href=\"down://%d\"><img border=\"0\" src=\"service-down.png\"></a></td>"
- "<td><a href=\"up://%d\"><img border=\"0\" src=\"service-up.png\"></a></td></tr></table>", id, id, id, id, id, id);
-
+ control_html = make_control_html (window, row, col, numwindows);
title_html = g_strdup_printf ("<table cellspacing=\"0\" "
"cellpadding=\"0\" border=\"0\" width=\"100%%\" height=\"100%%\">"
"<tr><td bgcolor=\"#%s\">"
- "<table width=\"100%%\"><tr><td>"
+ "<table width=\"100%%\" height=\"100%%\"><tr><td>"
"<img src=\"%s\"></td>"
"<td nowrap align=\"center\" width=\"100%%\">"
"<b>%s</b></td><td>%s</td></tr></table></td></tr><tr>"
"<td bgcolor=\"#%s\" height=\"100%%\">",
- title_colour[col % 2], icon, title,
- control_html, colour[col % 2]);
+ title_colour[col % 2], window->icon,
+ window->title, control_html,
+ colour[col % 2]);
g_free (control_html);
gtk_html_write (GTK_HTML (priv->html), priv->stream, title_html,
strlen (title_html));
g_free (title_html);
- if (html != NULL && *html != '\0') {
+ if (window->html != CORBA_OBJECT_NIL) {
+ char *html;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+ html = GNOME_Evolution_Summary_HTMLView_getHtml (window->html,
+ &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("Cannot get HTML.");
+ return;
+ }
+ CORBA_exception_free (&ev);
+
gtk_html_write (GTK_HTML (priv->html), priv->stream,
html, strlen (html));
} else {
- g_warning ("Bonobo executive summary components are not supported at this time.");
#if 0
- body_cid = g_strdup_printf ("<object classid=\"cid:2-%p\"></object>", window);
+ char *body_cid;
+
+ body_cid = g_strdup_printf ("<object classid=\"cid:%d\"></object>", id);
gtk_html_write (GTK_HTML (priv->html), priv->stream,
body_cid, strlen (body_cid));
+ g_free (body_cid);
#endif
}
@@ -340,6 +492,7 @@ e_summary_rebuild_page (ESummary *esummary)
GList *windows;
char *service_table = "<table numcols=\"3\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" height=\"100%\">";
int loc;
+ int numwindows;
g_return_val_if_fail (esummary != NULL, FALSE);
g_return_val_if_fail (IS_E_SUMMARY (esummary), FALSE);
@@ -354,13 +507,20 @@ e_summary_rebuild_page (ESummary *esummary)
gtk_layout_freeze (GTK_LAYOUT (priv->html));
e_summary_start_load (esummary);
- load_default (esummary);
+
+ if (priv->header == NULL) {
+ load_default_header (esummary);
+ } else {
+ gtk_html_write (GTK_HTML (priv->html), priv->stream,
+ priv->header, priv->header_len);
+ }
/* Load the start of the services */
gtk_html_write (GTK_HTML (priv->html), priv->stream, service_table,
strlen (service_table));
/* Load each of the services */
loc = 0;
+ numwindows = g_list_length (priv->window_list);
for (windows = priv->window_list; windows; windows = windows->next) {
ESummaryWindow *window;
char *td = "<td height=\"100%\" width=\"33%\" valign=\"top\">";
@@ -380,7 +540,7 @@ e_summary_rebuild_page (ESummary *esummary)
td, strlen (td));
e_summary_display_window (esummary, window,
- (loc / 3), (loc % 3));
+ (loc / 3), (loc % 3), numwindows);
gtk_html_write (GTK_HTML (priv->html), priv->stream, "</td>", 5);
loc++;
@@ -388,6 +548,14 @@ e_summary_rebuild_page (ESummary *esummary)
gtk_html_write (GTK_HTML (priv->html), priv->stream, "</tr></table>",
13);
+
+ if (priv->footer == NULL) {
+ load_default_footer (esummary);
+ } else {
+ gtk_html_write (GTK_HTML (priv->html), priv->stream,
+ priv->footer, priv->footer_len);
+ }
+
e_summary_end_load (esummary);
gtk_layout_thaw (GTK_LAYOUT (priv->html));
@@ -395,169 +563,187 @@ e_summary_rebuild_page (ESummary *esummary)
return FALSE;
}
-void
-e_summary_add_service (ESummary *esummary,
- ExecutiveSummary *summary,
- ExecutiveSummaryComponentView *view,
- const char *iid)
+static void
+prop_changed_cb (BonoboPropertyListener *listener,
+ char *name,
+ BonoboArg *arg,
+ ESummaryWindow *window)
{
- ESummaryWindow *window;
- ESummaryPrivate *priv;
- int id;
-
- g_return_if_fail (esummary != NULL);
- g_return_if_fail (IS_E_SUMMARY (esummary));
- g_return_if_fail (summary != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY (summary));
- g_return_if_fail (view != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
-
- window = g_new0 (ESummaryWindow, 1);
- window->summary = summary;
- window->iid = g_strdup (iid);
- window->view = view;
+ if (strcmp (name, "window_title") == 0) {
+ if (window->title != NULL)
+ g_free (window->title);
+ window->title = g_strdup (BONOBO_ARG_GET_STRING (arg));
+ return;
+ }
- priv = esummary->private;
- priv->window_list = g_list_append (priv->window_list, window);
- g_hash_table_insert (priv->summary_to_window, summary, window);
-
- id = executive_summary_component_view_get_id (view);
- g_hash_table_insert (priv->id_to_view, GINT_TO_POINTER (id), view);
- g_hash_table_insert (priv->view_to_window, view, window);
+ if (strcmp (name, "window_icon") == 0) {
+ if (window->icon != NULL)
+ g_free (window->icon);
+ window->icon = g_strdup (BONOBO_ARG_GET_STRING (arg));
+ return;
+ }
}
-
-#if 0
-void
-e_summary_add_html_service (ESummary *esummary,
- ExecutiveSummary *summary,
- ExecutiveSummaryComponentClient *client,
- const char *html,
- const char *title,
- const char *icon)
+
+ESummaryWindow *
+e_summary_add_service (ESummary *esummary,
+ GNOME_Evolution_Summary_Component component,
+ const char *iid)
{
ESummaryWindow *window;
ESummaryPrivate *priv;
+ Bonobo_Unknown unknown = CORBA_OBJECT_NIL;
+ Bonobo_PropertyListener corba_listener;
+ CORBA_Environment ev;
- window = g_new0 (ESummaryWindow, 1);
- window->type = E_SUMMARY_WINDOW_HTML;
- window->html = g_strdup (html);
- window->title = g_strdup (title);
- window->icon = icon ? g_strdup (icon) : NULL;
- window->client = client;
+ g_return_val_if_fail (esummary != NULL, NULL);
+ g_return_val_if_fail (IS_E_SUMMARY (esummary), NULL);
+ g_return_val_if_fail (component != CORBA_OBJECT_NIL, NULL);
- window->summary = summary;
priv = esummary->private;
- priv->window_list = g_list_append (priv->window_list, window);
-
- g_hash_table_insert (priv->summary_to_window, summary, window);
-}
-void
-e_summary_add_bonobo_service (ESummary *esummary,
- ExecutiveSummary *summary,
- ExecutiveSummaryComponentClient *client,
- GtkWidget *control,
- const char *title,
- const char *icon)
-{
- ESummaryWindow *window;
- ESummaryPrivate *priv;
-
window = g_new0 (ESummaryWindow, 1);
- window->type = E_SUMMARY_WINDOW_BONOBO;
- window->control = control;
+ window->component = component;
+ window->iid = g_strdup (iid);
- window->client = client;
+ /* See what interfaces our component supports */
+ CORBA_exception_init (&ev);
+ unknown = Bonobo_Unknown_queryInterface (component,
+ "IDL:Bonobo/Control:1.0", &ev);
+ window->control = (Bonobo_Control) unknown;
+
+ unknown = Bonobo_Unknown_queryInterface (component,
+ "IDL:GNOME/Evolution/Summary/HTMLView:1.0",
+ &ev);
+ window->html = (GNOME_Evolution_Summary_HTMLView) unknown;
+
+ /* Check at least one of the above interfaces was supported */
+ if (window->html == CORBA_OBJECT_NIL &&
+ window->control == CORBA_OBJECT_NIL) {
+ CORBA_Environment ev2;
+ g_warning ("This component does not support either"
+ "Bonobo/Control:1.0 or GNOME/Evolution/Summary/HTMLView:1.0");
+
+ CORBA_exception_init (&ev2);
+ CORBA_Object_release (component, &ev2);
+ CORBA_exception_free (&ev2);
+
+ g_free (window);
+ return NULL;
+ }
- window->title = g_strdup (title);
- window->summary = summary;
- window->icon = icon ? g_strdup (icon): NULL;
+ unknown = Bonobo_Unknown_queryInterface (component,
+ "IDL:Bonobo/PropertyBag:1.0",
+ &ev);
+ window->propertybag = (Bonobo_PropertyBag) unknown;
+
+ unknown = Bonobo_Unknown_queryInterface (component,
+ "IDL:Bonobo/PersistStream:1.0",
+ &ev);
+ window->persiststream = (Bonobo_PersistStream) unknown;
+
+ unknown = Bonobo_Unknown_queryInterface (component,
+ "IDL:Bonobo/PropertyControl:1.0",
+ &ev);
+ window->propertycontrol = (Bonobo_PropertyControl) unknown;
+
+ /* Cache the title and icon */
+ window->title = g_strdup (bonobo_property_bag_client_get_value_string (
+ window->propertybag,
+ "window_title",
+ NULL));
+ window->icon = g_strdup (bonobo_property_bag_client_get_value_string (
+ window->propertybag,
+ "window_icon", NULL));
+ /* Listen to changes */
+ window->listener = bonobo_property_listener_new ();
+ gtk_signal_connect (GTK_OBJECT (window->listener), "prop_changed",
+ GTK_SIGNAL_FUNC (prop_changed_cb), window);
+ corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (window->listener));
+ Bonobo_PropertyBag_addChangeListener (window->propertybag,
+ "window_title",
+ corba_listener, &ev);
+
+ Bonobo_PropertyBag_addChangeListener (window->propertybag,
+ "window_icon",
+ corba_listener, &ev);
+ CORBA_exception_free (&ev);
- priv = esummary->private;
priv->window_list = g_list_append (priv->window_list, window);
- g_hash_table_insert (priv->summary_to_window, summary, window);
+ return window;
}
-#endif
void
-e_summary_window_free (ESummaryWindow *window,
- ESummary *esummary)
+e_summary_window_free (ESummaryWindow *window)
{
- ESummaryPrivate *priv;
+ CORBA_Environment ev;
g_return_if_fail (window != NULL);
- g_return_if_fail (esummary != NULL);
- g_return_if_fail (IS_E_SUMMARY (esummary));
- priv = esummary->private;
g_free (window->iid);
+ g_free (window->icon);
+ g_free (window->title);
- priv->window_list = g_list_remove (priv->window_list, window);
+ CORBA_exception_init (&ev);
+ Bonobo_Unknown_unref (window->component, &ev);
+ CORBA_Object_release (window->component, &ev);
- bonobo_object_unref (BONOBO_OBJECT (window->summary));
- gtk_object_unref (GTK_OBJECT (window->view));
-}
+ if (window->control != CORBA_OBJECT_NIL) {
+ CORBA_Object_release (window->control, &ev);
+ }
-/* Call this before e_summary_window_free, execpt when you are freeing
- the hash table */
-void
-e_summary_window_remove_from_ht (ESummaryWindow *window,
- ESummary *esummary)
-{
- ESummaryPrivate *priv;
+ if (window->html != CORBA_OBJECT_NIL) {
+ CORBA_Object_release (window->html, &ev);
+ }
- priv = esummary->private;
- g_hash_table_remove (priv->summary_to_window, window->summary);
+ if (window->propertybag != CORBA_OBJECT_NIL) {
+ CORBA_Object_release (window->propertybag, &ev);
+ }
+
+ if (window->persiststream != CORBA_OBJECT_NIL) {
+ CORBA_Object_release (window->persiststream, &ev);
+ }
+
+ if (window->propertycontrol != CORBA_OBJECT_NIL) {
+ CORBA_Object_release (window->propertycontrol, &ev);
+ }
+
+ CORBA_exception_free (&ev);
+
+ g_free (window);
+
+ /* The contents of window are set to dead_window
+ so we know if we're trying to access a window
+ that no longer exists */
+ *window = dead_window;
}
void
-e_summary_update_window (ESummary *esummary,
- ExecutiveSummary *summary,
- const char *html)
+e_summary_remove_window (ESummary *esummary,
+ ESummaryWindow *window)
{
ESummaryPrivate *priv;
-
+
g_return_if_fail (esummary != NULL);
g_return_if_fail (IS_E_SUMMARY (esummary));
- g_return_if_fail (summary != NULL);
-
- priv = esummary->private;
-
- if (priv->idle != 0)
- return;
-
- priv->idle = g_idle_add ((GSourceFunc) e_summary_rebuild_page, esummary);
-}
-
-ExecutiveSummaryComponentView *
-e_summary_view_from_id (ESummary *esummary,
- int id)
-{
- ESummaryPrivate *priv;
- ExecutiveSummaryComponentView *view;
-
- g_return_val_if_fail (esummary != NULL, NULL);
- g_return_val_if_fail (IS_E_SUMMARY (esummary), NULL);
- g_return_val_if_fail (id > 0, NULL);
+ g_return_if_fail (window != NULL);
priv = esummary->private;
- view = g_hash_table_lookup (priv->id_to_view, GINT_TO_POINTER (id));
-
- return view;
+ priv->window_list = g_list_remove (priv->window_list, window);
+ e_summary_window_free (window);
}
-
+
void
-e_summary_set_shell_view_interface (ESummary *summary,
+e_summary_set_shell_view_interface (ESummary *esummary,
GNOME_Evolution_ShellView svi)
{
ESummaryPrivate *priv;
- g_return_if_fail (summary != NULL);
- g_return_if_fail (IS_E_SUMMARY (summary));
+ g_return_if_fail (esummary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (esummary));
g_return_if_fail (svi != CORBA_OBJECT_NIL);
- priv = summary->private;
+ priv = esummary->private;
priv->shell_view_interface = svi;
}
@@ -654,72 +840,329 @@ e_summary_set_title (ESummary *esummary,
}
static void
+load_html_page (ESummary *esummary,
+ const char *filename)
+{
+ ESummaryPrivate *priv;
+ GnomeVFSHandle *handle = NULL;
+ GnomeVFSResult result;
+ GtkWidget *toplevel;
+ GString *string;
+ char *str, *comment;
+
+ g_return_if_fail (esummary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (esummary));
+
+ priv = esummary->private;
+
+ /* Pass NULL to reset the page to the default */
+ if (filename == NULL || *filename == '\0') {
+ g_free (priv->header);
+ g_free (priv->footer);
+ return;
+ }
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (esummary));
+ string = g_string_new ("");
+ result = gnome_vfs_open (&handle, filename, GNOME_VFS_OPEN_READ);
+ if (result != GNOME_VFS_OK) {
+ e_notice (GTK_WINDOW (toplevel), GNOME_MESSAGE_BOX_WARNING,
+ _("Cannot open the HTML file:\n%s"), filename);
+ return;
+ }
+
+ while (1) {
+ char buffer[4096];
+ GnomeVFSFileSize size;
+
+ memset (buffer, 0x00, 4096);
+ result = gnome_vfs_read (handle, buffer, 4096, &size);
+ if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) {
+ e_notice (GTK_WINDOW (toplevel), GNOME_MESSAGE_BOX_WARNING,
+ _("Error reading data:\n%s"),
+ gnome_vfs_result_to_string (result));
+ gnome_vfs_close (handle);
+ return;
+ }
+ if (size == 0)
+ break; /* EOF */
+
+ string = g_string_append (string, buffer);
+ }
+
+ gnome_vfs_close (handle);
+ str = string->str;
+ g_string_free (string, FALSE);
+
+ comment = strstr (str, "<!-- EVOLUTION EXECUTIVE SUMMARY SERVICES DO NOT REMOVE -->");
+ if (comment == NULL) {
+ e_notice (GTK_WINDOW (toplevel), GNOME_MESSAGE_BOX_WARNING,
+ _("File does not have a place for the services.\n"));
+ g_free (str);
+ return;
+ }
+
+ priv->header = g_strndup (str, comment - str);
+ priv->header_len = strlen (priv->header);
+ priv->footer = g_strdup (comment);
+ priv->footer_len = strlen (priv->footer);
+ g_free (str);
+}
+
+static char *
+load_component_id_stream_read (Bonobo_Stream stream,
+ CORBA_Environment *ev)
+{
+ Bonobo_Stream_iobuf *buffer;
+ GString *str;
+ char *ans;
+
+ str = g_string_sized_new (256);
+#define READ_CHUNK_SIZE 65536
+ do {
+ int i;
+ Bonobo_Stream_read (stream, READ_CHUNK_SIZE, &buffer, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ return NULL;
+
+ /* FIXME: make better PLEASE!!!*/
+ for (i = 0; i < buffer->_length; i++)
+ g_string_append_c (str, buffer->_buffer[i]);
+
+ if (buffer->_length <= 0)
+ break;
+ CORBA_free (buffer);
+ } while (1);
+#undef READ_CHUNK_SIZE
+ CORBA_free (buffer);
+
+ ans = str->str;
+ g_string_free (str, FALSE);
+
+ return ans;
+}
+
+static char *
+load_component_id (Bonobo_Storage corba_storage,
+ CORBA_Environment *ev)
+{
+ Bonobo_Stream corba_stream;
+ char *iid;
+
+ corba_stream = Bonobo_Storage_openStream (corba_storage, IID_FILE,
+ Bonobo_Storage_READ, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ return NULL;
+
+ if (corba_stream) {
+ iid = load_component_id_stream_read (corba_stream, ev);
+ Bonobo_Unknown_unref (corba_stream, ev);
+ CORBA_Object_release (corba_stream, ev);
+ } else {
+ g_warning ("Cannot find `%s'", IID_FILE);
+ return NULL;
+ }
+
+ return iid;
+}
+
+static void
+load_component (ESummary *esummary,
+ BonoboStorage *storage,
+ int index)
+{
+ char *curdir;
+ char *iid;
+ Bonobo_Storage corba_subdir;
+ Bonobo_Storage corba_storage;
+ ESummaryWindow *window;
+ CORBA_Environment ev;
+
+ curdir = g_strdup_printf ("%08d", index);
+ corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (storage));
+ CORBA_exception_init (&ev);
+
+ corba_subdir = Bonobo_Storage_openStorage (corba_storage, curdir,
+ Bonobo_Storage_READ, &ev);
+ iid = load_component_id (corba_subdir, &ev);
+
+ if (iid) {
+ Bonobo_Stream corba_stream;
+
+ window = e_summary_factory_embed_service_from_id (esummary, iid);
+ if (window) {
+ if (window->persiststream) {
+ corba_stream = Bonobo_Storage_openStream
+ (corba_subdir,
+ DATA_FILE,
+ Bonobo_Storage_READ, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ return;
+
+ Bonobo_PersistStream_load (window->persiststream,
+ corba_stream,
+ "", &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ g_warning ("Could not load `%s'", iid);
+
+ }
+ }
+
+ g_free (iid);
+ }
+
+ CORBA_exception_free (&ev);
+ g_free (curdir);
+}
+
+static void
e_summary_load_state (ESummary *esummary,
const char *path)
{
char *fullpath;
- char **argv;
- int argc, i;
+ char *htmlpage = NULL;
+ BonoboStorage *storage;
+ Bonobo_Storage corba_storage;
+ Bonobo_Storage_DirectoryList *list;
+ CORBA_Environment ev;
+ int i;
g_return_if_fail (esummary != NULL);
g_return_if_fail (IS_E_SUMMARY (esummary));
- fullpath = g_strdup_printf ("=%s=/services/iids", path);
- gnome_config_get_vector (fullpath, &argc, &argv);
+ fullpath = g_strdup_printf ("%s", path);
+ storage = bonobo_storage_open (STORAGE_TYPE, fullpath,
+ Bonobo_Storage_READ |
+ Bonobo_Storage_WRITE,
+ 0664);
+ if (storage != NULL) {
+ CORBA_exception_init (&ev);
+
+ corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (storage));
+ list = Bonobo_Storage_listContents (corba_storage, "/", 0, &ev);
+ if (!list) {
+ CORBA_exception_free (&ev);
+ bonobo_object_unref (BONOBO_OBJECT (storage));
+ return;
+ }
+
+ for (i = 0; i < list->_length; i++)
+ load_component (esummary, storage, i);
+
+ CORBA_free (list);
+ bonobo_object_unref (BONOBO_OBJECT (storage));
+ }
- for (i = 0; i < argc; i++) {
- e_summary_factory_embed_service_from_id (esummary, argv[i]);
+ g_free (fullpath);
+
+ /* Load the html page */
+ fullpath = g_strdup_printf ("=%s=/executive-summary/page", path);
+ htmlpage = gnome_config_get_string (fullpath);
+ g_print ("htmlpage: %s\n", htmlpage);
+ if (htmlpage) {
+ load_html_page (esummary, htmlpage);
}
-
- g_free (argv);
g_free (fullpath);
+ g_free (htmlpage);
}
static void
+save_component (BonoboStorage *storage,
+ ESummaryWindow *window,
+ int index)
+{
+ char *curdir = g_strdup_printf ("%08d", index);
+ Bonobo_Storage corba_storage;
+ Bonobo_Storage corba_subdir;
+ CORBA_Environment ev;
+
+ corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (storage));
+ CORBA_exception_init (&ev);
+
+ corba_subdir = Bonobo_Storage_openStorage (corba_storage, curdir,
+ Bonobo_Storage_CREATE, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("Cannot create '%s'", curdir);
+ } else {
+ Bonobo_Stream corba_stream;
+
+ corba_stream = Bonobo_Storage_openStream
+ (corba_subdir, IID_FILE, Bonobo_Storage_CREATE, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("EEk: %s", CORBA_exception_id (&ev));
+ return;
+ }
+
+ bonobo_stream_client_write_string (corba_stream,
+ window->iid, TRUE, &ev);
+ Bonobo_Unknown_unref (corba_stream, &ev);
+ CORBA_Object_release (corba_stream, &ev);
+
+ corba_stream = Bonobo_Storage_openStream (corba_subdir, DATA_FILE,
+ Bonobo_Storage_CREATE,
+ &ev);
+ if (window->persiststream != CORBA_OBJECT_NIL) {
+ Bonobo_PersistStream_save (window->persiststream,
+ corba_stream, "", &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("Unable to save %s", window->iid);
+ }
+ }
+
+ Bonobo_Unknown_unref (corba_stream, &ev);
+ CORBA_Object_release (corba_stream, &ev);
+
+ Bonobo_Unknown_unref (corba_subdir, &ev);
+ CORBA_Object_release (corba_subdir, &ev);
+ }
+
+ g_free (curdir);
+ CORBA_exception_free (&ev);
+}
+
+static void
e_summary_save_state (ESummary *esummary,
const char *path)
{
ESummaryPrivate *priv;
+ BonoboStorage *storage;
+ Bonobo_Storage corba_storage;
+ CORBA_Environment ev;
GList *windows;
char *fullpath;
- char **argv;
- int argc, i;
+ int i;
g_return_if_fail (esummary != NULL);
g_return_if_fail (IS_E_SUMMARY (esummary));
- fullpath = g_strdup_printf("=%s=/services/iids", path);
priv = esummary->private;
- argc = g_list_length (priv->window_list);
- argv = g_new (char *, argc);
+#if 0
+ fullpath = g_strdup_printf("%s", path);
+ g_print ("fullpath: %s\n", fullpath);
+ unlink (fullpath);
- for (windows = priv->window_list, i = 0; windows;
- windows = windows->next, i++) {
- ESummaryWindow *window;
+ storage = bonobo_storage_open (STORAGE_TYPE, fullpath,
+ Bonobo_Storage_READ |
+ Bonobo_Storage_WRITE |
+ Bonobo_Storage_CREATE, 0660);
+ g_return_if_fail (storage);
- window = windows->data;
- g_print ("%s: IID: %s\n", path, window->iid);
- argv[i] = window->iid;
+ CORBA_exception_init (&ev);
+ corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (storage));
+
+ i = 0;
+ for (windows = priv->window_list; windows; windows = windows->next) {
+ save_component (storage, windows->data, i);
+ i++;
}
- gnome_config_set_vector (fullpath, argc, (const char **)argv);
-
- gnome_config_sync ();
- gnome_config_drop_all ();
+ Bonobo_Storage_commit (corba_storage, &ev);
+ CORBA_exception_free (&ev);
+ bonobo_object_unref (BONOBO_OBJECT (storage));
g_free (fullpath);
- g_free (argv);
-}
-
-ESummaryWindow *
-e_summary_window_from_view (ESummary *esummary,
- ExecutiveSummaryComponentView *view)
-{
- ESummaryPrivate *priv;
-
- priv = esummary->private;
- return g_hash_table_lookup (priv->view_to_window, view);
+#endif
}
void
diff --git a/executive-summary/component/e-summary.h b/executive-summary/component/e-summary.h
index 2e930cd692..5eae27ea0c 100644
--- a/executive-summary/component/e-summary.h
+++ b/executive-summary/component/e-summary.h
@@ -24,13 +24,11 @@
#ifndef _E_SUMMARY_H__
#define _E_SUMMARY_H__
-#include <gtk/gtksignal.h>
#include <gtkhtml/gtkhtml.h>
#include <gtk/gtkvbox.h>
#include <evolution-services/executive-summary.h>
-#include <evolution-services/executive-summary-component-client.h>
-#include <evolution-services/executive-summary-component-view.h>
+#include <bonobo.h>
#include <Evolution.h>
#define E_SUMMARY_TYPE (e_summary_get_type ())
@@ -45,9 +43,20 @@ typedef struct _ESummaryClass ESummaryClass;
typedef struct _ESummaryWindow ESummaryWindow;
struct _ESummaryWindow {
- ExecutiveSummary *summary;
- ExecutiveSummaryComponentView *view;
+ GNOME_Evolution_Summary_Component component;
+
+ Bonobo_Control control;
+ GNOME_Evolution_Summary_HTMLView html;
+
+ Bonobo_PersistStream persiststream;
+ Bonobo_PropertyBag propertybag;
+ Bonobo_PropertyControl propertycontrol;
+
+ BonoboPropertyListener *listener;
+
char *iid;
+ char *title;
+ char *icon;
};
struct _ESummary {
@@ -63,31 +72,14 @@ struct _ESummaryClass {
GtkType e_summary_get_type (void);
GtkWidget *e_summary_new (const GNOME_Evolution_Shell shell);
int e_summary_rebuild_page (ESummary *esummary);
-void e_summary_add_html_service (ESummary *esummary,
- ExecutiveSummary *summary,
- ExecutiveSummaryComponentClient *client,
- const char *html,
- const char *title,
- const char *icon);
-void e_summary_add_bonobo_service (ESummary *esummary,
- ExecutiveSummary *summary,
- ExecutiveSummaryComponentClient *client,
- GtkWidget *control,
- const char *title,
- const char *icon);
-void e_summary_update_window (ESummary *esummary,
- ExecutiveSummary *summary,
- const char *html);
-void e_summary_window_free (ESummaryWindow *window,
- ESummary *esummary);
-void e_summary_window_remove_from_ht (ESummaryWindow *window,
- ESummary *esummary);
-void e_summary_add_service (ESummary *esummary,
- ExecutiveSummary *summary,
- ExecutiveSummaryComponentView *view,
- const char *iid);
-ExecutiveSummaryComponentView * e_summary_view_from_id (ESummary *esummary,
- int id);
+
+void e_summary_window_free (ESummaryWindow *window);
+void e_summary_remove_window (ESummary *esummary,
+ ESummaryWindow *window);
+ESummaryWindow *e_summary_add_service (ESummary *esummary,
+ GNOME_Evolution_Summary_Component component,
+ const char *iid);
+
void e_summary_set_shell_view_interface (ESummary *summary,
GNOME_Evolution_ShellView svi);
void e_summary_set_message (ESummary *esummary,
@@ -98,8 +90,7 @@ void e_summary_change_current_view (ESummary *esummary,
const char *uri);
void e_summary_set_title (ESummary *esummary,
const char *title);
-ESummaryWindow *e_summary_window_from_view (ESummary *esummary,
- ExecutiveSummaryComponentView *view);
+
void e_summary_window_move_left (ESummary *esummary,
ESummaryWindow *window);
void e_summary_window_move_right (ESummary *esummary,
diff --git a/executive-summary/evolution-services/Makefile.am b/executive-summary/evolution-services/Makefile.am
index cbe9d99a55..40e2972321 100644
--- a/executive-summary/evolution-services/Makefile.am
+++ b/executive-summary/evolution-services/Makefile.am
@@ -28,7 +28,8 @@ Executive-Summary-impl.o: Executive-Summary.h
IDLS = \
$(srcdir)/../idl/Executive-Summary.idl \
$(srcdir)/../idl/Summary.idl \
- $(srcdir)/../idl/SummaryComponent.idl
+ $(srcdir)/../idl/SummaryComponent.idl \
+ $(srcdir)/../idl/HtmlView.idl
$(IDL_GENERATED): $(IDLS)
$(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \
@@ -36,16 +37,12 @@ $(IDL_GENERATED): $(IDLS)
libevolution_services_la_SOURCES = \
$(IDL_GENERATED) \
- executive-summary.c \
- executive-summary.h \
- executive-summary-client.c \
- executive-summary-client.h \
executive-summary-component.c \
executive-summary-component.h \
- executive-summary-component-client.c \
- executive-summary-component-client.h \
- executive-summary-component-view.c \
- executive-summary-component-view.h
+ executive-summary-component-factory-client.c \
+ executive-summary-component-factory-client.h \
+ executive-summary-html-view.c \
+ executive-summary-html-view.h
libevolution_services_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
diff --git a/executive-summary/evolution-services/executive-summary-component-client.c b/executive-summary/evolution-services/executive-summary-component-client.c
index 5d13a39e6d..33225e7d98 100644
--- a/executive-summary/evolution-services/executive-summary-component-client.c
+++ b/executive-summary/evolution-services/executive-summary-component-client.c
@@ -33,7 +33,6 @@
#include <Executive-Summary.h>
#include "executive-summary-component-client.h"
-#include "executive-summary-component-view.h"
#include "executive-summary.h"
#define PARENT_TYPE BONOBO_OBJECT_CLIENT_TYPE
@@ -174,163 +173,6 @@ executive_summary_component_client_unset_owner (ExecutiveSummaryComponentClient
return;
}
-#if 0
-void
-executive_summary_component_client_supports (ExecutiveSummaryComponentClient *client,
- gboolean *bonobo,
- gboolean *html)
-{
- GNOME_Evolution_Summary_Component component;
- CORBA_Environment ev;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT (client));
-
- CORBA_exception_init (&ev);
- component = bonobo_object_corba_objref (BONOBO_OBJECT (client));
-
- GNOME_Evolution_Summary_Component_supports (component, bonobo, html, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Error checking supports");
- }
-
- CORBA_exception_free (&ev);
- return;
-}
-#endif
-
-ExecutiveSummaryComponentView *
-executive_summary_component_client_create_view (ExecutiveSummaryComponentClient *client,
- int id)
-{
- ExecutiveSummaryComponentView *view;
- GNOME_Evolution_Summary_Component component;
- char *html, *title, *icon;
- Bonobo_Control control;
- BonoboControl *bc;
- int ret_id;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT (client),
- NULL);
-
- CORBA_exception_init (&ev);
- if (client)
- component = bonobo_object_corba_objref (BONOBO_OBJECT (client));
-
- /* Get all the details about the view */
- g_print ("In %s\n", __FUNCTION__);
- ret_id = GNOME_Evolution_Summary_Component_createView (component, id, &control,
- &html, &title, &icon, &ev);
- g_print ("Out %s\n", __FUNCTION__);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Error creating view");
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- CORBA_exception_free (&ev);
-
- /* Create a local copy of the remote view */
- if (control != CORBA_OBJECT_NIL) {
- bc = BONOBO_CONTROL (bonobo_widget_new_control_from_objref (control, NULL));
- } else {
- bc = NULL;
- }
-
- view = executive_summary_component_view_new (NULL, bc, html, title,
- icon);
- executive_summary_component_view_set_id (view, ret_id);
-
- return view;
-}
-
-#if 0
-char *
-executive_summary_component_client_create_html_view (ExecutiveSummaryComponentClient *client,
- char **title,
- char **icon)
-{
- CORBA_char *ret_html;
- GNOME_Evolution_Summary_Component component;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT (client),
- NULL);
-
- CORBA_exception_init (&ev);
- component = bonobo_object_corba_objref (BONOBO_OBJECT (client));
-
- ret_html = GNOME_Evolution_Summary_Component_create_html_view (component, title, icon, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Error creating HTML view");
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- CORBA_exception_free (&ev);
-
- return (char *)g_strdup (ret_html);
-}
-#endif
-
-void
-executive_summary_component_client_configure (ExecutiveSummaryComponentClient *client)
-{
- GNOME_Evolution_Summary_Component component;
- CORBA_Environment ev;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT (client));
-
- CORBA_exception_init (&ev);
- component = bonobo_object_corba_objref (BONOBO_OBJECT (client));
- GNOME_Evolution_Summary_Component_configure (component, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Error configuring service");
- bonobo_object_unref (BONOBO_OBJECT (client));
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_exception_free (&ev);
-
- return;
-}
-
-void
-executive_summary_component_client_destroy_view (ExecutiveSummaryComponentClient *client,
- ExecutiveSummaryComponentView *view)
-{
- int id;
- GNOME_Evolution_Summary_Component component;
- CORBA_Environment ev;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT (client));
- g_return_if_fail (view != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
-
- id = executive_summary_component_view_get_id (view);
-
- CORBA_exception_init (&ev);
- component = bonobo_object_corba_objref (BONOBO_OBJECT (client));
- GNOME_Evolution_Summary_Component_destroyView (component, id, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Error destroying view #%d", id);
- }
-
- CORBA_exception_free (&ev);
-
- return;
-}
-
E_MAKE_TYPE (executive_summary_component_client,
"ExecutiveSummaryComponentClient",
ExecutiveSummaryComponentClient,
diff --git a/executive-summary/evolution-services/executive-summary-component-client.h b/executive-summary/evolution-services/executive-summary-component-client.h
index 3a9edd7a1c..b98aa9e7e5 100644
--- a/executive-summary/evolution-services/executive-summary-component-client.h
+++ b/executive-summary/evolution-services/executive-summary-component-client.h
@@ -59,7 +59,8 @@ void executive_summary_component_client_supports (ExecutiveSummaryComponentClien
gboolean *bonobo,
gboolean *html);
-void executive_summary_component_client_configure (ExecutiveSummaryComponentClient *client);
+void executive_summary_component_client_configure (ExecutiveSummaryComponentClient *client,
+ ExecutiveSummaryComponentView *view);
void executive_summary_component_client_destroy_view (ExecutiveSummaryComponentClient *client,
ExecutiveSummaryComponentView *view);
diff --git a/executive-summary/evolution-services/executive-summary-component-factory-client.c b/executive-summary/evolution-services/executive-summary-component-factory-client.c
new file mode 100644
index 0000000000..f798341c80
--- /dev/null
+++ b/executive-summary/evolution-services/executive-summary-component-factory-client.c
@@ -0,0 +1,181 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* executive-summary-component-factory-client.c
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <bonobo.h>
+#include <gnome.h>
+#include <gal/util/e-util.h>
+
+#include <liboaf/liboaf.h>
+
+#include <Executive-Summary.h>
+#include "executive-summary-component-factory-client.h"
+#include "executive-summary.h"
+
+#define PARENT_TYPE BONOBO_OBJECT_CLIENT_TYPE
+static BonoboObjectClass *parent_class = NULL;
+
+struct _ExecutiveSummaryComponentFactoryClientPrivate {
+ int dummy;
+};
+
+static void
+executive_summary_component_factory_client_destroy (GtkObject *object)
+{
+ ExecutiveSummaryComponentFactoryClient *client;
+ ExecutiveSummaryComponentFactoryClientPrivate *priv;
+
+ client = EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT (object);
+ priv = client->private;
+
+ if (priv == NULL)
+ return;
+
+ g_free (priv);
+ client->private = NULL;
+
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+static void
+executive_summary_component_factory_client_init (ExecutiveSummaryComponentFactoryClient *client)
+{
+ ExecutiveSummaryComponentFactoryClientPrivate *priv;
+
+ priv = g_new0 (ExecutiveSummaryComponentFactoryClientPrivate, 1);
+ client->private = priv;
+}
+
+static void
+executive_summary_component_factory_client_class_init (ExecutiveSummaryComponentFactoryClientClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = executive_summary_component_factory_client_destroy;
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+}
+
+E_MAKE_TYPE (executive_summary_component_factory_client,
+ "ExecutiveSummaryComponentFactoryClient",
+ ExecutiveSummaryComponentFactoryClient,
+ executive_summary_component_factory_client_class_init,
+ executive_summary_component_factory_client_init, PARENT_TYPE)
+
+
+/*** Public API ***/
+/**
+ * executive_summary_component_factory_client_construct:
+ * @client: The ExecutiveSummaryComponentFactoryClient to construct.
+ * @corba_object: The CORBA_Object to construct it from.
+ *
+ * Constructs a client from the given CORBA_Object.
+ */
+void
+executive_summary_component_factory_client_construct (ExecutiveSummaryComponentFactoryClient *client,
+ CORBA_Object corba_object)
+{
+ g_return_if_fail (client != NULL);
+ g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT (client));
+ g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
+
+ bonobo_object_client_construct (BONOBO_OBJECT_CLIENT (client), corba_object);
+}
+
+/**
+ * executive_summary_component_factory_client_new:
+ * @id: The OAFIID of the component to activate.
+ *
+ * Activates the component specified by @id, and creates a server side client
+ * for that object.
+ *
+ * Returns: A pointer to an ExecutiveSummaryComponentFactoryClient object.
+ */
+ExecutiveSummaryComponentFactoryClient *
+executive_summary_component_factory_client_new (const char *id)
+{
+ ExecutiveSummaryComponentFactoryClient *client;
+ CORBA_Environment ev;
+ CORBA_Object corba_object;
+
+ g_return_val_if_fail (id != NULL, NULL);
+
+ CORBA_exception_init (&ev);
+
+ corba_object = oaf_activate_from_id ((char *)id, 0, NULL, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ CORBA_exception_free (&ev);
+ g_warning ("Could not start %s\n", id);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+
+ if (corba_object == CORBA_OBJECT_NIL) {
+ g_warning ("Could not activate %s\n", id);
+ return NULL;
+ }
+
+ client = gtk_type_new (executive_summary_component_factory_client_get_type ());
+ executive_summary_component_factory_client_construct (client,
+ corba_object);
+
+ return client;
+}
+
+/**
+ * executive_summary_component_factory_client_create_view:
+ * @client: The client on which to create the view.
+ *
+ * Creates a new view of a remote component.
+ *
+ * Returns: A GNOME_Evolution_Summary_Component.
+ */
+GNOME_Evolution_Summary_Component
+executive_summary_component_factory_client_create_view (ExecutiveSummaryComponentFactoryClient *client)
+{
+ GNOME_Evolution_Summary_ComponentFactory factory;
+ GNOME_Evolution_Summary_Component component;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (client != NULL, CORBA_OBJECT_NIL);
+ g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT (client),
+ CORBA_OBJECT_NIL);
+
+ CORBA_exception_init (&ev);
+ factory = bonobo_object_corba_objref (BONOBO_OBJECT (client));
+
+ component = GNOME_Evolution_Summary_ComponentFactory_createView (factory, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("Error creating view: %s", CORBA_exception_id (&ev));
+ CORBA_exception_free (&ev);
+ return CORBA_OBJECT_NIL;
+ }
+
+ CORBA_exception_free (&ev);
+ return component;
+}
diff --git a/executive-summary/evolution-services/executive-summary-component-factory-client.h b/executive-summary/evolution-services/executive-summary-component-factory-client.h
new file mode 100644
index 0000000000..7c94afe15c
--- /dev/null
+++ b/executive-summary/evolution-services/executive-summary-component-factory-client.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* executive-summary-component-factory-client.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 _EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_H__
+#define _EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_H__
+
+#include <bonobo.h>
+
+#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE (executive_summary_component_factory_client_get_type ())
+#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE, ExecutiveSummaryComponentFactoryClient))
+#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE, ExecutiveSummaryComponentFactoryClientClass))
+#define IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE))
+#define IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE))
+
+typedef struct _ExecutiveSummaryComponentFactoryClientPrivate ExecutiveSummaryComponentFactoryClientPrivate;
+typedef struct _ExecutiveSummaryComponentFactoryClient ExecutiveSummaryComponentFactoryClient;
+typedef struct _ExecutiveSummaryComponentFactoryClientClass ExecutiveSummaryComponentFactoryClientClass;
+
+struct _ExecutiveSummaryComponentFactoryClient {
+ BonoboObjectClient parent;
+
+ ExecutiveSummaryComponentFactoryClientPrivate *private;
+};
+
+struct _ExecutiveSummaryComponentFactoryClientClass {
+ BonoboObjectClientClass parent_class;
+};
+
+GtkType executive_summary_component_factory_client_get_type (void);
+
+void executive_summary_component_factory_client_construct (ExecutiveSummaryComponentFactoryClient *client,
+ CORBA_Object corba_object);
+ExecutiveSummaryComponentFactoryClient *executive_summary_component_factory_client_new (const char *id);
+GNOME_Evolution_Summary_Component executive_summary_component_factory_client_create_view (ExecutiveSummaryComponentFactoryClient *client);
+
+#endif
+
diff --git a/executive-summary/evolution-services/executive-summary-component-view.c b/executive-summary/evolution-services/executive-summary-component-view.c
index ebcbeb9e09..6ba24e143c 100644
--- a/executive-summary/evolution-services/executive-summary-component-view.c
+++ b/executive-summary/evolution-services/executive-summary-component-view.c
@@ -37,6 +37,8 @@ struct _ExecutiveSummaryComponentViewPrivate {
ExecutiveSummaryComponent *component;
BonoboControl *control;
+ Bonobo_Control objref;
+
char *html;
char *title;
@@ -48,6 +50,13 @@ struct _ExecutiveSummaryComponentViewPrivate {
static GtkObjectClass *parent_class = NULL;
#define PARENT_TYPE (gtk_object_get_type ())
+enum {
+ CONFIGURE,
+ LAST_SIGNAL
+};
+
+static gint32 view_signals[LAST_SIGNAL] = { 0 };
+
static void
executive_summary_component_view_destroy (GtkObject *object)
{
@@ -83,6 +92,14 @@ executive_summary_component_view_class_init (ExecutiveSummaryComponentViewClass
object_class = GTK_OBJECT_CLASS (view_class);
object_class->destroy = executive_summary_component_view_destroy;
+
+ view_signals[CONFIGURE] = gtk_signal_new ("configure",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (ExecutiveSummaryComponentViewClass, configure),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+ gtk_object_class_add_signals (object_class, view_signals, LAST_SIGNAL);
parent_class = gtk_type_class (PARENT_TYPE);
}
@@ -96,6 +113,7 @@ executive_summary_component_view_init (ExecutiveSummaryComponentView *view)
view->private = priv;
priv->control = NULL;
+ priv->objref = NULL;
priv->html = NULL;
priv->title = NULL;
priv->icon = NULL;
@@ -191,7 +209,6 @@ executive_summary_component_view_set_title (ExecutiveSummaryComponentView *view,
component = priv->component;
if (component == NULL) {
- g_warning ("Calling %s from the wrong side of the CORBA interface", __FUNCTION__);
return;
}
@@ -230,7 +247,6 @@ executive_summary_component_view_set_icon (ExecutiveSummaryComponentView *view,
if (component == NULL) {
return;
}
-
executive_summary_component_set_icon (component, view);
}
@@ -291,6 +307,12 @@ executive_summary_component_view_set_html (ExecutiveSummaryComponentView *view,
executive_summary_component_update (component, view);
}
+void
+executive_summary_component_view_configure (ExecutiveSummaryComponentView *view)
+{
+ gtk_signal_emit (GTK_OBJECT (view), view_signals[CONFIGURE]);
+}
+
const char *
executive_summary_component_view_get_html (ExecutiveSummaryComponentView *view)
{
@@ -314,7 +336,7 @@ executive_summary_component_view_get_control (ExecutiveSummaryComponentView *vie
priv = view->private;
- return priv->control;
+ return (BonoboObject *)priv->control;
}
void
@@ -343,3 +365,39 @@ executive_summary_component_view_get_id (ExecutiveSummaryComponentView *view)
return priv->id;
}
+
+void
+executive_summary_component_view_set_objref (ExecutiveSummaryComponentView *view,
+ Bonobo_Control objref)
+{
+ ExecutiveSummaryComponentViewPrivate *priv;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
+
+ priv = view->private;
+
+ if (priv->objref) {
+ g_warning ("View already has an objref.");
+ return;
+ }
+
+ priv->objref = objref;
+}
+
+GtkWidget *
+executive_summary_component_view_get_widget (ExecutiveSummaryComponentView *view)
+{
+ ExecutiveSummaryComponentViewPrivate *priv;
+
+ g_return_val_if_fail (view != NULL, NULL);
+ g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view), NULL);
+
+ priv = view->private;
+ if (priv->objref == NULL) {
+ g_warning ("View has no objref.");
+ return NULL;
+ }
+
+ return bonobo_widget_new_control_from_objref (priv->objref, NULL);
+}
diff --git a/executive-summary/evolution-services/executive-summary-component-view.h b/executive-summary/evolution-services/executive-summary-component-view.h
index ecd0c7ab33..c18f77dcf4 100644
--- a/executive-summary/evolution-services/executive-summary-component-view.h
+++ b/executive-summary/evolution-services/executive-summary-component-view.h
@@ -24,6 +24,7 @@
#ifndef __EXECUTIVE_SUMMARY_COMPONENT_VIEW_H__
#define __EXECUTIVE_SUMMARY_COMPONENT_VIEW_H__
+#include <bonobo/bonobo-control.h>
#include <evolution-services/executive-summary-component.h>
#define EXECUTIVE_SUMMARY_COMPONENT_VIEW_TYPE (executive_summary_component_view_get_type ())
@@ -37,13 +38,16 @@ typedef struct _ExecutiveSummaryComponentView ExecutiveSummaryComponentView;
typedef struct _ExecutiveSummaryComponentViewClass ExecutiveSummaryComponentViewClass;
struct _ExecutiveSummaryComponentView {
- GtkObject object;
-
- ExecutiveSummaryComponentViewPrivate *private;
+ GtkObject object;
+
+ ExecutiveSummaryComponentViewPrivate *private;
};
struct _ExecutiveSummaryComponentViewClass {
- GtkObjectClass parent_class;
+ GtkObjectClass parent_class;
+
+ /* Signals */
+ void (* configure) (ExecutiveSummaryComponentView *view);
};
GtkType executive_summary_component_view_get_type (void);
@@ -77,6 +81,12 @@ const char *executive_summary_component_view_get_html (ExecutiveSummaryComponent
BonoboObject *executive_summary_component_view_get_control (ExecutiveSummaryComponentView *view);
int executive_summary_component_view_get_id (ExecutiveSummaryComponentView *view);
+void executive_summary_component_view_set_id (ExecutiveSummaryComponentView *view,
+ int id);
+void executive_summary_component_view_configure (ExecutiveSummaryComponentView *view);
+void executive_summary_component_view_set_objref (ExecutiveSummaryComponentView *view,
+ Bonobo_Control objref);
+GtkWidget *executive_summary_component_view_get_widget (ExecutiveSummaryComponentView *view);
#endif
diff --git a/executive-summary/evolution-services/executive-summary-component.c b/executive-summary/evolution-services/executive-summary-component.c
index ba0c3b7832..1b1070da21 100644
--- a/executive-summary/evolution-services/executive-summary-component.c
+++ b/executive-summary/evolution-services/executive-summary-component.c
@@ -31,9 +31,7 @@
#include <gal/util/e-util.h>
#include "Executive-Summary.h"
-#include "executive-summary.h"
#include "executive-summary-component.h"
-#include "executive-summary-component-view.h"
#include "executive-summary-client.h"
static void executive_summary_component_destroy (GtkObject *object);
@@ -41,22 +39,26 @@ static void executive_summary_component_init (ExecutiveSummaryComponent *compone
static void executive_summary_component_class_init (ExecutiveSummaryComponentClass *esc_class);
#define PARENT_TYPE (bonobo_object_get_type ())
+#define FACTORY_PARENT_TYPE (bonobo_object_get_type ())
static BonoboObjectClass *parent_class;
+static BonoboObjectClass *factory_parent_class;
struct _ExecutiveSummaryComponentPrivate {
- EvolutionServicesCreateViewFn create_view;
- EvolutionServicesConfigureFn configure;
-
+ int dummy;
+#if 0
ExecutiveSummaryClient *owner_client;
-
- void *closure;
+#endif
+};
- GHashTable *id_to_view;
+struct _ExecutiveSummaryComponentFactoryPrivate {
+ EvolutionServicesCreateViewFn create_view;
+ void *closure;
};
/* CORBA interface */
static POA_GNOME_Evolution_Summary_Component__vepv SummaryComponent_vepv;
+static POA_GNOME_Evolution_Summary_ComponentFactory__vepv ComponentFactory_vepv;
static POA_GNOME_Evolution_Summary_Component *
create_servant (void)
@@ -80,37 +82,19 @@ create_servant (void)
return servant;
}
-#if 0
-static void
-impl_GNOME_Evolution_Summary_Component_supports (PortableServer_Servant servant,
- CORBA_boolean *html,
- CORBA_boolean *bonobo,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- ExecutiveSummaryComponent *component;
- ExecutiveSummaryComponentPrivate *priv;
-
- bonobo_object = bonobo_object_from_servant (servant);
- component = EXECUTIVE_SUMMARY_COMPONENT (bonobo_object);
- priv = component->private;
-
- *html = (priv->create_html_view != NULL);
- *bonobo = (priv->create_bonobo_view != NULL);
-}
-#endif
-
static void
impl_GNOME_Evolution_Summary_Component_set_owner (PortableServer_Servant servant,
- GNOME_Evolution_Summary_ViewFrame summary,
- CORBA_Environment *ev)
+ GNOME_Evolution_Summary_ViewFrame summary,
+ CORBA_Environment *ev)
{
+#if 0
+
BonoboObject *bonobo_object;
ExecutiveSummaryComponent *component;
ExecutiveSummaryComponentPrivate *priv;
ExecutiveSummaryClient *client;
GNOME_Evolution_Summary_ViewFrame summary_duplicate;
-
+
bonobo_object = bonobo_object_from_servant (servant);
component = EXECUTIVE_SUMMARY_COMPONENT (bonobo_object);
priv = component->private;
@@ -122,12 +106,14 @@ impl_GNOME_Evolution_Summary_Component_set_owner (PortableServer_Servant servant
executive_summary_client_construct (client, summary_duplicate);
priv->owner_client = client;
+#endif
}
static void
impl_GNOME_Evolution_Summary_Component_unset_owner (PortableServer_Servant servant,
CORBA_Environment *ev)
{
+#if 0
BonoboObject *bonobo_object;
ExecutiveSummaryComponent *component;
ExecutiveSummaryComponentPrivate *priv;
@@ -141,127 +127,7 @@ impl_GNOME_Evolution_Summary_Component_unset_owner (PortableServer_Servant serva
bonobo_object_unref (BONOBO_OBJECT (priv->owner_client));
priv->owner_client = NULL;
-}
-
-static CORBA_long
-impl_GNOME_Evolution_Summary_Component_create_view (PortableServer_Servant servant,
- CORBA_long id,
- Bonobo_Control *control,
- CORBA_char **html,
- CORBA_char **title,
- CORBA_char **icon,
- CORBA_Environment *ev)
-{
- ExecutiveSummaryComponentView *view;
- BonoboObject *bonobo_object;
- ExecutiveSummaryComponent *component;
- ExecutiveSummaryComponentPrivate *priv;
- BonoboObject *initial_control;
- const char *initial_title, *initial_icon, *initial_html;
-
- bonobo_object = bonobo_object_from_servant (servant);
- component = EXECUTIVE_SUMMARY_COMPONENT (bonobo_object);
- priv = component->private;
-
- view = gtk_type_new (executive_summary_component_view_get_type ());
- executive_summary_component_view_set_id (view, id);
-
- (* priv->create_view) (component, view, priv->closure);
-
- /* Extract the values */
- initial_title = executive_summary_component_view_get_title (view);
- initial_icon = executive_summary_component_view_get_icon (view);
- initial_html = executive_summary_component_view_get_html (view);
- initial_control = executive_summary_component_view_get_control (view);
-
- /* Put the view in the hash table so it can be found later */
- g_hash_table_insert (priv->id_to_view, GINT_TO_POINTER (id), view);
-
- /* Duplicate the values */
- if (initial_control != NULL) {
- *control = bonobo_object_corba_objref (BONOBO_OBJECT (initial_control));
- } else {
- *control = CORBA_OBJECT_NIL;
- }
-
- *html = CORBA_string_dup (initial_html ? initial_html:"");
- *title = CORBA_string_dup (initial_title ? initial_title:"");
- *icon = CORBA_string_dup (initial_icon ? initial_icon:"");
-
- return id;
-}
-
-#if 0
-static CORBA_char *
-impl_GNOME_Evolution_Summary_Component_create_html_view (PortableServer_Servant servant,
- CORBA_char **title,
- CORBA_char **icon,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- ExecutiveSummaryComponent *component;
- ExecutiveSummaryComponentPrivate *priv;
- CORBA_char *ret_str;
- char *ret_html;
- char *initial_title, *initial_icon;
-
- bonobo_object = bonobo_object_from_servant (servant);
- component = EXECUTIVE_SUMMARY_COMPONENT (bonobo_object);
- priv = component->private;
-
- ret_html = (* priv->create_html_view) (component, &initial_title,
- &initial_icon,
- priv->closure);
-
- *title = CORBA_string_dup (initial_title ? initial_title:"");
- *icon = CORBA_string_dup (initial_icon ? initial_icon:"");
- g_free (initial_title);
- g_free (initial_icon);
-
- ret_str = CORBA_string_dup (ret_html ? ret_html:"");
- g_free (ret_html);
- return ret_str;
-}
-#endif
-
-static void
-impl_GNOME_Evolution_Summary_Component_destroy_view (PortableServer_Servant servant,
- CORBA_long id,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- ExecutiveSummaryComponent *component;
- ExecutiveSummaryComponentPrivate *priv;
- ExecutiveSummaryComponentView *view;
-
- g_print ("%s\n", __FUNCTION__);
- bonobo_object = bonobo_object_from_servant (servant);
- component = EXECUTIVE_SUMMARY_COMPONENT (bonobo_object);
- priv = component->private;
-
- view = g_hash_table_lookup (priv->id_to_view, GINT_TO_POINTER (id));
- if (view == NULL) {
- g_warning ("Unknown view: %d. Emit exception", id);
- return;
- }
-
- /* Destroy the view */
- gtk_object_unref (GTK_OBJECT (view));
-}
-
-static void
-impl_GNOME_Evolution_Summary_Component_configure (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- ExecutiveSummaryComponent *component;
- ExecutiveSummaryComponentPrivate *priv;
-
- bonobo_object = bonobo_object_from_servant (servant);
- component = EXECUTIVE_SUMMARY_COMPONENT (bonobo_object);
- priv = component->private;
-
- (* priv->configure) (component, priv->closure);
+#endif
}
static void
@@ -278,11 +144,13 @@ executive_summary_component_destroy (GtkObject *object)
return;
CORBA_exception_init (&ev);
-
+
+#if 0
if (priv->owner_client != NULL) {
bonobo_object_unref (BONOBO_OBJECT (priv->owner_client));
priv->owner_client = NULL;
}
+#endif
CORBA_exception_free (&ev);
@@ -308,10 +176,7 @@ corba_class_init (void)
epv = g_new0 (POA_GNOME_Evolution_Summary_Component__epv, 1);
epv->setOwner = impl_GNOME_Evolution_Summary_Component_set_owner;
epv->unsetOwner = impl_GNOME_Evolution_Summary_Component_unset_owner;
- epv->createView = impl_GNOME_Evolution_Summary_Component_create_view;
- epv->destroyView = impl_GNOME_Evolution_Summary_Component_destroy_view;
- epv->configure = impl_GNOME_Evolution_Summary_Component_configure;
-
+
vepv = &SummaryComponent_vepv;
vepv->_base_epv = base_epv;
vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
@@ -336,44 +201,37 @@ executive_summary_component_init (ExecutiveSummaryComponent *component)
{
ExecutiveSummaryComponentPrivate *priv;
- priv = g_new0 (ExecutiveSummaryComponentPrivate, 1);
+ priv = g_new (ExecutiveSummaryComponentPrivate, 1);
- priv->create_view = NULL;
- priv->configure = NULL;
-
- priv->owner_client = NULL;
- priv->closure = NULL;
-
- priv->id_to_view = g_hash_table_new (NULL, NULL);
component->private = priv;
}
+E_MAKE_TYPE (executive_summary_component, "ExecutiveSummaryComponent",
+ ExecutiveSummaryComponent, executive_summary_component_class_init,
+ executive_summary_component_init, PARENT_TYPE);
+
+
static void
executive_summary_component_construct (ExecutiveSummaryComponent *component,
- GNOME_Evolution_Summary_Component corba_object,
- EvolutionServicesCreateViewFn create_view,
- EvolutionServicesConfigureFn configure,
- void *closure)
+ GNOME_Evolution_Summary_Component corba_object)
{
- ExecutiveSummaryComponentPrivate *priv;
-
g_return_if_fail (component != NULL);
g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
bonobo_object_construct (BONOBO_OBJECT (component), corba_object);
-
- priv = component->private;
-
- priv->create_view = create_view;
- priv->configure = configure;
-
- priv->closure = closure;
}
+
+/*** Public API ***/
+/**
+ * executive_summary_component_new:
+ *
+ * Creates a BonoboObject that implements the Summary::Component interface.
+ *
+ * Returns: A pointer to a BonoboObject.
+ */
BonoboObject *
-executive_summary_component_new (EvolutionServicesCreateViewFn create_view,
- EvolutionServicesConfigureFn configure,
- void *closure)
+executive_summary_component_new (void)
{
ExecutiveSummaryComponent *component;
POA_GNOME_Evolution_Summary_Component *servant;
@@ -387,23 +245,18 @@ executive_summary_component_new (EvolutionServicesCreateViewFn create_view,
corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (component),
servant);
- executive_summary_component_construct (component, corba_object,
- create_view, configure, closure);
+ executive_summary_component_construct (component, corba_object);
return BONOBO_OBJECT (component);
}
-E_MAKE_TYPE (executive_summary_component, "ExecutiveSummaryComponent",
- ExecutiveSummaryComponent, executive_summary_component_class_init,
- executive_summary_component_init, PARENT_TYPE);
-
+#if 0
void
-executive_summary_component_set_title (ExecutiveSummaryComponent *component,
- gpointer view)
+executive_summary_component_flash (ExecutiveSummaryComponent *component,
+ gpointer view)
{
ExecutiveSummaryComponentPrivate *priv;
int id;
- const char *title;
g_return_if_fail (component != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT (component));
@@ -416,18 +269,17 @@ executive_summary_component_set_title (ExecutiveSummaryComponent *component,
}
id = executive_summary_component_view_get_id (EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
- title = executive_summary_component_view_get_title (EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
- executive_summary_client_set_title (priv->owner_client, id, title);
+ executive_summary_client_flash (priv->owner_client, id);
}
void
-executive_summary_component_set_icon (ExecutiveSummaryComponent *component,
- gpointer view)
+executive_summary_component_update (ExecutiveSummaryComponent *component,
+ gpointer view)
{
ExecutiveSummaryComponentPrivate *priv;
int id;
- const char *icon;
+ const char *html;
g_return_if_fail (component != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT (component));
@@ -435,68 +287,184 @@ executive_summary_component_set_icon (ExecutiveSummaryComponent *component,
priv = component->private;
if (priv->owner_client == NULL) {
- g_warning ("Component not owned!");
+ g_warning ("Component not ownded!");
return;
}
id = executive_summary_component_view_get_id (EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
- icon = executive_summary_component_view_get_icon (EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
+ html = executive_summary_component_view_get_html (EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
- executive_summary_client_set_icon (priv->owner_client, id, icon);
+ executive_summary_client_update (priv->owner_client, id, html);
}
+#endif
-void
-executive_summary_component_flash (ExecutiveSummaryComponent *component,
- gpointer view)
+
+/**** ComponentFactory implementation ****/
+
+static POA_GNOME_Evolution_Summary_ComponentFactory *
+create_factory_servant (void)
{
- ExecutiveSummaryComponentPrivate *priv;
- int id;
+ POA_GNOME_Evolution_Summary_ComponentFactory *servant;
+ CORBA_Environment ev;
+
+ servant = (POA_GNOME_Evolution_Summary_ComponentFactory *)g_new0 (BonoboObjectServant, 1);
+ servant->vepv = &ComponentFactory_vepv;
+
+ CORBA_exception_init (&ev);
+ POA_GNOME_Evolution_Summary_ComponentFactory__init ((PortableServer_Servant) servant, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_free (servant);
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+
+ return servant;
+}
- g_return_if_fail (component != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT (component));
+static GNOME_Evolution_Summary_Component
+impl_GNOME_Evolution_Summary_ComponentFactory_createView (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ ExecutiveSummaryComponent *view;
+ ExecutiveSummaryComponentFactory *factory;
+ ExecutiveSummaryComponentFactoryPrivate *priv;
+ GNOME_Evolution_Summary_Component component, component_dup;
+ CORBA_Environment ev2;
- priv = component->private;
+ bonobo_object = bonobo_object_from_servant (servant);
+ factory = EXECUTIVE_SUMMARY_COMPONENT_FACTORY (bonobo_object);
+ priv = factory->private;
- if (priv->owner_client == NULL) {
- g_warning ("Component not owned!");
- return;
- }
+ g_warning ("Hello?");
+ view = (* priv->create_view) (factory, priv->closure);
+ g_return_val_if_fail (view != NULL, CORBA_OBJECT_NIL);
- id = executive_summary_component_view_get_id (EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
+ component = bonobo_object_corba_objref (BONOBO_OBJECT (view));
- executive_summary_client_flash (priv->owner_client, id);
+ return component;
}
-void
-executive_summary_component_update (ExecutiveSummaryComponent *component,
- gpointer view)
+static void
+corba_factory_init (void)
{
- ExecutiveSummaryComponentPrivate *priv;
- int id;
- const char *html;
+ POA_GNOME_Evolution_Summary_ComponentFactory__vepv *vepv;
+ POA_GNOME_Evolution_Summary_ComponentFactory__epv *epv;
+ PortableServer_ServantBase__epv *base_epv;
+
+ base_epv = g_new0 (PortableServer_ServantBase__epv, 1);
+ base_epv->_private = NULL;
+ base_epv->finalize = NULL;
+ base_epv->default_POA = NULL;
+
+ epv = g_new0 (POA_GNOME_Evolution_Summary_ComponentFactory__epv, 1);
+ epv->createView = impl_GNOME_Evolution_Summary_ComponentFactory_createView;
- g_return_if_fail (component != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT (component));
+ vepv = &ComponentFactory_vepv;
+ vepv->_base_epv = base_epv;
+ vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
+ vepv->GNOME_Evolution_Summary_ComponentFactory_epv = epv;
+}
- priv = component->private;
+/* GtkObject methods */
+static void
+executive_summary_component_factory_destroy (GtkObject *object)
+{
+ ExecutiveSummaryComponentFactory *factory;
+ ExecutiveSummaryComponentFactoryPrivate *priv;
- if (priv->owner_client == NULL) {
- g_warning ("Component not ownded!");
+ factory = EXECUTIVE_SUMMARY_COMPONENT_FACTORY (object);
+ priv = factory->private;
+
+ if (priv == NULL)
return;
- }
- id = executive_summary_component_view_get_id (EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
- html = executive_summary_component_view_get_html (EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
+ g_free (priv);
+ factory->private = NULL;
- executive_summary_client_update (priv->owner_client, id, html);
+ (* GTK_OBJECT_CLASS (factory_parent_class)->destroy) (object);
}
-int
-executive_summary_component_create_unique_id (void)
+static void
+executive_summary_component_factory_class_init (ExecutiveSummaryComponentFactoryClass *klass)
{
- static int id = 0;
+ GtkObjectClass *object_class;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = executive_summary_component_factory_destroy;
- id++;
- g_print ("%s -- %d\n", __FUNCTION__, id);
- return id;
+ factory_parent_class = gtk_type_class (FACTORY_PARENT_TYPE);
+ corba_factory_init ();
}
+
+static void
+executive_summary_component_factory_init (ExecutiveSummaryComponentFactory *factory)
+{
+ ExecutiveSummaryComponentFactoryPrivate *priv;
+
+ priv = g_new (ExecutiveSummaryComponentFactoryPrivate, 1);
+
+ priv->create_view = NULL;
+ priv->closure = NULL;
+ factory->private = priv;
+}
+
+E_MAKE_TYPE (executive_summary_component_factory,
+ "ExecutiveSummaryComponentFactory",
+ ExecutiveSummaryComponentFactory,
+ executive_summary_component_factory_class_init,
+ executive_summary_component_factory_init, FACTORY_PARENT_TYPE);
+
+static void
+executive_summary_component_factory_construct (ExecutiveSummaryComponentFactory *factory,
+ GNOME_Evolution_Summary_ComponentFactory corba_object,
+ EvolutionServicesCreateViewFn create_view,
+ void *closure)
+{
+ ExecutiveSummaryComponentFactoryPrivate *priv;
+
+ g_return_if_fail (factory != NULL);
+ g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
+
+ bonobo_object_construct (BONOBO_OBJECT (factory), corba_object);
+ priv = factory->private;
+
+ priv->create_view = create_view;
+ priv->closure = closure;
+}
+
+
+/*** Public API ***/
+/**
+ * executive_summary_component_factory_new:
+ * @create_view: A pointer to the function to create a new view.
+ * @closure: The data to be passed to the @create_view function when it is
+ * called.
+ *
+ * Creates a BonoboObject that implements the Summary::ComponentFactory
+ * interface.
+ *
+ * Returns: A pointer to a BonoboObject.
+ */
+BonoboObject *
+executive_summary_component_factory_new (EvolutionServicesCreateViewFn create_view,
+ void *closure)
+{
+ ExecutiveSummaryComponentFactory *factory;
+ POA_GNOME_Evolution_Summary_ComponentFactory *servant;
+ GNOME_Evolution_Summary_ComponentFactory corba_object;
+
+ servant = create_factory_servant ();
+ if (servant == NULL)
+ return NULL;
+
+ factory = gtk_type_new (executive_summary_component_factory_get_type ());
+ corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (factory),
+ servant);
+ executive_summary_component_factory_construct (factory, corba_object,
+ create_view, closure);
+ return BONOBO_OBJECT (factory);
+}
+
diff --git a/executive-summary/evolution-services/executive-summary-component.h b/executive-summary/evolution-services/executive-summary-component.h
index 7d5ab904cc..9e09fea4a4 100644
--- a/executive-summary/evolution-services/executive-summary-component.h
+++ b/executive-summary/evolution-services/executive-summary-component.h
@@ -37,13 +37,6 @@ typedef struct _ExecutiveSummaryComponentPrivate ExecutiveSummaryComponentPrivat
typedef struct _ExecutiveSummaryComponent ExecutiveSummaryComponent;
typedef struct _ExecutiveSummaryComponentClass ExecutiveSummaryComponentClass;
-/* view is a ExecutiveSummaryComponentView * */
-typedef void (* EvolutionServicesCreateViewFn) (ExecutiveSummaryComponent *component,
- gpointer view,
- void *closure);
-typedef void (* EvolutionServicesConfigureFn) (ExecutiveSummaryComponent *component,
- void *closure);
-
struct _ExecutiveSummaryComponent {
BonoboObject parent;
@@ -56,18 +49,36 @@ struct _ExecutiveSummaryComponentClass {
GtkType executive_summary_component_get_type (void);
-BonoboObject *executive_summary_component_new (EvolutionServicesCreateViewFn create_view,
- EvolutionServicesConfigureFn configure,
- void *closure);
-void executive_summary_component_set_title (ExecutiveSummaryComponent *component,
- gpointer view);
-void executive_summary_component_set_icon (ExecutiveSummaryComponent *component,
- gpointer view);
+BonoboObject *executive_summary_component_new (void);
+
+
+/* Factory */
+
+#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE (executive_summary_component_factory_get_type ())
+#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE, ExecutiveSummaryComponentFactory))
+#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE, ExecutiveSummaryComponentFactoryClass))
+#define IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE))
+#define IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE))
+
+typedef struct _ExecutiveSummaryComponentFactoryPrivate ExecutiveSummaryComponentFactoryPrivate;
+typedef struct _ExecutiveSummaryComponentFactory ExecutiveSummaryComponentFactory;
+typedef struct _ExecutiveSummaryComponentFactoryClass ExecutiveSummaryComponentFactoryClass;
+
+typedef BonoboObject *(* EvolutionServicesCreateViewFn) (ExecutiveSummaryComponentFactory *factory,
+ void *closure);
+
+struct _ExecutiveSummaryComponentFactory {
+ BonoboObject parent;
+
+ ExecutiveSummaryComponentFactoryPrivate *private;
+};
+
+struct _ExecutiveSummaryComponentFactoryClass {
+ BonoboObjectClass parent_class;
+};
-void executive_summary_component_flash (ExecutiveSummaryComponent *component,
- gpointer view);
-void executive_summary_component_update (ExecutiveSummaryComponent *component,
- gpointer view);
-int executive_summary_component_create_unique_id (void);
+GtkType executive_summary_component_factory_get_type (void);
+BonoboObject *executive_summary_component_factory_new (EvolutionServicesCreateViewFn create_view,
+ void *closure);
#endif
diff --git a/executive-summary/evolution-services/executive-summary-html-view.c b/executive-summary/evolution-services/executive-summary-html-view.c
new file mode 100644
index 0000000000..ef90461623
--- /dev/null
+++ b/executive-summary/evolution-services/executive-summary-html-view.c
@@ -0,0 +1,244 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* executive-summary-html-view.c - Bonobo implementation of
+ * HtmlView.idl
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <bonobo.h>
+#include <gnome.h>
+#include <gal/util/e-util.h>
+
+#include "Executive-Summary.h"
+#include "executive-summary-html-view.h"
+
+static void executive_summary_html_view_destroy (GtkObject *object);
+static void executive_summary_html_view_init (ExecutiveSummaryHtmlView *component);
+static void executive_summary_html_view_class_init (ExecutiveSummaryHtmlViewClass *klass);
+
+#define PARENT_TYPE (bonobo_object_get_type ())
+
+static BonoboObjectClass *parent_class;
+
+struct _ExecutiveSummaryHtmlViewPrivate {
+ char *html;
+};
+
+/* CORBA interface */
+static POA_GNOME_Evolution_Summary_HTMLView__vepv HTMLView_vepv;
+
+static POA_GNOME_Evolution_Summary_HTMLView *
+create_servant (void)
+{
+ POA_GNOME_Evolution_Summary_HTMLView *servant;
+ CORBA_Environment ev;
+
+ servant = (POA_GNOME_Evolution_Summary_HTMLView *)g_new0 (BonoboObjectServant, 1);
+ servant->vepv = &HTMLView_vepv;
+
+ CORBA_exception_init (&ev);
+ POA_GNOME_Evolution_Summary_HTMLView__init ((PortableServer_Servant) servant, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_free (servant);
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+
+ return servant;
+}
+
+static CORBA_char *
+impl_GNOME_Evolution_Summary_HTMLView_getHtml (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ ExecutiveSummaryHtmlView *view;
+ ExecutiveSummaryHtmlViewPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ view = EXECUTIVE_SUMMARY_HTML_VIEW (bonobo_object);
+ priv = view->private;
+
+ return CORBA_string_dup (priv->html? priv->html: "");
+}
+
+/* GtkObject methods */
+static void
+executive_summary_html_view_destroy (GtkObject *object)
+{
+ ExecutiveSummaryHtmlView *view;
+ ExecutiveSummaryHtmlViewPrivate *priv;
+
+ view = EXECUTIVE_SUMMARY_HTML_VIEW (object);
+ priv = view->private;
+
+ if (priv == NULL)
+ return;
+
+ g_free (priv->html);
+ g_free (priv);
+
+ view->private = NULL;
+
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+static void
+corba_class_init (void)
+{
+ POA_GNOME_Evolution_Summary_HTMLView__vepv *vepv;
+ POA_GNOME_Evolution_Summary_HTMLView__epv *epv;
+ PortableServer_ServantBase__epv *base_epv;
+
+ base_epv = g_new0 (PortableServer_ServantBase__epv, 1);
+ base_epv->_private = NULL;
+ base_epv->finalize = NULL;
+ base_epv->default_POA = NULL;
+
+ epv = g_new0 (POA_GNOME_Evolution_Summary_HTMLView__epv, 1);
+ epv->getHtml = impl_GNOME_Evolution_Summary_HTMLView_getHtml;
+
+ vepv = &HTMLView_vepv;
+ vepv->_base_epv = base_epv;
+ vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
+ vepv->GNOME_Evolution_Summary_HTMLView_epv = epv;
+}
+
+static void
+executive_summary_html_view_class_init (ExecutiveSummaryHtmlViewClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = executive_summary_html_view_destroy;
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ corba_class_init ();
+}
+
+static void
+executive_summary_html_view_init (ExecutiveSummaryHtmlView *view)
+{
+ ExecutiveSummaryHtmlViewPrivate *priv;
+
+ priv = g_new (ExecutiveSummaryHtmlViewPrivate, 1);
+ priv->html = NULL;
+
+ view->private = priv;
+}
+
+E_MAKE_TYPE (executive_summary_html_view, "ExecutiveSummaryHtmlView",
+ ExecutiveSummaryHtmlView, executive_summary_html_view_class_init,
+ executive_summary_html_view_init, PARENT_TYPE);
+
+static void
+executive_summary_html_view_construct (ExecutiveSummaryHtmlView *view,
+ GNOME_Evolution_Summary_HTMLView corba_object)
+{
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
+
+ bonobo_object_construct (BONOBO_OBJECT (view), corba_object);
+}
+
+/*** Public API ***/
+/**
+ * executive_summary_html_view_new:
+ *
+ * Creates a new BonoboObject that implements
+ * the HTMLView.idl interface.
+ *
+ * Returns: A BonoboObject.
+ */
+BonoboObject *
+executive_summary_html_view_new (void)
+{
+ ExecutiveSummaryHtmlView *view;
+ POA_GNOME_Evolution_Summary_HTMLView *servant;
+ GNOME_Evolution_Summary_HTMLView corba_object;
+
+ servant = create_servant ();
+ if (servant == NULL)
+ return NULL;
+
+ view = gtk_type_new (executive_summary_html_view_get_type ());
+ corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (view),
+ servant);
+ executive_summary_html_view_construct (view, corba_object);
+
+ return BONOBO_OBJECT (view);
+}
+
+/**
+ * executive_summary_html_view_set_html:
+ * @view: The ExecutiveSummaryHtmlView to operate on,
+ * @html: The HTML as a string.
+ *
+ * Sets the HTML string in @view to @html. @html is copied into @view,
+ * so after this call you are free to do what you want with @html.
+ */
+void
+executive_summary_html_view_set_html (ExecutiveSummaryHtmlView *view,
+ const char *html)
+{
+ ExecutiveSummaryHtmlViewPrivate *priv;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (IS_EXECUTIVE_SUMMARY_HTML_VIEW (view));
+
+ priv = view->private;
+ if (priv->html)
+ g_free (priv->html);
+
+ if (html != NULL)
+ priv->html = g_strdup (html);
+ else
+ priv->html = NULL;
+}
+/**
+ * executive_summary_html_view_get_html:
+ * @view: The ExecutiveSummaryHtmlView to operate on.
+ *
+ * Retrieves the HTML stored in @view. This return value is not duplicated
+ * before returning, so you should not free it. Instead, if you want to free
+ * the HTML stored in @view, you should use
+ * executive_summary_html_view_set_html (view, NULL);.
+ *
+ * Returns: A pointer to the HTML stored in @view.
+ */
+const char *
+executive_summary_html_view_get_html (ExecutiveSummaryHtmlView *view)
+{
+ ExecutiveSummaryHtmlViewPrivate *priv;
+
+ g_return_val_if_fail (view != NULL, NULL);
+ g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_HTML_VIEW (view), NULL);
+
+ priv = view->private;
+ return priv->html;
+}
+
diff --git a/executive-summary/evolution-services/executive-summary-html-view.h b/executive-summary/evolution-services/executive-summary-html-view.h
new file mode 100644
index 0000000000..19e40cb2b8
--- /dev/null
+++ b/executive-summary/evolution-services/executive-summary-html-view.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* executive-summary-html-view.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 _EXECUTIVE_SUMMARY_HTML_VIEW_H__
+#define _EXECUTIVE_SUMMARY_HTML_VIEW_H__
+
+#include <bonobo/bonobo-object.h>
+
+#define EXECUTIVE_SUMMARY_HTML_VIEW_TYPE (executive_summary_html_view_get_type ())
+#define EXECUTIVE_SUMMARY_HTML_VIEW(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_HTML_VIEW_TYPE, ExecutiveSummaryHtmlView))
+#define EXECUTIVE_SUMMARY_HTML_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_HTML_VIEW_TYPE, ExecutiveSummaryHtmlViewClass))
+#define IS_EXECUTIVE_SUMMARY_HTML_VIEW(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_HTML_VIEW_TYPE))
+#define IS_EXECUTIVE_SUMMARY_HTML_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_HTML_VIEW_TYPE))
+
+typedef struct _ExecutiveSummaryHtmlViewPrivate ExecutiveSummaryHtmlViewPrivate;
+typedef struct _ExecutiveSummaryHtmlView ExecutiveSummaryHtmlView;
+typedef struct _ExecutiveSummaryHtmlViewClass ExecutiveSummaryHtmlViewClass;
+
+struct _ExecutiveSummaryHtmlView {
+ BonoboObject parent;
+
+ ExecutiveSummaryHtmlViewPrivate *private;
+};
+
+struct _ExecutiveSummaryHtmlViewClass {
+ BonoboObjectClass parent_class;
+};
+
+GtkType executive_summary_html_view_get_type (void);
+BonoboObject *executive_summary_html_view_new (void);
+
+void executive_summary_html_view_set_html (ExecutiveSummaryHtmlView *view,
+ const char *html);
+const char *executive_summary_html_view_get_html (ExecutiveSummaryHtmlView *view);
+
+#endif
+
diff --git a/executive-summary/evolution-services/executive-summary.c b/executive-summary/evolution-services/executive-summary.c
index 1f717cc0b4..868584ad52 100644
--- a/executive-summary/evolution-services/executive-summary.c
+++ b/executive-summary/evolution-services/executive-summary.c
@@ -79,6 +79,7 @@ create_servant (void)
return servant;
}
+#if 0
static void
impl_GNOME_Evolution_Summary_ViewFrame_setTitle (PortableServer_Servant servant,
CORBA_long id,
@@ -140,6 +141,7 @@ impl_GNOME_Evolution_Summary_ViewFrame_updateComponent (PortableServer_Servant s
gtk_signal_emit (GTK_OBJECT (summary), summary_signals[UPDATE],
id, html);
}
+#endif
/* GtkObject methods */
static void
@@ -173,10 +175,6 @@ corba_class_init (void)
base_epv->default_POA = NULL;
epv = g_new0 (POA_GNOME_Evolution_Summary_ViewFrame__epv, 1);
- epv->setTitle = impl_GNOME_Evolution_Summary_ViewFrame_setTitle;
- epv->setIcon = impl_GNOME_Evolution_Summary_ViewFrame_setIcon;
- epv->flash = impl_GNOME_Evolution_Summary_ViewFrame_flash;
- epv->updateComponent = impl_GNOME_Evolution_Summary_ViewFrame_updateComponent;
vepv = &Summary_vepv;
vepv->_base_epv = base_epv;
diff --git a/executive-summary/evolution-services/executive-summary.h b/executive-summary/evolution-services/executive-summary.h
index 23765044f4..ad5a07149d 100644
--- a/executive-summary/evolution-services/executive-summary.h
+++ b/executive-summary/evolution-services/executive-summary.h
@@ -65,3 +65,4 @@ void executive_summary_construct (ExecutiveSummary *es,
GNOME_Evolution_Summary_ViewFrame corba_object);
BonoboObject *executive_summary_new (void);
#endif
+
diff --git a/executive-summary/idl/Executive-Summary.idl b/executive-summary/idl/Executive-Summary.idl
index ac3809e299..a564e90fe6 100644
--- a/executive-summary/idl/Executive-Summary.idl
+++ b/executive-summary/idl/Executive-Summary.idl
@@ -1,3 +1,4 @@
#include <Bonobo.idl>
#include <SummaryComponent.idl>
#include <Summary.idl>
+#include <HtmlView.idl>
diff --git a/executive-summary/idl/HtmlView.idl b/executive-summary/idl/HtmlView.idl
new file mode 100644
index 0000000000..0116fbf9b8
--- /dev/null
+++ b/executive-summary/idl/HtmlView.idl
@@ -0,0 +1,23 @@
+/*-*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * CORBA interface for an HTML view.
+ *
+ * Authors:
+ * Iain Holmes <iain@helixcode.com>
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ */
+
+#include <Bonobo.idl>
+
+module GNOME {
+module Evolution {
+module Summary {
+
+ interface HTMLView : Bonobo::Unknown{
+ string getHtml ();
+ };
+};
+};
+};
+
diff --git a/executive-summary/idl/Summary.idl b/executive-summary/idl/Summary.idl
index 04b89187e0..118a0788d9 100644
--- a/executive-summary/idl/Summary.idl
+++ b/executive-summary/idl/Summary.idl
@@ -14,44 +14,6 @@ module GNOME {
module Evolution {
module Summary {
interface ViewFrame: Bonobo::Unknown {
- exception NoSubWindow {};
-
- /**
- * setTitle:
- * @component: The SummaryComponent whose window to set the title.
- * @title: The title.
- *
- * Sets the title of the subwindow that displays @component
- * to @title
- */
- void setTitle (in long id,
- in string title)
- raises (NoSubWindow);
-
- void setIcon (in long id,
- in string icon)
- raises (NoSubWindow);
-
- /**
- * flash:
- * @component: The SummaryComponent that owns a subwindow.
- *
- * Flashes the subwindow that displays @component.
- */
- void flash (in long id)
- raises (NoSubWindow);
-
- /**
- * updateComponent:
- * @component: The SummaryComponent that owns a subwindow.
- * @html: The new html that defines a component.
- *
- * Requests that the html that displays @component is changed
- * to @html.
- */
- void updateComponent (in long id,
- in string html)
- raises (NoSubWindow);
};
};
};
diff --git a/executive-summary/idl/SummaryComponent.idl b/executive-summary/idl/SummaryComponent.idl
index fbfd58800a..1129721a02 100644
--- a/executive-summary/idl/SummaryComponent.idl
+++ b/executive-summary/idl/SummaryComponent.idl
@@ -11,6 +11,7 @@
/* TODO: Needs Exceptions */
#include <Bonobo.idl>
+#include <oaf-factory.idl>
module GNOME {
module Evolution {
@@ -33,38 +34,10 @@ module Summary {
* Unsets the owner of the component.
*/
void unsetOwner ();
+ };
- /**
- * createView:
- * @control: A Bonobo_Control
- * @html: HTML of the view.
- * @title: Title of the view.
- * @icon: Icon to be used for the view.
- *
- * Creates a summary of the data that the component has.
- * Returns: The ID of the view.
- */
- long createView (in long id,
- out Bonobo::Control control,
- out string html,
- out string title,
- out string icon);
-
- /**
- * destroyView:
- * @id: ID of the view to be destroyed.
- *
- * Tells a service that a view has been destroyed.
- */
- void destroyView (in long id);
-
- /**
- * configure:
- *
- * Instructs the component to open a preferences dialog.
- */
- void configure ();
-
+ interface ComponentFactory: Bonobo::Unknown {
+ Component createView ();
};
};
};
diff --git a/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oaf.in b/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oaf.in
new file mode 100644
index 0000000000..327fd8de72
--- /dev/null
+++ b/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oaf.in
@@ -0,0 +1,27 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:evolution-summary-component-factory:rdf-summary:8d7a395c-1036-4e54-8aa6-bd30fb5a1379"
+ type="exe"
+ location="rdf-summary">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the RDF summary."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-summary-component:rdf-summary:65610e8c-7994-4cde-ab35-c907f35e37c0"
+ type="factory"
+ location="OAFIID:evolution-summary-component-factory:rdf-summary:8d7a395c-1036-4e54-8aa6-bd30fb5a1379">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="RDF Summary"/>
+</oaf_server>
+
+</oaf_info>
diff --git a/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oafinfo b/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oafinfo
new file mode 100644
index 0000000000..327fd8de72
--- /dev/null
+++ b/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oafinfo
@@ -0,0 +1,27 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:evolution-summary-component-factory:rdf-summary:8d7a395c-1036-4e54-8aa6-bd30fb5a1379"
+ type="exe"
+ location="rdf-summary">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the RDF summary."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-summary-component:rdf-summary:65610e8c-7994-4cde-ab35-c907f35e37c0"
+ type="factory"
+ location="OAFIID:evolution-summary-component-factory:rdf-summary:8d7a395c-1036-4e54-8aa6-bd30fb5a1379">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="RDF Summary"/>
+</oaf_server>
+
+</oaf_info>
diff --git a/executive-summary/test-service/GNOME_Evolution_Summary_test.oaf.in b/executive-summary/test-service/GNOME_Evolution_Summary_test.oaf.in
index dd169b8853..37fbbe9642 100644
--- a/executive-summary/test-service/GNOME_Evolution_Summary_test.oaf.in
+++ b/executive-summary/test-service/GNOME_Evolution_Summary_test.oaf.in
@@ -5,7 +5,7 @@
location="test-service">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME:GenericFactory:1.0"/>
+ <item value="IDL:GNOME/GenericFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
@@ -17,11 +17,37 @@
location="OAFIID:evolution-summary-component-factory:test-service:0ea887d5-622b-4b8c-b525-18aa1cbe18a6">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution:SummaryComponent:1.0"/>
+ <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
value="Test service"/>
</oaf_server>
+<!-- This does not work
+<oaf_server iid="OAFIID:evolution-summary-component-factory:test-bonobo-service:b6da2ad2-1fbb-4539-93f9-038b1702810e"
+ type="exe"
+ location="test-bonobo-service">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the test bonobo component."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-summary-component:test-bonobo-service:d3cb3ed6-a654-4337-8aa0-f443751d6d1b"
+ type="factory"
+ location="OAFIID:evolution-summary-component-factory:test-bonobo-service:b6da2ad2-1fbb-4539-93f9-038b1702810e">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Test bonobo service"/>
+</oaf_server>
+
+-->
</oaf_info>
diff --git a/executive-summary/test-service/GNOME_Evolution_Summary_test.oafinfo b/executive-summary/test-service/GNOME_Evolution_Summary_test.oafinfo
index dd169b8853..37fbbe9642 100644
--- a/executive-summary/test-service/GNOME_Evolution_Summary_test.oafinfo
+++ b/executive-summary/test-service/GNOME_Evolution_Summary_test.oafinfo
@@ -5,7 +5,7 @@
location="test-service">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME:GenericFactory:1.0"/>
+ <item value="IDL:GNOME/GenericFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
@@ -17,11 +17,37 @@
location="OAFIID:evolution-summary-component-factory:test-service:0ea887d5-622b-4b8c-b525-18aa1cbe18a6">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution:SummaryComponent:1.0"/>
+ <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
value="Test service"/>
</oaf_server>
+<!-- This does not work
+<oaf_server iid="OAFIID:evolution-summary-component-factory:test-bonobo-service:b6da2ad2-1fbb-4539-93f9-038b1702810e"
+ type="exe"
+ location="test-bonobo-service">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the test bonobo component."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-summary-component:test-bonobo-service:d3cb3ed6-a654-4337-8aa0-f443751d6d1b"
+ type="factory"
+ location="OAFIID:evolution-summary-component-factory:test-bonobo-service:b6da2ad2-1fbb-4539-93f9-038b1702810e">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Test bonobo service"/>
+</oaf_server>
+
+-->
</oaf_info>
diff --git a/executive-summary/test-service/Makefile.am b/executive-summary/test-service/Makefile.am
index e294a3ea49..56333302d7 100644
--- a/executive-summary/test-service/Makefile.am
+++ b/executive-summary/test-service/Makefile.am
@@ -15,7 +15,25 @@ test_service_LDADD = \
$(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
$(BONOBO_VFS_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS)
+
+#test_bonobo_service_SOURCES = \
+# test-bonobo.c
+
+#test_bonobo_service_LDADD = \
+# $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
+# $(BONOBO_VFS_GNOME_LIBS) \
+# $(EXTRA_GNOME_LIBS)
+
+#rdf_summary_SOURCES = \
+# rdf-summary.c
+
+#rdf_summary_LDADD = \
+# $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
+# $(BONOBO_VFS_GNOME_LIBS) \
+# $(EXTRA_GNOME_LIBS)
+
oafdir = $(datadir)/oaf
-oaf_DATA = test-service.oafinfo
+oaf_DATA = test-service.oafinfo \
+ rdf-summary.oafinfo
EXTRA_DIST = $(oaf_DATA)
diff --git a/executive-summary/test-service/main.c b/executive-summary/test-service/main.c
index 75bbc3199b..6a646adecd 100644
--- a/executive-summary/test-service/main.c
+++ b/executive-summary/test-service/main.c
@@ -30,131 +30,220 @@
#include <bonobo.h>
#include <evolution-services/executive-summary-component.h>
-#include <evolution-services/executive-summary-component-view.h>
+#include <evolution-services/executive-summary-html-view.h>
#include <liboaf/liboaf.h>
-static int running_views = 0;
+enum {
+ PROPERTY_TITLE,
+ PROPERTY_ICON
+};
-struct userdata {
- int i;
+struct _UserData {
+ char *title;
+ char *icon;
};
+typedef struct _UserData UserData;
+
+static int running_views = 0;
#define TEST_SERVICE_ID "OAFIID:evolution-summary-component-factory:test-service:0ea887d5-622b-4b8c-b525-18aa1cbe18a6"
static BonoboGenericFactory *factory = NULL;
-/* The "do something interesting" function */
-int
-add_one (ExecutiveSummaryComponentView *view)
+/* PersistStream callbacks */
+static void
+load_from_stream (BonoboPersistStream *ps,
+ Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ gpointer data,
+ CORBA_Environment *ev)
{
- char *html;
- struct userdata *ud;
+ char *str;
- /* Get the user data from the view */
- ud = gtk_object_get_data (GTK_OBJECT (view), "timer-data");
- if (ud == NULL) {
- g_warning ("No user data");
- return FALSE;
+ if (*type && g_strcasecmp (type, "application/x-test-service") != 0) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
}
-
- /* Generate the new html */
- html = g_strdup_printf ("Since you started this service<br>"
- "<center>%d</center><br>seconds have passed.", ud->i);
-
- /* Change the html on the view
- which will tell the Executive Summary that something needs updating */
- executive_summary_component_view_set_html (view, html);
-
- /* executive_summary_component_view_set_html () makes a copy of the HTML
- passed into it, so we don't need to keep it around */
- g_free (html);
-
- /* Do something "fun" */
- ud->i++;
-
- return TRUE;
+
+ bonobo_stream_client_read_string (stream, &str, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION || str == NULL) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
+
+ g_print ("Restoring with :%s\n", str);
+ g_free (str);
}
-void
-view_destroyed (GtkObject *object,
- gpointer data)
+static void
+save_to_stream (BonoboPersistStream *ps,
+ const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ gpointer data,
+ CORBA_Environment *ev)
{
- ExecutiveSummaryComponentView *view;
- struct userdata *ud;
- int id;
-
- /* Free the user data for this view*/
- ud = gtk_object_get_data (object, "timer-data");
- gtk_object_set_data (object, "timer-data", NULL);
+
+ if (*type && g_strcasecmp (type, "application/x-test-service") != 0) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
+
+ bonobo_stream_client_printf (stream, TRUE, ev, "Yo yo yo");
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ return;
+}
+
+static Bonobo_Persist_ContentTypeList *
+content_types (BonoboPersistStream *ps,
+ void *closure,
+ CORBA_Environment *ev)
+{
+ return bonobo_persist_generate_content_types (1, "application/x-test-service");
+}
+
+/* PropertyControl callback */
+
+/* Propertybag set/get functions */
+static void
+set_property (BonoboPropertyBag *bag,
+ const BonoboArg *arg,
+ guint arg_id,
+ gpointer user_data)
+{
+ switch (arg_id) {
+ case PROPERTY_TITLE:
+ g_print ("Setting title.\n");
+ break;
+
+ case PROPERTY_ICON:
+ g_print ("Setting icon.\n");
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void
+get_property (BonoboPropertyBag *bag,
+ BonoboArg *arg,
+ guint arg_id,
+ gpointer user_data)
+{
+ UserData *ud = (UserData *) user_data;
+
+ switch (arg_id) {
+ case PROPERTY_TITLE:
+ BONOBO_ARG_SET_STRING (arg, ud->title);
+ break;
+
+ case PROPERTY_ICON:
+ BONOBO_ARG_SET_STRING (arg, ud->icon);
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void
+component_destroyed (GtkObject *object,
+ gpointer data)
+{
+ UserData *ud = (UserData *) ud;
+ /* Free the UserData structure */
+ g_free (ud->title);
+ g_free (ud->icon);
g_free (ud);
-
- /* Remove one running view */
+
running_views--;
-
- /* If there are no running views left, quit */
+
+ g_print ("Destroy!\n");
if (running_views <= 0)
gtk_main_quit ();
}
-/* Create the view:
- HTML only */
-static void
-create_view (ExecutiveSummaryComponent *component,
- ExecutiveSummaryComponentView *view,
+static BonoboObject *
+create_view (ExecutiveSummaryComponentFactory *_factory,
void *closure)
{
- char *html = "Since you started this service<br><center>0</center><br>seconds have passed.";
- struct userdata *ud;
-
- g_print ("In: %s\n", __FUNCTION__);
- /* Create the userdata structure */
- ud = g_new (struct userdata, 1);
-
- ud->i = 1;
- executive_summary_component_view_construct (view, component, NULL,
- html, "The Magic Counter",
- "gnome-clock.png");
- g_print ("Out: %s\n", __FUNCTION__);
- /* Set the user data on the object */
- gtk_object_set_data (GTK_OBJECT (view), "timer-data", ud);
+ BonoboObject *component, *view, *bag, *stream;
+ UserData *ud;
+
+ /* Create the component object */
+ component = executive_summary_component_new ();
+
+ /* Create the UserData structure and fill it */
+ ud = g_new (UserData, 1);
+ ud->title = g_strdup ("Hello World!");
+ ud->icon = g_strdup ("apple-red.png");
+
+ gtk_signal_connect (GTK_OBJECT (component), "destroy",
+ GTK_SIGNAL_FUNC (component_destroyed), ud);
+
+ /* Now create the aggregate objects. For a "service"
+ either a Summary::HTMLView or Bonobo::Control are required.
+ Other supported agreggate objects are
+ PersistStream: For saving and restoring the component.
+ PropertyBag: To set the icon and title and other properties
+ PropertyControl: To produce a control to configure the service.
- /* Connect the the destroyed signal to find out
- when the view is destroyed */
- gtk_signal_connect (GTK_OBJECT (view), "destroy",
- GTK_SIGNAL_FUNC (view_destroyed), NULL);
+ To aggregate the objects
+ i) Create the objects using their creation functions
+ ii) Use bonobo_object_add_interface ().
+ */
- /* Increase the number of running views */
- running_views++;
+ /* The Summary::HTMLView interface */
+ view = executive_summary_html_view_new ();
+ /* Set the default HTML */
+ executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (view),
+ "<B>Hello World</b>");
- /* Do something "interesting" once a second */
- gtk_timeout_add (1000, add_one, view);
-}
+ bonobo_object_add_interface (component, view);
-static void
-configure (ExecutiveSummaryComponent *component,
- void *closure)
-{
- GtkWidget *window, *label;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- label = gtk_label_new ("This is a configuration dialog.\nNo it really is");
-
- gtk_container_add (GTK_CONTAINER (window), label);
- gtk_widget_show_all (window);
+ /* Add the Bonobo::PropertyBag interface */
+ bag = bonobo_property_bag_new (get_property, set_property, ud);
+ /* Add the properties. There should be 2:
+ window_title: For the window title.
+ window_icon: For the window icon.
+ */
+ bonobo_property_bag_add (BONOBO_PROPERTY_BAG (bag),
+ "window_title", PROPERTY_TITLE,
+ BONOBO_ARG_STRING,
+ NULL,
+ "The title of this components window", 0);
+ bonobo_property_bag_add (BONOBO_PROPERTY_BAG (bag),
+ "window_icon", PROPERTY_ICON,
+ BONOBO_ARG_STRING,
+ NULL,
+ "The icon for this component's window", 0);
+
+ /* Now add the interface */
+ bonobo_object_add_interface (component, bag);
+
+
+ /* Add the Bonobo::PersistStream interface */
+ stream = bonobo_persist_stream_new (load_from_stream, save_to_stream,
+ NULL, content_types, NULL);
+ bonobo_object_add_interface (component, stream);
+
+ /* Return the ExecutiveSummaryComponent object */
+ return component;
}
static BonoboObject *
-factory_fn (BonoboGenericFactory *_factory,
+factory_fn (BonoboGenericFactory *generic_factory,
void *closure)
{
- ExecutiveSummaryComponent *component;
+ BonoboObject *_factory;
- /* Create an executive summary component for this factory */
- component = executive_summary_component_new (create_view,
- configure,
- NULL);
- return BONOBO_OBJECT (component);
+ /* Create an executive summary component factory */
+ _factory = executive_summary_component_factory_new (create_view, NULL);
+ return _factory;
}
void
diff --git a/executive-summary/test-service/rdf-summary.c b/executive-summary/test-service/rdf-summary.c
new file mode 100644
index 0000000000..b87c20a3c3
--- /dev/null
+++ b/executive-summary/test-service/rdf-summary.c
@@ -0,0 +1,393 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* RDF viewer Evolution Executive Summary Component.
+ * Bonoboised by Iain Holmes <iain@helixcode.com>
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * Based on code from Portaloo
+ * Channel retrieval tool
+ *
+ * (C) 1998 Alan Cox.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <gnome.h>
+#include <bonobo.h>
+#include <gnome-xml/parser.h>
+
+#include <evolution-services/executive-summary-component.h>
+#include <evolution-services/executive-summary-component-view.h>
+#include <liboaf/liboaf.h>
+#include <libgnomevfs/gnome-vfs.h>
+
+int xmlSubstituteEntitiesDefaultValue = 1; /* DV thinks of everything */
+
+static int wipe_trackers = FALSE;
+static int running_views = 0;
+
+static BonoboGenericFactory *factory = NULL;
+#define RDF_SUMMARY_ID "OAFIID:evolution-summary-component-factory:rdf-summary:8d7a395c-1036-4e54-8aa6-bd30fb5a1379"
+
+/************ RDF Parser *******************/
+
+static char *
+layer_find (xmlNodePtr node,
+ char *match,
+ char *fail)
+{
+ while (node!=NULL) {
+#ifdef RDF_DEBUG
+ xmlDebugDumpNode (stdout, node, 32);
+ printf("%s.\n", node->name);
+#endif
+ if (strcasecmp (node->name, match)==0) {
+ if (node->childs != NULL && node->childs->content != NULL) {
+ return node->childs->content;
+ } else {
+ return fail;
+ }
+ }
+ node = node->next;
+ }
+ return fail;
+}
+
+static char *
+layer_find_url (xmlNodePtr node,
+ char *match,
+ char *fail)
+{
+ char *p = layer_find (node, match, fail);
+ char *r = p;
+ static char *wb = NULL;
+ char *w;
+
+ if (wb) {
+ free (wb);
+ }
+
+ wb = w = malloc (3 * strlen (p));
+
+ if (w == NULL) {
+ fprintf(stderr, "Out of memory\n");
+ exit(1);
+ }
+
+ if (*r == ' ') r++; /* Fix UF bug */
+
+ while (*r) {
+ if (memcmp (r, "&amp;", 5) == 0) {
+ *w++ = '&';
+ r += 5;
+ continue;
+ }
+ if (memcmp (r, "&lt;", 4) == 0) {
+ *w++ = '<';
+ r += 4;
+ continue;
+ }
+ if (memcmp (r, "&gt;", 4) == 0) {
+ *w++ = '>';
+ r += 4;
+ continue;
+ }
+ if (*r == '"' || *r == ' '){
+ *w++ = '%';
+ *w++ = "0123456789ABCDEF"[*r/16];
+ *w++ = "0123456789ABCDEF"[*r&15];
+ r++;
+ continue;
+ }
+ *w++ = *r++;
+ }
+ *w = 0;
+ return wb;
+}
+
+static void
+tree_walk (xmlNodePtr root,
+ ExecutiveSummaryComponentView *view,
+ GString *html)
+{
+ xmlNodePtr walk;
+ xmlNodePtr rewalk = root;
+ xmlNodePtr channel = NULL;
+ xmlNodePtr image = NULL;
+ xmlNodePtr item[16];
+ int items = 0;
+ int limit = 10;
+ int i;
+ char *t;
+ char n[512];
+ char *tmp;
+
+ do {
+ walk = rewalk;
+ rewalk = NULL;
+
+ while (walk!=NULL){
+#ifdef RDF_DEBUG
+ printf ("%p, %s\n", walk, walk->name);
+#endif
+ if (strcasecmp (walk->name, "rdf") == 0) {
+ rewalk = walk->childs;
+ walk = walk->next;
+ continue;
+ }
+ if (strcasecmp (walk->name, "rss") == 0){
+ rewalk = walk->childs;
+ walk = walk->next;
+ continue;
+ }
+ /* This is the channel top level */
+#ifdef RDF_DEBUG
+ printf ("Top level '%s'.\n", walk->name);
+#endif
+ if (strcasecmp (walk->name, "channel") == 0) {
+ channel = walk;
+ rewalk = channel->childs;
+ }
+ if (strcasecmp (walk->name, "image") == 0) {
+ image = walk;
+ g_print ("Image\n");
+ }
+ if (strcasecmp (walk->name, "item") == 0 && items < 16) {
+ item[items++] = walk;
+ }
+ walk = walk->next;
+ }
+ }
+ while (rewalk);
+
+ if (channel == NULL) {
+ fprintf(stderr, "No channel definition.\n");
+ exit(1);
+ }
+
+ t = layer_find(channel->childs, "title", "No title");
+/* g_string_append (html, tmp); */
+ executive_summary_component_view_set_title (view, t);
+
+ tmp = g_strdup_printf ("%s",
+ layer_find(channel->childs, "description", ""));
+ g_string_append (html, tmp);
+ g_free (tmp);
+
+ if (image && !wipe_trackers) {
+ g_print ("URL: %s\n", layer_find_url (image->childs, "url",
+ "green-apple.png"));
+ executive_summary_component_view_set_icon (view,
+ layer_find_url
+ (image->childs,
+ "url", "apple-green.png"));
+ }
+
+ g_string_append (html, "<br clear=all><FONT size=\"-1\" face=\"helvetica\"><P><UL>\n");
+
+ for (i = 0; i < items; i++) {
+ char *p = layer_find (item[i]->childs, "title", "No information");
+
+ if(i == limit)
+ g_string_append (html, "--\n");
+ if (wipe_trackers) {
+ char *p = layer_find_url (item[i]->childs, "link", "");
+ char *x = strchr (p, '?');
+ unsigned char *r, *w;
+ int n;
+ if (x == NULL)
+ continue;
+ x++;
+ r = x;
+ w = x;
+ while (*r) {
+ if (*r == '+') {
+ *w++ = ' ';
+ } else if (*r == '%') {
+ sscanf (r+1, "%02x", &n);
+ *w++ = n;
+ r += 2;
+ } else {
+ *w++ = *r;
+ }
+ r++;
+ }
+ *w = 0;
+ tmp = g_strdup_printf ("<LI><A href=\"%s\">\n", x+4);
+ g_string_append (html, tmp);
+ g_free (tmp);
+ }
+ else {
+ tmp = g_strdup_printf ("<LI><A href=\"%s\">\n", layer_find_url(item[i]->childs, "link", ""));
+ g_string_append (html, tmp);
+ g_free (tmp);
+ }
+
+ tmp = g_strdup_printf ("%s\n</A>\n", p);
+ g_string_append (html, tmp);
+ g_free (tmp);
+ }
+ g_string_append (html, "</UL></FONT>\n");
+}
+
+/********* ExecutiveSummaryComponent section **************/
+static void
+view_destroyed (GtkObject *object,
+ gpointer data)
+{
+ running_views--;
+ if (running_views <= 0) {
+ gtk_main_quit ();
+ }
+}
+
+static int
+download (ExecutiveSummaryComponentView *view)
+{
+ GString *rdf;
+ GString *html;
+ char *xml;
+ GnomeVFSHandle *handle = NULL;
+ GnomeVFSResult result;
+ xmlDocPtr doc;
+ char *location;
+ int len = 0;
+
+ /* Download the RDF file here */
+ /* Then parse it */
+ /* The update it */
+
+ location = "/home/iain/gnotices.rdf";
+ result = gnome_vfs_open (&handle, location, GNOME_VFS_OPEN_READ);
+ if (result != GNOME_VFS_OK) {
+ char *emsg;
+
+ emsg = g_strdup_printf ("<b>Cannot open location:<br>%s</b>",
+ location);
+ executive_summary_component_view_set_html (view, emsg);
+ g_free (emsg);
+ return FALSE;
+ }
+
+ rdf = g_string_new ("");
+
+ while (1) {
+ char buffer[4096];
+ GnomeVFSFileSize size;
+
+ memset (buffer, 0x00, 4096);
+
+ result = gnome_vfs_read (handle, buffer, 4096, &size);
+ if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) {
+ executive_summary_component_view_set_html (view,
+ "<b>Error reading data.</b>");
+ g_string_free (rdf, TRUE);
+ return FALSE;
+ }
+
+ if (size == 0) {
+ break;
+ }
+
+ rdf = g_string_append (rdf, buffer);
+ len += size;
+ }
+
+ gnome_vfs_close (handle);
+ xml = rdf->str;
+ g_string_free (rdf, FALSE);
+
+ doc = xmlParseMemory (xml, len);
+ if (doc == NULL) {
+ g_warning ("Unable to parse document.");
+ return FALSE;
+ }
+
+ g_free (xml);
+ html = g_string_new ("");
+
+ tree_walk (doc->root, view, html);
+ executive_summary_component_view_set_html (view, html->str);
+ g_string_free (html, TRUE);
+ return FALSE;
+}
+
+static void
+create_view (ExecutiveSummaryComponent *component,
+ ExecutiveSummaryComponentView *view,
+ void *closure)
+{
+ char *html = "<b>Loading RDF file. . .<br>Please wait</b>";
+
+ executive_summary_component_view_construct (view, component, NULL,
+ html, "Downloading",
+ "apple-green.png");
+ gtk_signal_connect (GTK_OBJECT (view), "destroy",
+ GTK_SIGNAL_FUNC (view_destroyed), NULL);
+ running_views++;
+ g_idle_add (download, view);
+}
+
+static BonoboObject *
+factory_fn (BonoboGenericFactory *_factory,
+ void *closure)
+{
+ ExecutiveSummaryComponent *component;
+
+ component = executive_summary_component_new (create_view, NULL);
+ return BONOBO_OBJECT (component);
+}
+
+static void
+factory_init (void)
+{
+ if (factory != NULL) {
+ return;
+ }
+
+ factory = bonobo_generic_factory_new (RDF_SUMMARY_ID, factory_fn, NULL);
+ if (factory == NULL) {
+ g_error ("Cannot initialize factory");
+ }
+}
+
+int
+main (int argc,
+ char *argv[])
+{
+ CORBA_ORB orb;
+
+ gnome_init_with_popt_table ("RDF-Summary", VERSION,
+ argc, argv, oaf_popt_options, 0, NULL);
+ orb = oaf_init (argc, argv);
+ gnome_vfs_init ();
+
+ if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
+ g_error ("Could not initialize Bonobo");
+ }
+
+ factory_init ();
+ bonobo_main ();
+ return 0;
+
+#if 0
+ doc=xmlParseMemory(document, docp);
+
+ if(doc==NULL)
+ {
+ fprintf(stderr, "Unable to parse document.\n");
+ exit(1);
+ }
+
+ tree_walk(doc->root);
+
+ if(rename(buf, nam))
+ perror("rename");
+ return 0;
+#endif
+
+}
+
diff --git a/executive-summary/test-service/rdf-summary.oafinfo b/executive-summary/test-service/rdf-summary.oafinfo
new file mode 100644
index 0000000000..327fd8de72
--- /dev/null
+++ b/executive-summary/test-service/rdf-summary.oafinfo
@@ -0,0 +1,27 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:evolution-summary-component-factory:rdf-summary:8d7a395c-1036-4e54-8aa6-bd30fb5a1379"
+ type="exe"
+ location="rdf-summary">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the RDF summary."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-summary-component:rdf-summary:65610e8c-7994-4cde-ab35-c907f35e37c0"
+ type="factory"
+ location="OAFIID:evolution-summary-component-factory:rdf-summary:8d7a395c-1036-4e54-8aa6-bd30fb5a1379">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="RDF Summary"/>
+</oaf_server>
+
+</oaf_info>
diff --git a/executive-summary/test-service/test-service.oafinfo b/executive-summary/test-service/test-service.oafinfo
index dd169b8853..37fbbe9642 100644
--- a/executive-summary/test-service/test-service.oafinfo
+++ b/executive-summary/test-service/test-service.oafinfo
@@ -5,7 +5,7 @@
location="test-service">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME:GenericFactory:1.0"/>
+ <item value="IDL:GNOME/GenericFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
@@ -17,11 +17,37 @@
location="OAFIID:evolution-summary-component-factory:test-service:0ea887d5-622b-4b8c-b525-18aa1cbe18a6">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution:SummaryComponent:1.0"/>
+ <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
value="Test service"/>
</oaf_server>
+<!-- This does not work
+<oaf_server iid="OAFIID:evolution-summary-component-factory:test-bonobo-service:b6da2ad2-1fbb-4539-93f9-038b1702810e"
+ type="exe"
+ location="test-bonobo-service">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the test bonobo component."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-summary-component:test-bonobo-service:d3cb3ed6-a654-4337-8aa0-f443751d6d1b"
+ type="factory"
+ location="OAFIID:evolution-summary-component-factory:test-bonobo-service:b6da2ad2-1fbb-4539-93f9-038b1702810e">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Test bonobo service"/>
+</oaf_server>
+
+-->
</oaf_info>
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 <iain@helixcode.com>
+
+ * mail-config-gui.c (mail_config): Don't use the "delete-event"
+ signal.
+
+2000-11-21 Iain Holmes <iain@helixcode.com>
+
+ * 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 <danw@helixcode.com>
* 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">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME:GenericFactory:1.0"/>
+ <item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
@@ -70,7 +70,7 @@
location="OAFIID:evolution-executive-summary-component-factory:evolution-mail:be210cba-0eee-4def-84fa-643d50321217">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution:SummaryComponent:1.0"/>
+ <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
diff --git a/mail/GNOME_Evolution_Mail.oafinfo b/mail/GNOME_Evolution_Mail.oafinfo
index b187ffc121..eba585cca8 100644
--- a/mail/GNOME_Evolution_Mail.oafinfo
+++ b/mail/GNOME_Evolution_Mail.oafinfo
@@ -58,7 +58,7 @@
location="evolution-mail">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME:GenericFactory:1.0"/>
+ <item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
@@ -70,7 +70,7 @@
location="OAFIID:evolution-executive-summary-component-factory:evolution-mail:be210cba-0eee-4def-84fa-643d50321217">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution:SummaryComponent:1.0"/>
+ <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 111718b5e2..6b6f16cca4 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -44,7 +44,6 @@
#include "component-factory.h"
-#include <executive-summary/evolution-services/executive-summary-component.h>
#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">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME:GenericFactory:1.0"/>
+ <item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
@@ -70,7 +70,7 @@
location="OAFIID:evolution-executive-summary-component-factory:evolution-mail:be210cba-0eee-4def-84fa-643d50321217">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution:SummaryComponent:1.0"/>
+ <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c
index 0c6d9c7a74..90e11083f0 100644
--- a/mail/mail-config-gui.c
+++ b/mail/mail-config-gui.c
@@ -2201,9 +2201,6 @@ mail_config (GNOME_Evolution_Shell shell)
gtk_signal_connect (GTK_OBJECT (dialog->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 <bonobo.h>
+#include <bonobo/bonobo-property-bag.h>
#include "camel.h"
#include <gnome.h>
@@ -40,7 +41,7 @@
#include "filter/vfolder-context.h"
#include <evolution-services/executive-summary-component.h>
-#include <evolution-services/executive-summary-component-view.h>
+#include <evolution-services/executive-summary-html-view.h>
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;
}