From dcc8171fd4c8df52faff322827876acf30c35a4a Mon Sep 17 00:00:00 2001 From: nobody Date: Fri, 14 Dec 2001 04:59:04 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'EOG_0_109_1'. svn path=/tags/EOG_0_109_1/; revision=15041 --- executive-summary/component/.cvsignore | 10 - executive-summary/component/Makefile.am | 88 -- executive-summary/component/component-factory.c | 154 --- executive-summary/component/component-factory.h | 30 - executive-summary/component/e-summary-callbacks.c | 320 ----- executive-summary/component/e-summary-callbacks.h | 12 - executive-summary/component/e-summary-factory.c | 185 --- executive-summary/component/e-summary-factory.h | 34 - executive-summary/component/e-summary-prefs.c | 122 -- executive-summary/component/e-summary-prefs.h | 45 - executive-summary/component/e-summary-url.c | 851 ------------- executive-summary/component/e-summary-url.h | 36 - executive-summary/component/e-summary-util.c | 131 -- executive-summary/component/e-summary-util.h | 29 - executive-summary/component/e-summary.c | 1340 -------------------- executive-summary/component/e-summary.h | 115 -- .../component/executive-summary-config.glade | 223 ---- executive-summary/component/executive-summary.png | Bin 25562 -> 0 bytes executive-summary/component/main.c | 79 -- 19 files changed, 3804 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-callbacks.c delete mode 100644 executive-summary/component/e-summary-callbacks.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-prefs.c delete mode 100644 executive-summary/component/e-summary-prefs.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-config.glade 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 870746bf1e..0000000000 --- a/executive-summary/component/Makefile.am +++ /dev/null @@ -1,88 +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) \ - $(GTKHTML_CFLAGS) \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DG_LOG_DOMAIN=\"evolution-executive-summary\" - -COMPOSER_GENERATED = \ - Composer.h \ - Composer-common.c \ - Composer-skels.c \ - Composer-stubs.c - -Composer-impl.o: Composer.h - -selectnamesdir = $(top_srcdir)/addressbook/gui/component/select-names - -IDLS = \ - $(selectnamesdir)/Evolution-Addressbook-SelectNames.idl \ - $(top_srcdir)/composer/Evolution-Composer.idl \ - $(top_srcdir)/composer/Composer.idl - -$(COMPOSER_GENERATED): $(IDLS) - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - $(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-callbacks.c \ - e-summary-callbacks.h \ - e-summary-factory.c \ - e-summary-factory.h \ - e-summary-prefs.c \ - e-summary-prefs.h \ - e-summary-url.c \ - e-summary-url.h \ - e-summary-util.c \ - e-summary-util.h \ - main.c - -evolution_executive_summary_LDADD = \ - $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \ - $(top_builddir)/shell/libeshell.la \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(BONOBO_VFS_GNOME_LIBS) \ - $(EXTRA_GNOME_LIBS) \ - -lgal \ - $(GTKHTML_LIBS) - -gladedir = $(datadir)/evolution/glade -glade_DATA = executive-summary-config.glade - -if ENABLE_PURIFY -PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ - -all-local: evolution-executive-summary.pure - -evolution-executive-summary.pure: evolution-executive-summary - @rm -f evolution-executive-summary.pure - $(PLINK) $(evolution_executive_summary_OBJECTS) $(evolution_executive_summary_LDADD) $(LIBS) - -endif - -EXTRA_DIST = $(glade_DATA) -CLEANFILES = $(COMPOSER_GENERATED) -BUILT_SOURCES = $(COMPOSER_GENERATED) - -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) diff --git a/executive-summary/component/component-factory.c b/executive-summary/component/component-factory.c deleted file mode 100644 index ab917251d2..0000000000 --- a/executive-summary/component/component-factory.c +++ /dev/null @@ -1,154 +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 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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:GNOME_Evolution_Summary_ShellComponentFactory" - -static BonoboGenericFactory *factory = NULL; -static gint running_objects = 0; - -static const EvolutionShellComponentFolderType folder_types[] = { - { "executive-summary", "evolution-today.png", FALSE, NULL, NULL }, - { 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; - GNOME_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) -{ - GNOME_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 (BonoboObject *component, - 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, 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 fc10a08046..0000000000 --- a/executive-summary/component/component-factory.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* component-factory.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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-callbacks.c b/executive-summary/component/e-summary-callbacks.c deleted file mode 100644 index 1eff427af9..0000000000 --- a/executive-summary/component/e-summary-callbacks.c +++ /dev/null @@ -1,320 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-callbacks.c - * - * Author: - * Iain Holmes - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 /* For atoi */ - -#include -#include -#include -#include - -#include "e-summary.h" -#include "e-summary-callbacks.h" - -#include "Composer.h" - -#define COMPOSER_IID "OAFIID:GNOME_Evolution_Mail_Composer" -typedef struct _PropertyData { - ESummary *esummary; - GnomePropertyBox *box; - GladeXML *xml; -} PropertyData; - -/* HTML helper functions from mail/mail-config-gui.c */ -static void -html_size_req (GtkWidget *widget, - GtkRequisition *requisition) -{ - requisition->height = GTK_LAYOUT (widget)->height; -} - -/* Returns a GtkHTML which is already inside a GtkScrolledWindow. If - * @white is TRUE, the GtkScrolledWindow will be inside a GtkFrame. - */ -static GtkWidget * -html_new (gboolean white) -{ - GtkWidget *html, *scrolled, *frame; - GtkStyle *style; - - html = gtk_html_new (); - GTK_LAYOUT (html)->height = 0; - gtk_signal_connect (GTK_OBJECT (html), "size_request", - GTK_SIGNAL_FUNC (html_size_req), NULL); - gtk_html_set_editable (GTK_HTML (html), FALSE); - style = gtk_rc_get_style (html); - - if (style) { - gtk_html_set_default_background_color (GTK_HTML (html), - white ? &style->white: - &style->bg[0]); - } - - gtk_widget_set_sensitive (html, FALSE); - scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_NEVER, GTK_POLICY_NEVER); - gtk_container_add (GTK_CONTAINER (scrolled), html); - if (white) { - frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (frame), - GTK_SHADOW_ETCHED_IN); - gtk_container_add (GTK_CONTAINER (frame), scrolled); - gtk_widget_show_all (frame); - } else { - gtk_widget_show_all (scrolled); - } - - return html; -} - -static void -put_html (GtkHTML *html, - const char *text) -{ - GtkHTMLStream *handle; - char *htmltext; - - htmltext = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL); - handle = gtk_html_begin (html); - gtk_html_write (html, handle, "", 12); - gtk_html_write (html, handle, text, strlen (text)); - gtk_html_write (html, handle, "", 14); - g_free (htmltext); - gtk_html_end (html, handle, GTK_HTML_STREAM_OK); -} - -void -embed_service (GtkWidget *widget, - ESummary *esummary) -{ - char *required_interfaces[2] = {"IDL:GNOME/Evolution:Summary:ComponentFactory:1.0", - NULL}; - char *obj_id; - - obj_id = bonobo_selector_select_id (_("Select a service"), - (const char **) required_interfaces); - if (obj_id == NULL) - return; - - e_summary_embed_service_from_id (esummary, obj_id); -} - -void -new_mail (GtkWidget *widget, - ESummary *esummary) -{ - GNOME_Evolution_Composer_RecipientList *to, *cc, *bcc; - CORBA_char *subject; - CORBA_Object composer; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - composer = oaf_activate_from_id ((char *)COMPOSER_IID, 0, NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION || composer == NULL) { - CORBA_exception_free (&ev); - g_warning ("Unable to start composer component!"); - return; - } - CORBA_exception_free (&ev); - - to = GNOME_Evolution_Composer_RecipientList__alloc (); - to->_length = 0; - to->_maximum = 0; - to->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (0); - - cc = GNOME_Evolution_Composer_RecipientList__alloc (); - cc->_length = 0; - cc->_maximum = 0; - cc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (0); - - bcc = GNOME_Evolution_Composer_RecipientList__alloc (); - bcc->_length = 0; - bcc->_maximum = 0; - bcc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (0); - - subject = CORBA_string_dup (""); - - CORBA_exception_init (&ev); - GNOME_Evolution_Composer_setHeaders (composer, to, cc, - bcc, subject, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - CORBA_free (to); - CORBA_free (cc); - CORBA_free (bcc); - CORBA_free (subject); - - g_warning ("Error setting headers!"); - return; - } - - CORBA_free (to); - CORBA_free (cc); - CORBA_free (bcc); - CORBA_free (subject); - - GNOME_Evolution_Composer_show (composer, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - g_warning ("Error showing composer"); - return; - } - - CORBA_exception_free (&ev); - return; -} - -static void -destroy_prefs_cb (GtkObject *object, - PropertyData *data) -{ - gtk_object_unref (GTK_OBJECT(data->xml)); - g_free (data); -} - -static void -html_page_changed_cb (GtkEntry *entry, - PropertyData *data) -{ - ESummaryPrefs *prefs; - - /* Change the tmp prefs so that we can restore if the user cancels */ - prefs = data->esummary->tmp_prefs; - - if (prefs->page) - g_free (prefs->page); - - prefs->page = g_strdup (gtk_entry_get_text (entry)); - - gnome_property_box_changed (data->box); -} - -static void -column_spinner_changed_cb (GtkEntry *entry, - PropertyData *data) -{ - ESummaryPrefs *prefs; - char *value; - - prefs = data->esummary->tmp_prefs; - - gnome_property_box_changed (data->box); - value = gtk_entry_get_text (entry); - if (value == NULL || *value == '\0') - return; - - prefs->columns = atoi (value); -} - -static void -apply_prefs_cb (GnomePropertyBox *property_box, - int page, - ESummary *esummary) -{ - g_print ("Applying\n"); - - if (page != -1) - return; - - esummary->prefs = e_summary_prefs_copy (esummary->tmp_prefs); - - e_summary_reconfigure (esummary); -} - -void -configure_summary (GtkWidget *widget, - ESummary *esummary) -{ - static GtkWidget *prefs = NULL; - PropertyData *data; - GtkWidget *html_page; - GtkWidget *vbox, *html, *spinner; - char *tmp; - - if (prefs != NULL) { - g_assert (GTK_WIDGET_REALIZED (prefs)); - gdk_window_show (prefs->window); - gdk_window_raise (prefs->window); - return; - } - - data = g_new (PropertyData, 1); - data->esummary = esummary; - - if (esummary->tmp_prefs != NULL) { - e_summary_prefs_free (esummary->tmp_prefs); - } - - esummary->tmp_prefs = e_summary_prefs_copy (esummary->prefs); - - data->xml = glade_xml_new (EVOLUTION_GLADEDIR - "/executive-summary-config.glade", NULL); - prefs = glade_xml_get_widget (data->xml, "summaryprefs"); - data->box = GNOME_PROPERTY_BOX(prefs); - - vbox = glade_xml_get_widget (data->xml, "vbox"); - html = html_new (TRUE); - put_html (GTK_HTML(html), - _("You can select a different HTML page for the background " - "of the Executive Summary.\n\nJust leave it blank for the " - "default")); - gtk_box_pack_start (GTK_BOX (vbox), html->parent->parent, TRUE, TRUE, 0); - gtk_box_reorder_child (GTK_BOX (vbox), html->parent->parent, 0); - - html_page = glade_xml_get_widget (data->xml, "htmlpage"); - - if (esummary->prefs->page != NULL) - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (html_page))), esummary->prefs->page); - - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (html_page))), - "changed", GTK_SIGNAL_FUNC (html_page_changed_cb), - data); - - spinner = glade_xml_get_widget (data->xml, "columnspinner"); - - tmp = g_strdup_printf ("%d", esummary->prefs->columns); - gtk_entry_set_text (GTK_ENTRY (spinner), tmp); - g_free (tmp); - gtk_signal_connect (GTK_OBJECT (spinner), "changed", - GTK_SIGNAL_FUNC (column_spinner_changed_cb), data); - - gtk_signal_connect (GTK_OBJECT (prefs), "apply", - GTK_SIGNAL_FUNC (apply_prefs_cb), esummary); - - gtk_signal_connect (GTK_OBJECT (prefs), "destroy", - GTK_SIGNAL_FUNC (destroy_prefs_cb), data); - gtk_signal_connect (GTK_OBJECT (prefs), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroyed), &prefs); -} - diff --git a/executive-summary/component/e-summary-callbacks.h b/executive-summary/component/e-summary-callbacks.h deleted file mode 100644 index 6b908d694c..0000000000 --- a/executive-summary/component/e-summary-callbacks.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __E_SUMMARY_CALLBACKS_H__ -#define __E_SUMMARY_CALLBACKS_H__ - -#include "e-summary.h" - -void embed_service (GtkWidget *widget, - ESummary *esummary); -void new_mail (GtkWidget *widget, - ESummary *esummary); -void configure_summary (GtkWidget *widget, - ESummary *esummary); -#endif diff --git a/executive-summary/component/e-summary-factory.c b/executive-summary/component/e-summary-factory.c deleted file mode 100644 index 735074bcc3..0000000000 --- a/executive-summary/component/e-summary-factory.c +++ /dev/null @@ -1,185 +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 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 -#include "evolution-shell-component-utils.h" - -#include "e-summary-factory.h" - -#include "e-summary.h" -#include "e-summary-util.h" -#include "e-summary-callbacks.h" -#include "Evolution.h" - -#include -#include -#include - -static GList *control_list = NULL; - -BonoboUIVerb verbs[] = { - BONOBO_UI_UNSAFE_VERB ("AddService", embed_service), - BONOBO_UI_UNSAFE_VERB ("NewMail", new_mail), - BONOBO_UI_UNSAFE_VERB ("ESummarySettings", configure_summary), - BONOBO_UI_VERB_END -}; - -static EPixmap pixmaps [] = { - E_PIXMAP ("/Toolbar/AddService", "buttons/add-service.png"), - E_PIXMAP ("/Toolbar/NewMail", "buttons/compose-message.png"), - E_PIXMAP_END -}; - -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"); - - e_pixmaps_update (ui_component, pixmaps); - - bonobo_ui_component_thaw (ui_component, NULL); -} - -static void -control_deactivate (BonoboControl *control, - BonoboUIComponent *ui_component, - ESummary *esummary) -{ - e_summary_unset_message (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; - GNOME_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:GNOME/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)); -} - -BonoboControl * -e_summary_factory_new_control (const char *uri, - const GNOME_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); - - 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 d047ebd491..0000000000 --- a/executive-summary/component/e-summary-factory.h +++ /dev/null @@ -1,34 +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 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 GNOME_Evolution_Shell shell); -ESummaryWindow *e_summary_factory_embed_service_from_id (ESummary *esummary, - const char *obj_id); - -#endif diff --git a/executive-summary/component/e-summary-prefs.c b/executive-summary/component/e-summary-prefs.c deleted file mode 100644 index fdf51ead1e..0000000000 --- a/executive-summary/component/e-summary-prefs.c +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-prefs.c: Preference handling routines. - * - * Authors: Iain Holmes - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 "e-summary-prefs.h" -#include "e-summary.h" - -void -e_summary_prefs_free (ESummaryPrefs *prefs) -{ - g_return_if_fail (prefs != NULL); - - g_free (prefs->page); - g_free (prefs); -} - -ESummaryPrefs * -e_summary_prefs_new (void) -{ - ESummaryPrefs *prefs; - - prefs = g_new0 (ESummaryPrefs, 1); - return prefs; -} - -ESummaryPrefs * -e_summary_prefs_copy (ESummaryPrefs *prefs) -{ - ESummaryPrefs *copy; - - g_return_val_if_fail (prefs != NULL, NULL); - - copy = e_summary_prefs_new (); - copy->page = g_strdup (prefs->page); - copy->columns = prefs->columns; - - return copy; -} - -gboolean -e_summary_prefs_compare (ESummaryPrefs *p1, - ESummaryPrefs *p2) -{ - if (p1 == p2) - return TRUE; - - if (strcmp (p1->page, p2->page) == 0) - return TRUE; - - if (p1->columns == p2->columns) - return TRUE; - - return FALSE; -} - -ESummaryPrefs * -e_summary_prefs_load (const char *path) -{ - ESummaryPrefs *prefs; - char *item; - - g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (*path != '\0', NULL); - - prefs = e_summary_prefs_new (); - - item = g_strdup_printf ("=%s/e-summary=/executive-summary/page", path); - prefs->page = gnome_config_get_string (item); - g_free (item); - - item = g_strdup_printf ("=%s/e-summary=/executive-summary/columns=3", path); - prefs->columns = gnome_config_get_int (item); - g_free (item); - return prefs; -} - -void -e_summary_prefs_save (ESummaryPrefs *prefs, - const char *path) -{ - char *item; - - g_return_if_fail (prefs != NULL); - g_return_if_fail (path != NULL); - g_return_if_fail (*path != '\0'); - - item = g_strdup_printf ("=%s/e-summary=/executive-summary/page", path); - gnome_config_set_string (item, prefs->page); - g_free (item); - - item = g_strdup_printf ("=%s/e-summary=/executive-summary/columns", path); - gnome_config_set_int (item, prefs->columns); - g_free (item); - - gnome_config_sync (); - gnome_config_drop_all (); -} diff --git a/executive-summary/component/e-summary-prefs.h b/executive-summary/component/e-summary-prefs.h deleted file mode 100644 index e7b2b9b127..0000000000 --- a/executive-summary/component/e-summary-prefs.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-prefs.h: Preference handling routines. - * - * Authors: Iain Holmes - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __E_SUMMARY_PREFS_H__ -#define __E_SUMMARY_PREFS_H__ - -typedef struct _ESummaryPrefs ESummaryPrefs; -struct _ESummaryPrefs { - char *page; /* Background HTML page URL */ - int columns; /* Number of components per row (Default = 3) */ - - /* If anything is added here, don't forget to add - copy, compare, load and save routines to the appropriate - functions. */ -}; - -ESummaryPrefs *e_summary_prefs_new (void); -void e_summary_prefs_free (ESummaryPrefs *prefs); -ESummaryPrefs *e_summary_prefs_copy (ESummaryPrefs *prefs); -gboolean e_summary_prefs_compare (ESummaryPrefs *p1, - ESummaryPrefs *p2); -ESummaryPrefs *e_summary_prefs_load (const char *path); -void e_summary_prefs_save (ESummaryPrefs *prefs, - const char *path); - -#endif diff --git a/executive-summary/component/e-summary-url.c b/executive-summary/component/e-summary-url.c deleted file mode 100644 index ed4aa7af69..0000000000 --- a/executive-summary/component/e-summary-url.c +++ /dev/null @@ -1,851 +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 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 - -#include -#include -#include -#include - -#include - -#include -#include "e-summary.h" -#include "e-summary-url.h" -#include "e-summary-util.h" - -#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") -}; - -typedef struct _PropertyDialog { - BonoboListener *listener; - int listener_id; - - Bonobo_EventSource eventsource; - GtkWidget *dialog; -} PropertyDialog; -#define COMPOSER_IID "OAFIID:GNOME_Evolution_Mail_Composer" - -#if HAVECACHE -static ESummaryCache *image_cache = NULL; -#endif - -gboolean e_summary_url_mail_compose (ESummary *esummary, - const char *url); -gboolean e_summary_url_exec (const char *exec); - -struct _DownloadInfo { - GtkHTMLStream *stream; - char *uri; - char *buffer; - - gboolean error; -}; -typedef struct _DownloadInfo DownloadInfo; - -static void -close_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - gpointer data) -{ - DownloadInfo *info = data; - if (info->error) { - gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR); - } else { - gtk_html_stream_close (info->stream, GTK_HTML_STREAM_OK); - } - - g_free (info->uri); - g_free (info->buffer); - g_free (info); -} - -static void -read_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - gpointer buffer, - GnomeVFSFileSize bytes_requested, - GnomeVFSFileSize bytes_read, - gpointer data) -{ - DownloadInfo *info = data; - if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) { - g_warning ("Read error"); - info->error = TRUE; - gnome_vfs_async_close (handle, close_callback, info); - } - - if (bytes_read == 0) { - info->error = FALSE; - gnome_vfs_async_close (handle, close_callback, info); - } else { - gtk_html_stream_write (info->stream, buffer, bytes_read); - gnome_vfs_async_read (handle, buffer, 4095, read_callback, - info); - } -} - -static void -open_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - DownloadInfo *info) -{ - if (result != GNOME_VFS_OK) { - gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR); - g_free (info->uri); - g_free (info); - return; - } - - info->buffer = g_new (char, 4096); - gnome_vfs_async_read (handle, info->buffer, 4095, read_callback, info); -} - -void -e_summary_url_request (GtkHTML *html, - const gchar *url, - GtkHTMLStream *stream) -{ - char *filename; - GnomeVFSAsyncHandle *handle; - DownloadInfo *info; - - g_print ("url: %s\n", url); - 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; - } - - g_print ("Filename: %s\n", filename); - - info = g_new (DownloadInfo, 1); - info->stream = stream; - info->uri = filename; - info->error = FALSE; - - gnome_vfs_async_open (&handle, filename, GNOME_VFS_OPEN_READ, - (GnomeVFSAsyncOpenCallback) open_callback, info); -} - -static char * -parse_uri (const char *uri, - ESummaryProtocol protocol, - ESummary *esummary) -{ - char *parsed; - char *p; - int address; - ESummaryWindow *window; - - 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: - address = atoi (uri + 8); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - parsed = g_strdup (window->title); - break; - - case PROTOCOL_LEFT: - address = atoi (uri + 7); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - parsed = g_strdup (window->title); - break; - - case PROTOCOL_RIGHT: - address = atoi (uri + 8); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - parsed = g_strdup (window->title); - break; - - case PROTOCOL_UP: - address = atoi (uri + 5); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - parsed = g_strdup (window->title); - break; - - case PROTOCOL_DOWN: - address = atoi (uri + 7); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - parsed = g_strdup (window->title); - break; - - case PROTOCOL_CONFIGURE: - address = atoi (uri + 12); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - parsed = g_strdup (window->title); - 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; -} - -static void -property_apply (GnomePropertyBox *propertybox, - gint page_num, - Bonobo_PropertyControl control) -{ - CORBA_Environment ev; - - g_print ("page_num: %d\n", page_num); - - CORBA_exception_init (&ev); - Bonobo_PropertyControl_notifyAction (control, page_num, Bonobo_PropertyControl_APPLY, &ev); - CORBA_exception_free (&ev); -} - -static void -property_help (GnomePropertyBox *propertybox, - gint page_num, - Bonobo_PropertyControl control) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - Bonobo_PropertyControl_notifyAction (control, page_num, Bonobo_PropertyControl_HELP, &ev); - CORBA_exception_free (&ev); -} - -static void -property_event (BonoboListener *listener, - char *event_name, - CORBA_any *any, - CORBA_Environment *ev, - gpointer user_data) -{ - PropertyDialog *data = (PropertyDialog *) user_data; - if (strcmp (event_name, BONOBO_PROPERTY_CONTROL_CHANGED) == 0) { - gnome_property_box_changed (GNOME_PROPERTY_BOX (data->dialog)); - return; - } -} - -static void -dialog_destroyed (GtkObject *object, - PropertyDialog *dialog) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - Bonobo_EventSource_removeListener (dialog->eventsource, - dialog->listener_id, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Error: %s", CORBA_exception_id (&ev)); - } - - bonobo_object_unref (BONOBO_OBJECT (dialog->listener)); - CORBA_exception_free (&ev); - g_free (dialog); -} - -struct _idle_data { - ESummary *esummary; - ESummaryWindow *window; -}; - -static gboolean -idle_remove_window (gpointer data) -{ - struct _idle_data *id = data; - - e_summary_remove_window (id->esummary, id->window); - e_summary_queue_rebuild (id->esummary); - g_free (id); - - return FALSE; -} - -void -e_summary_url_click (GtkWidget *widget, - const char *url, - ESummary *esummary) -{ - ESummaryProtocol protocol; - char *parsed; - int address; - ESummaryWindow *window; - struct _idle_data *id; - Bonobo_Control control; - Bonobo_Listener corba_listener; - GtkWidget *prefsbox, *control_widget; - CORBA_Environment ev; - PropertyDialog *data; - int num_pages, i; - - 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. */ - address = atoi (url + 8); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - if (window->iid == NULL) - break; - - id = g_new (struct _idle_data, 1); - id->window = window; - id->esummary = esummary; - - /* Close the window on an idle to work around a bug in - gnome-vfs which locks the e_summary_remove_window function - and as gtkhtml has a pointer grab on, this locks the whole - display. GAH! */ - g_idle_add (idle_remove_window, id); - break; - - case PROTOCOL_CONFIGURE: - /* Configure the window. . . */ - address = atoi (url + 12); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - if (window->iid == NULL) - break; - - data = g_new (PropertyDialog, 1); - /* Create the property box */ - prefsbox = gnome_property_box_new (); - data->dialog = prefsbox; - - CORBA_exception_init (&ev); - data->eventsource = window->event_source; - data->listener = bonobo_listener_new (property_event, data); - corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (data->listener)); - data->listener_id = Bonobo_EventSource_addListener (data->eventsource, - corba_listener, &ev); - - gtk_signal_connect (GTK_OBJECT (prefsbox), "apply", - GTK_SIGNAL_FUNC (property_apply), - window->propertycontrol); - gtk_signal_connect (GTK_OBJECT (prefsbox), "help", - GTK_SIGNAL_FUNC (property_help), - window->propertycontrol); - gtk_signal_connect (GTK_OBJECT (prefsbox), "destroy", - GTK_SIGNAL_FUNC (dialog_destroyed), data); - - num_pages = Bonobo_PropertyControl__get_pageCount (window->propertycontrol, &ev); - for (i = 0; i < num_pages; i++) { - control = Bonobo_PropertyControl_getControl (window->propertycontrol, i, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Unable to get property control."); - CORBA_exception_free (&ev); - break; - } - control_widget = bonobo_widget_new_control_from_objref (control, - CORBA_OBJECT_NIL); - gnome_property_box_append_page (GNOME_PROPERTY_BOX (prefsbox), - control_widget, - gtk_label_new (_("page"))); - } - - gtk_widget_show_all (prefsbox); - - break; - - case PROTOCOL_LEFT: - /* Window left */ - address = atoi (url + 7); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - if (window->iid == NULL) - break; - - e_summary_window_move_left (esummary, window); - e_summary_queue_rebuild (esummary); - break; - - case PROTOCOL_RIGHT: - address = atoi (url + 8); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - if (window->iid == NULL) - break; - - e_summary_window_move_right (esummary, window); - e_summary_queue_rebuild (esummary); - break; - - case PROTOCOL_UP: - address = atoi (url + 5); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - if (window->iid == NULL) - break; - - e_summary_window_move_up (esummary, window); - e_summary_queue_rebuild (esummary); - break; - - case PROTOCOL_DOWN: - address = atoi (url + 7); - window = (ESummaryWindow *) GINT_TO_POINTER (address); - if (window->iid == NULL) - break; - - e_summary_window_move_down (esummary, window); - e_summary_queue_rebuild (esummary); - break; - - case PROTOCOL_OTHER: - case PROTOCOL_NONE: - case PROTOCOL_HTTP: - case PROTOCOL_FILE: - default: - /* Let browser handle it */ - gnome_url_show (url); - break; - - } - - g_free (parsed); -} - -static void -parse_mail_url (char *url, - GList **cc, - GList **bcc, - char **subject) -{ - char **options; - int i = 0; - - options = g_strsplit (url, "&", 0); - while (options[i] != NULL) { - char **params; - - params = g_strsplit (options[i], "=", 2); - if (strcmp (params[0], "subject") == 0) { - *subject = g_strdup (params[1]); - } else if (strcmp (params[0], "cc") == 0) { - *cc = g_list_prepend (*cc, g_strdup (params[1])); - } else if (strcmp (params[1], "bcc") == 0) { - *bcc = g_list_prepend (*bcc, g_strdup (params[1])); - } - - g_strfreev (params); - i++; - } - - g_strfreev (options); - /* Reverse the list so it's in the correct order */ - *cc = g_list_reverse (*cc); - *bcc = g_list_reverse (*bcc); -} - -static void -recipients_from_list (GNOME_Evolution_Composer_RecipientList *recipients, - GList *list) -{ - GList *t; - int i; - - for (i = 0, t = list; t; i++, t = t->next) { - GNOME_Evolution_Composer_Recipient *recipient; - char *address = (char *)t->data; - - recipient = recipients->_buffer + i; - recipient->name = CORBA_string_dup (""); - recipient->address = CORBA_string_dup (address ? address : ""); - } -} - -static void -free_list (GList *list) -{ - for (; list; list = list->next) { - g_free (list->data); - } -} - -gboolean -e_summary_url_mail_compose (ESummary *esummary, - const char *url) -{ - CORBA_Object composer; - CORBA_Environment ev; - char *full_address, *address, *proto, *q; - GNOME_Evolution_Composer_RecipientList *to, *cc, *bcc; - GNOME_Evolution_Composer_Recipient *recipient; - CORBA_char *subject; - GList *gcc = NULL, *gbcc = NULL; - char *gsubject = NULL; - - 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){ - full_address = proto + 3; - } else { - if (strncmp (url, "mailto:", 7) == 0) - full_address = (char *) (url + 7); - else - full_address = (char *) url; - } - - q = strchr (full_address, '?'); - if (q != NULL) { - address = g_strndup (full_address, q - full_address); - parse_mail_url (q + 1, &gcc, &gbcc, &gsubject); - } else { - address = g_strdup (full_address); - } - - to = GNOME_Evolution_Composer_RecipientList__alloc (); - to->_length = 1; - to->_maximum = 1; - to->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (to->_maximum); - - recipient = to->_buffer; - recipient->name = CORBA_string_dup (""); - recipient->address = CORBA_string_dup (address?address:""); - g_free (address); - - /* FIXME: Get these out of the URL */ - cc = GNOME_Evolution_Composer_RecipientList__alloc (); - cc->_length = g_list_length (gcc); - cc->_maximum = cc->_length; - cc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (cc->_maximum); - - recipients_from_list (cc, gcc); - free_list (gcc); - g_list_free (gcc); - - bcc = GNOME_Evolution_Composer_RecipientList__alloc (); - bcc->_length = g_list_length (gbcc); - bcc->_maximum = bcc->_length; - bcc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (bcc->_maximum); - - recipients_from_list (bcc, gbcc); - free_list (gbcc); - g_list_free (gbcc); - - subject = CORBA_string_dup (gsubject ? gsubject : ""); - g_free (gsubject); - - CORBA_exception_init (&ev); - GNOME_Evolution_Composer_setHeaders (composer, to, cc, bcc, subject, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - CORBA_free (to); - CORBA_free (cc); - CORBA_free (bcc); - CORBA_free (subject); - - g_warning ("%s(%d): Error setting headers", __FUNCTION__, __LINE__); - return FALSE; - } - - CORBA_free (to); - CORBA_free (cc); - CORBA_free (bcc); - CORBA_free (subject); - - CORBA_exception_init (&ev); - GNOME_Evolution_Composer_show (composer, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - 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, *tmp; - - protocol = get_protocol (uri); - contents = parse_uri (uri, protocol, esummary); - tmp = e_utf8_to_locale_string (contents); - - description = g_strdup_printf (_(descriptions[protocol]), tmp); - g_free (tmp); - 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); - } -} - -/* Cache stuff */ -#if HAVECACHE -void -e_summary_url_init_cache (void) -{ - if (image_cache != NULL) - return; - - image_cache = e_summary_cache_new (); -} - -void -e_summary_url_cache_destroy (void) -{ - if (image_cache == NULL) - return; - - gtk_object_unref (GTK_OBJECT (image_cache)); - - image_cache = NULL; -} -#endif diff --git a/executive-summary/component/e-summary-url.h b/executive-summary/component/e-summary-url.h deleted file mode 100644 index 03db66353b..0000000000 --- a/executive-summary/component/e-summary-url.h +++ /dev/null @@ -1,36 +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 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 4f7b5f5d6d..0000000000 --- a/executive-summary/component/e-summary-util.c +++ /dev/null @@ -1,131 +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 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 - -#include -#include -#include -#include -#include - -#include -#include -#include - -/** - * e_pixmap_file: - * @filename: Filename of pixmap. - * - * Finds @filename in the Evolution or GNOME installation dir. - * - * Returns: A newly allocated absolute path to @filename, or NULL - * if it cannot be found. - */ -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; - } - g_free (edir); - - /* 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; - } - g_free (edir); - - /* Fall back to the gnome_pixmap_file */ - return gnome_pixmap_file (filename); -} - -/** - * e_summary_rm_dir: - * @path: Full path to the directory or file to be removed. - * - * Deletes everything in fullpath. - */ -void -e_summary_rm_dir (const char *path) -{ - DIR *base; - struct stat statbuf; - struct dirent *contents; - - stat (path, &statbuf); - if (!S_ISDIR (statbuf.st_mode)) { - /* Not a directory */ - g_warning ("Removing: %s", path); - unlink (path); - return; - } else { - g_warning ("Opening: %s", path); - base = opendir (path); - - if (base == NULL) - return; - - contents = readdir (base); - while (contents != NULL) { - char *fullpath; - - if (strcmp (contents->d_name, ".") == 0|| - strcmp (contents->d_name, "..") ==0) { - contents = readdir (base); - continue; - } - - fullpath = g_concat_dir_and_file (path, contents->d_name); - e_summary_rm_dir (fullpath); - g_free (fullpath); - - contents = readdir (base); - } - - closedir (base); - rmdir (path); - } -} - diff --git a/executive-summary/component/e-summary-util.h b/executive-summary/component/e-summary-util.h deleted file mode 100644 index 185bafcf1f..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 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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); -void e_summary_rm_dir (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 7a33ba14ef..0000000000 --- a/executive-summary/component/e-summary.c +++ /dev/null @@ -1,1340 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary.c - * - * Authors: Iain Holmes - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "e-summary.h" -#include "e-summary-factory.h" -#include "e-summary-util.h" -#include "e-summary-url.h" - -#include -#include -#include - -#define PARENT_TYPE (gtk_vbox_get_type ()) - -#define STORAGE_TYPE "fs" -#define IID_FILE "oaf.id" -#define DATA_FILE "data" - -/* From component-factory.c */ -extern char *evolution_dir; - -static GtkObjectClass *e_summary_parent_class; - -struct _ESummaryPrivate { - GNOME_Evolution_Shell shell; - GNOME_Evolution_ShellView shell_view_interface; - - GtkWidget *html_scroller; - GtkWidget *html; - - guint idle; - - GtkHTMLStream *stream; - gboolean grabbed; - - GList *window_list; - - char *header; - int header_len; - char *footer; - int footer_len; -}; - -static gboolean on_object_requested (GtkHTML *html, - 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 -e_summary_destroy (GtkObject *object) -{ - ESummary *esummary = E_SUMMARY (object); - ESummaryPrivate *priv; - GList *l; - char *prefix; - - priv = esummary->private; - if (priv == NULL) - return; - - prefix = g_concat_dir_and_file (evolution_dir, "config/"); - e_summary_save_state (esummary, prefix); - g_free (prefix); - - e_summary_prefs_free (esummary->prefs); - for (l = priv->window_list; l; l = l->next) - e_summary_window_free (l->data); - g_list_free (priv->window_list); - - g_free (priv->header); - g_free (priv->footer); - g_free (esummary->private); - esummary->private = NULL; - - 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 *esummary) -{ - ESummaryPrivate *priv; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - - priv->stream = gtk_html_begin (GTK_HTML (priv->html)); - - /* HTML hacks */ - /* Hack to stop page returning to the top */ - GTK_HTML (priv->html)->engine->newPage = FALSE; - /* Hack to make the border width of the page 0 */ - GTK_HTML (priv->html)->engine->leftBorder = 0; - GTK_HTML (priv->html)->engine->rightBorder = 0; - GTK_HTML (priv->html)->engine->topBorder = 0; - GTK_HTML (priv->html)->engine->bottomBorder = 0; -} - -static void -load_default_header (ESummary *esummary) -{ - ESummaryPrivate *priv; - char *def = "" - "
" - "
" - "
" - "Submit a bug report" - "

"; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - - g_return_if_fail (priv->stream != NULL); - - gtk_html_write (GTK_HTML (priv->html), priv->stream, def, strlen (def)); -} -static void -load_default_footer (ESummary *esummary) -{ - ESummaryPrivate *priv; - char *footer = "

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

"; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - gtk_html_write (GTK_HTML (priv->html), priv->stream, - footer, strlen (footer)); -} - -static void -e_summary_end_load (ESummary *esummary) -{ - ESummaryPrivate *priv; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - gtk_html_end (GTK_HTML (priv->html), priv->stream, GTK_HTML_STREAM_OK); - - priv->stream = NULL; -} - -static void -e_summary_init (ESummary *esummary) -{ - GdkColor bgcolour = {0, 0xdfff, 0xdfff, 0xffff}; - ESummaryPrivate *priv; - - esummary->prefs = NULL; - esummary->tmp_prefs = NULL; - esummary->private = g_new0 (ESummaryPrivate, 1); - priv = esummary->private; - - 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_content_type (GTK_HTML (priv->html), - "text/html; charset=utf-8"); - 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_queue_rebuild (esummary); - - /* Pack stuff */ - gtk_box_pack_start (GTK_BOX (esummary), priv->html_scroller, - TRUE, TRUE, 0); -} - -E_MAKE_TYPE (e_summary, "ESummary", ESummary, e_summary_class_init, - e_summary_init, PARENT_TYPE); - -GtkWidget * -e_summary_new (const GNOME_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"); - e_summary_load_state (esummary, path); - g_free (path); - - return GTK_WIDGET (esummary); -} - -#if 0 -static void -control_unrealize (GtkHTMLEmbedded *eb, - GtkWidget *widget) -{ - g_print ("Removing\n"); -} - -static void -being_unrealized (GtkWidget *widget, - GtkHTMLEmbedded *eb) -{ - g_warning ("Widget is being unrealized"); - gtk_container_remove (GTK_CONTAINER (eb), widget); -} - -static void -being_realized (GtkWidget *widget, - gpointer user_data) -{ - gdk_window_ref (widget->window); -} -#endif - -static gboolean -on_object_requested (GtkHTML *html, - GtkHTMLEmbedded *eb, - ESummary *esummary) -{ -#if 0 - static GtkWidget *widget = NULL; - int id; - - if (sscanf (eb->classid, "cid:%d", &id) != 1) { - g_warning ("Could not get the view id: eb->classid = %s", - eb->classid); - return FALSE; - } - - if (widget == NULL || !GTK_IS_WIDGET (widget)) { - g_print ("Create new\n"); - widget = executive_summary_component_view_get_widget (view); -/* widget = gtk_button_new_with_label ("Hello?"); */ - gtk_signal_connect (GTK_OBJECT (widget), "realize", - GTK_SIGNAL_FUNC (being_realized), NULL); - gtk_signal_connect (GTK_OBJECT (widget), "unrealize", - GTK_SIGNAL_FUNC (being_unrealized), eb); - g_print ("New widget: %p\n", GTK_BIN (widget)->child); - } else { - g_print ("No new\n"); - } - - if (widget == NULL) { - g_warning ("View %d has no GtkWidget.", id); - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (eb), "unrealize", - GTK_SIGNAL_FUNC (control_unrealize), widget); - gtk_widget_show_all (widget); - gtk_widget_ref (widget); - - if (widget->parent == NULL) - gtk_container_add (GTK_CONTAINER (eb), widget); - -#endif - return TRUE; -} - -/* Generates the window controls and works out - if they should be disabled or not */ -static char * -make_control_html (ESummaryWindow *window, - int row, - int col, - int numwindows) -{ - char *html, *tmp; - int id = GPOINTER_TO_INT (window); - gboolean config; - - config = TRUE; - - if (window->propertycontrol == CORBA_OBJECT_NIL) - config = FALSE; - - html = g_strdup_printf ("
" - "" - "
", id); - - tmp = html; - if (!config) { - html = g_strdup_printf ("%s" - "
", tmp); - } else { - html = g_strdup_printf ("%s" - "" - "", tmp, id); - } - g_free (tmp); - - return html; -} - -static void -e_summary_display_window_title (ESummary *esummary, - ESummaryWindow *window, - int row, - int col, - int numwindows) -{ - ESummaryPrivate *priv; - char *title_html; - char *control_html; - char *title_colour[2] = {"bac1b6", - "cdd1c7"}; - - priv = esummary->private; - - control_html = make_control_html (window, row, col, numwindows); - title_html = g_strdup_printf ("" - "" - "
" - "" - "%s%s
", - title_colour[col % 2], window->icon, - window->title, control_html); - g_free (control_html); - - gtk_html_write (GTK_HTML (priv->html), priv->stream, title_html, - strlen (title_html)); - g_free (title_html); -} - -static void -e_summary_display_window (ESummary *esummary, - ESummaryWindow *window, - int row, - int col, - int numwindows) -{ - ESummaryPrivate *priv; - char *footer = ""; - char *header; - char *colour[2] = {"e6e8e4", - "edeeeb"}; - - priv = esummary->private; - - header = g_strdup_printf ("", colour[col % 2]); - gtk_html_write (GTK_HTML (priv->html), priv->stream, header, strlen (header)); - g_free (header); - - if (window->html != CORBA_OBJECT_NIL) { - char *html = NULL; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - html = GNOME_Evolution_Summary_HTMLView_getHtml (window->html, - &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - g_warning ("Cannot get HTML."); - if (html) - CORBA_free (html); - } else { - CORBA_exception_free (&ev); - - gtk_html_write (GTK_HTML (priv->html), priv->stream, - html, strlen (html)); - CORBA_free (html); - } - } else { -#if 0 - char *body_cid; - - body_cid = g_strdup_printf ("", id); - gtk_html_write (GTK_HTML (priv->html), priv->stream, - body_cid, strlen (body_cid)); - g_free (body_cid); -#endif - } - - gtk_html_write (GTK_HTML (priv->html), priv->stream, - footer, strlen (footer)); -} - -static int -e_summary_rebuild_page (ESummary *esummary) -{ - ESummaryPrivate *priv; - GList *windows; - char *service_table = ""; - char *tmp; - int numwindows, numrows; - int i, j, k; - int columns; - - g_return_val_if_fail (esummary != NULL, FALSE); - g_return_val_if_fail (IS_E_SUMMARY (esummary), FALSE); - - priv = esummary->private; - - if (priv->idle == 0) { - g_warning ("esummary->private->idle == 0! This means that " - "e_summary_rebuild_page was called by itself and " - "not queued. You should use e_summary_queue_rebuild " - "instead."); - return FALSE; - } - - /* 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 || - html_engine_is_selection_active (GTK_HTML (priv->html)->engine) == TRUE) - return FALSE; - - gtk_layout_freeze (GTK_LAYOUT (priv->html)); - e_summary_start_load (esummary); - - if (priv->header == NULL || *priv->header == '\0') { - load_default_header (esummary); - } else { - gtk_html_write (GTK_HTML (priv->html), priv->stream, - priv->header, priv->header_len); - } - - /* Load the start of the services */ - tmp = g_strdup_printf (service_table, esummary->prefs->columns); - gtk_html_write (GTK_HTML (priv->html), priv->stream, tmp, strlen (tmp)); - g_free (tmp); - /* Load each of the services */ - numwindows = g_list_length (priv->window_list); - - columns = esummary->prefs->columns; - - windows = priv->window_list; - if (numwindows % columns == 0) - numrows = numwindows / columns; - else - numrows = numwindows / columns + 1; - - for (i = 0; i < numrows; i++) { - GList *window = windows; - - /* Do the same row twice: - Once for the title, once for the contents */ - for (j = 0; j < 2; j++) { - int limit; - - gtk_html_write (GTK_HTML (priv->html), priv->stream, - "", 4); - /* For each window on row i */ - limit = MIN (columns, (numwindows - (i * columns))); - for (k = 0; k < limit; k++) { - - if (window == NULL) - break; - - if (j == 0) { - e_summary_display_window_title (esummary, - window->data, - k, k, - numwindows); - } else { - e_summary_display_window (esummary, - window->data, - k, k, - numwindows); - } - - if (window != NULL) - window = window->next; - - if (window == NULL) - break; - } - - gtk_html_write (GTK_HTML (priv->html), priv->stream, - "", 5); - if (j == 0) - window = windows; - else { - if (window) - windows = window; - else - break; - } - } - } - gtk_html_write (GTK_HTML (priv->html), priv->stream, "
", 13); - - if (priv->footer == NULL || *priv->footer == '\0') { - load_default_footer (esummary); - } else { - gtk_html_write (GTK_HTML (priv->html), priv->stream, - priv->footer, priv->footer_len); - } - - e_summary_end_load (esummary); - gtk_layout_thaw (GTK_LAYOUT (priv->html)); - - priv->idle = 0; - return FALSE; -} - -/* This is the function that should be called instead of - e_summary_queue_rebuild. This prevents multiple - rebuilds happening together. */ -void -e_summary_queue_rebuild (ESummary *esummary) -{ - ESummaryPrivate *priv; - - priv = esummary->private; - if (priv->idle != 0) - return; - - priv->idle = g_idle_add ((GSourceFunc) e_summary_rebuild_page, esummary); -} - -static void -listener_event (BonoboListener *listener, - char *event_name, - BonoboArg *event_data, - CORBA_Environment *ev, - gpointer user_data) -{ - ESummaryWindow *window = (ESummaryWindow *) user_data; - - if (strcmp (event_name, "Bonobo/Property:change:window_title") == 0) { - if (window->title != NULL) - g_free (window->title); - - window->title = g_strdup (BONOBO_ARG_GET_STRING (event_data)); - e_summary_queue_rebuild (window->esummary); - } else if (strcmp (event_name, "Bonobo/Property:change:window_icon") == 0) { - if (window->icon != NULL) - g_free (window->icon); - - window->icon = g_strdup (BONOBO_ARG_GET_STRING (event_data)); - e_summary_queue_rebuild (window->esummary); - } else if (strcmp (event_name, EXECUTIVE_SUMMARY_HTML_VIEW_HTML_CHANGED) == 0) { - e_summary_queue_rebuild (window->esummary); - } - - return; -} - -ESummaryWindow * -e_summary_add_service (ESummary *esummary, - GNOME_Evolution_Summary_Component component, - const char *iid) -{ - ESummaryWindow *window; - ESummaryPrivate *priv; - Bonobo_Unknown unknown = CORBA_OBJECT_NIL; - Bonobo_Listener listener; - CORBA_Environment ev; - - g_return_val_if_fail (esummary != NULL, NULL); - g_return_val_if_fail (IS_E_SUMMARY (esummary), NULL); - g_return_val_if_fail (component != CORBA_OBJECT_NIL, NULL); - - priv = esummary->private; - - window = g_new0 (ESummaryWindow, 1); - window->component = component; - window->iid = g_strdup (iid); - window->esummary = esummary; - - /* See what interfaces our component supports */ - CORBA_exception_init (&ev); - unknown = Bonobo_Unknown_queryInterface (component, - "IDL:Bonobo/Control:1.0", &ev); - window->control = (Bonobo_Control) unknown; - - unknown = Bonobo_Unknown_queryInterface (component, - "IDL:GNOME/Evolution/Summary/HTMLView:1.0", - &ev); - window->html = (GNOME_Evolution_Summary_HTMLView) unknown; - - /* Check at least one of the above interfaces was supported */ - if (window->html == CORBA_OBJECT_NIL && - window->control == CORBA_OBJECT_NIL) { - CORBA_Environment ev2; - g_warning ("This component does not support either" - "Bonobo/Control:1.0 or GNOME/Evolution/Summary/HTMLView:1.0"); - - CORBA_exception_init (&ev2); - CORBA_Object_release (component, &ev2); - CORBA_exception_free (&ev2); - - g_free (window); - return NULL; - } - - unknown = Bonobo_Unknown_queryInterface (component, - "IDL:Bonobo/PropertyBag:1.0", - &ev); - window->propertybag = (Bonobo_PropertyBag) unknown; - - window->event_source = Bonobo_Unknown_queryInterface(window->propertybag, - "IDL:Bonobo/EventSource:1.0", &ev); - if (window->event_source == CORBA_OBJECT_NIL) { - g_warning ("There is no Bonobo::EventSource interface"); - - /* FIXME: Free whatever objects exist */ - g_free (window); - return NULL; - } - - window->listener = bonobo_listener_new (NULL, NULL); - gtk_signal_connect (GTK_OBJECT (window->listener), "event_notify", - GTK_SIGNAL_FUNC (listener_event), window); - listener = bonobo_object_corba_objref (BONOBO_OBJECT (window->listener)); - window->listener_id = Bonobo_EventSource_addListener (window->event_source, listener, &ev); - - unknown = Bonobo_Unknown_queryInterface (component, - "IDL:Bonobo/PersistStream:1.0", - &ev); - window->persiststream = (Bonobo_PersistStream) unknown; - - unknown = Bonobo_Unknown_queryInterface (component, - "IDL:Bonobo/PropertyControl:1.0", - &ev); - window->propertycontrol = (Bonobo_PropertyControl) unknown; - - /* Cache the title and icon */ - window->title = bonobo_property_bag_client_get_value_string (window->propertybag, - "window_title", - NULL); - g_print ("title: %s\n", window->title); - window->icon = bonobo_property_bag_client_get_value_string (window->propertybag, - "window_icon", NULL); - g_print ("icon: %s\n", window->icon); - - CORBA_exception_free (&ev); - priv->window_list = g_list_append (priv->window_list, window); - - return window; -} - - -ESummaryWindow * -e_summary_embed_service_from_id (ESummary *esummary, - const char *obj_id) -{ - GNOME_Evolution_Summary_Component component; - ExecutiveSummaryComponentFactoryClient *client; - ESummaryWindow *window; - - client = executive_summary_component_factory_client_new (obj_id); - - component = executive_summary_component_factory_client_create_view (client); - - /* Don't need the client any more */ - bonobo_object_unref (BONOBO_OBJECT (client)); - - window = e_summary_add_service (esummary, component, obj_id); - e_summary_queue_rebuild (esummary); - - return window; -} - -void -e_summary_window_free (ESummaryWindow *window) -{ - CORBA_Environment ev; - - g_return_if_fail (window != NULL); - - g_free (window->iid); - g_free (window->icon); - g_free (window->title); - - CORBA_exception_init (&ev); - - if (window->control != CORBA_OBJECT_NIL) { - bonobo_object_release_unref (window->control, &ev); - } - - if (window->event_source != CORBA_OBJECT_NIL) { - Bonobo_EventSource_removeListener (window->event_source, - window->listener_id, - &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("CORBA ERROR: %s", CORBA_exception_id (&ev)); - } - bonobo_object_release_unref (window->event_source, &ev); - } - - bonobo_object_release_unref (window->propertybag, &ev); - bonobo_object_release_unref (window->persiststream, &ev); - bonobo_object_release_unref (window->propertycontrol, &ev); - bonobo_object_unref (BONOBO_OBJECT (window->listener)); - bonobo_object_release_unref (window->html, &ev); - - bonobo_object_release_unref (window->component, &ev); - CORBA_exception_free (&ev); - g_free (window); -} - -void -e_summary_remove_window (ESummary *esummary, - ESummaryWindow *window) -{ - ESummaryPrivate *priv; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - g_return_if_fail (window != NULL); - - priv = esummary->private; - priv->window_list = g_list_remove (priv->window_list, window); - e_summary_window_free (window); -} - -void -e_summary_set_shell_view_interface (ESummary *esummary, - GNOME_Evolution_ShellView svi) -{ - ESummaryPrivate *priv; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - g_return_if_fail (svi != CORBA_OBJECT_NIL); - - priv = esummary->private; - priv->shell_view_interface = svi; -} - -/* Wrappers for GNOME_Evolution_ShellView */ -void -e_summary_set_message (ESummary *esummary, - const char *message, - gboolean busy) -{ - ESummaryPrivate *priv; - GNOME_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) - GNOME_Evolution_ShellView_setMessage (svi, message, busy, &ev); - else - GNOME_Evolution_ShellView_setMessage (svi, "", busy, &ev); - CORBA_exception_free (&ev); -} - -void -e_summary_unset_message (ESummary *esummary) -{ - ESummaryPrivate *priv; - GNOME_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); - GNOME_Evolution_ShellView_unsetMessage (svi, &ev); - CORBA_exception_free (&ev); -} - -void -e_summary_change_current_view (ESummary *esummary, - const char *uri) -{ - ESummaryPrivate *priv; - GNOME_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); - GNOME_Evolution_ShellView_changeCurrentView (svi, uri, &ev); - CORBA_exception_free (&ev); -} - -void -e_summary_set_title (ESummary *esummary, - const char *title) -{ - ESummaryPrivate *priv; - GNOME_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); - GNOME_Evolution_ShellView_setTitle (svi, title, &ev); - CORBA_exception_free (&ev); -} - -static void -e_summary_load_page (ESummary *esummary) -{ - ESummaryPrivate *priv; - GnomeVFSHandle *handle = NULL; - GnomeVFSResult result; - GtkWidget *toplevel; - GString *string; - char *str, *comment; - char *filename; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - - /* Pass NULL to reset the page to the default */ - if ((esummary->prefs->page) == NULL || - *(esummary->prefs->page) == '\0') { - filename = g_concat_dir_and_file (EVOLUTION_DATADIR, "/evolution/summary.html"); - } else { - filename = g_strdup (esummary->prefs->page); - } - - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (esummary)); - string = g_string_new (""); - result = gnome_vfs_open (&handle, filename, GNOME_VFS_OPEN_READ); - if (result != GNOME_VFS_OK) { - e_notice (GTK_WINDOW (toplevel), GNOME_MESSAGE_BOX_WARNING, - _("Cannot open the HTML file:\n%s"), filename); - g_free (filename); - return; - } - - g_free (filename); - while (1) { - char buffer[4096]; - GnomeVFSFileSize size; - - memset (buffer, 0x00, 4096); - result = gnome_vfs_read (handle, buffer, 4096, &size); - if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) { - e_notice (GTK_WINDOW (toplevel), GNOME_MESSAGE_BOX_WARNING, - _("Error reading data:\n%s"), - gnome_vfs_result_to_string (result)); - gnome_vfs_close (handle); - return; - } - if (size == 0) - break; /* EOF */ - - string = g_string_append (string, buffer); - } - - gnome_vfs_close (handle); - str = string->str; - g_string_free (string, FALSE); - - comment = strstr (str, ""); - if (comment == NULL) { - e_notice (NULL, GNOME_MESSAGE_BOX_WARNING, - _("File does not have a place for the services.\n")); - g_free (str); - return; - } - - if (priv->header != NULL) - g_free (priv->header); - priv->header = g_strndup (str, comment - str); - priv->header_len = strlen (priv->header); - - if (priv->footer != NULL) - g_free (priv->footer); - priv->footer = g_strdup (comment); - priv->footer_len = strlen (priv->footer); - g_free (str); -} - -static char * -load_component_id_stream_read (Bonobo_Stream stream, - CORBA_Environment *ev) -{ - Bonobo_Stream_iobuf *buffer; - GString *str; - char *ans; - - str = g_string_sized_new (256); -#define READ_CHUNK_SIZE 65536 - do { - int i; - Bonobo_Stream_read (stream, READ_CHUNK_SIZE, &buffer, ev); - if (ev->_major != CORBA_NO_EXCEPTION) - return NULL; - - /* FIXME: make better PLEASE!!!*/ - for (i = 0; i < buffer->_length; i++) - g_string_append_c (str, buffer->_buffer[i]); - - if (buffer->_length <= 0) - break; - CORBA_free (buffer); - } while (1); -#undef READ_CHUNK_SIZE - CORBA_free (buffer); - - ans = str->str; - g_string_free (str, FALSE); - - return ans; -} - -static char * -load_component_id (Bonobo_Storage corba_storage, - CORBA_Environment *ev) -{ - Bonobo_Stream corba_stream; - char *iid; - - corba_stream = Bonobo_Storage_openStream (corba_storage, IID_FILE, - Bonobo_Storage_READ, ev); - if (ev->_major != CORBA_NO_EXCEPTION) - return NULL; - - if (corba_stream) { - iid = load_component_id_stream_read (corba_stream, ev); - Bonobo_Unknown_unref (corba_stream, ev); - CORBA_Object_release (corba_stream, ev); - } else { - g_warning ("Cannot find `%s'", IID_FILE); - return NULL; - } - - return iid; -} - -static void -load_component (ESummary *esummary, - BonoboStorage *storage, - int index) -{ - char *curdir; - char *iid; - Bonobo_Storage corba_subdir; - Bonobo_Storage corba_storage; - ESummaryWindow *window; - CORBA_Environment ev; - - curdir = g_strdup_printf ("%08d", index); - corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (storage)); - CORBA_exception_init (&ev); - - corba_subdir = Bonobo_Storage_openStorage (corba_storage, curdir, - Bonobo_Storage_READ, &ev); - if (corba_subdir == CORBA_OBJECT_NIL) { - g_free (curdir); - return; - } - - iid = load_component_id (corba_subdir, &ev); - - if (iid) { - Bonobo_Stream corba_stream; - - window = e_summary_embed_service_from_id (esummary, iid); - if (window) { - if (window->persiststream) { - corba_stream = Bonobo_Storage_openStream - (corba_subdir, - DATA_FILE, - Bonobo_Storage_READ | - Bonobo_Storage_CREATE, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_print ("Gah"); - return; - } - - Bonobo_PersistStream_load (window->persiststream, - corba_stream, - "", &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Could not load `%s'", iid); - - bonobo_object_release_unref (corba_stream, &ev); - } - } - - g_free (iid); - } - - bonobo_object_release_unref (corba_subdir, &ev); - CORBA_exception_free (&ev); - g_free (curdir); -} - -void -e_summary_reconfigure (ESummary *esummary) -{ - e_summary_load_page (esummary); - e_summary_queue_rebuild (esummary); -} - -static void -e_summary_load_state (ESummary *esummary, - const char *path) -{ - char *fullpath; - BonoboStorage *storage; - Bonobo_Storage corba_storage; - Bonobo_Storage_DirectoryList *list; - CORBA_Environment ev; - int i; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - fullpath = g_strdup_printf ("%s/Executive-Summary", path); - storage = bonobo_storage_open (STORAGE_TYPE, fullpath, - Bonobo_Storage_READ | - Bonobo_Storage_WRITE, - 0664); - if (storage != NULL) { - CORBA_exception_init (&ev); - - corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (storage)); - list = Bonobo_Storage_listContents (corba_storage, "/", 0, &ev); - if (list) { - for (i = 0; i < list->_length; i++) - load_component (esummary, storage, i); - - CORBA_free (list); - } - - bonobo_object_unref (BONOBO_OBJECT (storage)); - CORBA_exception_free (&ev); - } - - g_free (fullpath); - - /* Load the preferences */ - if (esummary->prefs != NULL) - e_summary_prefs_free (esummary->prefs); - - esummary->prefs = e_summary_prefs_load (path); - e_summary_reconfigure (esummary); -} - -static void -save_component (BonoboStorage *storage, - ESummaryWindow *window, - int index) -{ - char *curdir = g_strdup_printf ("%08d", index); - Bonobo_Storage corba_storage; - Bonobo_Storage corba_subdir; - CORBA_Environment ev; - - corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (storage)); - CORBA_exception_init (&ev); - - corba_subdir = Bonobo_Storage_openStorage (corba_storage, curdir, - Bonobo_Storage_CREATE| - Bonobo_Storage_WRITE| - Bonobo_Storage_READ, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Cannot create '%s'", curdir); - g_free (curdir); - } else { - Bonobo_Stream corba_stream; - - g_free (curdir); - corba_stream = Bonobo_Storage_openStream - (corba_subdir, IID_FILE, - Bonobo_Storage_CREATE| - Bonobo_Storage_READ| - Bonobo_Storage_WRITE, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("EEK: %s", CORBA_exception_id (&ev)); - if (corba_subdir != CORBA_OBJECT_NIL) - bonobo_object_release_unref (corba_subdir, &ev); - CORBA_exception_free (&ev); - return; - } - - bonobo_stream_client_write_string (corba_stream, - window->iid, TRUE, &ev); - bonobo_object_release_unref (corba_stream, &ev); - - corba_stream = Bonobo_Storage_openStream (corba_subdir, DATA_FILE, - Bonobo_Storage_CREATE, - &ev); - if (window->persiststream != CORBA_OBJECT_NIL) { - Bonobo_PersistStream_save (window->persiststream, - corba_stream, "", &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Unable to save %s", window->iid); - } - } - - bonobo_object_release_unref (corba_stream, &ev); - } - - if (corba_subdir != CORBA_OBJECT_NIL) - bonobo_object_release_unref (corba_subdir, &ev); - CORBA_exception_free (&ev); -} - -static void -e_summary_save_state (ESummary *esummary, - const char *path) -{ - ESummaryPrivate *priv; - BonoboStorage *storage; - Bonobo_Storage corba_storage; - CORBA_Environment ev; - GList *windows; - char *fullpath; - int i; - - g_return_if_fail (esummary != NULL); - g_return_if_fail (IS_E_SUMMARY (esummary)); - - priv = esummary->private; - - fullpath = g_strdup_printf("%s/Executive-Summary", path); - g_print ("fullpath: %s\n", fullpath); - - e_summary_rm_dir (fullpath); - - storage = bonobo_storage_open (STORAGE_TYPE, fullpath, - Bonobo_Storage_READ | - Bonobo_Storage_WRITE | - Bonobo_Storage_CREATE, 0660); - g_return_if_fail (storage); - - CORBA_exception_init (&ev); - corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (storage)); - - i = 0; - for (windows = priv->window_list; windows; windows = windows->next) { - save_component (storage, windows->data, i); - g_print ("IID: %s\n", ((ESummaryWindow *)windows->data)->iid); - i++; - } - - Bonobo_Storage_commit (corba_storage, &ev); - CORBA_exception_free (&ev); - bonobo_object_unref (BONOBO_OBJECT (storage)); - - e_summary_prefs_save (esummary->prefs, path); - g_free (fullpath); -} - -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 5469adc6fe..0000000000 --- a/executive-summary/component/e-summary.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary.h - * - * Authors: Iain Holmes - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 "e-summary-prefs.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; -typedef struct _ESummaryWindow ESummaryWindow; - -struct _ESummaryWindow { - GNOME_Evolution_Summary_Component component; - - Bonobo_Control control; - GNOME_Evolution_Summary_HTMLView html; - - Bonobo_PersistStream persiststream; - Bonobo_PropertyBag propertybag; - Bonobo_PropertyControl propertycontrol; - Bonobo_EventSource event_source; - - /* Listener for the event_source */ - BonoboListener *listener; - int listener_id; - - char *iid; - char *title; - char *icon; - - ESummary *esummary; -}; - -struct _ESummary { - GtkVBox parent; - - ESummaryPrefs *prefs; - ESummaryPrefs *tmp_prefs; - ESummaryPrivate *private; -}; - -struct _ESummaryClass { - GtkVBoxClass parent_class; -}; - -GtkType e_summary_get_type (void); -GtkWidget *e_summary_new (const GNOME_Evolution_Shell shell); -void e_summary_queue_rebuild (ESummary *esummary); - -void e_summary_window_free (ESummaryWindow *window); -void e_summary_remove_window (ESummary *esummary, - ESummaryWindow *window); -ESummaryWindow *e_summary_add_service (ESummary *esummary, - GNOME_Evolution_Summary_Component component, - const char *iid); -ESummaryWindow * e_summary_embed_service_from_id (ESummary *esummary, - const char *obj_id); - -void e_summary_set_shell_view_interface (ESummary *summary, - GNOME_Evolution_ShellView svi); -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); - -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); -void e_summary_reconfigure (ESummary *esummary); - -#endif diff --git a/executive-summary/component/executive-summary-config.glade b/executive-summary/component/executive-summary-config.glade deleted file mode 100644 index 17fd9b0e69..0000000000 --- a/executive-summary/component/executive-summary-config.glade +++ /dev/null @@ -1,223 +0,0 @@ - - - - - Project1 - project1 - - src - pixmaps - C - True - True - False - True - True - True - True - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h - - - - - GnomePropertyBox - summaryprefs - True - - - GtkNotebook - GnomePropertyBox:notebook - notebook1 - 2 - True - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - 0 - True - True - - - - GtkVBox - vbox - 2 - True - False - 8 - - - Placeholder - - - - GtkFrame - frame1 - 2 - True - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox2 - 2 - True - False - 5 - - - GtkHBox - hbox1 - 2 - True - False - 5 - - 0 - True - True - - - - GtkLabel - label2 - True - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GnomeFileEntry - htmlpage - True - 10 - False - False - - 0 - True - True - - - - GtkEntry - GnomeEntry:entry - combo-entry1 - True - True - True - True - 0 - - - - - - - GtkHBox - hbox2 - 2 - True - False - 5 - - 0 - True - True - - - - GtkLabel - label3 - True - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkSpinButton - columnspinner - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 1 - 1 - 100 - 1 - 10 - 10 - - 0 - True - True - - - - - - - - Placeholder - - - - - GtkLabel - Notebook:tab - Label - True - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - 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 e23b59c23a..0000000000 --- a/executive-summary/component/main.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * main.c: The core of the executive summary component. - * - * Copyright (C) 2000 Ximian, Inc - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#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 -#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 (); - glade_gnome_init (); - if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) { - g_error (_("Executive summary component could not initialize Bonobo.\n" - "If there was a warning message about the " - "RootPOA, it probably means\nyou compiled " - "Bonobo against GOAD instead of OAF.")); - } - -#ifdef GTKHTML_HAVE_GCONF - gconf_init (argc, argv, NULL); -#endif - - e_cursors_init (); - - component_factory_init (); - - gnome_vfs_init (); - bonobo_main (); - - return 0; -} -- cgit v1.2.3