aboutsummaryrefslogtreecommitdiffstats
path: root/executive-summary
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2000-12-08 08:00:15 +0800
committerIain Holmes <iain@src.gnome.org>2000-12-08 08:00:15 +0800
commit4a74b1ff15ca5cbc175c8fb98839960f1af494fb (patch)
treeed80ade2d481f5a265c0d9a475be689ace09c8df /executive-summary
parentadf19f49fbdf0e0e69a6ed80fe0cddaf4f3978d1 (diff)
downloadgsoc2013-evolution-4a74b1ff15ca5cbc175c8fb98839960f1af494fb.tar
gsoc2013-evolution-4a74b1ff15ca5cbc175c8fb98839960f1af494fb.tar.gz
gsoc2013-evolution-4a74b1ff15ca5cbc175c8fb98839960f1af494fb.tar.bz2
gsoc2013-evolution-4a74b1ff15ca5cbc175c8fb98839960f1af494fb.tar.lz
gsoc2013-evolution-4a74b1ff15ca5cbc175c8fb98839960f1af494fb.tar.xz
gsoc2013-evolution-4a74b1ff15ca5cbc175c8fb98839960f1af494fb.tar.zst
gsoc2013-evolution-4a74b1ff15ca5cbc175c8fb98839960f1af494fb.zip
New and improved display,
Bug fixes memory leaks removed Preferences and probably more that I can't remember. svn path=/trunk/; revision=6858
Diffstat (limited to 'executive-summary')
-rw-r--r--executive-summary/ChangeLog159
-rw-r--r--executive-summary/Makefile.am6
-rw-r--r--executive-summary/component/Makefile.am8
-rw-r--r--executive-summary/component/e-summary-callbacks.c212
-rw-r--r--executive-summary/component/e-summary-callbacks.h10
-rw-r--r--executive-summary/component/e-summary-factory.c50
-rw-r--r--executive-summary/component/e-summary-prefs.c97
-rw-r--r--executive-summary/component/e-summary-prefs.h39
-rw-r--r--executive-summary/component/e-summary-url.c125
-rw-r--r--executive-summary/component/e-summary.c259
-rw-r--r--executive-summary/component/e-summary.h23
-rw-r--r--executive-summary/component/executive-summary-config.glade169
-rw-r--r--executive-summary/component/main.c6
-rw-r--r--executive-summary/evolution-services/executive-summary-component-factory-client.c1
-rw-r--r--executive-summary/evolution-services/executive-summary-component.c107
-rw-r--r--executive-summary/evolution-services/executive-summary-html-view.c27
-rw-r--r--executive-summary/idl/HtmlView.idl2
-rw-r--r--executive-summary/idl/SummaryComponent.idl20
-rw-r--r--executive-summary/summary.html32
-rw-r--r--executive-summary/test-service/GNOME_Evolution_Summary_rdf.oaf.in2
-rw-r--r--executive-summary/test-service/GNOME_Evolution_Summary_rdf.oafinfo2
-rw-r--r--executive-summary/test-service/Makefile.am14
-rw-r--r--executive-summary/test-service/main.c8
-rw-r--r--executive-summary/test-service/rdf-summary.c292
24 files changed, 1347 insertions, 323 deletions
diff --git a/executive-summary/ChangeLog b/executive-summary/ChangeLog
index 3f80fce0b2..dca7a33b6a 100644
--- a/executive-summary/ChangeLog
+++ b/executive-summary/ChangeLog
@@ -1,3 +1,161 @@
+2000-12-07 Iain Holmes <iain@helixcode.com>
+
+ * summary.html: Prettier HTML summary.
+
+ * Makefile.am: Install the new summary.html
+
+ * component/e-summary.c (load_component): Free corba_subdir and
+ corba_stream.
+ (save_component): Free corba stuff.
+
+
+2000-12-06 Iain Holmes <iain@helixcode.com>
+
+ * e-summary-callbacks.c (new_mail): Update COMPOSER_IID to the new
+ style IIDs.
+ (configure_summary): Set up to do stuff when preferences are changed.
+
+ * e-summary-prefs.c (e_summary_prefs_save): Sync and drop the config file
+ so that changes are written to disk.
+
+ * e-summary.c (e_summary_reconfigure): Change the summary to the new
+ preferences.
+
+2000-12-04 Iain Holmes <iain@helixcode.com>
+
+ * test-service/rdf-summary.c (entry_changed): Add a NULL for opt_ev.
+
+ * idl/HtmlView.idl: Inherit from Bonobo::Unknown and not
+ Bonobo::EventSource.
+
+ * evolution-services/executive-summary-html-view.[ch]: Change
+ implementation of the EventSource so that it is aggregated onto
+ the HtmlView object and not inherited.
+
+ * component/e-summary.c (e_summary_window_free): Free the event_source.
+ (e_summary_add_service): query for the EventSource interface.
+
+2000-12-01 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_load_state): Fix memory leak.
+ (everywhere): Fixed memory leaks, and unref problems.
+
+2000-11-30 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_window_free): remove the
+ event listener before destruction.
+
+ * component/e-summary-url.c (e_summary_url_click): Handle the
+ new PropertyControl api. Add a listener to detect when the page
+ is changed, and adjust the property box accordingly.
+
+ * test-service/main.c (create_view): Increment running view.
+
+2000-11-29 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c: Big memory leak cleanup.
+
+2000-11-28 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_display_window): If the HTML
+ control dies, then just close the open tags.
+
+ * component/e-summary-url (e_summary_url_click): Put the control
+ into a GnomePropertyBox.
+
+ * evolution-services/executive-summary-component.c
+ (impl_GNOME_Evolution_Summary_ComponentFactory_createView):
+ Duplicate the component.
+
+2000-11-27 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_window_free): Free all the
+ interfaces and the component.
+ (e_summary_load_state): Fix typos.
+
+ * component/e-summary-prefs.c: Fix some typos.
+
+ * component/e-summary-url.c: If configure is pressed, retrieve
+ the control and embed it in a window.
+
+ * test-services/main.c (component_destroyed): assign ud from data
+ not from ud!
+
+ * test-services/rdf-summary.c (view_destroyed): Connect this
+ callback and free the summary.
+ (property_control): Made a simple configuration dialog.
+
+2000-11-25 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary-prefs.[ch]: New files to handle loading,
+ saving, copying and freeing preferences.
+
+ * component/e-summary.c (e_summary_save_state): Use the new
+ prefs stuff to save.
+ (e_summary_load_state): Use the new prefs stuff to load.
+
+ * component/e-summary-factory.c (set_pixmap): Use e_pixmap_file
+ to find the pixbuf.
+
+2000-11-24 Iain Holmes <iain@helixcode.com>
+
+ * idl/SummaryComponent.idl: Removed the setOwner and unsetOwner
+ methods from the Component interface.
+
+ * evolution-services/executive-summary.[ch]
+ evolution-services/executive-summary-client.[ch]
+ evolution-services/executive-summary-component-client.[ch]
+ evolution-services/executive-summary-component-view.[ch]:
+ Removed.
+
+ * component/main.c (main): Stopped ignoring the signals.
+
+ * component/executive-summary-config.glade: Glade file for the
+ prefs dialog.
+
+2000-11-23 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary-factory.c (embed-service): Moved to
+ e-summary-callbacks.c.
+ (e_summary_factory_embed_from_id): Moved to e-summary.c and renamed
+ e_summary_embed_from_id.
+ Added a New Mail button.
+
+ * component/e-summary-callbacks.c: New file.
+
+2000-11-22 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_save_state): removed the #if 0s
+ and changed the save type to fs.
+
+2000-11-21 Iain Holmes <iain@helixcode.com>
+
+ * test-services/rdf-summary.c: Rewrote to use the new services code.
+
+ * idl/HtmlView.idl: Inherit from Bonobo::EventSource instead of
+ Bonobo::Unknown.
+
+2000-11-20 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_save_state): #if 0'd out the
+ PersistStream code till it is fixed.
+ (e_summary_window_free): Only Bonobo_Unknown_unref the component,
+ not all the other interfaces.
+ (e_summary_remove_window): Function to remove the window from the
+ window list and free it.
+ (make_control_html): Make "id" the address of the window structure.
+
+ * component/e-summary-url.c: Reimplemented all the functions that the
+ Executive Summary had before the big code change.
+
+2000-11-18 Iain Holmes <iain@helixcode.com>
+
+ * component/e-summary.c (e_summary_save_state): Use Persist stream to
+ save the state of all the components.
+ (e_summary_load_state): Use Persist stream to load the components again.
+ (e_summary_add_service): Add a Property Listener to the property bag to
+ be notified of changes to the title or icon.
+
2000-12-07 Dave Camp <dave@helixcode.com>
* evolution-services/evolution-summary-component.c: Don't include
@@ -157,7 +315,6 @@
* 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 c1996cc419..5d41e71650 100644
--- a/executive-summary/Makefile.am
+++ b/executive-summary/Makefile.am
@@ -3,4 +3,8 @@ SUBDIRS = idl evolution-services component test-service
oafdir = $(datadir)/oaf
oaf_DATA = GNOME_Evolution_Summary.oafinfo
-EXTRA_DIST = $(oaf_DATA)
+htmldir = $(datadir)/evolution
+html_DATA = summary.html
+
+EXTRA_DIST = $(oaf_DATA) /
+ $(html_DATA)
diff --git a/executive-summary/component/Makefile.am b/executive-summary/component/Makefile.am
index ba77a68238..7e7bb2bc8b 100644
--- a/executive-summary/component/Makefile.am
+++ b/executive-summary/component/Makefile.am
@@ -48,8 +48,12 @@ evolution_executive_summary_SOURCES = \
component-factory.h \
e-summary.c \
e-summary.h \
+ e-summary-callbacks.c \
+ e-summary-callbacks.h \
e-summary-factory.c \
e-summary-factory.h \
+ e-summary-prefs.c \
+ e-summary-prefs.h \
e-summary-url.c \
e-summary-url.h \
e-summary-util.c \
@@ -66,3 +70,7 @@ evolution_executive_summary_LDADD = \
$(GTKHTML_LIBS) \
$(UNICODE_LIBS)
+gladedir = $(datadir)/evolution/glade
+glade_DATA = executive-summary-config.glade
+
+EXTRA_DIST = $(glade_DATA)
diff --git a/executive-summary/component/e-summary-callbacks.c b/executive-summary/component/e-summary-callbacks.c
new file mode 100644
index 0000000000..03ea56805c
--- /dev/null
+++ b/executive-summary/component/e-summary-callbacks.c
@@ -0,0 +1,212 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-summary-callbacks.c
+ *
+ * Author:
+ * 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 <gnome.h>
+#include <bonobo.h>
+
+#include <liboaf/liboaf.h>
+#include <glade/glade.h>
+
+#include "e-summary.h"
+
+#include "Composer.h"
+
+#define COMPOSER_IID "OAFIID:GNOME_Evolution_Mail_Composer"
+typedef struct _PropertyData {
+ ESummary *esummary;
+ GnomePropertyBox *box;
+ GladeXML *xml;
+} PropertyData;
+
+void
+embed_service (GtkWidget *widget,
+ ESummary *esummary)
+{
+ char *required_interfaces[2] = {"IDL:GNOME/Evolution:Summary:ComponentFactory:1.0",
+ NULL};
+ char *obj_id;
+
+ obj_id = bonobo_selector_select_id ("Select a service",
+ (const char **) required_interfaces);
+ if (obj_id == NULL)
+ return;
+
+ e_summary_embed_service_from_id (esummary, obj_id);
+}
+
+void
+new_mail (GtkWidget *widget,
+ ESummary *esummary)
+{
+ GNOME_Evolution_Composer_RecipientList *to, *cc, *bcc;
+ CORBA_char *subject;
+ CORBA_Object composer;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+ composer = oaf_activate_from_id ((char *)COMPOSER_IID, 0, NULL, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION || composer == NULL) {
+ CORBA_exception_free (&ev);
+ g_warning ("Unable to start composer component!");
+ return;
+ }
+ CORBA_exception_free (&ev);
+
+ to = GNOME_Evolution_Composer_RecipientList__alloc ();
+ to->_length = 0;
+ to->_maximum = 0;
+ to->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (0);
+
+ cc = GNOME_Evolution_Composer_RecipientList__alloc ();
+ cc->_length = 0;
+ cc->_maximum = 0;
+ cc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (0);
+
+ bcc = GNOME_Evolution_Composer_RecipientList__alloc ();
+ bcc->_length = 0;
+ bcc->_maximum = 0;
+ bcc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (0);
+
+ subject = CORBA_string_dup ("");
+
+ 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 ("Error setting headers!");
+ return;
+ }
+
+ CORBA_free (to);
+ CORBA_free (cc);
+ CORBA_free (bcc);
+ CORBA_free (subject);
+
+ GNOME_Evolution_Composer_show (composer, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ CORBA_exception_free (&ev);
+ g_warning ("Error showing composer");
+ return;
+ }
+
+ CORBA_exception_free (&ev);
+ return;
+}
+
+static void
+destroy_prefs_cb (GtkObject *object,
+ PropertyData *data)
+{
+ gtk_object_unref (data->xml);
+ g_free (data);
+}
+
+static void
+html_page_changed_cb (GtkEntry *entry,
+ PropertyData *data)
+{
+ ESummaryPrefs *prefs;
+
+ /* Change the tmp prefs so that we can restore if the user cancels */
+ prefs = data->esummary->tmp_prefs;
+
+ if (prefs->page)
+ g_free (prefs->page);
+
+ prefs->page = g_strdup (gtk_entry_get_text (entry));
+
+ gnome_property_box_changed (data->box);
+}
+
+static void
+apply_prefs_cb (GnomePropertyBox *property_box,
+ int page,
+ ESummary *esummary)
+{
+ g_print ("Applying\n");
+
+ if (page != -1)
+ return;
+
+ esummary->prefs = e_summary_prefs_copy (esummary->tmp_prefs);
+
+ e_summary_reconfigure (esummary);
+}
+
+void
+configure_summary (GtkWidget *widget,
+ ESummary *esummary)
+{
+ static GtkWidget *prefs = NULL;
+ PropertyData *data;
+ GtkWidget *html_page;
+
+ if (prefs != NULL) {
+ g_assert (GTK_WIDGET_REALIZED (prefs));
+ gdk_window_show (prefs->window);
+ gdk_window_raise (prefs->window);
+ return;
+ }
+
+ data = g_new (PropertyData, 1);
+ data->esummary = esummary;
+
+ if (esummary->tmp_prefs != NULL) {
+ e_summary_prefs_free (esummary->tmp_prefs);
+ }
+
+ esummary->tmp_prefs = e_summary_prefs_copy (esummary->prefs);
+
+ data->xml = glade_xml_new (EVOLUTION_GLADEDIR
+ "/executive-summary-config.glade", NULL);
+ prefs = glade_xml_get_widget (data->xml, "summaryprefs");
+ data->box = prefs;
+ html_page = glade_xml_get_widget (data->xml, "htmlpage");
+
+ if (esummary->prefs->page != NULL)
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (html_page))), esummary->prefs->page);
+
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (html_page))),
+ "changed", GTK_SIGNAL_FUNC (html_page_changed_cb),
+ data);
+
+ gtk_signal_connect (GTK_OBJECT (prefs), "apply",
+ GTK_SIGNAL_FUNC (apply_prefs_cb), esummary);
+
+ gtk_signal_connect (GTK_OBJECT (prefs), "destroy",
+ GTK_SIGNAL_FUNC (destroy_prefs_cb), data);
+ gtk_signal_connect (GTK_OBJECT (prefs), "destroy",
+ GTK_SIGNAL_FUNC (gtk_widget_destroyed), &prefs);
+}
+
diff --git a/executive-summary/component/e-summary-callbacks.h b/executive-summary/component/e-summary-callbacks.h
new file mode 100644
index 0000000000..3d42adca26
--- /dev/null
+++ b/executive-summary/component/e-summary-callbacks.h
@@ -0,0 +1,10 @@
+#ifndef __E_SUMMARY_CALLBACKS_H__
+#define __E_SUMMARY_CALLBACKS_H__
+
+void embed_service (GtkWidget *widget,
+ ESummary *esummary);
+void new_mail (GtkWidget *widget,
+ ESummary *esummary);
+void configure_summary (GtkWidget *widget,
+ ESummary *esummary);
+#endif
diff --git a/executive-summary/component/e-summary-factory.c b/executive-summary/component/e-summary-factory.c
index 3f3a3bba89..48c35f9035 100644
--- a/executive-summary/component/e-summary-factory.c
+++ b/executive-summary/component/e-summary-factory.c
@@ -40,6 +40,8 @@
#include "e-summary-factory.h"
#include "e-summary.h"
+#include "e-summary-util.h"
+#include "e-summary-callbacks.h"
#include "Evolution.h"
#include <evolution-services/Executive-Summary.h>
@@ -48,11 +50,10 @@
static GList *control_list = NULL;
-void embed_service (GtkWidget *widget,
- ESummary *esummary);
-
BonoboUIVerb verbs[] = {
BONOBO_UI_UNSAFE_VERB ("AddService", embed_service),
+ BONOBO_UI_UNSAFE_VERB ("NewMail", new_mail),
+ BONOBO_UI_UNSAFE_VERB ("ESummarySettings", configure_summary),
BONOBO_UI_VERB_END
};
@@ -64,7 +65,11 @@ set_pixmap (BonoboUIComponent *component,
char *path;
GdkPixbuf *pixbuf;
+#if 0
path = g_concat_dir_and_file (EVOLUTION_DATADIR "/images/evolution/buttons", icon);
+#else
+ path = e_pixmap_file (icon);
+#endif
pixbuf = gdk_pixbuf_new_from_file (path);
g_return_if_fail (pixbuf != NULL);
@@ -78,6 +83,7 @@ static void
update_pixmaps (BonoboUIComponent *component)
{
set_pixmap (component, "/Toolbar/AddService", "add-service.png");
+ set_pixmap (component, "/Toolbar/NewMail", "compose-message.png");
}
static void
@@ -168,44 +174,6 @@ control_destroy_cb (BonoboControl *control,
gtk_object_destroy (GTK_OBJECT (esummary));
}
-/* A ********very********
- temporary function to embed something
-*/
-void
-embed_service (GtkWidget *widget,
- ESummary *esummary)
-{
- char *required_interfaces[2] = {"IDL:GNOME/Evolution:Summary:ComponentFactory:1.0",
- NULL};
- char *obj_id;
-
- obj_id = bonobo_selector_select_id ("Select a service",
- (const char **) required_interfaces);
- if (obj_id == NULL)
- return;
-
- e_summary_factory_embed_service_from_id (esummary, obj_id);
-}
-
-ESummaryWindow *
-e_summary_factory_embed_service_from_id (ESummary *esummary,
- const char *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);
-
- window = e_summary_add_service (esummary, component, obj_id);
- e_summary_rebuild_page (esummary);
-
- return window;
-}
-
BonoboControl *
e_summary_factory_new_control (const char *uri,
const GNOME_Evolution_Shell shell)
diff --git a/executive-summary/component/e-summary-prefs.c b/executive-summary/component/e-summary-prefs.c
new file mode 100644
index 0000000000..ffefdcd583
--- /dev/null
+++ b/executive-summary/component/e-summary-prefs.c
@@ -0,0 +1,97 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-summary-prefs.c: Preference handling routines.
+ *
+ * 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 <gnome.h>
+#include "e-summary-prefs.h"
+#include "e-summary.h"
+
+void
+e_summary_prefs_free (ESummaryPrefs *prefs)
+{
+ g_return_if_fail (prefs != NULL);
+
+ g_free (prefs->page);
+ g_free (prefs);
+}
+
+ESummaryPrefs *
+e_summary_prefs_new (void)
+{
+ ESummaryPrefs *prefs;
+
+ prefs = g_new0 (ESummaryPrefs, 1);
+ return prefs;
+}
+
+ESummaryPrefs *
+e_summary_prefs_copy (ESummaryPrefs *prefs)
+{
+ ESummaryPrefs *copy;
+
+ g_return_val_if_fail (prefs != NULL, NULL);
+
+ copy = e_summary_prefs_new ();
+ copy->page = g_strdup (prefs->page);
+
+ return copy;
+}
+
+ESummaryPrefs *
+e_summary_prefs_load (const char *path)
+{
+ ESummaryPrefs *prefs;
+ char *item;
+
+ g_return_val_if_fail (path != NULL, NULL);
+ g_return_val_if_fail (*path != '\0', NULL);
+
+ prefs = e_summary_prefs_new ();
+
+ item = g_strdup_printf ("=%s/e-summary=/executive-summary/page", path);
+ prefs->page = gnome_config_get_string (item);
+ g_free (item);
+
+ return prefs;
+}
+
+void
+e_summary_prefs_save (ESummaryPrefs *prefs,
+ const char *path)
+{
+ char *item;
+
+ g_return_if_fail (prefs != NULL);
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (*path != '\0');
+
+ item = g_strdup_printf ("=%s/e-summary=/executive-summary/page", path);
+ gnome_config_set_string (item, prefs->page);
+ g_free (item);
+
+ gnome_config_sync ();
+ gnome_config_drop_all ();
+}
diff --git a/executive-summary/component/e-summary-prefs.h b/executive-summary/component/e-summary-prefs.h
new file mode 100644
index 0000000000..95fc6af2c2
--- /dev/null
+++ b/executive-summary/component/e-summary-prefs.h
@@ -0,0 +1,39 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-summary-prefs.h: Preference handling routines.
+ *
+ * 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 __E_SUMMARY_PREFS_H__
+#define __E_SUMMARY_PREFS_H__
+
+typedef struct _ESummaryPrefs ESummaryPrefs;
+struct _ESummaryPrefs {
+ char *page;
+};
+
+ESummaryPrefs *e_summary_prefs_new (void);
+void e_summary_prefs_free (ESummaryPrefs *prefs);
+ESummaryPrefs *e_summary_prefs_copy (ESummaryPrefs *prefs);
+ESummaryPrefs *e_summary_prefs_load (const char *path);
+void e_summary_prefs_save (ESummaryPrefs *prefs,
+ const char *path);
+
+#endif
diff --git a/executive-summary/component/e-summary-url.c b/executive-summary/component/e-summary-url.c
index f7dd863a26..d53b21ec4c 100644
--- a/executive-summary/component/e-summary-url.c
+++ b/executive-summary/component/e-summary-url.c
@@ -73,6 +73,12 @@ static char *descriptions[] = {
N_("Open %s with the default GNOME application")
};
+typedef struct _PropertyDialog {
+ BonoboListener *listener;
+ Bonobo_Listener corba_listener;
+ Bonobo_EventSource eventsource;
+ GtkWidget *dialog;
+} PropertyDialog;
#define COMPOSER_IID "OAFIID:GNOME_Evolution_Mail_Composer"
gboolean e_summary_url_mail_compose (ESummary *esummary,
@@ -319,6 +325,65 @@ get_protocol (const char *url)
return protocol;
}
+static void
+property_apply (GnomePropertyBox *propertybox,
+ gint page_num,
+ Bonobo_PropertyControl control)
+{
+ CORBA_Environment ev;
+
+ g_print ("page_num: %d\n", page_num);
+
+ CORBA_exception_init (&ev);
+ Bonobo_PropertyControl_notifyAction (control, page_num, Bonobo_PropertyControl_APPLY, &ev);
+ CORBA_exception_free (&ev);
+}
+
+static void
+property_help (GnomePropertyBox *propertybox,
+ gint page_num,
+ Bonobo_PropertyControl control)
+{
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+ Bonobo_PropertyControl_notifyAction (control, page_num, Bonobo_PropertyControl_HELP, &ev);
+ CORBA_exception_free (&ev);
+}
+
+static void
+property_event (BonoboListener *listener,
+ char *event_name,
+ CORBA_any *any,
+ CORBA_Environment *ev,
+ gpointer user_data)
+{
+ PropertyDialog *data = (PropertyDialog *) user_data;
+ if (strcmp (event_name, "property_box_changed") == 0) {
+ gnome_property_box_changed (GNOME_PROPERTY_BOX (data->dialog));
+ return;
+ }
+}
+
+static void
+dialog_destroyed (GtkObject *object,
+ PropertyDialog *dialog)
+{
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+ Bonobo_EventSource_removeListener (dialog->eventsource,
+ dialog->corba_listener, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("Error: %s", CORBA_exception_id (&ev));
+ }
+
+ bonobo_object_unref (BONOBO_OBJECT (dialog->listener));
+ bonobo_object_release_unref (dialog->eventsource, &ev);
+ CORBA_exception_free (&ev);
+ g_free (dialog);
+}
+
void
e_summary_url_click (GtkWidget *widget,
const char *url,
@@ -328,6 +393,11 @@ e_summary_url_click (GtkWidget *widget,
char *parsed;
int address;
ESummaryWindow *window;
+ Bonobo_Control control;
+ GtkWidget *prefsbox, *control_widget;
+ CORBA_Environment ev;
+ PropertyDialog *data;
+ int num_pages, i;
protocol = get_protocol (url);
@@ -354,7 +424,7 @@ e_summary_url_click (GtkWidget *widget,
address = atoi (url + 8);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
- return;
+ break;
e_summary_remove_window (esummary, window);
e_summary_rebuild_page (esummary);
@@ -365,9 +435,50 @@ e_summary_url_click (GtkWidget *widget,
address = atoi (url + 12);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
- return;
+ break;
- /* Issue the configure command some how :) */
+ data = g_new (PropertyDialog, 1);
+ /* Create the property box */
+ prefsbox = gnome_property_box_new ();
+ data->dialog = prefsbox;
+
+ CORBA_exception_init (&ev);
+ data->eventsource = Bonobo_Unknown_queryInterface (window->propertycontrol,
+ "IDL:Bonobo/EventSource:1.0",
+ &ev);
+ data->listener = bonobo_listener_new (property_event, data);
+ data->corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (data->listener));
+ Bonobo_EventSource_addListener (data->eventsource,
+ data->corba_listener, &ev);
+
+ gtk_signal_connect (GTK_OBJECT (prefsbox), "apply",
+ GTK_SIGNAL_FUNC (property_apply),
+ window->propertycontrol);
+ gtk_signal_connect (GTK_OBJECT (prefsbox), "help",
+ GTK_SIGNAL_FUNC (property_help),
+ window->propertycontrol);
+ gtk_signal_connect (GTK_OBJECT (prefsbox), "destroy",
+ GTK_SIGNAL_FUNC (dialog_destroyed), data);
+
+ num_pages = Bonobo_PropertyControl__get_pageCount (window->propertycontrol, &ev);
+ for (i = 0; i < num_pages; i++) {
+ char *pagename;
+
+ control = Bonobo_PropertyControl_getControl (window->propertycontrol, i, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("Unable to get property control.");
+ CORBA_exception_free (&ev);
+ break;
+ }
+ control_widget = bonobo_widget_new_control_from_objref (control,
+ CORBA_OBJECT_NIL);
+ gnome_property_box_append_page (GNOME_PROPERTY_BOX (prefsbox),
+ control_widget,
+ gtk_label_new ("page"));
+ }
+
+ gtk_widget_show_all (prefsbox);
+
break;
case PROTOCOL_LEFT:
@@ -375,7 +486,7 @@ e_summary_url_click (GtkWidget *widget,
address = atoi (url + 7);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
- return;
+ break;
e_summary_window_move_left (esummary, window);
e_summary_rebuild_page (esummary);
@@ -385,7 +496,7 @@ e_summary_url_click (GtkWidget *widget,
address = atoi (url + 8);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
- return;
+ break;
e_summary_window_move_right (esummary, window);
e_summary_rebuild_page (esummary);
@@ -395,7 +506,7 @@ e_summary_url_click (GtkWidget *widget,
address = atoi (url + 5);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
- return;
+ break;
e_summary_window_move_up (esummary, window);
e_summary_rebuild_page (esummary);
@@ -405,7 +516,7 @@ e_summary_url_click (GtkWidget *widget,
address = atoi (url + 7);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
- return;
+ break;
e_summary_window_move_down (esummary, window);
e_summary_rebuild_page (esummary);
diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c
index e9bf104fd1..587b063e6a 100644
--- a/executive-summary/component/e-summary.c
+++ b/executive-summary/component/e-summary.c
@@ -32,7 +32,7 @@
#include <gtkhtml/gtkhtml-embedded.h>
#include <gtkhtml/gtkhtml-stream.h>
#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>
@@ -42,9 +42,12 @@
#include "e-summary-util.h"
#include "e-summary-url.h"
+#include <evolution-services/executive-summary-component.h>
+#include <evolution-services/executive-summary-component-factory-client.h>
+
#define PARENT_TYPE (gtk_vbox_get_type ())
-#define STORAGE_TYPE "efs"
+#define STORAGE_TYPE "fs"
#define IID_FILE "oaf.id"
#define DATA_FILE "data"
@@ -81,20 +84,6 @@ static void e_summary_save_state (ESummary *esummary,
static void e_summary_load_state (ESummary *esummary,
const char *path);
-/* 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
@@ -109,7 +98,7 @@ e_summary_destroy (GtkObject *object)
if (priv == NULL)
return;
- prefix = g_concat_dir_and_file (evolution_dir, "config/Executive-Summary");
+ prefix = g_concat_dir_and_file (evolution_dir, "config/");
e_summary_save_state (esummary, prefix);
g_free (prefix);
@@ -203,6 +192,8 @@ e_summary_init (ESummary *esummary)
GdkColor bgcolour = {0, 0xdfff, 0xdfff, 0xffff};
ESummaryPrivate *priv;
+ esummary->prefs = NULL;
+ esummary->tmp_prefs = NULL;
esummary->private = g_new0 (ESummaryPrivate, 1);
priv = esummary->private;
@@ -252,7 +243,7 @@ e_summary_new (const GNOME_Evolution_Shell shell)
/* Restore services */
path = g_concat_dir_and_file (evolution_dir,
- "config/Executive-Summary");
+ "config");
e_summary_load_state (esummary, path);
g_free (path);
@@ -324,8 +315,8 @@ on_object_requested (GtkHTML *html,
if (widget->parent == NULL)
gtk_container_add (GTK_CONTAINER (eb), widget);
- return TRUE;
#endif
+ return TRUE;
}
/* Generates the window controls and works out
@@ -386,14 +377,16 @@ make_control_html (ESummaryWindow *window,
tmp = html;
if (!r) {
html = g_strdup_printf ("%s<img src=\"service-right-disabled.png\">"
- "</td></tr><tr><td>", tmp);
+ "</td></tr></table>", 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);
+ "</a></td></tr></table>", tmp, id);
}
g_free (tmp);
+
+#if 0
tmp = html;
if (!d) {
html = g_strdup_printf ("%s<img src=\"service-down-disabled.png\">"
@@ -416,6 +409,7 @@ make_control_html (ESummaryWindow *window,
}
g_free (tmp);
+#endif
return html;
}
@@ -463,13 +457,14 @@ e_summary_display_window (ESummary *esummary,
html = GNOME_Evolution_Summary_HTMLView_getHtml (window->html,
&ev);
if (ev._major != CORBA_NO_EXCEPTION) {
+ CORBA_exception_free (&ev);
g_warning ("Cannot get HTML.");
- return;
- }
- CORBA_exception_free (&ev);
+ } else {
+ CORBA_exception_free (&ev);
- gtk_html_write (GTK_HTML (priv->html), priv->stream,
- html, strlen (html));
+ gtk_html_write (GTK_HTML (priv->html), priv->stream,
+ html, strlen (html));
+ }
} else {
#if 0
char *body_cid;
@@ -564,6 +559,23 @@ e_summary_rebuild_page (ESummary *esummary)
}
static void
+html_event (BonoboListener *listener,
+ char *event_name,
+ CORBA_any *any,
+ CORBA_Environment *ev,
+ gpointer user_data)
+{
+ ESummaryWindow *window = (ESummaryWindow *) user_data;
+
+ g_print ("Event: %s\n", event_name);
+ if (strcmp (event_name, "html_changed") != 0) {
+ return;
+ }
+
+ e_summary_rebuild_page (window->esummary);
+}
+
+static void
prop_changed_cb (BonoboPropertyListener *listener,
char *name,
BonoboArg *arg,
@@ -573,6 +585,7 @@ prop_changed_cb (BonoboPropertyListener *listener,
if (window->title != NULL)
g_free (window->title);
window->title = g_strdup (BONOBO_ARG_GET_STRING (arg));
+ e_summary_rebuild_page (window->esummary);
return;
}
@@ -580,6 +593,7 @@ prop_changed_cb (BonoboPropertyListener *listener,
if (window->icon != NULL)
g_free (window->icon);
window->icon = g_strdup (BONOBO_ARG_GET_STRING (arg));
+ e_summary_rebuild_page (window->esummary);
return;
}
}
@@ -604,6 +618,7 @@ e_summary_add_service (ESummary *esummary,
window = g_new0 (ESummaryWindow, 1);
window->component = component;
window->iid = g_strdup (iid);
+ window->esummary = esummary;
/* See what interfaces our component supports */
CORBA_exception_init (&ev);
@@ -631,6 +646,26 @@ e_summary_add_service (ESummary *esummary,
return NULL;
}
+ if (window->html != CORBA_OBJECT_NIL) {
+ Bonobo_Listener listener;
+ CORBA_Environment ev2;
+
+ /* If HTML view, then set up the listeners. */
+ window->event_source = Bonobo_Unknown_queryInterface (window->html,
+ "IDL:Bonobo/EventSource:1.0",
+ &ev);
+ window->html_listener = bonobo_listener_new (html_event,
+ window);
+ listener = bonobo_object_corba_objref (BONOBO_OBJECT (window->html_listener));
+ window->html_corba_listener = listener;
+
+ CORBA_exception_init (&ev2);
+ Bonobo_EventSource_addListener (window->event_source,
+ listener, &ev2);
+ /* Catch error? FIXME */
+ CORBA_exception_free (&ev2);
+ }
+
unknown = Bonobo_Unknown_queryInterface (component,
"IDL:Bonobo/PropertyBag:1.0",
&ev);
@@ -673,6 +708,28 @@ e_summary_add_service (ESummary *esummary,
return window;
}
+
+ESummaryWindow *
+e_summary_embed_service_from_id (ESummary *esummary,
+ const char *obj_id)
+{
+ GNOME_Evolution_Summary_Component component;
+ ExecutiveSummaryComponentFactoryClient *client;
+ ESummaryWindow *window;
+
+ client = executive_summary_component_factory_client_new (obj_id);
+
+ component = executive_summary_component_factory_client_create_view (client);
+
+ /* Don't need the client any more */
+ bonobo_object_unref (BONOBO_OBJECT (client));
+
+ window = e_summary_add_service (esummary, component, obj_id);
+ e_summary_rebuild_page (esummary);
+
+ return window;
+}
+
void
e_summary_window_free (ESummaryWindow *window)
{
@@ -685,37 +742,49 @@ e_summary_window_free (ESummaryWindow *window)
g_free (window->title);
CORBA_exception_init (&ev);
- Bonobo_Unknown_unref (window->component, &ev);
- CORBA_Object_release (window->component, &ev);
if (window->control != CORBA_OBJECT_NIL) {
- CORBA_Object_release (window->control, &ev);
+ bonobo_object_release_unref (window->control, &ev);
+ }
+
+ if (window->event_source != CORBA_OBJECT_NIL) {
+ Bonobo_EventSource_removeListener (window->event_source,
+ window->html_corba_listener,
+ &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("CORBA ERROR: %s", CORBA_exception_id (&ev));
+ }
+ bonobo_object_release_unref (window->event_source, &ev);
}
if (window->html != CORBA_OBJECT_NIL) {
- CORBA_Object_release (window->html, &ev);
+ bonobo_object_release_unref (window->html, &ev);
}
if (window->propertybag != CORBA_OBJECT_NIL) {
- CORBA_Object_release (window->propertybag, &ev);
+ bonobo_object_release_unref (window->propertybag, &ev);
}
if (window->persiststream != CORBA_OBJECT_NIL) {
- CORBA_Object_release (window->persiststream, &ev);
+ bonobo_object_release_unref (window->persiststream, &ev);
}
if (window->propertycontrol != CORBA_OBJECT_NIL) {
- CORBA_Object_release (window->propertycontrol, &ev);
+ bonobo_object_release_unref (window->propertycontrol, &ev);
+ }
+
+ if (window->listener) {
+ bonobo_object_unref (BONOBO_OBJECT (window->listener));
+ }
+
+ if (window->html_listener) {
+ bonobo_object_unref (BONOBO_OBJECT (window->html_listener));
}
+ bonobo_object_release_unref (window->component, &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
@@ -840,8 +909,7 @@ e_summary_set_title (ESummary *esummary,
}
static void
-load_html_page (ESummary *esummary,
- const char *filename)
+e_summary_load_page (ESummary *esummary)
{
ESummaryPrivate *priv;
GnomeVFSHandle *handle = NULL;
@@ -849,17 +917,17 @@ load_html_page (ESummary *esummary,
GtkWidget *toplevel;
GString *string;
char *str, *comment;
+ char *filename;
g_return_if_fail (esummary != NULL);
g_return_if_fail (IS_E_SUMMARY (esummary));
-
+
priv = esummary->private;
+ filename = g_strdup (esummary->prefs->page);
/* Pass NULL to reset the page to the default */
if (filename == NULL || *filename == '\0') {
- g_free (priv->header);
- g_free (priv->footer);
- return;
+ filename = g_concat_dir_and_file (EVOLUTION_DATADIR, "/evolution/summary.html");
}
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (esummary));
@@ -868,9 +936,11 @@ load_html_page (ESummary *esummary,
if (result != GNOME_VFS_OK) {
e_notice (GTK_WINDOW (toplevel), GNOME_MESSAGE_BOX_WARNING,
_("Cannot open the HTML file:\n%s"), filename);
+ g_free (filename);
return;
}
+ g_free (filename);
while (1) {
char buffer[4096];
GnomeVFSFileSize size;
@@ -896,7 +966,7 @@ load_html_page (ESummary *esummary,
comment = strstr (str, "<!-- EVOLUTION EXECUTIVE SUMMARY SERVICES DO NOT REMOVE -->");
if (comment == NULL) {
- e_notice (GTK_WINDOW (toplevel), GNOME_MESSAGE_BOX_WARNING,
+ e_notice (NULL, GNOME_MESSAGE_BOX_WARNING,
_("File does not have a place for the services.\n"));
g_free (str);
return;
@@ -984,20 +1054,28 @@ load_component (ESummary *esummary,
corba_subdir = Bonobo_Storage_openStorage (corba_storage, curdir,
Bonobo_Storage_READ, &ev);
+ if (corba_subdir == CORBA_OBJECT_NIL) {
+ g_free (curdir);
+ return;
+ }
+
iid = load_component_id (corba_subdir, &ev);
if (iid) {
Bonobo_Stream corba_stream;
- window = e_summary_factory_embed_service_from_id (esummary, iid);
+ window = e_summary_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)
+ Bonobo_Storage_READ |
+ Bonobo_Storage_CREATE, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_print ("Gah");
return;
+ }
Bonobo_PersistStream_load (window->persiststream,
corba_stream,
@@ -1005,22 +1083,34 @@ load_component (ESummary *esummary,
if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("Could not load `%s'", iid);
+ bonobo_object_release_unref (corba_stream, &ev);
}
}
g_free (iid);
}
+ bonobo_object_release_unref (corba_subdir, &ev);
CORBA_exception_free (&ev);
g_free (curdir);
}
-
+
+void
+e_summary_reconfigure (ESummary *esummary)
+{
+ ESummaryPrefs *prefs;
+
+ prefs = esummary->prefs;
+
+ e_summary_load_page (esummary);
+ e_summary_rebuild_page (esummary);
+}
+
static void
e_summary_load_state (ESummary *esummary,
const char *path)
{
char *fullpath;
- char *htmlpage = NULL;
BonoboStorage *storage;
Bonobo_Storage corba_storage;
Bonobo_Storage_DirectoryList *list;
@@ -1030,7 +1120,7 @@ e_summary_load_state (ESummary *esummary,
g_return_if_fail (esummary != NULL);
g_return_if_fail (IS_E_SUMMARY (esummary));
- fullpath = g_strdup_printf ("%s", path);
+ fullpath = g_strdup_printf ("%s/Executive-Summary", path);
storage = bonobo_storage_open (STORAGE_TYPE, fullpath,
Bonobo_Storage_READ |
Bonobo_Storage_WRITE,
@@ -1040,30 +1130,22 @@ e_summary_load_state (ESummary *esummary,
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;
+ if (list) {
+ for (i = 0; i < list->_length; i++)
+ load_component (esummary, storage, i);
+
+ CORBA_free (list);
}
-
- for (i = 0; i < list->_length; i++)
- load_component (esummary, storage, i);
-
- CORBA_free (list);
+
bonobo_object_unref (BONOBO_OBJECT (storage));
+ CORBA_exception_free (&ev);
}
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 (fullpath);
- g_free (htmlpage);
+ /* Load the preferences */
+ esummary->prefs = e_summary_prefs_load (path);
+ e_summary_reconfigure (esummary);
}
static void
@@ -1080,23 +1162,33 @@ save_component (BonoboStorage *storage,
CORBA_exception_init (&ev);
corba_subdir = Bonobo_Storage_openStorage (corba_storage, curdir,
- Bonobo_Storage_CREATE, &ev);
+ Bonobo_Storage_CREATE|
+ Bonobo_Storage_WRITE|
+ Bonobo_Storage_READ, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Cannot create '%s'", curdir);
+ g_free (curdir);
} else {
Bonobo_Stream corba_stream;
+ g_free (curdir);
corba_stream = Bonobo_Storage_openStream
- (corba_subdir, IID_FILE, Bonobo_Storage_CREATE, &ev);
+ (corba_subdir, IID_FILE,
+ Bonobo_Storage_CREATE|
+ Bonobo_Storage_READ|
+ Bonobo_Storage_WRITE, &ev);
+
if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("EEk: %s", CORBA_exception_id (&ev));
+ g_warning ("EEK: %s", CORBA_exception_id (&ev));
+ if (corba_subdir != CORBA_OBJECT_NIL)
+ bonobo_object_release_unref (corba_subdir, &ev);
+ CORBA_exception_free (&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);
+ bonobo_object_release_unref (corba_stream, &ev);
corba_stream = Bonobo_Storage_openStream (corba_subdir, DATA_FILE,
Bonobo_Storage_CREATE,
@@ -1109,14 +1201,11 @@ save_component (BonoboStorage *storage,
}
}
- Bonobo_Unknown_unref (corba_stream, &ev);
- CORBA_Object_release (corba_stream, &ev);
-
- Bonobo_Unknown_unref (corba_subdir, &ev);
- CORBA_Object_release (corba_subdir, &ev);
+ bonobo_object_release_unref (corba_stream, &ev);
}
- g_free (curdir);
+ if (corba_subdir != CORBA_OBJECT_NIL)
+ bonobo_object_release_unref (corba_subdir, &ev);
CORBA_exception_free (&ev);
}
@@ -1137,10 +1226,11 @@ e_summary_save_state (ESummary *esummary,
priv = esummary->private;
-#if 0
- fullpath = g_strdup_printf("%s", path);
+ fullpath = g_strdup_printf("%s/Executive-Summary", path);
g_print ("fullpath: %s\n", fullpath);
- unlink (fullpath);
+
+ /* FIXME: Use RC's rmdir function */
+ remove (fullpath);
storage = bonobo_storage_open (STORAGE_TYPE, fullpath,
Bonobo_Storage_READ |
@@ -1154,6 +1244,7 @@ e_summary_save_state (ESummary *esummary,
i = 0;
for (windows = priv->window_list; windows; windows = windows->next) {
save_component (storage, windows->data, i);
+ g_print ("IID: %s\n", ((ESummaryWindow *)windows->data)->iid);
i++;
}
@@ -1161,8 +1252,8 @@ e_summary_save_state (ESummary *esummary,
CORBA_exception_free (&ev);
bonobo_object_unref (BONOBO_OBJECT (storage));
+ e_summary_prefs_save (esummary->prefs, path);
g_free (fullpath);
-#endif
}
void
diff --git a/executive-summary/component/e-summary.h b/executive-summary/component/e-summary.h
index 5eae27ea0c..90c1412f95 100644
--- a/executive-summary/component/e-summary.h
+++ b/executive-summary/component/e-summary.h
@@ -24,12 +24,15 @@
#ifndef _E_SUMMARY_H__
#define _E_SUMMARY_H__
-#include <gtkhtml/gtkhtml.h>
#include <gtk/gtkvbox.h>
-#include <evolution-services/executive-summary.h>
#include <bonobo.h>
+#include <bonobo/bonobo-listener.h>
+#include <bonobo/bonobo-event-source.h>
#include <Evolution.h>
+#include <evolution-services/Executive-Summary.h>
+
+#include "e-summary-prefs.h"
#define E_SUMMARY_TYPE (e_summary_get_type ())
#define E_SUMMARY(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_TYPE, ESummary))
@@ -51,22 +54,29 @@ struct _ESummaryWindow {
Bonobo_PersistStream persiststream;
Bonobo_PropertyBag propertybag;
Bonobo_PropertyControl propertycontrol;
+ Bonobo_EventSource event_source;
BonoboPropertyListener *listener;
+ BonoboListener *html_listener;
+ Bonobo_Listener html_corba_listener;
char *iid;
char *title;
char *icon;
+
+ ESummary *esummary;
};
struct _ESummary {
- GtkVBox parent;
+ GtkVBox parent;
- ESummaryPrivate *private;
+ ESummaryPrefs *prefs;
+ ESummaryPrefs *tmp_prefs;
+ ESummaryPrivate *private;
};
struct _ESummaryClass {
- GtkVBoxClass parent_class;
+ GtkVBoxClass parent_class;
};
GtkType e_summary_get_type (void);
@@ -79,6 +89,8 @@ void e_summary_remove_window (ESummary *esummary,
ESummaryWindow *e_summary_add_service (ESummary *esummary,
GNOME_Evolution_Summary_Component component,
const char *iid);
+ESummaryWindow * e_summary_embed_service_from_id (ESummary *esummary,
+ const char *obj_id);
void e_summary_set_shell_view_interface (ESummary *summary,
GNOME_Evolution_ShellView svi);
@@ -99,5 +111,6 @@ void e_summary_window_move_up (ESummary *esummary,
ESummaryWindow *window);
void e_summary_window_move_down (ESummary *esummary,
ESummaryWindow *window);
+void e_summary_reconfigure (ESummary *esummary);
#endif
diff --git a/executive-summary/component/executive-summary-config.glade b/executive-summary/component/executive-summary-config.glade
new file mode 100644
index 0000000000..387964fa21
--- /dev/null
+++ b/executive-summary/component/executive-summary-config.glade
@@ -0,0 +1,169 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>Project1</name>
+ <program_name>project1</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+ <use_widget_names>False</use_widget_names>
+ <output_main_file>True</output_main_file>
+ <output_support_files>True</output_support_files>
+ <output_build_files>True</output_build_files>
+ <backup_source_files>True</backup_source_files>
+ <main_source_file>interface.c</main_source_file>
+ <main_header_file>interface.h</main_header_file>
+ <handler_source_file>callbacks.c</handler_source_file>
+ <handler_header_file>callbacks.h</handler_header_file>
+ <support_source_file>support.c</support_source_file>
+ <support_header_file>support.h</support_header_file>
+ <translatable_strings_file></translatable_strings_file>
+</project>
+
+<widget>
+ <class>GnomePropertyBox</class>
+ <name>summaryprefs</name>
+ <cxx_use_heap>True</cxx_use_heap>
+
+ <widget>
+ <class>GtkNotebook</class>
+ <child_name>GnomePropertyBox:notebook</child_name>
+ <name>notebook1</name>
+ <border_width>2</border_width>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_focus>True</can_focus>
+ <show_tabs>True</show_tabs>
+ <show_border>True</show_border>
+ <tab_pos>GTK_POS_TOP</tab_pos>
+ <scrollable>False</scrollable>
+ <tab_hborder>2</tab_hborder>
+ <tab_vborder>2</tab_vborder>
+ <popup_enable>False</popup_enable>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox1</name>
+ <border_width>2</border_width>
+ <cxx_use_heap>True</cxx_use_heap>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame1</name>
+ <border_width>2</border_width>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Appearence</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox2</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label2</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Background</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GnomeFileEntry</class>
+ <name>htmlpage</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <max_saved>10</max_saved>
+ <directory>False</directory>
+ <modal>False</modal>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkEntry</class>
+ <child_name>GnomeEntry:entry</child_name>
+ <name>combo-entry1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>Label</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>General</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/executive-summary/component/main.c b/executive-summary/component/main.c
index 3c9cc059dd..0c36a9866e 100644
--- a/executive-summary/component/main.c
+++ b/executive-summary/component/main.c
@@ -23,8 +23,6 @@
#include <config.h>
-#include <signal.h>
-
#include <gnome.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object-directory.h>
@@ -55,6 +53,7 @@ main (int argc,
orb = oaf_init (argc, argv);
gdk_rgb_init ();
+ glade_gnome_init ();
if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
g_error (_("Executive summary component could not initialize Bonobo.\n"
"If there was a warning message about the "
@@ -70,9 +69,6 @@ main (int argc,
component_factory_init ();
- signal (SIGSEGV, SIG_DFL);
- signal (SIGBUS, SIG_DFL);
-
gnome_vfs_init ();
bonobo_main ();
diff --git a/executive-summary/evolution-services/executive-summary-component-factory-client.c b/executive-summary/evolution-services/executive-summary-component-factory-client.c
index f798341c80..19114bfa6f 100644
--- a/executive-summary/evolution-services/executive-summary-component-factory-client.c
+++ b/executive-summary/evolution-services/executive-summary-component-factory-client.c
@@ -33,7 +33,6 @@
#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;
diff --git a/executive-summary/evolution-services/executive-summary-component.c b/executive-summary/evolution-services/executive-summary-component.c
index 609b31939b..5339defc6b 100644
--- a/executive-summary/evolution-services/executive-summary-component.c
+++ b/executive-summary/evolution-services/executive-summary-component.c
@@ -45,9 +45,6 @@ static BonoboObjectClass *factory_parent_class;
struct _ExecutiveSummaryComponentPrivate {
int dummy;
-#if 0
- ExecutiveSummaryClient *owner_client;
-#endif
};
struct _ExecutiveSummaryComponentFactoryPrivate {
@@ -82,54 +79,6 @@ create_servant (void)
}
static void
-impl_GNOME_Evolution_Summary_Component_set_owner (PortableServer_Servant servant,
- 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;
-
- /* Create a summary client */
- client = gtk_type_new (executive_summary_client_get_type ());
-
- summary_duplicate = CORBA_Object_duplicate (summary, ev);
- 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;
-
- bonobo_object = bonobo_object_from_servant (servant);
- component = EXECUTIVE_SUMMARY_COMPONENT (bonobo_object);
- priv = component->private;
-
- if (priv->owner_client == NULL)
- return;
-
- bonobo_object_unref (BONOBO_OBJECT (priv->owner_client));
- priv->owner_client = NULL;
-#endif
-}
-
-static void
executive_summary_component_destroy (GtkObject *object)
{
ExecutiveSummaryComponent *component;
@@ -173,8 +122,6 @@ corba_class_init (void)
base_epv->default_POA = NULL;
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;
vepv = &SummaryComponent_vepv;
vepv->_base_epv = base_epv;
@@ -249,54 +196,6 @@ executive_summary_component_new (void)
return BONOBO_OBJECT (component);
}
-#if 0
-void
-executive_summary_component_flash (ExecutiveSummaryComponent *component,
- gpointer view)
-{
- ExecutiveSummaryComponentPrivate *priv;
- int id;
-
- g_return_if_fail (component != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT (component));
-
- priv = component->private;
-
- if (priv->owner_client == NULL) {
- g_warning ("Component not owned!");
- return;
- }
-
- id = executive_summary_component_view_get_id (EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
-
- executive_summary_client_flash (priv->owner_client, id);
-}
-
-void
-executive_summary_component_update (ExecutiveSummaryComponent *component,
- gpointer view)
-{
- ExecutiveSummaryComponentPrivate *priv;
- int id;
- const char *html;
-
- g_return_if_fail (component != NULL);
- g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT (component));
-
- priv = component->private;
-
- if (priv->owner_client == NULL) {
- g_warning ("Component not ownded!");
- 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));
-
- executive_summary_client_update (priv->owner_client, id, html);
-}
-#endif
-
/**** ComponentFactory implementation ****/
@@ -337,13 +236,15 @@ impl_GNOME_Evolution_Summary_ComponentFactory_createView (PortableServer_Servant
factory = EXECUTIVE_SUMMARY_COMPONENT_FACTORY (bonobo_object);
priv = factory->private;
- g_warning ("Hello?");
view = (* priv->create_view) (factory, priv->closure);
g_return_val_if_fail (view != NULL, CORBA_OBJECT_NIL);
component = bonobo_object_corba_objref (BONOBO_OBJECT (view));
+ CORBA_exception_init (&ev2);
+ component_dup = CORBA_Object_duplicate (component, &ev2);
+ CORBA_exception_free (&ev2);
- return component;
+ return component_dup;
}
static void
diff --git a/executive-summary/evolution-services/executive-summary-html-view.c b/executive-summary/evolution-services/executive-summary-html-view.c
index ef90461623..ebc3ae9b23 100644
--- a/executive-summary/evolution-services/executive-summary-html-view.c
+++ b/executive-summary/evolution-services/executive-summary-html-view.c
@@ -27,6 +27,7 @@
#endif
#include <bonobo.h>
+#include <bonobo/bonobo-event-source.h>
#include <gnome.h>
#include <gal/util/e-util.h>
@@ -42,6 +43,8 @@ static void executive_summary_html_view_class_init (ExecutiveSummaryHtmlViewClas
static BonoboObjectClass *parent_class;
struct _ExecutiveSummaryHtmlViewPrivate {
+ BonoboEventSource *event_source;
+
char *html;
};
@@ -103,7 +106,7 @@ executive_summary_html_view_destroy (GtkObject *object)
view->private = NULL;
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@@ -147,6 +150,7 @@ executive_summary_html_view_init (ExecutiveSummaryHtmlView *view)
priv = g_new (ExecutiveSummaryHtmlViewPrivate, 1);
priv->html = NULL;
+ priv->event_source = NULL;
view->private = priv;
}
@@ -159,9 +163,18 @@ static void
executive_summary_html_view_construct (ExecutiveSummaryHtmlView *view,
GNOME_Evolution_Summary_HTMLView corba_object)
{
+ ExecutiveSummaryHtmlViewPrivate *priv;
+
g_return_if_fail (view != NULL);
g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
+ priv = view->private;
+
+ priv->event_source = bonobo_event_source_new ();
+ g_warning ("new event source: %p", priv->event_source);
+ bonobo_object_add_interface (BONOBO_OBJECT (view),
+ BONOBO_OBJECT (priv->event_source));
+
bonobo_object_construct (BONOBO_OBJECT (view), corba_object);
}
@@ -206,6 +219,8 @@ executive_summary_html_view_set_html (ExecutiveSummaryHtmlView *view,
const char *html)
{
ExecutiveSummaryHtmlViewPrivate *priv;
+ CORBA_any any;
+ CORBA_short s;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_HTML_VIEW (view));
@@ -218,6 +233,16 @@ executive_summary_html_view_set_html (ExecutiveSummaryHtmlView *view,
priv->html = g_strdup (html);
else
priv->html = NULL;
+
+ /* Notify any listeners */
+ s = 0;
+
+ any._type = (CORBA_TypeCode) TC_short;
+ any._value = &s;
+
+ g_warning ("Notifying event source: %p", priv->event_source);
+ bonobo_event_source_notify_listeners (BONOBO_EVENT_SOURCE (priv->event_source),
+ "html_changed", &any, NULL);
}
/**
* executive_summary_html_view_get_html:
diff --git a/executive-summary/idl/HtmlView.idl b/executive-summary/idl/HtmlView.idl
index 0116fbf9b8..547c3148a5 100644
--- a/executive-summary/idl/HtmlView.idl
+++ b/executive-summary/idl/HtmlView.idl
@@ -14,7 +14,7 @@ module GNOME {
module Evolution {
module Summary {
- interface HTMLView : Bonobo::Unknown{
+ interface HTMLView : Bonobo::Unknown {
string getHtml ();
};
};
diff --git a/executive-summary/idl/SummaryComponent.idl b/executive-summary/idl/SummaryComponent.idl
index 1129721a02..fefc8e518d 100644
--- a/executive-summary/idl/SummaryComponent.idl
+++ b/executive-summary/idl/SummaryComponent.idl
@@ -19,24 +19,16 @@ module Summary {
interface ViewFrame;
interface Component: Bonobo::Unknown {
+ };
+ interface ComponentFactory: Bonobo::Unknown {
/**
- * setOwner:
- * @summary: A Summary object.
+ * createView:
*
- * Sets the owner of the component.
- */
- void setOwner (in ViewFrame owner);
-
- /**
- * unsetOwner:
+ * Creates a new Component object.
*
- * Unsets the owner of the component.
- */
- void unsetOwner ();
- };
-
- interface ComponentFactory: Bonobo::Unknown {
+ * Returns: A Component object.
+ **/
Component createView ();
};
};
diff --git a/executive-summary/summary.html b/executive-summary/summary.html
new file mode 100644
index 0000000000..a849ddf3d6
--- /dev/null
+++ b/executive-summary/summary.html
@@ -0,0 +1,32 @@
+<html>
+<head>
+<Title>Evolution Executive Summary</title>
+</head>
+
+<body bgcolor="#ffffff" background="/usr/local/share/images/evolution/executive-summary-bg.png">
+<table cellpadding="0" cellspacing="0" numcols="3" width="100%">
+<tr>
+<td bgcolor="#9aadbf" height="102">
+<img src="/usr/local/share/images/evolution/butterfly.png"></td>
+<td colspan="2" align="middle" bgcolor="#9aadbf">
+E V O L U T I O N
+</td></tr>
+<tr><td bgcolor="#9aadbf">&nbsp;</td>
+<td><img src="/usr/local/share/images/evolution/executive-summary-curve.png"></td>
+<td>Use this to search for something on Google</td>
+</tr>
+<tr height="100%">
+<td bgcolor="#9aadbf">&nbsp;</td>
+<td colspan="2"><table width="100%" height="100%">
+<tr>
+<td>
+<!-- EVOLUTION EXECUTIVE SUMMARY SERVICES DO NOT REMOVE -->
+</td>
+</tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
+
+
diff --git a/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oaf.in b/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oaf.in
index 702a099dcc..4cb096b3ae 100644
--- a/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oaf.in
+++ b/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oaf.in
@@ -17,7 +17,7 @@
location="OAFIID:GNOME_Evolution_Summary_rdf_SummaryComponentFactory">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
diff --git a/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oafinfo b/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oafinfo
index 702a099dcc..4cb096b3ae 100644
--- a/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oafinfo
+++ b/executive-summary/test-service/GNOME_Evolution_Summary_rdf.oafinfo
@@ -17,7 +17,7 @@
location="OAFIID:GNOME_Evolution_Summary_rdf_SummaryComponentFactory">
<oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
diff --git a/executive-summary/test-service/Makefile.am b/executive-summary/test-service/Makefile.am
index 22c1307380..51f41c899b 100644
--- a/executive-summary/test-service/Makefile.am
+++ b/executive-summary/test-service/Makefile.am
@@ -1,4 +1,4 @@
-bin_PROGRAMS = test-service
+bin_PROGRAMS = test-service rdf-summary
CFLAGS += -g
INCLUDES = \
@@ -24,13 +24,13 @@ test_service_LDADD = \
# $(BONOBO_VFS_GNOME_LIBS) \
# $(EXTRA_GNOME_LIBS)
-#rdf_summary_SOURCES = \
-# rdf-summary.c
+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)
+rdf_summary_LDADD = \
+ $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
+ $(BONOBO_VFS_GNOME_LIBS) \
+ $(EXTRA_GNOME_LIBS)
oafdir = $(datadir)/oaf
oaf_DATA = \
diff --git a/executive-summary/test-service/main.c b/executive-summary/test-service/main.c
index 5b8fdd7b85..1dcbf20b51 100644
--- a/executive-summary/test-service/main.c
+++ b/executive-summary/test-service/main.c
@@ -154,7 +154,7 @@ static void
component_destroyed (GtkObject *object,
gpointer data)
{
- UserData *ud = (UserData *) ud;
+ UserData *ud = (UserData *) data;
/* Free the UserData structure */
g_free (ud->title);
g_free (ud->icon);
@@ -163,8 +163,10 @@ component_destroyed (GtkObject *object,
running_views--;
g_print ("Destroy!\n");
- if (running_views <= 0)
+ if (running_views <= 0) {
+ bonobo_object_unref (BONOBO_OBJECT (factory));
gtk_main_quit ();
+ }
}
static BonoboObject *
@@ -225,12 +227,12 @@ create_view (ExecutiveSummaryComponentFactory *_factory,
/* 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);
+ running_views++;
/* Return the ExecutiveSummaryComponent object */
return component;
}
diff --git a/executive-summary/test-service/rdf-summary.c b/executive-summary/test-service/rdf-summary.c
index ee01c13dcc..9596472a58 100644
--- a/executive-summary/test-service/rdf-summary.c
+++ b/executive-summary/test-service/rdf-summary.c
@@ -20,7 +20,7 @@
#include <gnome-xml/parser.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>
#include <libgnomevfs/gnome-vfs.h>
@@ -32,6 +32,27 @@ static int running_views = 0;
static BonoboGenericFactory *factory = NULL;
#define RDF_SUMMARY_ID "OAFIID:GNOME_Evolution_Summary_rdf_SummaryComponentFactory"
+enum {
+ PROPERTY_TITLE,
+ PROPERTY_ICON
+};
+
+struct _RdfSummary {
+ BonoboObject *component;
+ BonoboObject *view;
+ BonoboObject *bag;
+ BonoboObject *property_control;
+
+ GtkWidget *rdf;
+ GtkWidget *g_limit;
+
+ char *title;
+ char *icon;
+ char *location;
+ int limit;
+};
+typedef struct _RdfSummary RdfSummary;
+
/************ RDF Parser *******************/
static char *
@@ -110,16 +131,17 @@ layer_find_url (xmlNodePtr node,
static void
tree_walk (xmlNodePtr root,
- ExecutiveSummaryComponentView *view,
+ RdfSummary *summary,
GString *html)
{
+ BonoboArg *arg;
xmlNodePtr walk;
xmlNodePtr rewalk = root;
xmlNodePtr channel = NULL;
xmlNodePtr image = NULL;
xmlNodePtr item[16];
int items = 0;
- int limit = 10;
+ int limit = summary->limit;
int i;
char *t;
char n[512];
@@ -169,21 +191,32 @@ tree_walk (xmlNodePtr root,
}
t = layer_find(channel->childs, "title", "No title");
-/* g_string_append (html, tmp); */
- executive_summary_component_view_set_title (view, t);
+ arg = bonobo_arg_new (BONOBO_ARG_STRING);
+ BONOBO_ARG_SET_STRING (arg, t);
+ bonobo_property_bag_set_value (BONOBO_PROPERTY_BAG (summary->bag),
+ "window_title", (const BonoboArg *) arg,
+ NULL);
+ bonobo_arg_release (arg);
+
+#if 0
tmp = g_strdup_printf ("%s",
layer_find(channel->childs, "description", ""));
g_string_append (html, tmp);
g_free (tmp);
+#endif
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"));
+ char *icon;
+
+ icon = layer_find_url (image->childs, "url", "apple-red.png");
+ arg = bonobo_arg_new (BONOBO_ARG_STRING);
+ BONOBO_ARG_SET_STRING (arg, icon);
+ bonobo_property_bag_set_value (BONOBO_PROPERTY_BAG (summary->bag),
+ "window_icon",
+ (const BonoboArg *) arg, NULL);
+ bonobo_arg_release (arg);
+
}
g_string_append (html, "<br clear=all><FONT size=\"-1\" face=\"helvetica\"><P><UL>\n");
@@ -238,6 +271,12 @@ static void
view_destroyed (GtkObject *object,
gpointer data)
{
+ RdfSummary *summary = (RdfSummary *) data;
+
+ g_free (summary->title);
+ g_free (summary->icon);
+ g_free (summary);
+
running_views--;
if (running_views <= 0) {
gtk_main_quit ();
@@ -245,8 +284,9 @@ view_destroyed (GtkObject *object,
}
static int
-download (ExecutiveSummaryComponentView *view)
+download (RdfSummary *summary)
{
+ ExecutiveSummaryHtmlView *view;
GString *rdf;
GString *html;
char *xml;
@@ -260,14 +300,15 @@ download (ExecutiveSummaryComponentView *view)
/* Then parse it */
/* The update it */
- location = "/home/iain/gnotices.rdf";
- result = gnome_vfs_open (&handle, location, GNOME_VFS_OPEN_READ);
+ view = EXECUTIVE_SUMMARY_HTML_VIEW (summary->view);
+ result = gnome_vfs_open (&handle, summary->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);
+ summary->location);
+ executive_summary_html_view_set_html (view, emsg);
g_free (emsg);
return FALSE;
}
@@ -282,8 +323,8 @@ download (ExecutiveSummaryComponentView *view)
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>");
+ executive_summary_html_view_set_html (view,
+ "<b>Error reading data.</b>");
g_string_free (rdf, TRUE);
return FALSE;
}
@@ -309,36 +350,206 @@ download (ExecutiveSummaryComponentView *view)
g_free (xml);
html = g_string_new ("");
- tree_walk (doc->root, view, html);
- executive_summary_component_view_set_html (view, html->str);
+ tree_walk (doc->root, summary, html);
+ executive_summary_html_view_set_html (view, html->str);
g_string_free (html, TRUE);
return FALSE;
}
static void
-create_view (ExecutiveSummaryComponent *component,
- ExecutiveSummaryComponentView *view,
+get_prop (BonoboPropertyBag *bag,
+ BonoboArg *arg,
+ guint arg_id,
+ gpointer user_data)
+{
+ RdfSummary *summary = (RdfSummary *) 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;
+ }
+}
+
+static void
+set_prop (BonoboPropertyBag *bag,
+ const BonoboArg *arg,
+ guint arg_id,
+ gpointer user_data)
+{
+ RdfSummary *summary = (RdfSummary *) user_data;
+
+ switch (arg_id) {
+ case PROPERTY_TITLE:
+ if (summary->title)
+ g_free (summary->title);
+
+ summary->title = g_strdup (BONOBO_ARG_GET_STRING (arg));
+ bonobo_property_bag_notify_listeners (bag, "window_title",
+ arg, NULL);
+ break;
+
+ case PROPERTY_ICON:
+ if (summary->icon)
+ g_free (summary->icon);
+
+ summary->icon = g_strdup (BONOBO_ARG_GET_STRING (arg));
+ bonobo_property_bag_notify_listeners (bag, "window_icon",
+ arg, NULL);
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void
+entry_changed (GtkEntry *entry,
+ RdfSummary *summary)
+{
+ bonobo_property_control_changed (BONOBO_PROPERTY_CONTROL (summary->property_control), NULL);
+}
+
+static BonoboControl *
+property_control (BonoboPropertyControl *property_control,
+ int page_num,
+ gpointer user_data)
+{
+ BonoboControl *control;
+ RdfSummary *summary = (RdfSummary *) user_data;
+ GtkWidget *container, *label, *hbox;
+ char *climit;
+
+ container = gtk_vbox_new (FALSE, 2);
+ gtk_container_set_border_width (GTK_CONTAINER (container), 2);
+ hbox = gtk_hbox_new (FALSE, 2);
+
+ label = gtk_label_new ("Location:");
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+ summary->rdf = gtk_entry_new ();
+ if (summary->location)
+ gtk_entry_set_text (GTK_ENTRY (summary->rdf), summary->location);
+
+ gtk_signal_connect (GTK_OBJECT (summary->rdf), "changed",
+ GTK_SIGNAL_FUNC (entry_changed), summary);
+
+ gtk_box_pack_start (GTK_BOX (hbox), summary->rdf, TRUE, TRUE, 0);
+
+ gtk_box_pack_start (GTK_BOX (container), hbox, FALSE, FALSE, 0);
+
+ hbox = gtk_hbox_new (FALSE, 2);
+
+ label = gtk_label_new ("Maximum number of entries:");
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+ summary->g_limit = gtk_entry_new ();
+ climit = g_strdup_printf ("%d", summary->limit);
+ gtk_entry_set_text (GTK_ENTRY (summary->g_limit), climit);
+ g_free (climit);
+
+ gtk_signal_connect (GTK_OBJECT (summary->g_limit), "changed",
+ GTK_SIGNAL_FUNC (entry_changed), summary);
+
+ gtk_box_pack_start (GTK_BOX (hbox), summary->g_limit, TRUE, TRUE, 0);
+
+ gtk_box_pack_start (GTK_BOX (container), hbox, FALSE, FALSE, 0);
+ gtk_widget_show_all (container);
+
+ control = bonobo_control_new (container);
+ return control;
+}
+
+static void
+property_action (GtkObject *property_control,
+ int page_num,
+ Bonobo_PropertyControl_Action action,
+ RdfSummary *summary)
+{
+ switch (action) {
+ case Bonobo_PropertyControl_APPLY:
+ g_free (summary->location);
+ summary->location = g_strdup (gtk_entry_get_text (GTK_ENTRY (summary->rdf)));
+ summary->limit = atoi (gtk_entry_get_text (GTK_ENTRY (summary->g_limit)));
+ g_idle_add (download, summary);
+ break;
+
+ case Bonobo_PropertyControl_HELP:
+ g_print ("HELP: Page %d!\n", page_num);
+ break;
+
+ default:
+ break;
+ }
+}
+
+static BonoboObject *
+create_view (ExecutiveSummaryComponentFactory *_factory,
void *closure)
{
+ RdfSummary *summary;
+ BonoboObject *component, *view, *bag, *property;
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);
+ summary = g_new (RdfSummary, 1);
+ summary->icon = g_strdup ("apple-green.png");
+ summary->title = g_strdup ("Downloading...");
+ summary->location = g_strdup ("http://news.gnome.org/gnome-news/rdf");
+ summary->limit = 10;
+
+ component = executive_summary_component_new ();
+ gtk_signal_connect (GTK_OBJECT (component), "destroy",
+ GTK_SIGNAL_FUNC (view_destroyed), summary);
+
+ summary->component = component;
+
+ view = executive_summary_html_view_new ();
+ summary->view = view;
+ executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (view),
+ html);
+ bonobo_object_add_interface (component, view);
+
+ bag = bonobo_property_bag_new (get_prop, set_prop, summary);
+ summary->bag = bag;
+ bonobo_property_bag_add (BONOBO_PROPERTY_BAG (bag),
+ "window_title", PROPERTY_TITLE,
+ BONOBO_ARG_STRING, NULL,
+ "The title of this component's 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);
+ bonobo_object_add_interface (component, bag);
+
+ property = bonobo_property_control_new (property_control, 1, summary);
+ summary->property_control = property;
+
+ gtk_signal_connect (GTK_OBJECT (property), "action",
+ GTK_SIGNAL_FUNC (property_action), summary);
+
+ bonobo_object_add_interface (component, property);
+
running_views++;
- g_idle_add (download, view);
+ g_idle_add (download, summary);
+
+ return component;
}
static BonoboObject *
factory_fn (BonoboGenericFactory *_factory,
void *closure)
{
- ExecutiveSummaryComponent *component;
+ ExecutiveSummaryComponentFactory *component_factory;
- component = executive_summary_component_new (create_view, NULL);
- return BONOBO_OBJECT (component);
+ component_factory = executive_summary_component_factory_new (create_view, NULL);
+ return BONOBO_OBJECT (component_factory);
}
static void
@@ -371,23 +582,10 @@ main (int argc,
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
+ if (factory != NULL)
+ bonobo_object_unref (BONOBO_OBJECT (factory));
+ return 0;
}