From b741f2e9e395de5408edea20ff3c4d4731439079 Mon Sep 17 00:00:00 2001 From: nobody Date: Mon, 17 Sep 2001 04:32:38 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'GNOME_SPELL_0_3'. svn path=/tags/GNOME_SPELL_0_3/; revision=12879 --- shell/importer/.cvsignore | 10 - shell/importer/GNOME_Evolution_Importer.idl | 95 ----- shell/importer/Makefile.am | 62 --- shell/importer/evolution-importer-client.c | 249 ------------ shell/importer/evolution-importer-client.h | 75 ---- shell/importer/evolution-importer-listener.c | 226 ----------- shell/importer/evolution-importer-listener.h | 72 ---- shell/importer/evolution-importer.c | 230 ----------- shell/importer/evolution-importer.h | 96 ----- shell/importer/evolution-intelligent-importer.c | 198 ---------- shell/importer/evolution-intelligent-importer.h | 75 ---- shell/importer/import.glade | 91 ----- shell/importer/intelligent.c | 487 ------------------------ shell/importer/intelligent.h | 29 -- 14 files changed, 1995 deletions(-) delete mode 100644 shell/importer/.cvsignore delete mode 100644 shell/importer/GNOME_Evolution_Importer.idl delete mode 100644 shell/importer/Makefile.am delete mode 100644 shell/importer/evolution-importer-client.c delete mode 100644 shell/importer/evolution-importer-client.h delete mode 100644 shell/importer/evolution-importer-listener.c delete mode 100644 shell/importer/evolution-importer-listener.h delete mode 100644 shell/importer/evolution-importer.c delete mode 100644 shell/importer/evolution-importer.h delete mode 100644 shell/importer/evolution-intelligent-importer.c delete mode 100644 shell/importer/evolution-intelligent-importer.h delete mode 100644 shell/importer/import.glade delete mode 100644 shell/importer/intelligent.c delete mode 100644 shell/importer/intelligent.h (limited to 'shell/importer') diff --git a/shell/importer/.cvsignore b/shell/importer/.cvsignore deleted file mode 100644 index a1e30a4161..0000000000 --- a/shell/importer/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -Makefile.in -Makefile -GNOME_Evolution_Importer-stubs.c -GNOME_Evolution_Importer-skels.c -GNOME_Evolution_Importer-common.c -GNOME_Evolution_Importer.h -*.lo -*.la diff --git a/shell/importer/GNOME_Evolution_Importer.idl b/shell/importer/GNOME_Evolution_Importer.idl deleted file mode 100644 index 18ea7a65bb..0000000000 --- a/shell/importer/GNOME_Evolution_Importer.idl +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interfaces for the importer framework. - * - * Authors: - * Iain Holmes - * - * Copyright (C) 2000 Ximian, Inc. - */ - -#include - -module GNOME { -module Evolution { - interface ImporterListener : Bonobo::Unknown { - enum ImporterResult { - OK, - UNSUPPORTED_OPERATION, - NOT_READY, - BUSY, - UNKNOWN_DATA, - BAD_DATA, - BAD_FILE - }; - - /** - * notifyResult: - * @result: The result of the import. - * @more_items: Are there any more items to be processed? - * - * Notifies the listener of the result and whether there are - * any more items to be imported. - */ - oneway void notifyResult (in ImporterResult result, - in boolean more_items); - }; - - interface Importer : Bonobo::Unknown { - - /** - * processItem: - * @listener: The ImporterListener that will be notified of the - * progress. - * - * Processes the next item. - * - */ - oneway void processItem (in ImporterListener listener); - - /** - * getError: - * - * Retrieve a detailed explaination of the error. - * - * Returns: A string. - */ - string getError (); - - /** - * supportFormat: - * @filename: The filename of the file. - * - * Checks if the importer created by this factory can - * import the file specified. - * - * Returns: A boolean, TRUE if it can import the file, - * FALSE otherwise. - */ - boolean supportFormat (in string filename); - - /** - * loadFile: - * @filename: The filename of the file. - * @folderpath: The full pathname to the folder. - * - * Loads the file and prepares an Importer object that can - * process files of this type. - * - * Returns: An Importer object. - */ - boolean loadFile (in string filename, - in string folderpath); - }; - - interface IntelligentImporter : Bonobo::Unknown { - - readonly attribute string importername; - readonly attribute string message; - - boolean canImport (); - - void importData (); - }; -}; -}; diff --git a/shell/importer/Makefile.am b/shell/importer/Makefile.am deleted file mode 100644 index 496a53da3f..0000000000 --- a/shell/importer/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/shell \ - -I$(top_builddir)/shell \ - -I$(includedir) \ - $(EXTRA_GNOME_CFLAGS) \ - -DG_LOG_DOMAIN=\"Evolution-Importer\" \ - -DEVOLUTION_GLADEDIR=\"$(datadir)/evolution/glade\" - -lib_LTLIBRARIES = libevolution-importer.la - -IDLS = \ - GNOME_Evolution_Importer.idl - -IDL_GENERATED = \ - GNOME_Evolution_Importer.h \ - GNOME_Evolution_Importer-common.c \ - GNOME_Evolution_Importer-skels.c \ - GNOME_Evolution_Importer-stubs.c - -GNOME_Evolution_Importer-impl.o: GNOME_Evolution_Importer.h - -$(IDL_GENERATED): $(IDLS) - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - $(srcdir)/GNOME_Evolution_Importer.idl - -idldir = $(datadir)/idl -idl_DATA = $(IDLS) - -libevolution_importerincludedir = $(includedir)/evolution/importer -libevolution_importer_la_SOURCES = \ - $(IDL_GENERATED) \ - evolution-intelligent-importer.c \ - evolution-importer-client.c \ - evolution-importer-listener.c \ - evolution-importer.c \ - intelligent.c \ - intelligent.h - -libevolution_importerinclude_HEADERS = \ - GNOME_Evolution_Importer.h \ - evolution-intelligent-importer.h \ - evolution-importer-client.h \ - evolution-importer-listener.h \ - evolution-importer.h - -libevolution_importer_la_LIBADD = \ - $(top_builddir)/e-util/libeutil.la \ - $(BONOBO_CONF_LIBS) \ - $(EXTRA_GNOME_LIBS) \ - $(GTKHTML_LIBS) - -gladedir = $(datadir)/evolution/glade -glade_DATA = import.glade - -EXTRA_DIST = $(glade_DATA) $(IDLS) - -BUILT_SOURCES=$(IDL_GENERATED) -CLEANFILES = $(BUILT_SOURCES) -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) - diff --git a/shell/importer/evolution-importer-client.c b/shell/importer/evolution-importer-client.c deleted file mode 100644 index 337cf36507..0000000000 --- a/shell/importer/evolution-importer-client.c +++ /dev/null @@ -1,249 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer-client.c - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Iain Holmes - * Based on evolution-shell-component-client.c by Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "evolution-importer-client.h" - -#include -#include -#include -#include - -#include - -#include "GNOME_Evolution_Importer.h" - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - - -static void -destroy (GtkObject *object) -{ - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -static void -class_init (EvolutionImporterClientClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = destroy; -} - -static void -init (EvolutionImporterClient *client) -{ -} - -/** - * evolution_importer_client_new: - * @objref: The CORBA_Object to make a client for. - * - * Makes a client for @objref. @objref should be an Evolution_Importer. - * - * Returns: A newly created EvolutionImporterClient. - */ -EvolutionImporterClient * -evolution_importer_client_new (const CORBA_Object objref) -{ - EvolutionImporterClient *client; - - g_return_val_if_fail (objref != CORBA_OBJECT_NIL, NULL); - - client = gtk_type_new (evolution_importer_client_get_type ()); - client->objref = objref; - - return client; -} - -/** - * evolution_importer_client_new_from_id: - * @id: The oafiid of the component to make a client for. - * - * Makes a client for the object returned by activating @id. - * - * Returns: A newly created EvolutionImporterClient. - */ -EvolutionImporterClient * -evolution_importer_client_new_from_id (const char *id) -{ - CORBA_Environment ev; - CORBA_Object objref; - - g_return_val_if_fail (id != NULL, NULL); - - CORBA_exception_init (&ev); - objref = oaf_activate_from_id ((char *) id, 0, NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - g_warning ("Could not start %s.", id); - return NULL; - } - - CORBA_exception_free (&ev); - if (objref == CORBA_OBJECT_NIL) { - g_warning ("Could not activate component %s", id); - return NULL; - } - - return evolution_importer_client_new (objref); -} - -/* API */ -/** - * evolution_importer_client_support_format: - * @client: The EvolutionImporterClient. - * @filename: Name of the file to check. - * - * Checks whether @client is able to import @filename. - * - * Returns: TRUE if @client can import @filename, FALSE otherwise. - */ -gboolean -evolution_importer_client_support_format (EvolutionImporterClient *client, - const char *filename) -{ - GNOME_Evolution_Importer corba_importer; - gboolean result; - CORBA_Environment ev; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), FALSE); - g_return_val_if_fail (filename != NULL, FALSE); - - CORBA_exception_init (&ev); - corba_importer = client->objref; - result = GNOME_Evolution_Importer_supportFormat (corba_importer, - filename, &ev); - CORBA_exception_free (&ev); - - return result; -} - -/** - * evolution_importer_client_load_file: - * @client: The EvolutionImporterClient. - * @filename: The file to load. - * @folderpath: The full path to the folder, or NULL for Inbox. - * - * Loads and initialises the importer. - * - * Returns: TRUE on sucess, FALSE on failure. - */ -gboolean -evolution_importer_client_load_file (EvolutionImporterClient *client, - const char *filename, - const char *folderpath) -{ - GNOME_Evolution_Importer corba_importer; - gboolean result; - CORBA_Environment ev; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), FALSE); - g_return_val_if_fail (filename != NULL, FALSE); - - CORBA_exception_init (&ev); - corba_importer = client->objref; - result = GNOME_Evolution_Importer_loadFile (corba_importer, - filename, - folderpath ? folderpath : "", - &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Oh there *WAS* an exception.\nIt was %s", - CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - return FALSE; - } - CORBA_exception_free (&ev); - - return result; -} - -/** - * evolution_importer_client_process_item: - * @client: The EvolutionImporterClient. - * @listener: The EvolutionImporterListener. - * - * Starts importing the next item in the file. @listener will be notified - * when the item has finished. - */ -void -evolution_importer_client_process_item (EvolutionImporterClient *client, - EvolutionImporterListener *listener) -{ - GNOME_Evolution_Importer corba_importer; - GNOME_Evolution_ImporterListener corba_listener; - CORBA_Environment ev; - - g_return_if_fail (client != NULL); - g_return_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client)); - g_return_if_fail (listener != NULL); - g_return_if_fail (EVOLUTION_IS_IMPORTER_LISTENER (listener)); - - CORBA_exception_init (&ev); - - corba_importer = client->objref; - corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener)); - GNOME_Evolution_Importer_processItem (corba_importer, - corba_listener, &ev); - CORBA_exception_free (&ev); -} - -/** - * evolution_importer_client_get_error: - * @client: The EvolutionImporterClient. - * - * Gets the error as a string. - * - * Returns: The error as a string. If there is no error NULL is returned. - * Importers need not support this method and if so, NULL is also returned. - */ -const char * -evolution_importer_client_get_error (EvolutionImporterClient *client) -{ - GNOME_Evolution_Importer corba_importer; - CORBA_char *str; - CORBA_Environment ev; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), NULL); - - corba_importer = client->objref; - - CORBA_exception_init (&ev); - str = GNOME_Evolution_Importer_getError (corba_importer, &ev); - - return str; -} - -E_MAKE_TYPE (evolution_importer_client, "EvolutionImporterClient", - EvolutionImporterClient, class_init, init, PARENT_TYPE) diff --git a/shell/importer/evolution-importer-client.h b/shell/importer/evolution-importer-client.h deleted file mode 100644 index 20142c018d..0000000000 --- a/shell/importer/evolution-importer-client.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer-client.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Iain Holmes - */ - -#ifndef EVOLUTION_IMPORTER_CLIENT_H -#define EVOLUTION_IMPORTER_CLIENT_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif - -#define EVOLUTION_TYPE_IMPORTER_CLIENT (evolution_importer_client_get_type ()) -#define EVOLUTION_IMPORTER_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClient)) -#define EVOLUTION_IMPORTER_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClientClass)) -#define EVOLUTION_IS_IMPORTER_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT)) -#define EVOLUTION_IS_IMPORTER_CLIENT_CLASS(klass) (GTK_CHECK_TYPE ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT)) - - -typedef struct _EvolutionImporterClient EvolutionImporterClient; -typedef struct _EvolutionImporterClientClass EvolutionImporterClientClass; - -struct _EvolutionImporterClient { - GtkObject parent_type; - - GNOME_Evolution_Importer objref; -}; - -struct _EvolutionImporterClientClass { - GtkObjectClass parent_class; -}; - -GtkType evolution_importer_client_get_type (void); - -EvolutionImporterClient *evolution_importer_client_new (const CORBA_Object objref); -EvolutionImporterClient *evolution_importer_client_new_from_id (const char *id); - -gboolean evolution_importer_client_support_format (EvolutionImporterClient *client, - const char *filename); -gboolean evolution_importer_client_load_file (EvolutionImporterClient *client, - const char *filename, - const char *folderpath); -void evolution_importer_client_process_item (EvolutionImporterClient *client, - EvolutionImporterListener *listener); -const char *evolution_importer_client_get_error (EvolutionImporterClient *client); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/shell/importer/evolution-importer-listener.c b/shell/importer/evolution-importer-listener.c deleted file mode 100644 index 8a547e6f3e..0000000000 --- a/shell/importer/evolution-importer-listener.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer-client.c - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Iain Holmes - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "evolution-importer-listener.h" - -#include -#include - -#include "GNOME_Evolution_Importer.h" -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE - -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionImporterListenerPrivate { - EvolutionImporterListenerCallback callback; - - void *closure; -}; - -#if 0 -static POA_GNOME_Evolution_ImporterListener__vepv Listener_vepv; - -static POA_GNOME_Evolution_ImporterListener * -create_servant (void) -{ - POA_GNOME_Evolution_ImporterListener *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_ImporterListener *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &Listener_vepv; - - CORBA_exception_init (&ev); - POA_GNOME_Evolution_ImporterListener__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} -#endif - -static EvolutionImporterResult -corba_result_to_evolution (GNOME_Evolution_ImporterListener_ImporterResult corba_result) -{ - switch (corba_result) { - case GNOME_Evolution_ImporterListener_OK: - return EVOLUTION_IMPORTER_OK; - case GNOME_Evolution_ImporterListener_UNSUPPORTED_OPERATION: - return EVOLUTION_IMPORTER_UNSUPPORTED_OPERATION; - case GNOME_Evolution_ImporterListener_UNKNOWN_DATA: - return EVOLUTION_IMPORTER_UNKNOWN_DATA; - case GNOME_Evolution_ImporterListener_BAD_DATA: - return EVOLUTION_IMPORTER_BAD_DATA; - case GNOME_Evolution_ImporterListener_BAD_FILE: - return EVOLUTION_IMPORTER_BAD_FILE; - case GNOME_Evolution_ImporterListener_NOT_READY: - return EVOLUTION_IMPORTER_NOT_READY; - case GNOME_Evolution_ImporterListener_BUSY: - return EVOLUTION_IMPORTER_BUSY; - default: - return EVOLUTION_IMPORTER_UNKNOWN_ERROR; - } -} - -static inline EvolutionImporterListener * -evolution_importer_listener_from_servant (PortableServer_Servant servant) -{ - return EVOLUTION_IMPORTER_LISTENER (bonobo_object_from_servant (servant)); -} - -static void -impl_GNOME_Evolution_ImporterListener_notifyResult (PortableServer_Servant servant, - GNOME_Evolution_ImporterListener_ImporterResult result, - CORBA_boolean more_items, - CORBA_Environment *ev) -{ - EvolutionImporterListener *listener; - EvolutionImporterListenerPrivate *priv; - EvolutionImporterResult out_result; - - listener = evolution_importer_listener_from_servant (servant); - priv = listener->priv; - - g_print ("Notified\n"); - out_result = corba_result_to_evolution (result); - if (priv->callback) { - (priv->callback) (listener, out_result, more_items, - priv->closure); - } - - return; -} - - -/* GtkObject methods */ -static void -destroy (GtkObject *object) -{ - EvolutionImporterListener *listener; - EvolutionImporterListenerPrivate *priv; - - listener = EVOLUTION_IMPORTER_LISTENER (object); - priv = listener->priv; - - if (priv == NULL) - return; - - g_free (priv); - listener->priv = NULL; - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -#if 0 -static void -corba_class_init (void) -{ - POA_GNOME_Evolution_ImporterListener__vepv *vepv; - POA_GNOME_Evolution_ImporterListener__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_GNOME_Evolution_ImporterListener__epv, 1); - epv->notifyResult = impl_GNOME_Evolution_ImporterListener_notifyResult; - - vepv = &Listener_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_Evolution_ImporterListener_epv = epv; -} -#endif - -static void -evolution_importer_listener_class_init (EvolutionImporterListenerClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_ImporterListener__epv *epv = &klass->epv; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - epv->notifyResult = impl_GNOME_Evolution_ImporterListener_notifyResult; -} - -static void -evolution_importer_listener_init (EvolutionImporterListener *listener) -{ - EvolutionImporterListenerPrivate *priv; - - priv = g_new0 (EvolutionImporterListenerPrivate, 1); - listener->priv = priv; -} - -static void -evolution_importer_listener_construct (EvolutionImporterListener *listener, - EvolutionImporterListenerCallback callback, - void *closure) -{ - EvolutionImporterListenerPrivate *priv; - - g_return_if_fail (listener != NULL); - g_return_if_fail (EVOLUTION_IS_IMPORTER_LISTENER (listener)); - g_return_if_fail (callback != NULL); - - priv = listener->priv; - priv->callback = callback; - priv->closure = closure; -} - -/** - * evolution_importer_listener_new - * @callback: The #EvolutionImporterListenerCallback callback. - * @closure: The data that will be passed to that callback. - * - * Creates a new #EvolutionImporterListener object which calls @callback when - * something happens. - * Returns: A newly allocated #EvolutionImporterListener. - */ -EvolutionImporterListener * -evolution_importer_listener_new (EvolutionImporterListenerCallback callback, - void *closure) -{ - EvolutionImporterListener *listener; - - listener = gtk_type_new (evolution_importer_listener_get_type ()); - - evolution_importer_listener_construct (listener, callback, closure); - return listener; -} - -BONOBO_X_TYPE_FUNC_FULL (EvolutionImporterListener, - GNOME_Evolution_ImporterListener, - PARENT_TYPE, evolution_importer_listener); diff --git a/shell/importer/evolution-importer-listener.h b/shell/importer/evolution-importer-listener.h deleted file mode 100644 index 6289e54d99..0000000000 --- a/shell/importer/evolution-importer-listener.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer-listener.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Iain Holmes - */ - -#ifndef EVOLUTION_IMPORTER_LISTENER_H -#define EVOLUTION_IMPORTER_LISTENER_H - -#include -#include -#include -#include "evolution-importer.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -#define EVOLUTION_TYPE_IMPORTER_LISTENER (evolution_importer_listener_get_type ()) -#define EVOLUTION_IMPORTER_LISTENER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListener)) -#define EVOLUTION_IMPORTER_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListenerClass)) -#define EVOLUTION_IS_IMPORTER_LISTENER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER)) -#define EVOLUTION_IS_IMPORTER_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER)) - -typedef struct _EvolutionImporterListener EvolutionImporterListener; -typedef struct _EvolutionImporterListenerPrivate EvolutionImporterListenerPrivate; -typedef struct _EvolutionImporterListenerClass EvolutionImporterListenerClass; - -typedef void (* EvolutionImporterListenerCallback) (EvolutionImporterListener *listener, - EvolutionImporterResult result, - gboolean more_items, - void *closure); -struct _EvolutionImporterListener { - BonoboXObject parent; - - EvolutionImporterListenerPrivate *priv; -}; - -struct _EvolutionImporterListenerClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_ImporterListener__epv epv; -}; - -GtkType evolution_importer_listener_get_type (void); - -EvolutionImporterListener *evolution_importer_listener_new (EvolutionImporterListenerCallback callback, - void *closure); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/shell/importer/evolution-importer.c b/shell/importer/evolution-importer.c deleted file mode 100644 index f41ace28aa..0000000000 --- a/shell/importer/evolution-importer.c +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer.c - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Iain Holmes - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "evolution-importer.h" - -#include -#include - -#include "GNOME_Evolution_Importer.h" - -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionImporterPrivate { - EvolutionImporterLoadFileFn load_file_fn; - EvolutionImporterSupportFormatFn support_format_fn; - EvolutionImporterProcessItemFn process_item_fn; - EvolutionImporterGetErrorFn get_error_fn; - - void *closure; -}; - - -static inline EvolutionImporter * -evolution_importer_from_servant (PortableServer_Servant servant) -{ - return EVOLUTION_IMPORTER (bonobo_object_from_servant (servant)); -} - -static CORBA_boolean -impl_GNOME_Evolution_Importer_supportFormat (PortableServer_Servant servant, - const CORBA_char *filename, - CORBA_Environment *ev) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - - importer = evolution_importer_from_servant (servant); - priv = importer->priv; - - if (priv->support_format_fn != NULL) - return (priv->support_format_fn) (importer, filename, - priv->closure); - else - return FALSE; -} - -static CORBA_boolean -impl_GNOME_Evolution_Importer_loadFile (PortableServer_Servant servant, - const CORBA_char *filename, - const CORBA_char *folderpath, - CORBA_Environment *ev) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - - importer = evolution_importer_from_servant (servant); - priv = importer->priv; - - if (priv->load_file_fn != NULL) - return (priv->load_file_fn) (importer, filename, - folderpath, priv->closure); - else - return FALSE; -} - -static void -impl_GNOME_Evolution_Importer_processItem (PortableServer_Servant servant, - GNOME_Evolution_ImporterListener listener, - CORBA_Environment *ev) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - - importer = evolution_importer_from_servant (servant); - priv = importer->priv; - - if (priv->process_item_fn != NULL) - (priv->process_item_fn) (importer, listener, priv->closure, ev); - else - GNOME_Evolution_ImporterListener_notifyResult (listener, - GNOME_Evolution_ImporterListener_UNSUPPORTED_OPERATION, FALSE, ev); -} - -static CORBA_char * -impl_GNOME_Evolution_Importer_getError (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - CORBA_char *out_str; - - importer = evolution_importer_from_servant (servant); - priv = importer->priv; - - if (priv->get_error_fn != NULL) { - out_str = (priv->get_error_fn) (importer, priv->closure); - return CORBA_string_dup (out_str ? out_str : ""); - } else - return CORBA_string_dup (""); -} - - -static void -destroy (GtkObject *object) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - - importer = EVOLUTION_IMPORTER (object); - priv = importer->priv; - - if (priv == NULL) - return; - - g_free (priv); - importer->priv = NULL; - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -evolution_importer_class_init (EvolutionImporterClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_Importer__epv *epv = &klass->epv; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - epv->supportFormat = impl_GNOME_Evolution_Importer_supportFormat; - epv->loadFile = impl_GNOME_Evolution_Importer_loadFile; - epv->processItem = impl_GNOME_Evolution_Importer_processItem; - epv->getError = impl_GNOME_Evolution_Importer_getError; -} - -static void -evolution_importer_init (EvolutionImporter *importer) -{ - EvolutionImporterPrivate *priv; - - priv = g_new0 (EvolutionImporterPrivate, 1); - - importer->priv = priv; -} - - - -static void -evolution_importer_construct (EvolutionImporter *importer, - EvolutionImporterSupportFormatFn support_format_fn, - EvolutionImporterLoadFileFn load_file_fn, - EvolutionImporterProcessItemFn process_item_fn, - EvolutionImporterGetErrorFn get_error_fn, - void *closure) -{ - EvolutionImporterPrivate *priv; - - g_return_if_fail (importer != NULL); - g_return_if_fail (EVOLUTION_IS_IMPORTER (importer)); - g_return_if_fail (support_format_fn != NULL); - g_return_if_fail (load_file_fn != NULL); - g_return_if_fail (process_item_fn != NULL); - - priv = importer->priv; - priv->support_format_fn = support_format_fn; - priv->load_file_fn = load_file_fn; - priv->process_item_fn = process_item_fn; - priv->get_error_fn = get_error_fn; - - priv->closure = closure; -} - -/** - * evolution_importer_new: - * @support_format_fn: The function to be called by the supportFormat method. - * @load_file_fn: The function to be called by the loadFile method. - * @process_item_fn: The function to be called by the processItem method. - * @get_error_fn: The function to be called by the getError method. - * @closure: The data to be passed to all of the above functions. - * - * Creates a new EvolutionImporter object. Of the parameters only - * @get_error_function and @closure may be #NULL. - * - * Returns: A newly created EvolutionImporter object. - */ -EvolutionImporter * -evolution_importer_new (EvolutionImporterSupportFormatFn support_format_fn, - EvolutionImporterLoadFileFn load_file_fn, - EvolutionImporterProcessItemFn process_item_fn, - EvolutionImporterGetErrorFn get_error_fn, - void *closure) -{ - EvolutionImporter *importer; - - importer = gtk_type_new (evolution_importer_get_type ()); - evolution_importer_construct (importer, support_format_fn, load_file_fn, - process_item_fn, get_error_fn, closure); - return importer; -} - -BONOBO_X_TYPE_FUNC_FULL (EvolutionImporter, - GNOME_Evolution_Importer, - PARENT_TYPE, - evolution_importer); diff --git a/shell/importer/evolution-importer.h b/shell/importer/evolution-importer.h deleted file mode 100644 index abdcfc6bb6..0000000000 --- a/shell/importer/evolution-importer.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Iain Holmes - */ - -#ifndef EVOLUTION_IMPORTER_H -#define EVOLUTION_IMPORTER_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -#define EVOLUTION_TYPE_IMPORTER (evolution_importer_get_type ()) -#define EVOLUTION_IMPORTER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_IMPORTER, EvolutionImporter)) -#define EVOLUTION_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER, EvolutionImporterClass)) -#define EVOLUTION_IS_IMPORTER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_IMPORTER)) -#define EVOLUTION_IS_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER)) - -typedef struct _EvolutionImporter EvolutionImporter; -typedef struct _EvolutionImporterPrivate EvolutionImporterPrivate; -typedef struct _EvolutionImporterClass EvolutionImporterClass; - -typedef gboolean (* EvolutionImporterSupportFormatFn) (EvolutionImporter *importer, - const char *filename, - void *closure); -typedef gboolean (* EvolutionImporterLoadFileFn) (EvolutionImporter *importer, - const char *filename, - const char *folderpath, - void *closure); -typedef void (* EvolutionImporterProcessItemFn) (EvolutionImporter *importer, - CORBA_Object listener, - void *closure, - CORBA_Environment *ev); -typedef char *(* EvolutionImporterGetErrorFn) (EvolutionImporter *importer, - void *closure); - -typedef enum { - EVOLUTION_IMPORTER_OK, - EVOLUTION_IMPORTER_UNSUPPORTED_OPERATION, - EVOLUTION_IMPORTER_INTERRUPTED, - EVOLUTION_IMPORTER_BUSY, - EVOLUTION_IMPORTER_NOT_READY, - EVOLUTION_IMPORTER_UNKNOWN_DATA, - EVOLUTION_IMPORTER_BAD_DATA, - EVOLUTION_IMPORTER_BAD_FILE, - EVOLUTION_IMPORTER_UNKNOWN_ERROR -} EvolutionImporterResult; - -struct _EvolutionImporter { - BonoboXObject parent; - - EvolutionImporterPrivate *priv; -}; - -struct _EvolutionImporterClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_Importer__epv epv; -}; - -GtkType evolution_importer_get_type (void); - -EvolutionImporter *evolution_importer_new (EvolutionImporterSupportFormatFn support_format_fn, - EvolutionImporterLoadFileFn load_file_fn, - EvolutionImporterProcessItemFn process_item_fn, - EvolutionImporterGetErrorFn get_error_fn, - void *closure); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/shell/importer/evolution-intelligent-importer.c b/shell/importer/evolution-intelligent-importer.c deleted file mode 100644 index e15f37cc24..0000000000 --- a/shell/importer/evolution-intelligent-importer.c +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-intelligent-importer.c - * - * Copyright (C) 2000, 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Iain Holmes - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "evolution-intelligent-importer.h" - -#include - -#include "GNOME_Evolution_Importer.h" - -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionIntelligentImporterPrivate { - EvolutionIntelligentImporterCanImportFn can_import_fn; - EvolutionIntelligentImporterImportDataFn import_data_fn; - - char *importername; - char *message; - void *closure; -}; - - -static inline EvolutionIntelligentImporter * -evolution_intelligent_importer_from_servant (PortableServer_Servant servant) -{ - return EVOLUTION_INTELLIGENT_IMPORTER (bonobo_object_from_servant (servant)); -} - -static CORBA_char * -impl_GNOME_Evolution_IntelligentImporter__get_importername (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionIntelligentImporter *ii; - - ii = evolution_intelligent_importer_from_servant (servant); - - return CORBA_string_dup (ii->priv->importername ? - ii->priv->importername : ""); -} - -static CORBA_char * -impl_GNOME_Evolution_IntelligentImporter__get_message (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionIntelligentImporter *ii; - - ii = evolution_intelligent_importer_from_servant (servant); - - return CORBA_string_dup (ii->priv->message ? - ii->priv->message : ""); -} - -static CORBA_boolean -impl_GNOME_Evolution_IntelligentImporter_canImport (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionIntelligentImporter *ii; - EvolutionIntelligentImporterPrivate *priv; - - ii = evolution_intelligent_importer_from_servant (servant); - priv = ii->priv; - - if (priv->can_import_fn != NULL) - return (priv->can_import_fn) (ii, priv->closure); - else - return FALSE; -} - -static void -impl_GNOME_Evolution_IntelligentImporter_importData (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionIntelligentImporter *ii; - EvolutionIntelligentImporterPrivate *priv; - - ii = evolution_intelligent_importer_from_servant (servant); - priv = ii->priv; - - if (priv->import_data_fn) - (priv->import_data_fn) (ii, priv->closure); -} - - -static void -destroy (GtkObject *object) -{ - EvolutionIntelligentImporter *ii; - - ii = EVOLUTION_INTELLIGENT_IMPORTER (object); - - if (ii->priv == NULL) - return; - - g_free (ii->priv->importername); - g_free (ii->priv); - ii->priv = NULL; - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -evolution_intelligent_importer_class_init (EvolutionIntelligentImporterClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_IntelligentImporter__epv *epv = &klass->epv; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - epv->_get_importername = impl_GNOME_Evolution_IntelligentImporter__get_importername; - epv->_get_message = impl_GNOME_Evolution_IntelligentImporter__get_message; - epv->canImport = impl_GNOME_Evolution_IntelligentImporter_canImport; - epv->importData = impl_GNOME_Evolution_IntelligentImporter_importData; -} - -static void -evolution_intelligent_importer_init (EvolutionIntelligentImporter *ii) -{ - ii->priv = g_new0 (EvolutionIntelligentImporterPrivate, 1); -} - - -static void -evolution_intelligent_importer_construct (EvolutionIntelligentImporter *ii, - EvolutionIntelligentImporterCanImportFn can_import_fn, - EvolutionIntelligentImporterImportDataFn import_data_fn, - const char *importername, - const char *message, - void *closure) -{ - g_return_if_fail (ii != NULL); - ii->priv->importername = g_strdup (importername); - ii->priv->message = g_strdup (message); - - ii->priv->can_import_fn = can_import_fn; - ii->priv->import_data_fn = import_data_fn; - ii->priv->closure = closure; -} - -/** - * evolution_intelligent_importer_new: - * can_import_fn: The function that will be called to see if this importer can do - * anything. - * import_data_fn: The function that will be called when the importer should - * import the data. - * importername: The name of this importer. - * message: The message that will be displayed when the importer can import. - * closure: The data to be passed to @can_import_fn and @import_data_fn. - * - * Creates a new IntelligentImporter. - * - * Returns: A newly allocated EvolutionIntelligentImporter. - */ -EvolutionIntelligentImporter * -evolution_intelligent_importer_new (EvolutionIntelligentImporterCanImportFn can_import_fn, - EvolutionIntelligentImporterImportDataFn import_data_fn, - const char *importername, - const char *message, - void *closure) -{ - EvolutionIntelligentImporter *ii; - - ii = gtk_type_new (evolution_intelligent_importer_get_type ()); - evolution_intelligent_importer_construct (ii, can_import_fn, - import_data_fn, importername, - message, closure); - return ii; -} - -BONOBO_X_TYPE_FUNC_FULL (EvolutionIntelligentImporter, - GNOME_Evolution_IntelligentImporter, - PARENT_TYPE, - evolution_intelligent_importer); diff --git a/shell/importer/evolution-intelligent-importer.h b/shell/importer/evolution-intelligent-importer.h deleted file mode 100644 index 4d2a4e849d..0000000000 --- a/shell/importer/evolution-intelligent-importer.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-intelligent-importer.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Iain Holmes - */ - -#ifndef EVOLUTION_INTELLIGENT_IMPORTER_H -#define EVOLUTION_INTELLIGENT_IMPORTER_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_INTELLIGENT_IMPORTER (evolution_intelligent_importer_get_type ()) -#define EVOLUTION_INTELLIGENT_IMPORTER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporter)) -#define EVOLUTION_INTELLIGENT_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporterClass)) -#define EVOLUTION_IS_INTELLIGENT_IMPORTER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER)) -#define EVOLUTION_IS_INTELLIGENT_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER)) - -typedef struct _EvolutionIntelligentImporter EvolutionIntelligentImporter; -typedef struct _EvolutionIntelligentImporterPrivate EvolutionIntelligentImporterPrivate; -typedef struct _EvolutionIntelligentImporterClass EvolutionIntelligentImporterClass; - -typedef gboolean (* EvolutionIntelligentImporterCanImportFn) (EvolutionIntelligentImporter *ii, - void *closure); -typedef void (* EvolutionIntelligentImporterImportDataFn) (EvolutionIntelligentImporter *ii, - void *closure); - -struct _EvolutionIntelligentImporter { - BonoboXObject parent; - - EvolutionIntelligentImporterPrivate *priv; -}; - -struct _EvolutionIntelligentImporterClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_IntelligentImporter__epv epv; -}; - -GtkType evolution_intelligent_importer_get_type (void); - -EvolutionIntelligentImporter *evolution_intelligent_importer_new (EvolutionIntelligentImporterCanImportFn can_import_fn, - EvolutionIntelligentImporterImportDataFn import_data_fn, - const char *importername, - const char *message, - void *closure); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/shell/importer/import.glade b/shell/importer/import.glade deleted file mode 100644 index c3d858fbbf..0000000000 --- a/shell/importer/import.glade +++ /dev/null @@ -1,91 +0,0 @@ - - - - - import - import - - . - ../../art - C - True - True - False - False - False - - - - GtkWindow - importwizard - False - Evolution Importer Assistant - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - - - GnomeDruid - druid1 - - - GnomeDruidPageStart - page1 - Evolution Import Assistant - Welcome to the Evolution Import Assistant. -With this assistant you will be guided through the process of -importing external files into Evolution. - 255,255,255 - 0,0,0 - 1,1,1 - 1,1,1 - 255,255,255 - import.png - - - - GnomeDruidPageStandard - page2 - Select a File (step 1 of 2) - 255,255,255 - 1,1,1 - 1,1,1 - import.png - - - GtkVBox - GnomeDruidPageStandard:vbox - druid-vbox1 - False - 0 - - 0 - True - True - - - - Placeholder - - - - - - GnomeDruidPageFinish - page3 - Import File (Step 2 of 2) - Click "Import" to begin importing the file into Evolution. - 1,1,1 - 1,1,1 - 255,255,255 - 0,0,0 - 255,255,255 - import.png - - - - - diff --git a/shell/importer/intelligent.c b/shell/importer/intelligent.c deleted file mode 100644 index 28fcd9a00f..0000000000 --- a/shell/importer/intelligent.c +++ /dev/null @@ -1,487 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* intelligent.c - * - * Authors: - * Iain Holmes - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "intelligent.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include "intelligent.h" -#include "GNOME_Evolution_Importer.h" - -/* Prototypes */ - -void intelligent_importer_init (void); - -/* End prototypes */ - -typedef struct { - CORBA_Object object; - Bonobo_Control control; - GtkWidget *widget; - - char *name; - char *blurb; - char *iid; -} IntelligentImporterData; - -typedef struct { - GtkWidget *dialog; - GtkWidget *placeholder; - GtkWidget *clist; - BonoboWidget *current; - - GList *importers; - - int running; -} IntelligentImporterDialog; - -typedef struct { - CORBA_Object importer; - char *iid; -} SelectedImporterData; - -static void -free_importer_dialog (IntelligentImporterDialog *d) -{ - GList *l; - - for (l = d->importers; l; l = l->next) { - CORBA_Environment ev; - IntelligentImporterData *data; - - data = l->data; - - CORBA_exception_init (&ev); - if (data->object != CORBA_OBJECT_NIL) - bonobo_object_release_unref (data->object, &ev); - - g_free (data->iid); - g_free (data->name); - g_free (data->blurb); - g_free (data); - } - - g_list_free (d->importers); - gtk_widget_destroy (d->dialog); - g_free (d); -} - -static void -start_importers (GList *selected) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - for (; selected; selected = selected->next) { - SelectedImporterData *selection = selected->data; - - GNOME_Evolution_IntelligentImporter_importData (selection->importer, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Error importing %s\n%s", selection->iid, - CORBA_exception_id (&ev)); - } - } - CORBA_exception_free (&ev); -} - -static GList * -get_intelligent_importers (void) -{ - OAF_ServerInfoList *info_list; - GList *iids_ret = NULL; - CORBA_Environment ev; - int i; - - CORBA_exception_init (&ev); - info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:1.0')", NULL, &ev); - CORBA_exception_free (&ev); - - for (i = 0; i < info_list->_length; i++) { - const OAF_ServerInfo *info; - - info = info_list->_buffer + i; - iids_ret = g_list_prepend (iids_ret, g_strdup (info->iid)); - } - - return iids_ret; -} - -static void -select_row_cb (GtkCList *clist, - int row, - int column, - GdkEvent *ev, - IntelligentImporterDialog *d) -{ - gtk_notebook_set_page (GTK_NOTEBOOK (d->placeholder), row); -} - -static void -unselect_row_cb (GtkCList *clist, - int row, - int column, - GdkEvent *ev, - IntelligentImporterDialog *d) -{ - gtk_notebook_set_page (GTK_NOTEBOOK (d->placeholder), d->running); -} - -static IntelligentImporterDialog * -create_gui (GList *importers) -{ - GtkWidget *dialog, *clist, *sw, *label; - GtkWidget *hbox, *vbox, *dummy; - IntelligentImporterDialog *d; - GList *l; - int running = 0; - - d = g_new (IntelligentImporterDialog, 1); - d->dialog = dialog = gnome_dialog_new (_("Importers"), - NULL); - gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog), - _("Import"), - GNOME_STOCK_PIXMAP_CONVERT); - gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog), - _("Don't import"), - GNOME_STOCK_BUTTON_NO); - gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog), _("Don't ask me again"), - GNOME_STOCK_BUTTON_CANCEL); - - gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE); - d->importers = NULL; - d->current = NULL; - - d->clist = clist = gtk_clist_new (1); - gtk_clist_set_selection_mode (GTK_CLIST (d->clist), GTK_SELECTION_MULTIPLE); - - label = gtk_label_new (_("Evolution can import data from the following files:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, .5); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, - TRUE, TRUE, 0); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), hbox, - TRUE, TRUE, 0); - - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_widget_set_usize (sw, 300, 150); - gtk_container_add (GTK_CONTAINER (sw), clist); - gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 2); - gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - - d->placeholder = gtk_notebook_new (); - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (d->placeholder), FALSE); - gtk_box_pack_start (GTK_BOX (vbox), d->placeholder, TRUE, TRUE, 0); - - for (l = importers; l; l = l->next) { - IntelligentImporterData *data; - CORBA_Environment ev; - gboolean dontaskagain, can_run; - char *text[1], *prefix; - - /* Check if we want to show this one again */ - prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", gnome_util_user_home ()); - gnome_config_push_prefix (prefix); - g_free (prefix); - - dontaskagain = gnome_config_get_bool (l->data); - gnome_config_pop_prefix (); - - if (dontaskagain) - continue; - - data = g_new0 (IntelligentImporterData, 1); - data->iid = g_strdup (l->data); - - CORBA_exception_init (&ev); - data->object = oaf_activate_from_id ((char *) data->iid, 0, - NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not start %s: %s", data->iid, - CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - - /* Clean up the IntelligentImporterData */ - g_free (data->iid); - g_free (data); - continue; - } - - CORBA_exception_free (&ev); - if (data->object == CORBA_OBJECT_NIL) { - g_warning ("Could not activate_component %s", data->iid); - g_free (data->iid); - g_free (data); - continue; - } - - CORBA_exception_init (&ev); - can_run = GNOME_Evolution_IntelligentImporter_canImport (data->object, - &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not get canImport(%s): %s", - data->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data); - continue; - } - CORBA_exception_free (&ev); - - if (can_run == FALSE) { - CORBA_exception_init (&ev); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data); - continue; - } - - running++; - - data->name = g_strdup (GNOME_Evolution_IntelligentImporter__get_importername (data->object, &ev)); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not get name(%s): %s", - data->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data); - continue; - } - - data->blurb = g_strdup (GNOME_Evolution_IntelligentImporter__get_message (data->object, &ev)); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not get message(%s): %s", - data->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data->name); - g_free (data); - continue; - } - - data->control = Bonobo_Unknown_queryInterface (data->object, - "IDL:Bonobo/Control:1.0", &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not QI for Bonobo/Control:1.0 %s:%s", - data->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data->name); - g_free (data->blurb); - continue; - } - if (data->control != CORBA_OBJECT_NIL) { - data->widget = bonobo_widget_new_control_from_objref (data->control, CORBA_OBJECT_NIL); - /* Ref this widget so even if we remove it from the - containers it will always have an extra ref. */ - gtk_widget_show (data->widget); - gtk_widget_ref (data->widget); - } else { - data->widget = gtk_label_new (""); - } - - CORBA_exception_free (&ev); - - d->importers = g_list_prepend (d->importers, data); - gtk_notebook_prepend_page (GTK_NOTEBOOK (d->placeholder), - data->widget, NULL); - text[0] = data->name; - gtk_clist_prepend (GTK_CLIST (clist), text); - } - - d->running = running; - dummy = gtk_drawing_area_new (); - gtk_widget_show (dummy); - gtk_notebook_append_page (GTK_NOTEBOOK (d->placeholder), - dummy, NULL); - /* Set the start to the blank page */ - gtk_notebook_set_page (GTK_NOTEBOOK (d->placeholder), running); - - gtk_signal_connect (GTK_OBJECT (clist), "select-row", - GTK_SIGNAL_FUNC (select_row_cb), d); - gtk_signal_connect (GTK_OBJECT (clist), "unselect-row", - GTK_SIGNAL_FUNC (unselect_row_cb), d); - - gtk_widget_show_all (GNOME_DIALOG (dialog)->vbox); - return d; -} - -void -intelligent_importer_init (void) -{ - GList *importers, *l, *selected = NULL; - IntelligentImporterDialog *d; - char *prefix; - gboolean dontaskagain; - - prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", gnome_util_user_home ()); - gnome_config_push_prefix (prefix); - g_free (prefix); - - dontaskagain = gnome_config_get_bool ("Dontaskagain=False"); - gnome_config_pop_prefix (); - - if (dontaskagain) { - return; - } - - importers = get_intelligent_importers (); - if (importers == NULL) - return; /* No intelligent importers. Easy :) */ - - d = create_gui (importers); - if (d->running == 0) { - free_importer_dialog (d); - return; /* No runnable intelligent importers. */ - } - - switch (gnome_dialog_run_and_close (GNOME_DIALOG (d->dialog))) { - case 0: /* Okay button */ - /* Make a list of the importers */ - - /* FIXME: Sort this list and don't do it a slow way */ - for (l = GTK_CLIST (d->clist)->selection; l; l = l->next) { - IntelligentImporterData *data; - SelectedImporterData *new_data; - CORBA_Environment ev; - char *iid; - - data = g_list_nth_data (d->importers, GPOINTER_TO_INT (l->data)); - iid = g_strdup (data->iid); - - new_data = g_new (SelectedImporterData, 1); - new_data->iid = iid; - - /* Reference the remote object, and duplicate the - local one. */ - CORBA_exception_init (&ev); - new_data->importer = bonobo_object_dup_ref (data->object, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Error duplicating %s\n%s", iid, - CORBA_exception_id (&ev)); - g_free (iid); - CORBA_exception_free (&ev); - g_free (new_data); - continue; - } - CORBA_exception_free (&ev); - - selected = g_list_prepend (selected, new_data); - } - - /* Now destroy all the importers, as we've kept references to - the ones we need */ - free_importer_dialog (d); - - if (selected != NULL) { - /* Restart the selected ones */ - start_importers (selected); - - /* Free the selected list */ - for (l = selected; l; l = l->next) { - CORBA_Environment ev; - SelectedImporterData *selection = l->data; - - CORBA_exception_init (&ev); - bonobo_object_release_unref (selection->importer, &ev); - CORBA_exception_free (&ev); - - g_free (selection->iid); - g_free (selection); - } - g_list_free (selected); - } - - break; - - case 1: /* No button */ - free_importer_dialog (d); - break; - - case 2: /* Dont ask again */ - prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", - gnome_util_user_home ()); - gnome_config_push_prefix (prefix); - g_free (prefix); - - gnome_config_set_bool ("Dontaskagain", TRUE); - gnome_config_pop_prefix (); - - gnome_config_sync (); - gnome_config_drop_all (); - g_print ("Not asking again"); - free_importer_dialog (d); - break; - - default: - free_importer_dialog (d); - break; - } - - g_list_free (importers); -} diff --git a/shell/importer/intelligent.h b/shell/importer/intelligent.h deleted file mode 100644 index 5e1523a8e1..0000000000 --- a/shell/importer/intelligent.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* importer.c - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Kjartan Maraas - */ - -#ifndef __INTELLIGENT_H__ -#define __INTELLIGENT_H__ - -void intelligent_importer_init (void); - -#endif -- cgit v1.2.3