From 4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a Mon Sep 17 00:00:00 2001 From: nobody Date: Mon, 6 Nov 2000 21:40:14 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'BONOBO_0_31'. svn path=/tags/BONOBO_0_31/; revision=6435 --- executive-summary/component/.cvsignore | 10 - executive-summary/component/Makefile.am | 62 -- executive-summary/component/component-factory.c | 157 ----- executive-summary/component/component-factory.h | 31 - executive-summary/component/e-summary-factory.c | 300 -------- executive-summary/component/e-summary-factory.h | 35 - executive-summary/component/e-summary-url.c | 567 --------------- executive-summary/component/e-summary-url.h | 37 - executive-summary/component/e-summary-util.c | 63 -- executive-summary/component/e-summary-util.h | 29 - executive-summary/component/e-summary.c | 813 ---------------------- executive-summary/component/e-summary.h | 112 --- executive-summary/component/executive-summary.png | Bin 25562 -> 0 bytes executive-summary/component/main.c | 84 --- 14 files changed, 2300 deletions(-) delete mode 100644 executive-summary/component/.cvsignore delete mode 100644 executive-summary/component/Makefile.am delete mode 100644 executive-summary/component/component-factory.c delete mode 100644 executive-summary/component/component-factory.h delete mode 100644 executive-summary/component/e-summary-factory.c delete mode 100644 executive-summary/component/e-summary-factory.h delete mode 100644 executive-summary/component/e-summary-url.c delete mode 100644 executive-summary/component/e-summary-url.h delete mode 100644 executive-summary/component/e-summary-util.c delete mode 100644 executive-summary/component/e-summary-util.h delete mode 100644 executive-summary/component/e-summary.c delete mode 100644 executive-summary/component/e-summary.h delete mode 100644 executive-summary/component/executive-summary.png delete mode 100644 executive-summary/component/main.c (limited to 'executive-summary/component') diff --git a/executive-summary/component/.cvsignore b/executive-summary/component/.cvsignore deleted file mode 100644 index 75f1a012f2..0000000000 --- a/executive-summary/component/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -core -Makefile.in -Makefile -.deps -.libs -evolution-executive-summary -Composer-common.c -Composer.h -Composer-stubs.c -Composer-skels.c \ 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 5b3f147dfd..0000000000 --- a/executive-summary/component/Makefile.am +++ /dev/null @@ -1,62 +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 \ - -I$(top_srcdir)/executive-summary \ - -I$(top_builddir)/executive-summary/evolution-services \ - -I$(top_srcdir)/executive-summary/evolution-services \ - $(EXTRA_GNOME_CFLAGS) \ - $(GNOME_VFS_CFLAGS) \ - $(UNICODE_CFLAGS) \ - $(GTKHTML_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DG_LOG_DOMAIN=\"evolution-executive-summary\" - -CLEANFILES = $(COMPOSER_GENERATED) - -COMPOSER_GENERATED = \ - Composer.h \ - Composer-common.c \ - Composer-skels.c \ - Composer-stubs.c - -Composer-impl.o: Composer.h - -$(COMPOSER_GENERATED): - $(ORBIT_IDL) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - -I$(srcdir) $(top_srcdir)/composer/Composer.idl - -evolution_executive_summary_SOURCES = \ - $(COMPOSER_GENERATED) \ - component-factory.c \ - component-factory.h \ - e-summary.c \ - e-summary.h \ - e-summary-factory.c \ - e-summary-factory.h \ - e-summary-url.c \ - e-summary-url.h \ - e-summary-util.c \ - e-summary-util.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 - * Iain Holmes - * - * 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 -#endif - -#include -#include - -#include "Evolution.h" -#include "evolution-storage.h" - -#include "evolution-shell-component.h" -#include - -#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 79105c18a0..0000000000 --- a/executive-summary/component/e-summary-factory.c +++ /dev/null @@ -1,300 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-factory.c - * - * Authors: Ettore Perazzoli - * Iain Holmes - * - * 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 -#endif - -#include -#include -#include -#include -#include - -#include - -#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 -#include -#include -#include -#include - -static GList *control_list = NULL; - -void embed_service (GtkWidget *widget, - ESummary *esummary); - -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_container (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) -{ - ESummary *summary; - BonoboUIComponent *ui_component; - Bonobo_ControlFrame control_frame; - Evolution_ShellView shell_view_interface; - CORBA_Environment ev; - - ui_component = bonobo_control_get_ui_component (control); - g_assert (ui_component != NULL); - - if (gtk_object_get_data (GTK_OBJECT (control), "shell_view_interface") == NULL) { - control_frame = bonobo_control_get_control_frame (control); - if (control_frame == NULL) { - goto out; - } - - CORBA_exception_init (&ev); - shell_view_interface = Bonobo_Unknown_queryInterface (control_frame, - "IDL:Evolution/ShellView:1.0", - &ev); - CORBA_exception_free (&ev); - - if (shell_view_interface != CORBA_OBJECT_NIL) { - gtk_object_set_data (GTK_OBJECT (control), - "shell_view_interface", - shell_view_interface); - } else { - g_warning ("Control frame doesn't have Evolution/ShellView."); - } - - summary = E_SUMMARY (user_data); - e_summary_set_shell_view_interface (summary, - shell_view_interface); - } - - out: - 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, - int id, - const char *html, - ESummary *esummary) -{ - ExecutiveSummaryComponentView *view; - - view = e_summary_view_from_id (esummary, id); - executive_summary_component_view_set_html (view, html); - e_summary_update_window (esummary, summary, html); -} - -static void -set_title (ExecutiveSummary *summary, - int id, - const char *title, - ESummary *esummary) -{ - ExecutiveSummaryComponentView *view; - - view = e_summary_view_from_id (esummary, id); - executive_summary_component_view_set_title (view, title); -} - -static void -flash (ExecutiveSummary *summary, - int id, - gpointer user_data) -{ - g_print ("FLASH!\n"); -} - -static void -view_destroyed (ExecutiveSummaryComponentView *view, - ExecutiveSummaryComponentClient *client) -{ - int id; - - g_print ("%s\n", __FUNCTION__); - id = executive_summary_component_view_get_id (view); - g_print ("%d\n", id); - executive_summary_component_client_destroy_view (client, view); -} - -/* A ********very******** - temporary function to embed something -*/ -void -embed_service (GtkWidget *widget, - ESummary *esummary) -{ - char *required_interfaces[2] = {"IDL:Evolution:SummaryComponent: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); -} - -void -e_summary_factory_embed_service_from_id (ESummary *esummary, - const char *obj_id) -{ - ExecutiveSummaryComponentClient *client; - ExecutiveSummary *summary; - ExecutiveSummaryComponentView *view; - int id; - - client = executive_summary_component_client_new (obj_id); - - g_return_if_fail (client != NULL); - - /* Set the owner */ - summary = EXECUTIVE_SUMMARY (executive_summary_new ()); - executive_summary_component_client_set_owner (client, summary); - gtk_signal_connect (GTK_OBJECT (summary), "flash", - GTK_SIGNAL_FUNC (flash), esummary); - gtk_signal_connect (GTK_OBJECT (summary), "set_title", - GTK_SIGNAL_FUNC (set_title), esummary); - gtk_signal_connect (GTK_OBJECT (summary), "update", - GTK_SIGNAL_FUNC (update), esummary); - - /* Create view */ - id = executive_summary_component_create_unique_id (); - view = executive_summary_component_client_create_view (client, id); - gtk_signal_connect (GTK_OBJECT (view), "destroy", - GTK_SIGNAL_FUNC (view_destroyed), client); - - e_summary_add_service (esummary, summary, view, obj_id); - e_summary_rebuild_page (esummary); -} - -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 175988a78c..0000000000 --- a/executive-summary/component/e-summary-factory.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-factory.h - * - * Authors: Iain Holmes - * - * 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 -#include "e-summary.h" - -BonoboControl *e_summary_factory_new_control (const char *uri, - const Evolution_Shell shell); -void e_summary_factory_embed_service_from_id (ESummary *esummary, - const char *obj_id); - -#endif diff --git a/executive-summary/component/e-summary-url.c b/executive-summary/component/e-summary-url.c deleted file mode 100644 index c07a3efc99..0000000000 --- a/executive-summary/component/e-summary-url.c +++ /dev/null @@ -1,567 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-url.c - * - * Authors: Iain Holmes - * - * 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 -#endif - -#include -#include - -#include -#include -#include - -#include - -#include -#include "e-summary.h" -#include "e-summary-url.h" -#include "e-summary-util.h" - -#include -#include "Composer.h" - -typedef enum _ESummaryProtocol { - PROTOCOL_NONE, - PROTOCOL_HTTP, - PROTOCOL_MAILTO, - PROTOCOL_VIEW, - PROTOCOL_EXEC, - PROTOCOL_FILE, - PROTOCOL_CLOSE, - PROTOCOL_LEFT, - PROTOCOL_RIGHT, - PROTOCOL_UP, - PROTOCOL_DOWN, - PROTOCOL_CONFIGURE, - PROTOCOL_OTHER -} ESummaryProtocol; - -static char *descriptions[] = { - N_("Open %s with the default GNOME application"), - N_("Open %s with the default GNOME web browser"), - N_("Send an email to %s"), - N_("Change the view to %s"), - N_("Run %s"), - N_("Open %s with the default GNOME application"), - N_("Close %s"), - N_("Move %s to the left"), - N_("Move %s to the right"), - N_("Move %s into the previous row"), - N_("Move %s into the next row"), - N_("Configure %s"), - N_("Open %s with the default GNOME application") -}; - -#define COMPOSER_IID "OAFIID:evolution-composer:evolution-mail:cd8618ea-53e1-4b9e-88cf-ec578bdb903b" - -gboolean e_summary_url_mail_compose (ESummary *esummary, - const char *url); -gboolean e_summary_url_exec (const char *exec); - -void -e_summary_url_request (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 char * -parse_uri (const char *uri, - ESummaryProtocol protocol, - ESummary *esummary) -{ - ExecutiveSummaryComponentView *view; - char *parsed; - char *p; - int id; - - switch (protocol) { - - case PROTOCOL_HTTP: - /* "http://" == 7 */ - parsed = g_strdup (uri + 7); - break; - - case PROTOCOL_EXEC: - /* "exec://" == 7 */ - parsed = g_strdup (uri + 7); - break; - - case PROTOCOL_VIEW: - /* "view://" == 7 */ - parsed = g_strdup (uri + 7); - break; - - case PROTOCOL_MAILTO: - /* Fun. Mailto's might be "mailto:" or "mailto://" */ - if (strstr (uri, "mailto://") == NULL) { - parsed = (char *) (uri + 7); - } else { - parsed = (char *) (uri + 9); - } - - /* Now strip anything after a question mark, - as it is a parameter (that we ignore for the time being) */ - if ( (p = strchr (parsed, '?')) != NULL) { - parsed = g_strndup (parsed, p - parsed); - } else { - parsed = g_strdup (parsed); - } - - break; - - case PROTOCOL_CLOSE: - id = atoi (uri + 8); - view = e_summary_view_from_id (esummary, id); - parsed = g_strdup (executive_summary_component_view_get_title (view)); - break; - - case PROTOCOL_LEFT: - id = atoi (uri + 7); - view = e_summary_view_from_id (esummary, id); - parsed = g_strdup (executive_summary_component_view_get_title (view)); - break; - - case PROTOCOL_RIGHT: - id = atoi (uri + 8); - view = e_summary_view_from_id (esummary, id); - parsed = g_strdup (executive_summary_component_view_get_title (view)); - break; - - case PROTOCOL_UP: - id = atoi (uri + 5); - view = e_summary_view_from_id (esummary, id); - parsed = g_strdup (executive_summary_component_view_get_title (view)); - break; - - case PROTOCOL_DOWN: - id = atoi (uri + 7); - view = e_summary_view_from_id (esummary, id); - parsed = g_strdup (executive_summary_component_view_get_title (view)); - break; - - case PROTOCOL_CONFIGURE: - id = atoi (uri + 12); - view = e_summary_view_from_id (esummary, id); - parsed = g_strdup (executive_summary_component_view_get_title (view)); - break; - - case PROTOCOL_NONE: - case PROTOCOL_OTHER: - default: - /* Just return the uneditted uri. */ - parsed = g_strdup (uri); - break; - } - - return parsed; -} - -static ESummaryProtocol -get_protocol (const char *url) -{ - char *lowerurl; - ESummaryProtocol protocol = PROTOCOL_OTHER; - - lowerurl = g_strdup (url); - g_strdown (lowerurl); - - /* Check for no :/ */ - if (strstr (lowerurl, "://") == NULL) { - - /* Annoying alternative for mailto URLs */ - if (strncmp (lowerurl, "mailto:", 6) != 0) { - g_free (lowerurl); - return PROTOCOL_NONE; - } else { - g_free (lowerurl); - return PROTOCOL_MAILTO; - } - } - - switch (lowerurl[0]) { - case 'c': - switch (lowerurl[1]) { - case 'l': - if (strncmp (lowerurl + 2, "ose", 3) == 0) - protocol = PROTOCOL_CLOSE; - break; - case 'o': - if (strncmp (lowerurl + 2, "nfigure", 7) == 0) - protocol = PROTOCOL_CONFIGURE; - break; - } - - case 'd': - if (strncmp (lowerurl + 1, "own", 3) == 0) - protocol = PROTOCOL_DOWN; - break; - - case 'e': - if (strncmp (lowerurl + 1, "xec", 3) == 0) - protocol = PROTOCOL_EXEC; - break; - - case 'f': - if (strncmp (lowerurl + 1, "ile", 3) == 0) - protocol = PROTOCOL_FILE; - break; - - case 'h': - if (strncmp (lowerurl + 1, "ttp", 3) == 0) - protocol = PROTOCOL_HTTP; - break; - - case 'l': - if (strncmp (lowerurl + 1, "eft", 3) == 0) - protocol = PROTOCOL_LEFT; - break; - - case 'm': - if (strncmp (lowerurl + 1, "ailto", 5) == 0) - protocol = PROTOCOL_MAILTO; - break; - - case 'r': - if (strncmp (lowerurl + 1, "ight", 4) == 0) - protocol = PROTOCOL_RIGHT; - break; - - case 'u': - if (lowerurl[1] == 'p') - protocol = PROTOCOL_UP; - break; - - case 'v': - if (strncmp (lowerurl + 1, "iew", 3) == 0) - protocol = PROTOCOL_VIEW; - break; - - default: - break; - } - - g_free (lowerurl); - - return protocol; -} - -void -e_summary_url_click (GtkWidget *widget, - const char *url, - ESummary *esummary) -{ - ESummaryProtocol protocol; - ExecutiveSummaryComponentView *view; - gpointer window; /* FIXME */ - char *parsed; - int id; - - protocol = get_protocol (url); - - parsed = parse_uri (url, protocol, esummary); - - switch (protocol) { - case PROTOCOL_MAILTO: - /* Open a composer window */ - e_summary_url_mail_compose (esummary, parsed); - break; - - case PROTOCOL_VIEW: - /* Change the EShellView's current uri */ - e_summary_change_current_view (esummary, parsed); - break; - - case PROTOCOL_EXEC: - /* Execute the rest of the url */ - e_summary_url_exec (parsed); - break; - - case PROTOCOL_CLOSE: - /* Close the window. */ - id = atoi (url + 8); - view = e_summary_view_from_id (esummary, id); - if (view == NULL) - return; - - window = e_summary_window_from_view (esummary, view); - e_summary_window_remove_from_ht (window, esummary); - e_summary_window_free (window, esummary); - e_summary_rebuild_page (esummary); - break; - - case PROTOCOL_CONFIGURE: - /* Configure the window. . . */ - id = atoi (url + 12); - view = e_summary_view_from_id (esummary, id); - if (view == NULL) - return; - - /* Issue the configure command some how :) */ - break; - - case PROTOCOL_LEFT: - /* Window left */ - id = atoi (url + 7); - view = e_summary_view_from_id (esummary, id); - - if (view == NULL) - return; - - window = e_summary_window_from_view (esummary, view); - - e_summary_window_move_left (esummary, window); - e_summary_rebuild_page (esummary); - break; - - case PROTOCOL_RIGHT: - id = atoi (url + 8); - view = e_summary_view_from_id (esummary, id); - if (view == NULL) - return; - - window = e_summary_window_from_view (esummary, view); - - e_summary_window_move_right (esummary, window); - e_summary_rebuild_page (esummary); - break; - - case PROTOCOL_UP: - id = atoi (url + 5); - view = e_summary_view_from_id (esummary, id); - if (view == NULL) - return; - - window = e_summary_window_from_view (esummary, view); - - e_summary_window_move_up (esummary, window); - e_summary_rebuild_page (esummary); - break; - - case PROTOCOL_DOWN: - id = atoi (url + 7); - view = e_summary_view_from_id (esummary, id); - if (view == NULL) - return; - - window = e_summary_window_from_view (esummary, view); - - e_summary_window_move_down (esummary, window); - e_summary_rebuild_page (esummary); - break; - - case PROTOCOL_NONE: - case PROTOCOL_OTHER: - case PROTOCOL_HTTP: - case PROTOCOL_FILE: - default: - /* Let browser handle it */ - gnome_url_show (url); - break; - - } - - g_free (parsed); -} - -gboolean -e_summary_url_mail_compose (ESummary *esummary, - const char *url) -{ - CORBA_Object composer; - CORBA_Environment ev; - Evolution_Composer_RecipientList *to, *cc, *bcc; - Evolution_Composer_Recipient *recipient; - char *address, *proto; - CORBA_char *subject; - - CORBA_exception_init (&ev); - - /* FIXME: Query for IIDs? */ - composer = oaf_activate_from_id ((char *)COMPOSER_IID, 0, NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - g_warning ("Unable to start composer component!"); - return FALSE; - } - - if ( (proto = strstr (url, "://")) != NULL){ - address = proto + 3; - } else { - if (strncmp (url, "mailto:", 7) == 0) - address = (char *) (url + 7); - else - address = (char *) url; - } - - to = Evolution_Composer_RecipientList__alloc (); - to->_length = 1; - to->_maximum = 1; - to->_buffer = CORBA_sequence_Evolution_Composer_Recipient_allocbuf (to->_maximum); - - recipient = to->_buffer; - recipient->name = CORBA_string_dup (""); - recipient->address = CORBA_string_dup (address?address:""); - - /* FIXME: Get these out of the URL */ - cc = Evolution_Composer_RecipientList__alloc (); - cc->_length = 0; - cc->_maximum = 0; - cc->_buffer = CORBA_sequence_Evolution_Composer_Recipient_allocbuf (cc->_maximum); - - bcc = Evolution_Composer_RecipientList__alloc (); - bcc->_length = 0; - bcc->_maximum = 0; - bcc->_buffer = CORBA_sequence_Evolution_Composer_Recipient_allocbuf (bcc->_maximum); - - subject = CORBA_string_dup (""); - - CORBA_exception_init (&ev); - Evolution_Composer_set_headers (composer, to, cc, bcc, subject, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - CORBA_free (to); - g_warning ("%s(%d): Error setting headers", __FUNCTION__, __LINE__); - return FALSE; - } - - CORBA_free (to); - - CORBA_exception_init (&ev); - Evolution_Composer_show (composer, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - g_warning ("%s(%d): Error showing composer", __FUNCTION__, __LINE__); - return FALSE; - } - - CORBA_exception_free (&ev); - - /* FIXME: Free the composer? */ - - return TRUE; -} - -gboolean -e_summary_url_exec (const char *exec) -{ - gchar **exec_array; - int argc; - - exec_array = g_strsplit (exec, " ", 0); - - argc = 0; - while (exec_array[argc] != NULL) { - argc++; - } - - gnome_execute_async (NULL, argc, exec_array); - - g_strfreev (exec_array); - return TRUE; -} - -static char * -e_summary_url_describe (const char *uri, - ESummary *esummary) -{ - ESummaryProtocol protocol; - char *contents, *description; - - protocol = get_protocol (uri); - contents = parse_uri (uri, protocol, esummary); - - description = g_strdup_printf (_(descriptions[protocol]), contents); - g_free (contents); - - return description; -} - -void -e_summary_url_over (GtkHTML *html, - const char *uri, - ESummary *esummary) -{ - char *description; - - if (uri != NULL) { - description = e_summary_url_describe (uri, esummary); - e_summary_set_message (esummary, description, FALSE); - g_free (description); - } else { - e_summary_unset_message (esummary); - } -} diff --git a/executive-summary/component/e-summary-url.h b/executive-summary/component/e-summary-url.h deleted file mode 100644 index 9844d384e0..0000000000 --- a/executive-summary/component/e-summary-url.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-url.h - * - * Authors: Iain Holmes - * - * 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_URL_H__ -#define _E_SUMMARY_URL_H__ - -void e_summary_url_request (GtkHTML *html, - const gchar *url, - GtkHTMLStream *stream); -void e_summary_url_click (GtkWidget *widget, - const char *url, - ESummary *esummary); -void e_summary_url_over (GtkHTML *html, - const char *uri, - ESummary *esummary); - -#endif diff --git a/executive-summary/component/e-summary-util.c b/executive-summary/component/e-summary-util.c deleted file mode 100644 index 8ed8d4daea..0000000000 --- a/executive-summary/component/e-summary-util.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-url.c - * - * Authors: Iain Holmes - * - * 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. - */ - -#include - -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); -} - diff --git a/executive-summary/component/e-summary-util.h b/executive-summary/component/e-summary-util.h deleted file mode 100644 index 0cfd50403a..0000000000 --- a/executive-summary/component/e-summary-util.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-util.h - * - * Authors: Iain Holmes - * - * 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_UTIL_H__ -#define _E_SUMMARY_UTIL_H__ - -char *e_pixmap_file (const char *filename); - -#endif diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c deleted file mode 100644 index dca8f98f0f..0000000000 --- a/executive-summary/component/e-summary.c +++ /dev/null @@ -1,813 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary.c - * - * Authors: Iain Holmes - * - * 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 -#endif - -#include -#include - -#include -#include -#include - -#include "e-summary.h" -#include "e-summary-factory.h" -#include "e-summary-util.h" -#include "e-summary-url.h" - -#define PARENT_TYPE (gtk_vbox_get_type ()) - -/* From component-factory.c */ -extern char *evolution_dir; - -static GtkObjectClass *e_summary_parent_class; - -struct _ESummaryPrivate { - Evolution_Shell shell; - Evolution_ShellView shell_view_interface; - - GtkWidget *html_scroller; - GtkWidget *html; - - GHashTable *id_to_view; - GHashTable *view_to_window; - GHashTable *summary_to_window; - GList *window_list; - - guint idle; - - GtkHTMLStream *stream; - gboolean grabbed; -}; - -static gboolean on_object_requested (GtkHTML *html, - GtkHTMLEmbedded *eb, - ESummary *summary); -static void e_summary_save_state (ESummary *esummary, - const char *path); -static void e_summary_load_state (ESummary *esummary, - const char *path); - -/* GtkObject methods */ - -static void -s2w_foreach (gpointer *key, - gpointer *value, - ESummary *esummary) -{ - e_summary_window_free ((ESummaryWindow *) value, esummary); - g_free (value); -} - -static void -e_summary_destroy (GtkObject *object) -{ - ESummary *esummary = E_SUMMARY (object); - ESummaryPrivate *priv; - char *prefix; - - priv = esummary->private; - if (priv == NULL) - return; - - prefix = g_concat_dir_and_file (evolution_dir, "config/Executive-Summary"); - e_summary_save_state (esummary, prefix); - g_free (prefix); - - g_hash_table_foreach (priv->summary_to_window, - (GHFunc) s2w_foreach, esummary); - g_hash_table_destroy (priv->summary_to_window); - g_hash_table_destroy (priv->id_to_view); - g_hash_table_destroy (priv->view_to_window); - - 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 void -e_summary_start_load (ESummary *summary) -{ - ESummaryPrivate *priv; - char *header = ""; - - priv = summary->private; - - priv->stream = gtk_html_begin (GTK_HTML (priv->html)); - - /* Hack to stop page returning to the top */ - GTK_HTML (priv->html)->engine->newPage = FALSE; - - gtk_html_write (GTK_HTML (priv->html), priv->stream, - header, strlen (header)); -} - -static void -load_default (ESummary *summary) -{ - ESummaryPrivate *priv; - char *def = "
" - "
" - "
" - "Submit a bug report" - "

"; - - 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 = "

All Executive Summary comments to Iain Holmes (iain@helixcode.com)

"; - - 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_html_set_default_background_color (GTK_HTML (priv->html), &bgcolour); - gtk_signal_connect (GTK_OBJECT (priv->html), "url-requested", - GTK_SIGNAL_FUNC (e_summary_url_request), esummary); - gtk_signal_connect (GTK_OBJECT (priv->html), "object-requested", - GTK_SIGNAL_FUNC (on_object_requested), esummary); - gtk_signal_connect (GTK_OBJECT (priv->html), "link-clicked", - GTK_SIGNAL_FUNC (e_summary_url_click), esummary); - gtk_signal_connect (GTK_OBJECT (priv->html), "on_url", - GTK_SIGNAL_FUNC (e_summary_url_over), esummary); - - 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 hashtables */ - priv->summary_to_window = g_hash_table_new (NULL, NULL); - priv->id_to_view = g_hash_table_new (NULL, NULL); - priv->view_to_window = g_hash_table_new (NULL, NULL); -} - -E_MAKE_TYPE (e_summary, "ESummary", ESummary, e_summary_class_init, - e_summary_init, PARENT_TYPE); - -GtkWidget * -e_summary_new (const Evolution_Shell shell) -{ - ESummary *esummary; - ESummaryPrivate *priv; - char *path; - - esummary = gtk_type_new (e_summary_get_type ()); - priv = esummary->private; - - priv->shell = shell; - - /* Restore services */ - path = g_concat_dir_and_file (evolution_dir, - "config/Executive-Summary"); - e_summary_load_state (esummary, path); - g_free (path); - - 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: - g_warning ("Bonobo services are not supported in this version."); - break; - - default: - g_assert_not_reached (); - } - - return TRUE; -} - -static void -e_summary_display_window (ESummary *esummary, - ESummaryWindow *window, - int row, - int col) -{ - ESummaryPrivate *priv; - char *footer = ""; - char *title_html; - char *control_html; - char *colour[2] = {"e6e8e4", - "edeeeb"}; - char *title_colour[2] = {"bac1b6", - "cdd1c7"}; - const char *title, *icon, *html; - int id; - - priv = esummary->private; - - title = executive_summary_component_view_get_title (window->view); - icon = executive_summary_component_view_get_icon (window->view); - html = executive_summary_component_view_get_html (window->view); - id = executive_summary_component_view_get_id (window->view); - - /** FIXME: Make this faster by caching it? */ - - control_html = g_strdup_printf - ("" - "" - "" - "" - "" - "
" - "
", id, id, id, id, id, id); - - title_html = g_strdup_printf ("" - "" - "
" - "" - "
" - "" - "%s%s
", - title_colour[col % 2], icon, title, - control_html, colour[col % 2]); - g_free (control_html); - - gtk_html_write (GTK_HTML (priv->html), priv->stream, title_html, - strlen (title_html)); - g_free (title_html); - - if (html != NULL && *html != '\0') { - gtk_html_write (GTK_HTML (priv->html), priv->stream, - html, strlen (html)); - } else { - g_warning ("Bonobo executive summary components are not supported at this time."); -#if 0 - body_cid = g_strdup_printf ("", window); - gtk_html_write (GTK_HTML (priv->html), priv->stream, - body_cid, strlen (body_cid)); -#endif - } - - 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 = ""; - int loc; - - g_return_val_if_fail (esummary != NULL, FALSE); - g_return_val_if_fail (IS_E_SUMMARY (esummary), FALSE); - - priv = esummary->private; - - /* If there is a selection, don't redraw the page so that the selection - isn't cleared */ - if (GTK_HTML (priv->html)->in_selection == TRUE || - GTK_HTML (priv->html)->engine->active_selection == TRUE) - return TRUE; - - 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 = "", 5); - } - gtk_html_write (GTK_HTML (priv->html), - priv->stream, "", 18); - } - - gtk_html_write (GTK_HTML (priv->html), priv->stream, - td, strlen (td)); - - e_summary_display_window (esummary, window, - (loc / 3), (loc % 3)); - - gtk_html_write (GTK_HTML (priv->html), priv->stream, "", 5); - loc++; - } - - gtk_html_write (GTK_HTML (priv->html), priv->stream, "
"; - - window = windows->data; - - if (loc % 3 == 0) { - if (loc != 0) { - gtk_html_write (GTK_HTML (priv->html), - priv->stream, "
", - 13); - e_summary_end_load (esummary); - gtk_layout_thaw (GTK_LAYOUT (priv->html)); - - priv->idle = 0; - return FALSE; -} - -void -e_summary_add_service (ESummary *esummary, - ExecutiveSummary *summary, - ExecutiveSummaryComponentView *view, - const char *iid) -{ - ESummaryWindow *window; - ESummaryPrivate *priv; - int id; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - g_return_if_fail (summary != NULL); - g_return_if_fail (IS_EXECUTIVE_SUMMARY (summary)); - g_return_if_fail (view != NULL); - g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view)); - - window = g_new0 (ESummaryWindow, 1); - window->summary = summary; - window->iid = g_strdup (iid); - window->view = view; - - priv = esummary->private; - priv->window_list = g_list_append (priv->window_list, window); - g_hash_table_insert (priv->summary_to_window, summary, window); - - id = executive_summary_component_view_get_id (view); - g_hash_table_insert (priv->id_to_view, GINT_TO_POINTER (id), view); - g_hash_table_insert (priv->view_to_window, view, window); -} - -#if 0 -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); -} -#endif - -void -e_summary_window_free (ESummaryWindow *window, - ESummary *esummary) -{ - ESummaryPrivate *priv; - - g_return_if_fail (window != NULL); - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - g_free (window->iid); - - priv->window_list = g_list_remove (priv->window_list, window); - - bonobo_object_unref (BONOBO_OBJECT (window->summary)); - gtk_object_unref (GTK_OBJECT (window->view)); -} - -/* Call this before e_summary_window_free, execpt when you are freeing - the hash table */ -void -e_summary_window_remove_from_ht (ESummaryWindow *window, - ESummary *esummary) -{ - ESummaryPrivate *priv; - - priv = esummary->private; - g_hash_table_remove (priv->summary_to_window, window->summary); -} - -void -e_summary_update_window (ESummary *esummary, - ExecutiveSummary *summary, - const char *html) -{ - ESummaryPrivate *priv; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - g_return_if_fail (summary != NULL); - - priv = esummary->private; - - if (priv->idle != 0) - return; - - priv->idle = g_idle_add ((GSourceFunc) e_summary_rebuild_page, esummary); -} - -ExecutiveSummaryComponentView * -e_summary_view_from_id (ESummary *esummary, - int id) -{ - ESummaryPrivate *priv; - ExecutiveSummaryComponentView *view; - - g_return_val_if_fail (esummary != NULL, NULL); - g_return_val_if_fail (IS_E_SUMMARY (esummary), NULL); - g_return_val_if_fail (id > 0, NULL); - - priv = esummary->private; - view = g_hash_table_lookup (priv->id_to_view, GINT_TO_POINTER (id)); - - return view; -} - -void -e_summary_set_shell_view_interface (ESummary *summary, - Evolution_ShellView svi) -{ - ESummaryPrivate *priv; - - g_return_if_fail (summary != NULL); - g_return_if_fail (IS_E_SUMMARY (summary)); - g_return_if_fail (svi != CORBA_OBJECT_NIL); - - priv = summary->private; - priv->shell_view_interface = svi; -} - -/* Wrappers for Evolution_ShellView */ -void -e_summary_set_message (ESummary *esummary, - const char *message, - gboolean busy) -{ - ESummaryPrivate *priv; - Evolution_ShellView svi; - CORBA_Environment ev; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - - svi = priv->shell_view_interface; - if (svi == NULL) - return; - - CORBA_exception_init (&ev); - if (message != NULL) - Evolution_ShellView_set_message (svi, message, busy, &ev); - else - Evolution_ShellView_set_message (svi, "", busy, &ev); - CORBA_exception_free (&ev); -} - -void -e_summary_unset_message (ESummary *esummary) -{ - ESummaryPrivate *priv; - Evolution_ShellView svi; - CORBA_Environment ev; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - - svi = priv->shell_view_interface; - if (svi == NULL) - return; - - CORBA_exception_init (&ev); - Evolution_ShellView_unset_message (svi, &ev); - CORBA_exception_free (&ev); -} - -void -e_summary_change_current_view (ESummary *esummary, - const char *uri) -{ - ESummaryPrivate *priv; - Evolution_ShellView svi; - CORBA_Environment ev; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - - svi = priv->shell_view_interface; - if (svi == NULL) - return; - - CORBA_exception_init (&ev); - Evolution_ShellView_change_current_view (svi, uri, &ev); - CORBA_exception_free (&ev); -} - -void -e_summary_set_title (ESummary *esummary, - const char *title) -{ - ESummaryPrivate *priv; - Evolution_ShellView svi; - CORBA_Environment ev; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - - svi = priv->shell_view_interface; - if (svi == NULL) - return; - - CORBA_exception_init (&ev); - Evolution_ShellView_set_title (svi, title, &ev); - CORBA_exception_free (&ev); -} - -static void -e_summary_load_state (ESummary *esummary, - const char *path) -{ - char *fullpath; - char **argv; - int argc, i; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - fullpath = g_strdup_printf ("=%s=/services/iids", path); - gnome_config_get_vector (fullpath, &argc, &argv); - - for (i = 0; i < argc; i++) { - e_summary_factory_embed_service_from_id (esummary, argv[i]); - } - - g_free (argv); - g_free (fullpath); -} - -static void -e_summary_save_state (ESummary *esummary, - const char *path) -{ - ESummaryPrivate *priv; - GList *windows; - char *fullpath; - char **argv; - int argc, i; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - fullpath = g_strdup_printf("=%s=/services/iids", path); - priv = esummary->private; - - argc = g_list_length (priv->window_list); - argv = g_new (char *, argc); - - for (windows = priv->window_list, i = 0; windows; - windows = windows->next, i++) { - ESummaryWindow *window; - - window = windows->data; - g_print ("%s: IID: %s\n", path, window->iid); - argv[i] = window->iid; - } - - gnome_config_set_vector (fullpath, argc, (const char **)argv); - - gnome_config_sync (); - gnome_config_drop_all (); - - g_free (fullpath); - g_free (argv); -} - -ESummaryWindow * -e_summary_window_from_view (ESummary *esummary, - ExecutiveSummaryComponentView *view) -{ - ESummaryPrivate *priv; - - priv = esummary->private; - return g_hash_table_lookup (priv->view_to_window, view); -} - -void -e_summary_window_move_left (ESummary *esummary, - ESummaryWindow *window) -{ - ESummaryPrivate *priv; - GList *win_item, *grandparent; - int position; - - priv = esummary->private; - - /* Need to cache this location */ - win_item = g_list_find (priv->window_list, window); - - /* Find the item 2 previous. */ - if (win_item->prev == NULL) - return; /* Item was first, can't be moved left */ - - grandparent = win_item->prev->prev; - - /* Remove it from the list */ - priv->window_list = g_list_remove_link (priv->window_list, win_item); - - /* Insert it after the grandparent */ - position = g_list_position (priv->window_list, grandparent); - priv->window_list = g_list_insert (priv->window_list, win_item->data, - position + 1); - g_list_free_1 (win_item); -} - -void -e_summary_window_move_right (ESummary *esummary, - ESummaryWindow *window) -{ - ESummaryPrivate *priv; - GList *win_item, *child; - int position; - - priv = esummary->private; - - win_item = g_list_find (priv->window_list, window); - - if (win_item->next == NULL) - return; - - child = win_item->next; - - priv->window_list = g_list_remove_link (priv->window_list, win_item); - - position = g_list_position (priv->window_list, child); - priv->window_list = g_list_insert (priv->window_list, win_item->data, - position + 1); - g_list_free_1 (win_item); -} - -void -e_summary_window_move_up (ESummary *esummary, - ESummaryWindow *window) -{ - ESummaryPrivate *priv; - GList *win_item; - int position; - - priv = esummary->private; - - win_item = g_list_find (priv->window_list, window); - - position = g_list_position (priv->window_list, win_item); - priv->window_list = g_list_remove_link (priv->window_list, win_item); - - priv->window_list = g_list_insert (priv->window_list, win_item->data, - position - 3); - g_list_free_1 (win_item); -} - -void -e_summary_window_move_down (ESummary *esummary, - ESummaryWindow *window) -{ - ESummaryPrivate *priv; - GList *win_item; - int position; - - priv = esummary->private; - - win_item = g_list_find (priv->window_list, window); - - position = g_list_position (priv->window_list, win_item); - priv->window_list = g_list_remove_link (priv->window_list, win_item); - - priv->window_list = g_list_insert (priv->window_list, win_item->data, - position + 3); -} diff --git a/executive-summary/component/e-summary.h b/executive-summary/component/e-summary.h deleted file mode 100644 index f68575d76c..0000000000 --- a/executive-summary/component/e-summary.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary.h - * - * Authors: Iain Holmes - * - * 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 -#include -#include -#include -#include -#include - -#include - -#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; -typedef struct _ESummaryWindow ESummaryWindow; - -struct _ESummaryWindow { - ExecutiveSummary *summary; - ExecutiveSummaryComponentView *view; - char *iid; -}; - -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); -void e_summary_window_free (ESummaryWindow *window, - ESummary *esummary); -void e_summary_window_remove_from_ht (ESummaryWindow *window, - ESummary *esummary); -void e_summary_add_service (ESummary *esummary, - ExecutiveSummary *summary, - ExecutiveSummaryComponentView *view, - const char *iid); -ExecutiveSummaryComponentView * e_summary_view_from_id (ESummary *esummary, - int id); -void e_summary_set_shell_view_interface (ESummary *summary, - Evolution_ShellView svi); -void e_summary_set_message (ESummary *esummary, - const char *message, - gboolean busy); -void e_summary_unset_message (ESummary *esummary); -void e_summary_change_current_view (ESummary *esummary, - const char *uri); -void e_summary_set_title (ESummary *esummary, - const char *title); -ESummaryWindow *e_summary_window_from_view (ESummary *esummary, - ExecutiveSummaryComponentView *view); -void e_summary_window_move_left (ESummary *esummary, - ESummaryWindow *window); -void e_summary_window_move_right (ESummary *esummary, - ESummaryWindow *window); -void e_summary_window_move_up (ESummary *esummary, - ESummaryWindow *window); -void e_summary_window_move_down (ESummary *esummary, - ESummaryWindow *window); - -#endif diff --git a/executive-summary/component/executive-summary.png b/executive-summary/component/executive-summary.png deleted file mode 100644 index 10a122f39e..0000000000 Binary files a/executive-summary/component/executive-summary.png and /dev/null differ diff --git a/executive-summary/component/main.c b/executive-summary/component/main.c deleted file mode 100644 index 9c331ce813..0000000000 --- a/executive-summary/component/main.c +++ /dev/null @@ -1,84 +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 - */ - -#include - -#include - -#include -#include -#include -#include - -#ifdef GTKHTML_HAVE_GCONF -#include -#endif - -#include "gal/widgets/e-gui-utils.h" -#include "gal/widgets/e-cursors.h" -#include "gal/widgets/e-unicode.h" - -#include -#include "component-factory.h" - -int -main (int argc, - char **argv) -{ - CORBA_ORB orb; - -#ifdef ENABLE_NLS - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); -#endif - - 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; -} -- cgit v1.2.3