diff options
Diffstat (limited to 'executive-summary/component')
-rw-r--r-- | executive-summary/component/.cvsignore | 6 | ||||
-rw-r--r-- | executive-summary/component/Makefile.am | 57 | ||||
-rw-r--r-- | executive-summary/component/component-factory.c | 157 | ||||
-rw-r--r-- | executive-summary/component/component-factory.h | 31 | ||||
-rw-r--r-- | executive-summary/component/e-summary-factory.c | 249 | ||||
-rw-r--r-- | executive-summary/component/e-summary-factory.h | 32 | ||||
-rw-r--r-- | executive-summary/component/e-summary.c | 557 | ||||
-rw-r--r-- | executive-summary/component/e-summary.h | 74 | ||||
-rw-r--r-- | executive-summary/component/executive-summary.png | bin | 25562 -> 0 bytes | |||
-rw-r--r-- | executive-summary/component/main.c | 82 |
10 files changed, 0 insertions, 1245 deletions
diff --git a/executive-summary/component/.cvsignore b/executive-summary/component/.cvsignore deleted file mode 100644 index 40163816ad..0000000000 --- a/executive-summary/component/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -core -Makefile.in -Makefile -.deps -.libs -evolution-executive-summary
\ No newline at end of file diff --git a/executive-summary/component/Makefile.am b/executive-summary/component/Makefile.am deleted file mode 100644 index bf86e72d2c..0000000000 --- a/executive-summary/component/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -bin_PROGRAMS = evolution-executive-summary - -INCLUDES = \ - -I$(top_srcdir)/widgets \ - -I$(top_srcdir)/widgets/e-text \ - -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 \ - $(EXTRA_GNOME_CFLAGS) \ - $(GNOME_VFS_CFLAGS) \ - $(UNICODE_CFLAGS) \ - $(GTKHTML_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DG_LOG_DOMAIN=\"evolution-executive-summary\" - -CLEANFILES = $(IDL_GENERATED) - -IDL_GENERATED = \ - Executive-Summary.h \ - Executive-Summary-common.c \ - Executive-Summary-skels.c \ - Executive-Summary-stubs.c - -Executive-Summary-impl.o: Executive-Summary.h - -$(IDL_GENERATED): - $(ORBIT_IDL) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - -I$(srcdir) $(srcdir)/../idl/Executive-Summary.idl - -evolution_executive_summary_SOURCES = \ - component-factory.c \ - component-factory.h \ - e-summary.c \ - e-summary.h \ - e-summary-factory.c \ - e-summary-factory.h \ - main.c - -evolution_executive_summary_LDADD = \ - $(top_builddir)/shell/libeshell.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \ - $(top_builddir)/executive-summary/widgets/libesummary-widgets.a \ - $(BONOBO_VFS_GNOME_LIBS) \ - $(EXTRA_GNOME_LIBS) \ - $(GTKHTML_LIBS) \ - $(UNICODE_LIBS) - diff --git a/executive-summary/component/component-factory.c b/executive-summary/component/component-factory.c deleted file mode 100644 index 9af99c7e67..0000000000 --- a/executive-summary/component/component-factory.c +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* component-factory.c - * - * Authors: Ettore Perazzoli <ettore@helixcode.com> - * Iain Holmes <iain@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> -#include <gnome.h> - -#include "Evolution.h" -#include "evolution-storage.h" - -#include "evolution-shell-component.h" -#include <gal/widgets/e-gui-utils.h> - -#include "component-factory.h" -#include "e-summary-factory.h" - -#define COMPONENT_FACTORY_IID "OAFIID:evolution-shell-component-factory:evolution-executive-summary:e030e71d-0c53-4118-8d48-28757f0a8504" - -static BonoboGenericFactory *factory = NULL; -static gint running_objects = 0; - -static const EvolutionShellComponentFolderType folder_types[] = { - { "executive-summary", "evolution-today.png" }, - { NULL, NULL } -}; - -char *evolution_dir; - -/* EvolutionShellComponent methods and signals */ - -static EvolutionShellComponentResult -create_view (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *folder_type, - BonoboControl **control_return, - void *closure) -{ - EvolutionShellClient *shell_client; - Evolution_Shell corba_shell; - BonoboControl *control; - - if (g_strcasecmp (folder_type, "executive-summary") != 0) - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; - - shell_client = evolution_shell_component_get_owner (shell_component); - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - - control = e_summary_factory_new_control (physical_uri, corba_shell); - if (!control) - return EVOLUTION_SHELL_COMPONENT_NOTFOUND; - - *control_return = control; - - return EVOLUTION_SHELL_COMPONENT_OK; -} - -static void -owner_set_cb (EvolutionShellComponent *shell_component, - EvolutionShellClient *shell_client, - const char *evolution_homedir, - gpointer user_data) -{ - Evolution_Shell corba_shell; - - evolution_dir = g_strdup (evolution_homedir); - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); -} - -static void -owner_unset_cb (EvolutionShellComponent *shell_component, - gpointer user_data) -{ - gtk_main_quit (); -} - -static void -factory_destroy (BonoboEmbeddable *embeddable, - gpointer dummy) -{ - running_objects--; - - if (running_objects > 0) - return; - - if (factory) - bonobo_object_unref (BONOBO_OBJECT (factory)); - else - g_warning ("Serious ref counting error"); - factory = NULL; - - gtk_main_quit (); -} - -static BonoboObject * -factory_fn (BonoboGenericFactory *factory, - void *closure) -{ - EvolutionShellComponent *shell_component; - - running_objects++; - - shell_component = evolution_shell_component_new (folder_types, - create_view, - NULL, - NULL, - NULL, - NULL); - gtk_signal_connect (GTK_OBJECT (shell_component), "destroy", - GTK_SIGNAL_FUNC (factory_destroy), NULL); - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", - GTK_SIGNAL_FUNC (owner_set_cb), NULL); - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset", - GTK_SIGNAL_FUNC (owner_unset_cb), NULL); - - return BONOBO_OBJECT (shell_component); -} - -void -component_factory_init (void) -{ - if (factory != NULL) - return; - - factory = bonobo_generic_factory_new (COMPONENT_FACTORY_IID, - factory_fn, NULL); - - if (factory == NULL) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize Evolution's Executive Summary component.")); - exit (1); - } -} diff --git a/executive-summary/component/component-factory.h b/executive-summary/component/component-factory.h deleted file mode 100644 index 65e4ad1d56..0000000000 --- a/executive-summary/component/component-factory.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* component-factory.h - * - * 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. - * - * Author: Ettore Perazzoli - */ - -#ifndef COMPONENT_FACTORY_H -#define COMPONENT_FACTORY_H - -void component_factory_init (void); - -#endif - - diff --git a/executive-summary/component/e-summary-factory.c b/executive-summary/component/e-summary-factory.c deleted file mode 100644 index c0d0dd5ed4..0000000000 --- a/executive-summary/component/e-summary-factory.c +++ /dev/null @@ -1,249 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-factory.c - * - * Authors: Ettore Perazzoli <ettore@helixcode.com> - * 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/bonobo-main.h> -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-control.h> - -#include <liboaf/liboaf.h> - -#include "gal/util/e-util.h" -#include "e-util/e-gui-utils.h" - -#include "e-summary-factory.h" - -#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> - -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), - BONOBO_UI_VERB_END -}; - -static void -set_pixmap (BonoboUIComponent *component, - const char *xml_path, - const char *icon) -{ - char *path; - GdkPixbuf *pixbuf; - - path = g_concat_dir_and_file (EVOLUTION_DATADIR "/images/evolution/buttons", icon); - - pixbuf = gdk_pixbuf_new_from_file (path); - g_return_if_fail (pixbuf != NULL); - - bonobo_ui_util_set_pixbuf (component, xml_path, pixbuf); - gdk_pixbuf_unref (pixbuf); - g_free (path); -} - -static void -update_pixmaps (BonoboUIComponent *component) -{ - set_pixmap (component, "/Toolbar/AddService", "add-service.png"); -} - -static void -control_activate (BonoboControl *control, - BonoboUIComponent *ui_component, - ESummary *esummary) -{ - Bonobo_UIContainer container; - - container = bonobo_control_get_remote_ui_handler (control); - bonobo_ui_component_set_container (ui_component, container); - bonobo_object_release_unref (container, NULL); - - bonobo_ui_component_add_verb_list_with_data (ui_component, verbs, esummary); - - bonobo_ui_component_freeze (ui_component, NULL); - - bonobo_ui_util_set_ui (ui_component, EVOLUTION_DATADIR, - "evolution-executive-summary.xml", - "evolution-executive-summary"); - - update_pixmaps (ui_component); - bonobo_ui_component_thaw (ui_component, NULL); -} - -static void -control_deactivate (BonoboControl *control, - BonoboUIComponent *ui_component, - ESummary *esummary) -{ - bonobo_ui_component_unset_container (ui_component); -} - -static void -control_activate_cb (BonoboControl *control, - gboolean activate, - gpointer user_data) -{ - BonoboUIComponent *ui_component; - - ui_component = bonobo_control_get_ui_component (control); - g_assert (ui_component != NULL); - - if (activate) - control_activate (control, ui_component, user_data); - else - control_deactivate (control, ui_component, user_data); -} - -static void -control_destroy_cb (BonoboControl *control, - gpointer user_data) -{ - GtkWidget *esummary = user_data; - - control_list = g_list_remove (control_list, control); - - gtk_object_destroy (GTK_OBJECT (esummary)); -} - -static void -update (ExecutiveSummary *summary, - const Evolution_SummaryComponent component, - const char *html, - ESummary *esummary) -{ - e_summary_update_window (esummary, summary, html); -} - -static void -set_title (ExecutiveSummary *summary, - const Evolution_SummaryComponent component, - const char *title, - void *closure) -{ - g_print ("Setting title to %s\n", title); -} - -static void -flash (ExecutiveSummary *summary, - const Evolution_SummaryComponent component, - void *closure) -{ - g_print ("FLASH!\n"); -} - -/* A ********very******** - temporary function to embed something -*/ -GtkWidget* -embed_service (GtkWidget *widget, - ESummary *esummary) -{ - ExecutiveSummaryComponentClient *client; - ExecutiveSummary *summary; - char *required_interfaces[2] = {"IDL:Evolution:SummaryComponent:1.0", - NULL}; - char *obj_id; - char *title; - char *icon; - char *html; - - obj_id = bonobo_selector_select_id ("Select a service", - (const char **) required_interfaces); - if (obj_id == NULL) - return NULL; - - client = executive_summary_component_client_new (obj_id); - - if (client == NULL) - return NULL; - - /* Set the owner */ - summary = executive_summary_new (set_title, flash, update, esummary); - executive_summary_component_client_set_owner (client, summary); - - /* 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); - - e_summary_rebuild_page (esummary); - return NULL; -} - -BonoboControl * -e_summary_factory_new_control (const char *uri, - const Evolution_Shell shell) -{ - BonoboControl *control; - GtkWidget *esummary; - - esummary = e_summary_new (shell); - if (esummary == NULL) - return NULL; - - gtk_widget_show (esummary); - - control = bonobo_control_new (esummary); - - if (control == NULL) { - gtk_object_destroy (GTK_OBJECT (esummary)); - return NULL; - } - - gtk_signal_connect (GTK_OBJECT (control), "activate", - control_activate_cb, esummary); - - gtk_signal_connect (GTK_OBJECT (control), "destroy", - control_destroy_cb, esummary); - - control_list = g_list_prepend (control_list, control); - - e_summary_rebuild_page (E_SUMMARY (esummary)); - return control; -} diff --git a/executive-summary/component/e-summary-factory.h b/executive-summary/component/e-summary-factory.h deleted file mode 100644 index e9c8660c82..0000000000 --- a/executive-summary/component/e-summary-factory.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-factory.h - * - * Authors: Iain Holmes <iain@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _E_SUMMARY_FACTORY_H__ -#define _E_SUMMARY_FACTORY_H__ - -#include <Evolution.h> - -BonoboControl *e_summary_factory_new_control (const char *uri, - const Evolution_Shell shell); - -#endif diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c deleted file mode 100644 index 1ece837ada..0000000000 --- a/executive-summary/component/e-summary.c +++ /dev/null @@ -1,557 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary.c - * - * Authors: Iain Holmes <iain@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <bonobo.h> - -#include <gtkhtml/gtkhtml.h> -#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 <libgnomevfs/gnome-vfs.h> -#include "e-summary.h" - -#define PARENT_TYPE (gtk_vbox_get_type ()) - -static GtkObjectClass *e_summary_parent_class; - -struct _ESummaryPrivate { - GtkWidget *html_scroller; - GtkWidget *html; - - GHashTable *summary_to_window; - GList *window_list; - - guint idle; - - 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; -} ESummaryWindow; - -static gboolean on_object_requested (GtkHTML *html, - GtkHTMLEmbedded *eb, - ESummary *summary); -static void e_summary_window_free (ESummaryWindow *window, - ESummaryPrivate *priv); - -/* GtkObject methods */ - -static void -s2w_foreach (gpointer *key, - gpointer *value, - ESummaryPrivate *priv) -{ - e_summary_window_free ((ESummaryWindow *) value, priv); - g_free (value); -} - -static void -e_summary_destroy (GtkObject *object) -{ - ESummary *esummary = E_SUMMARY (object); - ESummaryPrivate *priv; - - priv = esummary->private; - if (priv == NULL) - return; - - g_hash_table_foreach (priv->summary_to_window, - s2w_foreach, priv); - g_hash_table_destroy (priv->summary_to_window); - - g_free (esummary->private); - esummary->private = NULL; - - e_summary_parent_class->destroy (object); -} - -static void -e_summary_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = e_summary_destroy; - - e_summary_parent_class = gtk_type_class (PARENT_TYPE); -} - -static char * -e_pixmap_file (const char *filename) -{ - char *ret; - char *edir; - - if (g_file_exists (filename)) { - ret = g_strdup (filename); - - return ret; - } - - /* Try the evolution images dir */ - edir = g_concat_dir_and_file (EVOLUTION_DATADIR "/images/evolution", - filename); - - if (g_file_exists (edir)) { - ret = g_strdup (edir); - g_free (edir); - - return ret; - } - - /* Try the evolution button images dir */ - edir = g_concat_dir_and_file (EVOLUTION_DATADIR "/images/evolution/buttons", - filename); - - if (g_file_exists (edir)) { - ret = g_strdup (edir); - g_free (edir); - - return ret; - } - - /* Fall back to the gnome_pixmap_file */ - return gnome_pixmap_file (filename); -} - -static void -request_cb (GtkHTML *html, - const gchar *url, - GtkHTMLStream *stream) -{ - char *filename; - GnomeVFSHandle *handle = NULL; - GnomeVFSResult result; - - if (strncasecmp (url, "file:", 5) == 0) { - url += 5; - filename = e_pixmap_file (url); - } else if (strchr (url, ':') >= strchr (url, '/')) { - filename = e_pixmap_file (url); - } else - filename = g_strdup (url); - - if (filename == NULL) { - gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR); - return; - } - - result = gnome_vfs_open (&handle, filename, GNOME_VFS_OPEN_READ); - - if (result != GNOME_VFS_OK) { - g_warning ("%s: %s", filename, - gnome_vfs_result_to_string (result)); - g_free (filename); - gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR); - return; - } - - g_free (filename); - while (1) { - char buffer[4096]; - GnomeVFSFileSize size; - - /* Clear buffer */ - memset (buffer, 0x00, 4096); - - result = gnome_vfs_read (handle, buffer, 4096, &size); - if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) { - g_warning ("Error reading data: %s", - gnome_vfs_result_to_string (result)); - gnome_vfs_close (handle); - gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR); - } - - if (size == 0) - break; /* EOF */ - - gtk_html_stream_write (stream, buffer, size); - } - - gtk_html_stream_close (stream, GTK_HTML_STREAM_OK); - gnome_vfs_close (handle); -} - -static void -e_summary_start_load (ESummary *summary) -{ - ESummaryPrivate *priv; - char *header = "<html><body>"; - - priv = summary->private; - priv->stream = gtk_html_begin (GTK_HTML (priv->html)); - gtk_html_write (GTK_HTML (priv->html), priv->stream, - header, strlen (header)); -} - -static void -load_default (ESummary *summary) -{ - ESummaryPrivate *priv; - char *def = "<table width=\"100%\"><tr><td align=\"right\"><img src=\"ccsplash.png\"></td></tr></table><hr>"; - - g_return_if_fail (summary != NULL); - g_return_if_fail (IS_E_SUMMARY (summary)); - - priv = summary->private; - - g_return_if_fail (priv->stream != NULL); - - gtk_html_write (GTK_HTML (priv->html), priv->stream, def, strlen (def)); -} - -static void -e_summary_end_load (ESummary *summary) -{ - ESummaryPrivate *priv; - char *footer = "</body></html>"; - - priv = summary->private; - gtk_html_write (GTK_HTML (priv->html), priv->stream, - footer, strlen (footer)); - gtk_html_end (GTK_HTML (priv->html), priv->stream, GTK_HTML_STREAM_OK); - - priv->stream = NULL; -} - -static void -e_summary_init (ESummary *esummary) -{ - GdkColor bgcolour = {0, 0xdfff, 0xdfff, 0xffff}; - ESummaryPrivate *priv; - - esummary->private = g_new0 (ESummaryPrivate, 1); - priv = esummary->private; - - priv->window_list = NULL; - priv->idle = 0; - /* HTML widget */ - priv->html_scroller = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->html_scroller), - GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - priv->html = gtk_html_new (); - gtk_html_set_editable (GTK_HTML (priv->html), FALSE); - 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); - - e_summary_rebuild_page (esummary); - - /* Pack stuff */ - gtk_box_pack_start (GTK_BOX (esummary), priv->html_scroller, - TRUE, TRUE, 0); - - /* Init hashtable */ - priv->summary_to_window = g_hash_table_new (NULL, NULL); -} - -E_MAKE_TYPE (e_summary, "ESummary", ESummary, e_summary_class_init, - e_summary_init, PARENT_TYPE); - -GtkWidget * -e_summary_new (const Evolution_Shell shell) -{ - ESummary *esummary; - - esummary = gtk_type_new (e_summary_get_type ()); - - return GTK_WIDGET (esummary); -} - -static gboolean -on_object_requested (GtkHTML *html, - GtkHTMLEmbedded *eb, - ESummary *summary) -{ - ESummaryWindow *window; - int type; - - if (sscanf (eb->classid, "cid:%d-%p", &type, &window) != 2) { - g_warning ("Could not get the window reference\n"); - return FALSE; - } - - switch (type) { - case 1: - g_assert_not_reached (); - 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)); - break; - - default: - g_assert_not_reached (); - } - - return TRUE; -} - -static void -e_summary_display_window (ESummary *esummary, - ESummaryWindow *window, - int col) -{ - ESummaryPrivate *priv; - char *footer = "</td></tr></table>"; - char *title_cid, *body_cid; - char *colour[2] = {"e6e8e4", - "edeeeb"}; - char *title_colour[2] = {"bac1b6", - "cdd1c7"}; - - priv = esummary->private; - - /** 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); - - switch (window->type) { - case E_SUMMARY_WINDOW_HTML: - gtk_html_write (GTK_HTML (priv->html), priv->stream, - window->html, strlen (window->html)); - break; - - case E_SUMMARY_WINDOW_BONOBO: - 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; - } - - gtk_html_write (GTK_HTML (priv->html), priv->stream, - footer, strlen (footer)); -} - -int -e_summary_rebuild_page (ESummary *esummary) -{ - ESummaryPrivate *priv; - GList *windows; - char *service_table = "<table numcols=\"3\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" height=\"100%\">"; - int loc; - - g_return_val_if_fail (esummary != NULL, FALSE); - g_return_val_if_fail (IS_E_SUMMARY (esummary), FALSE); - - priv = esummary->private; - - gtk_layout_freeze (GTK_LAYOUT (priv->html)); - e_summary_start_load (esummary); - load_default (esummary); - - /* Load the start of the services */ - gtk_html_write (GTK_HTML (priv->html), priv->stream, service_table, - strlen (service_table)); - /* Load each of the services */ - loc = 0; - for (windows = priv->window_list; windows; windows = windows->next) { - ESummaryWindow *window; - char *td = "<td height=\"100%\" width=\"33%\" valign=\"top\">"; - - window = windows->data; - - if (loc % 3 == 0) { - if (loc != 0) { - gtk_html_write (GTK_HTML (priv->html), - priv->stream, "</tr>", 5); - } - gtk_html_write (GTK_HTML (priv->html), - priv->stream, "<tr height=\"100%\">", 18); - } - - gtk_html_write (GTK_HTML (priv->html), priv->stream, - td, strlen (td)); - - e_summary_display_window (esummary, window, (loc % 3)); - - gtk_html_write (GTK_HTML (priv->html), priv->stream, "</td>", 5); - loc++; - } - - gtk_html_write (GTK_HTML (priv->html), priv->stream, "</tr></table>", - 13); - e_summary_end_load (esummary); - gtk_layout_thaw (GTK_LAYOUT (priv->html)); - - priv->idle = 0; - return FALSE; -} - -void -e_summary_add_html_service (ESummary *esummary, - ExecutiveSummary *summary, - ExecutiveSummaryComponentClient *client, - const char *html, - const char *title, - const char *icon) -{ - ESummaryWindow *window; - ESummaryPrivate *priv; - - window = g_new0 (ESummaryWindow, 1); - window->type = E_SUMMARY_WINDOW_HTML; - window->html = g_strdup (html); - window->title = g_strdup (title); - window->icon = icon ? g_strdup (icon) : NULL; - window->client = client; - - window->summary = summary; - priv = esummary->private; - priv->window_list = g_list_append (priv->window_list, window); - - g_hash_table_insert (priv->summary_to_window, summary, window); -} - -void -e_summary_add_bonobo_service (ESummary *esummary, - ExecutiveSummary *summary, - ExecutiveSummaryComponentClient *client, - GtkWidget *control, - const char *title, - const char *icon) -{ - ESummaryWindow *window; - ESummaryPrivate *priv; - - window = g_new0 (ESummaryWindow, 1); - window->type = E_SUMMARY_WINDOW_BONOBO; - window->control = control; - - window->client = client; - - window->title = g_strdup (title); - window->summary = summary; - window->icon = icon ? g_strdup (icon): NULL; - - priv = esummary->private; - priv->window_list = g_list_append (priv->window_list, window); - - g_hash_table_insert (priv->summary_to_window, summary, window); -} - -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); - - priv->window_list = g_list_remove (priv->window_list, window); - - bonobo_object_unref (BONOBO_OBJECT (window->summary)); - bonobo_object_unref (BONOBO_OBJECT (window->client)); -} - -/* Call this before e_summary_window_free, execpt when you are freeing - the hash table */ -static void -e_summary_window_remove_from_ht (ESummaryWindow *window, - ESummaryPrivate *priv) -{ - g_hash_table_remove (priv->summary_to_window, window->summary); -} - -void -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; - - window = g_hash_table_lookup (priv->summary_to_window, summary); - - g_return_if_fail (window != NULL); - - g_free (window->html); - window->html = g_strdup (html); - - if (priv->idle != 0) - return; - - priv->idle = g_idle_add (e_summary_rebuild_page, esummary); -} - diff --git a/executive-summary/component/e-summary.h b/executive-summary/component/e-summary.h deleted file mode 100644 index 02deb8c7a8..0000000000 --- a/executive-summary/component/e-summary.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary.h - * - * Authors: Iain Holmes <iain@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _E_SUMMARY_H__ -#define _E_SUMMARY_H__ - -#include <gtk/gtksignal.h> -#include <gtkhtml/gtkhtml.h> -#include <gtk/gtkvbox.h> -#include <executive-summary.h> -#include <executive-summary-component-client.h> - -#include "shell/Evolution.h" - -#define E_SUMMARY_TYPE (e_summary_get_type ()) -#define E_SUMMARY(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_TYPE, ESummary)) -#define E_SUMMARY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SUMMARY_TYPE, ESummaryClass)) -#define IS_E_SUMMARY(obj) (GTK_CHECK_TYPE ((obj), E_SUMMARY_TYPE)) -#define IS_E_SUMMARY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SUMMARY_TYPE)) - -typedef struct _ESummaryPrivate ESummaryPrivate; -typedef struct _ESummary ESummary; -typedef struct _ESummaryClass ESummaryClass; - -struct _ESummary { - GtkVBox parent; - - ESummaryPrivate *private; -}; - -struct _ESummaryClass { - GtkVBoxClass parent_class; -}; - -GtkType e_summary_get_type (void); -GtkWidget *e_summary_new (const Evolution_Shell shell); -int e_summary_rebuild_page (ESummary *esummary); -void e_summary_add_html_service (ESummary *esummary, - ExecutiveSummary *summary, - ExecutiveSummaryComponentClient *client, - const char *html, - const char *title, - const char *icon); -void e_summary_add_bonobo_service (ESummary *esummary, - ExecutiveSummary *summary, - ExecutiveSummaryComponentClient *client, - GtkWidget *control, - const char *title, - const char *icon); -void e_summary_update_window (ESummary *esummary, - ExecutiveSummary *summary, - const char *html); - -#endif diff --git a/executive-summary/component/executive-summary.png b/executive-summary/component/executive-summary.png Binary files differdeleted file mode 100644 index 10a122f39e..0000000000 --- a/executive-summary/component/executive-summary.png +++ /dev/null diff --git a/executive-summary/component/main.c b/executive-summary/component/main.c deleted file mode 100644 index 70fd5e4ae5..0000000000 --- a/executive-summary/component/main.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * main.c: The core of the executive summary component. - * - * 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. - * - * Author: Iain Holmes <iain@helixcode.com> - */ - -#include <config.h> - -#include <signal.h> - -#include <gnome.h> -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-object-directory.h> -#include <liboaf/liboaf.h> - -#ifdef GTKHTML_HAVE_GCONF -#include <gconf/gconf.h> -#endif - -#include "gal/widgets/e-gui-utils.h" -#include "gal/widgets/e-cursors.h" -#include "gal/widgets/e-unicode.h" - -#include <libgnomevfs/gnome-vfs.h> -#include "component-factory.h" - -int -main (int argc, - char **argv) -{ - CORBA_ORB orb; - - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - gnome_init_with_popt_table ("evolution-executive-summary", VERSION, - argc, argv, oaf_popt_options, 0, NULL); - orb = oaf_init (argc, argv); - - gdk_rgb_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 " - "RootPOA, it probably means\nyou compiled " - "Bonobo against GOAD instead of OAF.")); - } - -#ifdef GTKHTML_HAVE_GCONF - gconf_init (argc, argv, NULL); -#endif - - e_unicode_init (); - - e_cursors_init (); - - component_factory_init (); - - signal (SIGSEGV, SIG_DFL); - signal (SIGBUS, SIG_DFL); - - gnome_vfs_init (); - bonobo_main (); - - return 0; -} |