Commit 20394851 authored by Iain Holmes's avatar Iain Holmes

Summary is back in :D

Fixed a silly size issue for composer file selectors.

svn path=/trunk/; revision=6187
parent 8ab09706
2000-10-25 Iain Holmes <iain@helixcode.com>
* configure.in: Added executive-summary stuff
* Makefile.am: Added the executive-summary subdirs.
2000-10-23 Dan Winship <danw@helixcode.com>
* notes/Makefile.am (INCLUDES): Update EVOLUTION_LOCALEDIR
......
......@@ -25,6 +25,7 @@ SUBDIRS = \
e-util \
widgets \
shell \
executive-summary \
libibex \
camel \
filter \
......
2000-10-25 Iain Holmes <iain@helixcode.com>
* e-msg-composer-select-file.c (create_file_selection): Set the
wmclass and wmclass_name for the file selectors so that Sawfish
doesn't make the dialogs the same size as the parent.
2000-10-25 Dan Winship <danw@helixcode.com>
* evolution-composer.c (init): Attach send/postpone signal
......
......@@ -106,6 +106,8 @@ create_file_selection (EMsgComposer *composer)
info = g_new (FileSelectionInfo, 1);
widget = gtk_file_selection_new (NULL);
gtk_window_set_wmclass (GTK_WINDOW (widget), "fileselection",
"Evolution:composer");
ok_button = GTK_FILE_SELECTION (widget)->ok_button;
cancel_button = GTK_FILE_SELECTION (widget)->cancel_button;
......
......@@ -576,6 +576,12 @@ po/Makefile.in
e-util/Makefile
e-util/ename/Makefile
libibex/Makefile
executive-summary/Makefile
executive-summary/evolution-services/Makefile
executive-summary/widgets/Makefile
executive-summary/idl/Makefile
executive-summary/component/Makefile
executive-summary/test-service/Makefile
camel/Makefile
camel/providers/Makefile
camel/providers/mbox/Makefile
......
2000-10-25 Iain Holmes <iain@helixcode.com>
* local/Makefile.am: Added executive-summary again.
* shortcurts.xml: In out, in out and shake it all about
The executive summary is back in.
2000-10-12 Iain Holmes <iain@helixcode.com>
* local/Makefile.am: And removed it again.
......
......@@ -2,6 +2,7 @@ SUBDIRS = \
Calendar \
Contacts \
Drafts \
Executive-Summary \
Inbox \
Outbox \
Sent \
......
<?xml version="1.0"?>
<shortcuts>
<group title="Evolution shortcuts">
<!-- <item>evolution:/local/Executive-Summary</item> -->
<item>evolution:/local/Executive-Summary</item>
<item>evolution:/local/Inbox</item>
<!-- <item>evolution:/local/Outbox</item>
<item>evolution:/local/Trash</item>
......
2000-10-25 Iain Holmes <iain@helixcode.com>
* test-service/main.c: Store each individual views data with the view.
Add comments to explain everything.
* evolution-services/executive-summary-component.c
(impl_Evolution_SummaryComponent_create_view): Only try to create a
control if the returned control != NULL.
2000-10-25 Iain Holmes <iain@helixcode.com>
* evolution-services/executive-summary-component.c
(impl_Evolution_SummaryComponent_create_view): Set the UID of the view
before passing it to the create_view method.
2000-10-25 Iain Holmes <iain@helixcode.com>
* idl/Summary.idl: Added set_icon method, and changed update_html_component
to update_component. Made all methods take a long ID instead of an
SummaryComponent.
* idl/SummaryComponent.idl: Combined the create_bonobo_view and
create_html_view into create_view.
Added a destroy_view method.
* evolution-services/Makefile.am: Added the 2 new files.
* evolution-services/executive-summary-component-view.[ch]: New
files implementing a view of an ExecutiveSummaryComponent.
* evolution-services/executive-summary.[ch]
* evolution-services/executive-summary-client.[ch]
* evolution-services/executive-summary-component.[ch]
* evolution-services/executive-summary-component-client.[ch]:
* component/e-summary-factory.c
* component/e-summary.c
* test-service/main.c:
Updated to use new methods and the new ExecutiveSummaryComponentView
object.
2000-10-16 Iain Holmes <iain@helixcode.com>
* evolution-services/executive-summary.c (executive_summary_class_init):
Implement the update, set_title and flash functionality as signals
instead of methods.
(impl_Evolution_Summary_set_title): Emit signal.
(impl_Evolution_Summary_flash): Emit signal.
(impl_Evolution_Summary_update_html_component): Emit signal.
(executive_summary_new): Don't need the methods anymore.
(executive_summary_construct): Same.
(executive_summary_init): Remove the private initialisation.
2000-10-23 Dan Winship <danw@helixcode.com>
* idl/Makefile.am (INCLUDES):
......
......@@ -6,10 +6,8 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
-I$(top_builddir)/executive-summary/evolution-services \
-I$(top_srcdir)/executive-summary/evolution-services \
-I$(top_builddir)/executive-summary/widdets \
-I$(top_srcdir)/executive-summary/widgets \
-I$(top_builddir)/executive-summary \
-I$(top_srcdir)/executive-summary/ \
$(EXTRA_GNOME_CFLAGS) \
$(GNOME_VFS_CFLAGS) \
$(UNICODE_CFLAGS) \
......
......@@ -42,27 +42,16 @@
#include "e-summary.h"
#include "Evolution.h"
#include <executive-summary-component-client.h>
#include <Executive-Summary.h>
#include <executive-summary.h>
#include <executive-summary-component.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>
static GList *control_list = NULL;
GtkWidget* embed_service (GtkWidget *widget,
ESummary *esummary);
static void update (ExecutiveSummary *summary,
const Evolution_SummaryComponent component,
const char *html,
ESummary *esummary);
static void set_title (ExecutiveSummary *summary,
const Evolution_SummaryComponent component,
const char *title,
void *closure);
static void flash (ExecutiveSummary *summary,
const Evolution_SummaryComponent component,
void *closure);
BonoboUIVerb verbs[] = {
BONOBO_UI_UNSAFE_VERB ("AddService", embed_service),
......@@ -153,30 +142,47 @@ control_destroy_cb (BonoboControl *control,
static void
update (ExecutiveSummary *summary,
const Evolution_SummaryComponent component,
int id,
const char *html,
ESummary *esummary)
{
ExecutiveSummaryComponentView *view;
g_print ("OI!\n");
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,
const Evolution_SummaryComponent component,
int id,
const char *title,
void *closure)
gpointer user_data)
{
g_print ("Setting title to %s\n", title);
}
static void
flash (ExecutiveSummary *summary,
const Evolution_SummaryComponent component,
void *closure)
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
*/
......@@ -186,6 +192,7 @@ embed_service (GtkWidget *widget,
{
ExecutiveSummaryComponentClient *client;
ExecutiveSummary *summary;
ExecutiveSummaryComponentView *view;
char *required_interfaces[2] = {"IDL:Evolution:SummaryComponent:1.0",
NULL};
char *obj_id;
......@@ -204,14 +211,21 @@ embed_service (GtkWidget *widget,
return NULL;
/* Set the owner */
summary = executive_summary_new (set_title, flash, update, esummary);
summary = executive_summary_new ();
executive_summary_component_client_set_owner (client, summary);
gtk_signal_connect (GTK_OBJECT (summary), "flash",
GTK_SIGNAL_FUNC (flash), NULL);
gtk_signal_connect (GTK_OBJECT (summary), "set_title",
GTK_SIGNAL_FUNC (set_title), NULL);
gtk_signal_connect (GTK_OBJECT (summary), "update",
GTK_SIGNAL_FUNC (update), esummary);
/* Create view */
html = executive_summary_component_client_create_html_view (client, &title, &icon);
e_summary_add_html_service (esummary, summary, client, html, title, icon);
g_free (html);
view = executive_summary_component_client_create_view (client);
gtk_signal_connect (GTK_OBJECT (view), "destroy",
GTK_SIGNAL_FUNC (view_destroyed), client);
e_summary_add_service (esummary, summary, view);
e_summary_rebuild_page (esummary);
return NULL;
}
......
......@@ -32,10 +32,10 @@
#include <gtkhtml/gtkhtml-stream.h>
#include <gtk/gtkvbox.h>
#include <gal/util/e-util.h>
#include <e-summary-subwindow.h>
#include <executive-summary.h>
#include <executive-summary-component-client.h>
#include <evolution-services/executive-summary.h>
#include <evolution-services/executive-summary-component-client.h>
#include <evolution-services/executive-summary-component-view.h>
#include <libgnomevfs/gnome-vfs.h>
#include "e-summary.h"
......@@ -48,6 +48,7 @@ struct _ESummaryPrivate {
GtkWidget *html_scroller;
GtkWidget *html;
GHashTable *id_to_view;
GHashTable *summary_to_window;
GList *window_list;
......@@ -56,21 +57,9 @@ struct _ESummaryPrivate {
GtkHTMLStream *stream;
};
typedef enum {
E_SUMMARY_WINDOW_BONOBO,
E_SUMMARY_WINDOW_HTML
} ESummaryWindowType;
typedef struct _ESummaryWindow {
ExecutiveSummary *summary;
ExecutiveSummaryComponentClient *client;
char *title;
char *icon;
ESummaryWindowType type;
char *html;
GtkWidget *control;
ExecutiveSummaryComponentView *view;
} ESummaryWindow;
static gboolean on_object_requested (GtkHTML *html,
......@@ -86,6 +75,7 @@ s2w_foreach (gpointer *key,
gpointer *value,
ESummaryPrivate *priv)
{
g_print ("%s\n", __FUNCTION__);
e_summary_window_free ((ESummaryWindow *) value, priv);
g_free (value);
}
......@@ -95,7 +85,8 @@ e_summary_destroy (GtkObject *object)
{
ESummary *esummary = E_SUMMARY (object);
ESummaryPrivate *priv;
g_print ("Destroy\n");
priv = esummary->private;
if (priv == NULL)
return;
......@@ -103,6 +94,7 @@ e_summary_destroy (GtkObject *object)
g_hash_table_foreach (priv->summary_to_window,
s2w_foreach, priv);
g_hash_table_destroy (priv->summary_to_window);
g_hash_table_destroy (priv->id_to_view);
g_free (esummary->private);
esummary->private = NULL;
......@@ -218,7 +210,7 @@ static void
e_summary_start_load (ESummary *summary)
{
ESummaryPrivate *priv;
char *header = "<html><body>";
char *header = "<html><body bgcolor=\"#ffffff\">";
priv = summary->private;
priv->stream = gtk_html_begin (GTK_HTML (priv->html));
......@@ -273,12 +265,12 @@ e_summary_init (ESummary *esummary)
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
priv->html = gtk_html_new ();
gtk_html_set_editable (GTK_HTML (priv->html), FALSE);
gtk_html_set_default_background_color (GTK_HTML (priv->html), &bgcolour);
gtk_signal_connect (GTK_OBJECT (priv->html), "url-requested",
GTK_SIGNAL_FUNC (request_cb), NULL);
gtk_signal_connect (GTK_OBJECT (priv->html), "object-requested",
GTK_SIGNAL_FUNC (on_object_requested), esummary);
gtk_html_set_default_background_color (GTK_HTML (priv->html), &bgcolour);
gtk_container_add (GTK_CONTAINER (priv->html_scroller), priv->html);
gtk_widget_show_all (priv->html_scroller);
......@@ -288,8 +280,9 @@ e_summary_init (ESummary *esummary)
gtk_box_pack_start (GTK_BOX (esummary), priv->html_scroller,
TRUE, TRUE, 0);
/* Init hashtable */
/* Init hashtables */
priv->summary_to_window = g_hash_table_new (NULL, NULL);
priv->id_to_view = g_hash_table_new (NULL, NULL);
}
E_MAKE_TYPE (e_summary, "ESummary", ESummary, e_summary_class_init,
......@@ -324,15 +317,7 @@ on_object_requested (GtkHTML *html,
break;
case 2:
gtk_widget_show (window->control);
gtk_widget_ref (GTK_WIDGET (window->control));
if (window->control->parent != NULL) {
gtk_container_remove (GTK_CONTAINER (window->control->parent), window->control);
}
gtk_container_add (GTK_CONTAINER (eb), window->control);
gtk_widget_unref (GTK_WIDGET (window->control));
g_warning ("Bonobo services are not supported in this version.");
break;
default:
......@@ -349,46 +334,45 @@ e_summary_display_window (ESummary *esummary,
{
ESummaryPrivate *priv;
char *footer = "</td></tr></table>";
char *title_cid, *body_cid;
char *title_html;
char *colour[2] = {"e6e8e4",
"edeeeb"};
char *title_colour[2] = {"bac1b6",
"cdd1c7"};
const char *title, *icon, *html;
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);
/** FIXME: Make this faster by caching it? */
title_cid = g_strdup_printf ("<table cellspacing=\"0\" "
"cellpadding=\"0\" border=\"0\" width=\"100%%\" height=\"100%%\">"
"<tr><td bgcolor=\"#%s\">"
"<table width=\"100%%\"><tr><td>"
"<img src=\"%s\"></td>"
"<td nowrap align=\"center\" width=\"100%%\">"
"<b>%s</b></td></tr></table></td></tr><tr>"
"<td bgcolor=\"#%s\" height=\"100%%\">",
title_colour[col % 2],
window->icon,
window->title,
colour[col % 2]);
gtk_html_write (GTK_HTML (priv->html), priv->stream, title_cid,
strlen (title_cid));
g_free (title_cid);
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>"
"<img src=\"%s\"></td>"
"<td nowrap align=\"center\" width=\"100%%\">"
"<b>%s</b></td></tr></table></td></tr><tr>"
"<td bgcolor=\"#%s\" height=\"100%%\">",
title_colour[col % 2], icon, title,
colour[col % 2]);
gtk_html_write (GTK_HTML (priv->html), priv->stream, title_html,
strlen (title_html));
g_free (title_html);
switch (window->type) {
case E_SUMMARY_WINDOW_HTML:
if (html != NULL && *html != '\0') {
gtk_html_write (GTK_HTML (priv->html), priv->stream,
window->html, strlen (window->html));
break;
case E_SUMMARY_WINDOW_BONOBO:
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);
gtk_html_write (GTK_HTML (priv->html), priv->stream,
body_cid, strlen (body_cid));
break;
default:
break;
#endif
}
gtk_html_write (GTK_HTML (priv->html), priv->stream,
......@@ -450,6 +434,37 @@ e_summary_rebuild_page (ESummary *esummary)
return FALSE;
}
void
e_summary_add_service (ESummary *esummary,
ExecutiveSummary *summary,
ExecutiveSummaryComponentView *view)
{
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->view = view;
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_print ("--%d: %p\n", id, view);
g_hash_table_insert (priv->id_to_view, GINT_TO_POINTER (id), view);
}
#if 0
void
e_summary_add_html_service (ESummary *esummary,
ExecutiveSummary *summary,
......@@ -501,22 +516,17 @@ e_summary_add_bonobo_service (ESummary *esummary,
g_hash_table_insert (priv->summary_to_window, summary, window);
}
#endif
static void
e_summary_window_free (ESummaryWindow *window,
ESummaryPrivate *priv)
{
g_free (window->title);
g_free (window->icon);
if (window->type == E_SUMMARY_WINDOW_BONOBO)
gtk_widget_unref (window->control);
else
g_free (window->html);
g_print ("%s\n", __FUNCTION__);
priv->window_list = g_list_remove (priv->window_list, window);
bonobo_object_unref (BONOBO_OBJECT (window->summary));
bonobo_object_unref (BONOBO_OBJECT (window->client));
gtk_object_unref (GTK_OBJECT (window->view));
}
/* Call this before e_summary_window_free, execpt when you are freeing
......@@ -533,25 +543,34 @@ e_summary_update_window (ESummary *esummary,
ExecutiveSummary *summary,
const char *html)
{
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 (e_summary_rebuild_page, esummary);
}
window = g_hash_table_lookup (priv->summary_to_window, summary);
g_return_if_fail (window != NULL);
ExecutiveSummaryComponentView *
e_summary_view_from_id (ESummary *esummary,
int id)
{
ESummaryPrivate *priv;
ExecutiveSummaryComponentView *view;
g_free (window->html);
window->html = g_strdup (html);
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);
if (priv->idle != 0)
return;
priv = esummary->private;
view = g_hash_table_lookup (priv->id_to_view, GINT_TO_POINTER (id));
priv->idle = g_idle_add (e_summary_rebuild_page, esummary);
g_print ("%d: %p\n", id, view);
return view;
}
......@@ -27,8 +27,8 @@
#include <gtk/gtksignal.h>
#include <gtkhtml/gtkhtml.h>
#include <gtk/gtkvbox.h>
#include <executive-summary.h>
#include <executive-summary-component-client.h>
#include <evolution-services/executive-summary.h>
#include <evolution-services/executive-summary-component-client.h>
#include "shell/Evolution.h"
......
lib_LTLIBRARIES = libevolution-services.la
INCLUDES = \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/widgets/e-text \
-I$(top_srcdir) \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
-I$(top_srcdir)/executive-summary \
-I$(top_builddir)/executive-summary \
$(EXTRA_GNOME_CFLAGS) \
$(GNOME_VFS_CFLAGS) \
$(UNICODE_CFLAGS) \
......@@ -43,7 +43,9 @@ libevolution_services_la_SOURCES = \
executive-summary-component.c \
executive-summary-component.h \
executive-summary-component-client.c \
executive-summary-component-client.h
executive-summary-component-client.h \
executive-summary-component-view.c \
executive-summary-component-view.h
libevolution_services_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
......
......@@ -95,18 +95,16 @@ E_MAKE_TYPE (executive_summary_client, "ExecutiveSummaryClient",
void
executive_summary_client_set_title (ExecutiveSummaryClient *client,
ExecutiveSummaryComponent *component,
int id,
const char *title)
{
Evolution_Summary summary;
Evolution_SummaryComponent corba_object;
CORBA_Environment ev;
CORBA_exception_init (&ev);
summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));
corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (component));
Evolution_Summary_set_title (summary, corba_object, title, &ev);
Evolution_Summary_set_title (summary, id, title, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error setting title to %s:%s", title, CORBA_exception_id (&ev));
......@@ -115,19 +113,37 @@ executive_summary_client_set_title (ExecutiveSummaryClient *client,
CORBA_exception_free (&ev);
}
void
executive_summary_client_set_icon (ExecutiveSummaryClient *client,
int id,
const char *icon)
{
Evolution_Summary summary;
CORBA_Environment ev;
CORBA_exception_init (&ev);
summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));
Evolution_Summary_set_icon (summary, id, icon, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error setting icon to %s:%s", icon, CORBA_exception_id (&ev));
}
CORBA_exception_free (&ev);
}
void
executive_summary_client_flash (ExecutiveSummaryClient *client,
ExecutiveSummaryComponent *component)
int id)
{
Evolution_Summary summary;
Evolution_SummaryComponent corba_object;
CORBA_Environment ev;
CORBA_exception_init (&ev);
summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));
corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (component));
Evolution_Summary_flash (summary, corba_object, &ev);
Evolution_Summary_flash (summary, id, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error flashing");
......@@ -138,19 +154,16 @@ executive_summary_client_flash (ExecutiveSummaryClient *client,
void
executive_summary_client_update (ExecutiveSummaryClient *client,
ExecutiveSummaryComponent *component,
char *html)
int id,
const char *html)
{
Evolution_Summary summary;
Evolution_SummaryComponent corba_object;
CORBA_Environment ev;
CORBA_exception_init (&ev);
summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));
corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (component));
Evolution_Summary_update_html_component (summary, corba_object,
html, &ev);
Evolution_Summary_update_component (summary, id, html, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error updating the component");
}
......
......@@ -21,11 +21,11 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef _EXECUTIVE_SUMMARY_COMPONENT_CLIENT_H__
#define _EXECUTIVE_SUMMARY_COMPONENT_CLIENT_H__
#ifndef _EXECUTIVE_SUMMARY_CLIENT_H__
#define _EXECUTIVE_SUMMARY_CLIENT_H__
#include <bonobo.h>
#include "executive-summary-component.h"
#include <evolution-services/executive-summary-component.h>
#define EXECUTIVE_SUMMARY_CLIENT_TYPE (executive_summary_client_get_type ())
#define EXECUTIVE_SUMMARY_CLIENT(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_CLIENT_TYPE, ExecutiveSummaryClient))
......@@ -51,12 +51,15 @@ GtkType executive_summary_client_get_type (void);
void executive_summary_client_construct (ExecutiveSummaryClient *client,
CORBA_Object object);
void executive_summary_client_set_title (ExecutiveSummaryClient *client,
ExecutiveSummaryComponent *component,
int id,
const char *title);
void executive_summary_client_set_icon (ExecutiveSummaryClient *client,
int id,
const char *icon);
void executive_summary_client_flash (ExecutiveSummaryClient *client,