aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-05-23 18:15:30 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-05-23 18:15:30 +0800
commitd00e525efc8be034cd2009100258680a62a87202 (patch)
tree7bd885b5dc38cc1ca530f400aa58943ef39a0211
parent84844abe322120292b1d2e0e8978046e1c550bfe (diff)
downloadgsoc2013-evolution-d00e525efc8be034cd2009100258680a62a87202.tar
gsoc2013-evolution-d00e525efc8be034cd2009100258680a62a87202.tar.gz
gsoc2013-evolution-d00e525efc8be034cd2009100258680a62a87202.tar.bz2
gsoc2013-evolution-d00e525efc8be034cd2009100258680a62a87202.tar.lz
gsoc2013-evolution-d00e525efc8be034cd2009100258680a62a87202.tar.xz
gsoc2013-evolution-d00e525efc8be034cd2009100258680a62a87202.tar.zst
gsoc2013-evolution-d00e525efc8be034cd2009100258680a62a87202.zip
Get rid of the old `evolution-service-repository' cruft and start
implementing new CORBA storage interfaces for the shell. svn path=/trunk/; revision=3178
-rw-r--r--.cvsignore25
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/Makefile.am1
-rw-r--r--mail/folder-browser-factory.c51
-rw-r--r--shell/ChangeLog36
-rw-r--r--shell/Evolution-Shell.idl18
-rw-r--r--shell/Evolution-ShellComponent.idl17
-rw-r--r--shell/Evolution-Storage.idl53
-rw-r--r--shell/Evolution.idl13
-rw-r--r--shell/Makefile.am18
-rw-r--r--shell/e-corba-storage-registry.c236
-rw-r--r--shell/e-corba-storage-registry.h73
-rw-r--r--shell/e-corba-storage.c349
-rw-r--r--shell/e-corba-storage.h76
-rw-r--r--shell/e-folder-type-repository.c2
-rw-r--r--shell/e-folder.c2
-rw-r--r--shell/e-shell-view-menu.c2
-rw-r--r--shell/e-shell.c113
-rw-r--r--shell/e-shell.h22
-rw-r--r--shell/e-storage-set.h3
-rw-r--r--shell/e-storage.c36
-rw-r--r--shell/e-storage.h13
-rw-r--r--shell/evolution-service-repository.c279
-rw-r--r--shell/evolution-service-repository.h66
-rw-r--r--shell/evolution-service-repository.idl21
25 files changed, 1046 insertions, 487 deletions
diff --git a/.cvsignore b/.cvsignore
index 2f7f5151f9..94e9b857b3 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,21 +1,24 @@
+ABOUT-NLS
+Makefile
Makefile.in
aclocal.m4
-configure
+config.cache
config.guess
-config.sub
-ltconfig
-ltmain.sh
+config.h
config.h.in
config.log
-config.h
-config.cache
-libtool
config.status
+config.sub
+configure
+install-sh
+intl
+libtool
+ltconfig
+ltmain.sh
+missing
+mkinstalldirs
stamp-h
-Makefile
-stamp.h
stamp-h.in
+stamp.h
xlibtool
xltmain.sh
-intl
-ABOUT-NLS \ No newline at end of file
diff --git a/mail/ChangeLog b/mail/ChangeLog
index d167dbc7b2..d795771850 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2000-05-23 Ettore Perazzoli <ettore@helixcode.com>
+
+ * Makefile.am: Don't link to `evolution-service-repository.o'
+ anymore.
+
+ * folder-browser-factory.c: Don't use crufty service-repository
+ anymore.
+
2000-05-21 Ettore Perazzoli <ettore@helixcode.com>
* message-list.c (get_message_info): Made static.
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 700fb60eb6..1fdb0d3e73 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -51,7 +51,6 @@ evolution_mail_LDADD = \
../shell/Evolution-common.o \
../shell/Evolution-stubs.o \
../shell/Evolution-skels.o \
- ../shell/evolution-service-repository.o \
../composer/libcomposer.la \
../widgets/e-table/libetable.a \
../widgets/e-text/libetext.a \
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index e46e51df52..de9d9ff06e 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -18,7 +18,6 @@
#include "folder-browser.h"
#include "mail.h"
#include "shell/Evolution.h"
-#include "shell/evolution-service-repository.h"
#ifdef USING_OAF
#define CONTROL_FACTORY_ID "OAFIID:control-factory:evolution-mail:25902062-543b-4f44-8702-d90145fcdbf2"
@@ -27,49 +26,6 @@
#endif
static void
-folder_browser_set_shell (EvolutionServiceRepository *sr,
- Evolution_Shell shell,
- void *closure)
-{
- FolderBrowser *folder_browser;
- CORBA_Environment ev;
-
- g_return_if_fail (closure);
- g_return_if_fail (IS_FOLDER_BROWSER (closure));
- g_return_if_fail (shell != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- folder_browser = FOLDER_BROWSER (closure);
-
- folder_browser->shell = shell;
-
- /* test the component->shell registration */
- Evolution_Shell_register_service (shell, Evolution_Shell_MAIL_STORE, "a_service", &ev);
-
- CORBA_exception_free (&ev);
-}
-
-static void
-folder_browser_control_add_service_repository_interface (BonoboControl *control,
- GtkWidget *folder_browser)
-{
- EvolutionServiceRepository *sr;
-
- /*
- * create an implementation for the Evolution::ServiceRepository
- * interface
- */
- sr = evolution_service_repository_new (folder_browser_set_shell,
- (void *)folder_browser);
-
- /* add the interface to the control */
- bonobo_object_add_interface (BONOBO_OBJECT (control),
- BONOBO_OBJECT (sr));
-}
-
-
-static void
random_cb (GtkWidget *button, gpointer user_data)
{
printf ("Yow! I am called back!\n");
@@ -204,13 +160,6 @@ folder_browser_factory (BonoboGenericFactory *factory, void *closure)
bonobo_control_set_property_bag (control,
FOLDER_BROWSER (folder_browser)->properties);
- /* for the moment, the control has the ability to register
- * some services itself, but this should not last.
- *
- * It's not the way to do it, but we don't have the
- * correct infrastructure in the shell now.
- */
- folder_browser_control_add_service_repository_interface (control, folder_browser);
return BONOBO_OBJECT (control);
}
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 395510285b..cb23544111 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,39 @@
+2000-05-23 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-shell.c: New member `corba_storage_registry' in
+ `EShellPrivate'.
+ (init): Initialize it to NULL.
+ (destroy): Unref it if not NULL.
+ (setup_corba_storages): New function to set up the CORBA storage
+ registry and `bonobo_object_add_interface()' it to the shell.
+ (setup_storages): Call it from here.
+
+ * e-shell.h, e-shell.c: Derive EShell from BonoboObject instead of
+ GtkObject.
+
+ * e-storage.c (e_storage_remove_folder): Return value changed into
+ `gboolean'; return false if an error occurs, true otherwise.
+ (e_storage_new_folder): Likewise.
+
+ * e-corba-storage-registry.c: New.
+ * e-corba-storage-registry.h: New.
+
+ * e-corba-storage.c: New.
+ * e-corba-storage.h: New.
+
+ * Evolution.idl: Include the new IDLs, but no
+ `evolution-service-repository.idl' anymore.
+
+ * Evolution-Shell.idl: New.
+ * Evolution-ShellComponent.idl: New.
+ * Evolution-Storage.idl: New.
+
+ * evolution-service-repository.idl: Removed.
+ * evolution-service-repository.c: Removed.
+ * evolution-service-repository.h: Removed.
+
+ * e-folder-type-repository.c (folder_type_new): Free `icon_path'.
+
2000-05-18 Dan Winship <danw@helixcode.com>
* main.c (new_view_idle_cb): add development_warning (moved from
diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl
new file mode 100644
index 0000000000..496fdd8a27
--- /dev/null
+++ b/shell/Evolution-Shell.idl
@@ -0,0 +1,18 @@
+/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Interface for the Evolution shell.
+ *
+ * Authors:
+ * Ettore Perazzoli <ettore@helixcode.com>
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ */
+
+#include <Bonobo.idl>
+
+module Evolution {
+ interface Shell : Bonobo::Unknown {
+ /* Nothing for now. */
+ void dummy_method ();
+ };
+};
diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl
new file mode 100644
index 0000000000..9a4624010e
--- /dev/null
+++ b/shell/Evolution-ShellComponent.idl
@@ -0,0 +1,17 @@
+/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Interface for the Evolution components.
+ *
+ * Authors:
+ * Ettore Perazzoli <ettore@helixcode.com>
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ */
+
+#include <Bonobo.h>
+
+module Evolution {
+ interface ShellComponent : Bonobo::Unknown {
+ void set_shell (in Shell shell);
+ };
+};
diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl
new file mode 100644
index 0000000000..d88db2f152
--- /dev/null
+++ b/shell/Evolution-Storage.idl
@@ -0,0 +1,53 @@
+/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Storage interface for the Evolution shell.
+ *
+ * Authors:
+ * Ettore Perazzoli <ettore@helixcode.com>
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ */
+
+#include <Bonobo.h>
+
+module Evolution {
+ struct Folder {
+ string type;
+ string description;
+ string name;
+ string physical_uri;
+ };
+
+ interface Storage;
+ interface StorageListener;
+
+ interface Storage : Bonobo::Unknown {
+ attribute string name;
+
+ void set_listener (in StorageListener storage_listener);
+ };
+
+ interface StorageListener {
+ exception Exists {};
+ exception NotFound {};
+
+ void destroyed ();
+
+ void new_folder (in string path, in Folder folder)
+ raises (Exists);
+
+ void removed_folder (in string path)
+ raises (NotFound);
+ };
+
+ interface StorageRegistry : Bonobo::Unknown {
+ exception Exists {};
+ exception NotFound {};
+
+ StorageListener register_storage (in Storage storage, in string name)
+ raises (Exists);
+
+ void unregister_storage (in string name)
+ raises (NotFound);
+ };
+};
diff --git a/shell/Evolution.idl b/shell/Evolution.idl
index c9026e2083..80a45eedc1 100644
--- a/shell/Evolution.idl
+++ b/shell/Evolution.idl
@@ -1,14 +1,15 @@
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
/*
- * CORBA interface for the Evolution shell
+ * CORBA interface for the Evolution shell.
*
* Authors:
- * Miguel de Icaza (miguel@kernel.org)
+ * Ettore Perazzoli <ettore@helixcode.com>
*
- * (C) 2000 Helix Code, Inc.
+ * Copyright (C) 2000 Helix Code, Inc.
*/
+
#include <Bonobo.idl>
-#include <Shell.idl>
-#include <evolution-service-repository.idl>
+#include <Evolution-Storage.idl>
+#include <Evolution-Shell.idl>
+#include <Evolution-ShellComponent.idl>
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 607d827396..a62fb41abd 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -21,8 +21,18 @@ EVOLUTION_CORBA_GENERATED = \
CLEANFILES = $(EVOLUTION_CORBA_GENERATED)
+IDLS = \
+ Evolution.idl \
+ Evolution-Shell.idl \
+ Evolution-ShellComponent.idl \
+ Evolution-Storage.idl
+
evolution_SOURCES = \
$(EVOLUTION_CORBA_GENERATED) \
+ e-corba-storage.c \
+ e-corba-storage.h \
+ e-corba-storage-registry.c \
+ e-corba-storage-registry.h \
e-folder-type-repository.c \
e-folder-type-repository.h \
e-folder.c \
@@ -54,13 +64,11 @@ evolution_SOURCES = \
e-storage-watcher.h \
e-storage.c \
e-storage.h \
- evolution-service-repository.c \
- evolution-service-repository.h \
main.c
Evolution-impl.o: Evolution.h
-$(EVOLUTION_CORBA_GENERATED): Evolution.idl evolution-service-repository.idl
+$(EVOLUTION_CORBA_GENERATED): $(IDLS)
$(ORBIT_IDL) -I$(datadir)/idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Evolution.idl
evolution_LDADD = \
@@ -70,9 +78,7 @@ evolution_LDADD = \
$(top_builddir)/e-util/libeutil.la \
$(BONOBO_GNOME_LIBS)
-EXTRA_DIST = Evolution.idl \
- Shell.idl \
- evolution-service-repository.idl
+EXTRA_DIST = $(IDLS)
if ENABLE_PURIFY
PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c
new file mode 100644
index 0000000000..51f845ea38
--- /dev/null
+++ b/shell/e-corba-storage-registry.c
@@ -0,0 +1,236 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-corba-storage-registry.c
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-util/e-util.h"
+
+#include "e-corba-storage.h"
+
+#include "e-corba-storage-registry.h"
+
+
+#define PARENT_TYPE BONOBO_OBJECT_TYPE
+static BonoboObjectClass *parent_class = NULL;
+
+struct _ECorbaStorageRegistryPrivate {
+ EStorageSet *storage_set;
+};
+
+
+/* CORBA interface implementation. */
+
+static POA_Evolution_StorageRegistry__vepv storage_registry_vepv;
+
+static POA_Evolution_StorageRegistry *
+create_servant (void)
+{
+ POA_Evolution_StorageRegistry *servant;
+ CORBA_Environment ev;
+
+ servant = (POA_Evolution_StorageRegistry *) g_new0 (BonoboObjectServant, 1);
+ servant->vepv = &storage_registry_vepv;
+
+ CORBA_exception_init (&ev);
+
+ POA_Evolution_StorageRegistry__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;
+}
+
+static Evolution_StorageListener
+impl_StorageRegistry_register_storage (PortableServer_Servant servant,
+ const Evolution_Storage storage_interface,
+ const CORBA_char *name,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ ECorbaStorageRegistry *storage_registry;
+ ECorbaStorageRegistryPrivate *priv;
+ EStorage *storage;
+ Evolution_StorageListener listener_interface;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object);
+ priv = storage_registry->priv;
+
+ storage = e_corba_storage_new (storage_interface, name);
+
+ /* FIXME check failure. */
+ e_storage_set_add_storage (priv->storage_set, storage);
+
+ listener_interface = CORBA_Object_duplicate (e_corba_storage_get_StorageListener
+ (E_CORBA_STORAGE (storage)), ev);
+
+ return listener_interface;
+}
+
+static void
+impl_StorageRegistry_unregister_storage (PortableServer_Servant servant,
+ const CORBA_char *name,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ ECorbaStorageRegistry *storage_registry;
+ ECorbaStorageRegistryPrivate *priv;
+ EStorage *storage;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object);
+ priv = storage_registry->priv;
+
+ storage = e_storage_set_get_storage (priv->storage_set, name);
+ if (storage == NULL) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Evolution_StorageRegistry_NotFound,
+ NULL);
+ return;
+ }
+
+ /* FIXME: Yucky to get the storage by name and then remove it. */
+ /* FIXME: Check failure. */
+ e_storage_set_remove_storage (priv->storage_set, storage);
+}
+
+
+/* GtkObject methods. */
+
+static void
+destroy (GtkObject *object)
+{
+ ECorbaStorageRegistry *corba_storage_registry;
+ ECorbaStorageRegistryPrivate *priv;
+
+ corba_storage_registry = E_CORBA_STORAGE_REGISTRY (object);
+ priv = corba_storage_registry->priv;
+
+ if (priv->storage_set != NULL)
+ gtk_object_unref (GTK_OBJECT (priv->storage_set));
+ g_free (priv);
+
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+
+/* Initialization. */
+
+static void
+corba_class_init (void)
+{
+ POA_Evolution_StorageRegistry__vepv *vepv;
+ POA_Evolution_StorageRegistry__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_Evolution_StorageRegistry__epv, 1);
+ epv->register_storage = impl_StorageRegistry_register_storage;
+ epv->unregister_storage = impl_StorageRegistry_unregister_storage;
+
+ vepv = &storage_registry_vepv;
+ vepv->_base_epv = base_epv;
+ vepv->Evolution_StorageRegistry_epv = epv;
+}
+
+static void
+class_init (ECorbaStorageRegistryClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = destroy;
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ corba_class_init ();
+}
+
+static void
+init (ECorbaStorageRegistry *corba_storage_registry)
+{
+ ECorbaStorageRegistryPrivate *priv;
+
+ priv = g_new (ECorbaStorageRegistryPrivate, 1);
+ priv->storage_set = NULL;
+
+ corba_storage_registry->priv = priv;
+}
+
+
+void
+e_corba_storage_registry_construct (ECorbaStorageRegistry *corba_storage_registry,
+ Evolution_StorageRegistry corba_object,
+ EStorageSet *storage_set)
+{
+ ECorbaStorageRegistryPrivate *priv;
+
+ g_return_if_fail (corba_storage_registry != NULL);
+ g_return_if_fail (E_IS_CORBA_STORAGE_REGISTRY (corba_storage_registry));
+ g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
+
+ bonobo_object_construct (BONOBO_OBJECT (corba_storage_registry), corba_object);
+
+ priv = corba_storage_registry->priv;
+
+ gtk_object_ref (GTK_OBJECT (storage_set));
+ priv->storage_set = storage_set;
+}
+
+ECorbaStorageRegistry *
+e_corba_storage_registry_new (EStorageSet *storage_set)
+{
+ ECorbaStorageRegistry *corba_storage_registry;
+ POA_Evolution_StorageRegistry *servant;
+ Evolution_StorageRegistry corba_object;
+
+ g_return_val_if_fail (storage_set != NULL, NULL);
+ g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL);
+
+ servant = create_servant ();
+ if (servant == NULL)
+ return NULL;
+
+ corba_storage_registry = gtk_type_new (e_corba_storage_registry_get_type ());
+
+ corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (corba_storage_registry),
+ servant);
+
+ e_corba_storage_registry_construct (corba_storage_registry, corba_object, storage_set);
+
+ return corba_storage_registry;
+}
+
+
+E_MAKE_TYPE (e_corba_storage_registry, "ECorbaStorageRegistry", ECorbaStorageRegistry, class_init, init, PARENT_TYPE)
diff --git a/shell/e-corba-storage-registry.h b/shell/e-corba-storage-registry.h
new file mode 100644
index 0000000000..baf689c551
--- /dev/null
+++ b/shell/e-corba-storage-registry.h
@@ -0,0 +1,73 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-corba-storage-registry.h
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+#ifndef __E_CORBA_STORAGE_REGISTRY_H__
+#define __E_CORBA_STORAGE_REGISTRY_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <bonobo/bonobo-object.h>
+
+#include "Evolution.h"
+#include "e-storage-set.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define E_TYPE_CORBA_STORAGE_REGISTRY (e_corba_storage_registry_get_type ())
+#define E_CORBA_STORAGE_REGISTRY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CORBA_STORAGE_REGISTRY, ECorbaStorageRegistry))
+#define E_CORBA_STORAGE_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CORBA_STORAGE_REGISTRY, ECorbaStorageRegistryClass))
+#define E_IS_CORBA_STORAGE_REGISTRY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CORBA_STORAGE_REGISTRY))
+#define E_IS_CORBA_STORAGE_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_CORBA_STORAGE_REGISTRY))
+
+
+typedef struct _ECorbaStorageRegistry ECorbaStorageRegistry;
+typedef struct _ECorbaStorageRegistryPrivate ECorbaStorageRegistryPrivate;
+typedef struct _ECorbaStorageRegistryClass ECorbaStorageRegistryClass;
+
+struct _ECorbaStorageRegistry {
+ BonoboObject parent;
+
+ ECorbaStorageRegistryPrivate *priv;
+};
+
+struct _ECorbaStorageRegistryClass {
+ BonoboObjectClass parent_class;
+};
+
+
+GtkType e_corba_storage_registry_get_type (void);
+void e_corba_storage_registry_construct (ECorbaStorageRegistry *corba_storage_registry,
+ Evolution_StorageRegistry corba_object,
+ EStorageSet *storage_set);
+ECorbaStorageRegistry *e_corba_storage_registry_new (EStorageSet *storage_set);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __E_CORBA_STORAGE_REGISTRY_H__ */
diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c
new file mode 100644
index 0000000000..4048a6d272
--- /dev/null
+++ b/shell/e-corba-storage.c
@@ -0,0 +1,349 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-corba-storage.c
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <bonobo.h>
+
+#include "e-util/e-util.h"
+
+#include "Evolution.h"
+
+#include "e-corba-storage.h"
+
+
+#define PARENT_TYPE E_TYPE_STORAGE
+static EStorageClass *parent_class = NULL;
+
+typedef struct _StorageListenerServant StorageListenerServant;
+
+struct _ECorbaStoragePrivate {
+ char *name;
+
+ Evolution_Storage storage_interface;
+
+ /* The Evolution::StorageListener interface we expose. */
+
+ Evolution_StorageListener storage_listener_interface;
+ StorageListenerServant *storage_listener_servant;
+};
+
+
+/* Implementation of the CORBA Evolution::StorageListener interface. */
+
+static POA_Evolution_StorageListener__vepv storage_listener_vepv;
+
+struct _StorageListenerServant {
+ POA_Evolution_StorageListener servant;
+ EStorage *storage;
+};
+
+static StorageListenerServant *
+storage_listener_servant_new (ECorbaStorage *corba_storage)
+{
+ StorageListenerServant *servant;
+
+ servant = g_new0 (StorageListenerServant, 1);
+
+ servant->servant.vepv = &storage_listener_vepv;
+
+ gtk_object_ref (GTK_OBJECT (corba_storage));
+ servant->storage = E_STORAGE (corba_storage);
+
+ return servant;
+}
+
+static void
+storage_listener_servant_free (StorageListenerServant *servant)
+{
+ gtk_object_unref (GTK_OBJECT (servant->storage));
+
+ g_free (servant);
+}
+
+#if 0
+static void
+impl_StorageListener_destroy (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ /* FIXME */
+}
+#endif
+
+static void
+impl_StorageListener_new_folder (PortableServer_Servant servant,
+ const CORBA_char *path,
+ const Evolution_Folder *folder,
+ CORBA_Environment *ev)
+{
+ StorageListenerServant *storage_listener_servant;
+ EStorage *storage;
+ EFolder *e_folder;
+
+ storage_listener_servant = (StorageListenerServant *) servant;
+ storage = storage_listener_servant->storage;
+
+ e_folder = e_folder_new (folder->name,
+ folder->type,
+ folder->description);
+
+ if (! e_storage_new_folder (storage, path, e_folder)) {
+ CORBA_exception_set (ev,
+ CORBA_USER_EXCEPTION,
+ ex_Evolution_StorageListener_Exists,
+ NULL);
+ gtk_object_unref (GTK_OBJECT (e_folder));
+ }
+}
+
+static void
+impl_StorageListener_removed_folder (PortableServer_Servant servant,
+ const CORBA_char *path,
+ CORBA_Environment *ev)
+{
+ StorageListenerServant *storage_listener_servant;
+ EStorage *storage;
+
+ storage_listener_servant = (StorageListenerServant *) servant;
+ storage = storage_listener_servant->storage;
+
+ if (! e_storage_remove_folder (storage, path))
+ CORBA_exception_set (ev,
+ CORBA_USER_EXCEPTION,
+ ex_Evolution_StorageListener_NotFound,
+ NULL);
+}
+
+
+static gboolean
+setup_storage_listener (ECorbaStorage *corba_storage)
+{
+ StorageListenerServant *servant;
+ ECorbaStoragePrivate *priv;
+ Evolution_StorageListener storage_listener_interface;
+ CORBA_Environment ev;
+
+ priv = corba_storage->priv;
+
+ servant = storage_listener_servant_new (corba_storage);
+
+ CORBA_exception_init (&ev);
+
+ POA_Evolution_StorageListener__init (servant, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ goto error;
+
+ CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev));
+ if (ev._major != CORBA_NO_EXCEPTION)
+ goto error;
+
+ storage_listener_interface = PortableServer_POA_servant_to_reference (bonobo_poa (),
+ servant, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ goto error;
+
+ priv->storage_listener_interface = storage_listener_interface;
+ priv->storage_listener_servant = servant;
+
+ return TRUE;
+
+ error:
+ storage_listener_servant_free (servant);
+ CORBA_exception_free (&ev);
+ return FALSE;
+}
+
+
+/* GtkObject methods. */
+
+static void
+destroy (GtkObject *object)
+{
+ CORBA_Environment ev;
+ ECorbaStorage *corba_storage;
+ ECorbaStoragePrivate *priv;
+
+ corba_storage = E_CORBA_STORAGE (object);
+ priv = corba_storage->priv;
+
+ g_free (priv->name);
+
+ CORBA_exception_init (&ev);
+
+ if (priv->storage_interface != CORBA_OBJECT_NIL) {
+ Bonobo_Unknown_unref (priv->storage_interface, &ev);
+ CORBA_Object_release (priv->storage_interface, &ev);
+ }
+
+ if (priv->storage_listener_interface != CORBA_OBJECT_NIL)
+ CORBA_Object_release (priv->storage_listener_interface, &ev);
+
+ if (priv->storage_listener_servant != NULL) {
+ PortableServer_ObjectId *object_id;
+
+ object_id = PortableServer_POA_servant_to_id (bonobo_poa (), priv->storage_listener_servant,
+ &ev);
+ PortableServer_POA_deactivate_object (bonobo_poa (), object_id, &ev);
+
+ POA_Evolution_StorageListener__fini (priv->storage_listener_servant, &ev);
+ CORBA_free (object_id);
+ }
+
+ CORBA_exception_free (&ev);
+
+ g_free (priv);
+
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+
+/* EStorage methods. */
+
+static const char *
+get_name (EStorage *storage)
+{
+ ECorbaStorage *corba_storage;
+ ECorbaStoragePrivate *priv;
+
+ corba_storage = E_CORBA_STORAGE (storage);
+ priv = corba_storage->priv;
+
+ return priv->name;
+}
+
+
+static void
+corba_class_init (void)
+{
+ POA_Evolution_StorageListener__vepv *vepv;
+ POA_Evolution_StorageListener__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_Evolution_StorageListener__epv, 1);
+ epv->new_folder = impl_StorageListener_new_folder;
+ epv->removed_folder = impl_StorageListener_removed_folder;
+
+ vepv = &storage_listener_vepv;
+ vepv->_base_epv = base_epv;
+ vepv->Evolution_StorageListener_epv = epv;
+}
+
+static void
+class_init (ECorbaStorageClass *klass)
+{
+ GtkObjectClass *object_class;
+ EStorageClass *storage_class;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = destroy;
+
+ storage_class = E_STORAGE_CLASS (klass);
+ storage_class->get_name = get_name;
+
+ corba_class_init ();
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+}
+
+static void
+init (ECorbaStorage *corba_storage)
+{
+ ECorbaStoragePrivate *priv;
+
+ priv = g_new (ECorbaStoragePrivate, 1);
+ priv->name = NULL;
+ priv->storage_interface = CORBA_OBJECT_NIL;
+
+ corba_storage->priv = priv;
+}
+
+
+/* FIXME: OK to have a boolean construct function? */
+void
+e_corba_storage_construct (ECorbaStorage *corba_storage,
+ const Evolution_Storage storage_interface,
+ const char *name)
+{
+ ECorbaStoragePrivate *priv;
+ CORBA_Environment ev;
+
+ g_return_if_fail (corba_storage != NULL);
+ g_return_if_fail (E_IS_CORBA_STORAGE (corba_storage));
+ g_return_if_fail (storage_interface != CORBA_OBJECT_NIL);
+ g_return_if_fail (name != NULL);
+
+ e_storage_construct (E_STORAGE (corba_storage));
+
+ priv = corba_storage->priv;
+
+ priv->name = g_strdup (name);
+
+ CORBA_exception_init (&ev);
+
+ Bonobo_Unknown_ref (storage_interface, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("%s -- Cannot reference Bonobo object", __FUNCTION__);
+ } else {
+ priv->storage_interface = CORBA_Object_duplicate (storage_interface, &ev);
+ }
+
+ CORBA_exception_free (&ev);
+
+ setup_storage_listener (corba_storage);
+}
+
+EStorage *
+e_corba_storage_new (const Evolution_Storage storage_interface,
+ const char *name)
+{
+ EStorage *new;
+
+ g_return_val_if_fail (storage_interface != CORBA_OBJECT_NIL, NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ new = gtk_type_new (e_corba_storage_get_type ());
+
+ e_corba_storage_construct (E_CORBA_STORAGE (new), storage_interface, name);
+
+ return new;
+}
+
+
+const Evolution_StorageListener
+e_corba_storage_get_StorageListener (ECorbaStorage *corba_storage)
+{
+ g_return_val_if_fail (corba_storage != NULL, NULL);
+ g_return_val_if_fail (E_IS_CORBA_STORAGE (corba_storage), NULL);
+
+ return corba_storage->priv->storage_listener_interface;
+}
+
+
+E_MAKE_TYPE (e_corba_storage, "ECorbaStorage", ECorbaStorage, class_init, init, PARENT_TYPE)
diff --git a/shell/e-corba-storage.h b/shell/e-corba-storage.h
new file mode 100644
index 0000000000..99ab23e97e
--- /dev/null
+++ b/shell/e-corba-storage.h
@@ -0,0 +1,76 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-corba-storage.h
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+#ifndef __E_CORBA_STORAGE_H__
+#define __E_CORBA_STORAGE_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-storage.h"
+
+#include "Evolution.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define E_TYPE_CORBA_STORAGE (e_corba_storage_get_type ())
+#define E_CORBA_STORAGE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CORBA_STORAGE, ECorbaStorage))
+#define E_CORBA_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CORBA_STORAGE, ECorbaStorageClass))
+#define E_IS_CORBA_STORAGE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CORBA_STORAGE))
+#define E_IS_CORBA_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_CORBA_STORAGE))
+
+
+typedef struct _ECorbaStorage ECorbaStorage;
+typedef struct _ECorbaStoragePrivate ECorbaStoragePrivate;
+typedef struct _ECorbaStorageClass ECorbaStorageClass;
+
+struct _ECorbaStorage {
+ EStorage parent;
+
+ ECorbaStoragePrivate *priv;
+};
+
+struct _ECorbaStorageClass {
+ EStorageClass parent_class;
+};
+
+
+GtkType e_corba_storage_get_type (void);
+void e_corba_storage_construct (ECorbaStorage *corba_storage,
+ const Evolution_Storage storage_interface,
+ const char *name);
+EStorage *e_corba_storage_new (const Evolution_Storage storage_interface,
+ const char *name);
+
+/* FIXME: I don't like this call. */
+const Evolution_StorageListener e_corba_storage_get_StorageListener (ECorbaStorage *corba_storage);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __E_CORBA_STORAGE_H__ */
diff --git a/shell/e-folder-type-repository.c b/shell/e-folder-type-repository.c
index 3170f3173e..a1892657de 100644
--- a/shell/e-folder-type-repository.c
+++ b/shell/e-folder-type-repository.c
@@ -89,6 +89,8 @@ folder_type_new (const char *name,
else
new->icon_pixbuf = gdk_pixbuf_new_from_file (icon_path);
+ g_free (icon_path);
+
icon_path = e_shell_get_icon_path (icon_name, TRUE);
if (icon_path != NULL) {
new->mini_icon_pixbuf = gdk_pixbuf_new_from_file (icon_path);
diff --git a/shell/e-folder.c b/shell/e-folder.c
index c5be881180..722e865499 100644
--- a/shell/e-folder.c
+++ b/shell/e-folder.c
@@ -83,7 +83,7 @@ remove (EFolder *folder)
static const char *
get_physical_uri (EFolder *folder)
{
- g_warning ("`%s' does not implement `EFolder::remove()'",
+ g_warning ("`%s' does not implement `EFolder::get_physical_uri()'",
gtk_type_name (GTK_OBJECT_TYPE (folder)));
return NULL;
}
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index 42003a1e42..0bdb6e36f3 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -279,7 +279,7 @@ GnomeUIInfo e_shell_view_menu [] = {
{ GNOME_APP_UI_SUBTREE, N_("_Actions"), NULL, menu_actions },
GNOMEUIINFO_MENU_HELP_TREE (menu_help),
-#warning Should provide a help menu here; Bonobo needs it
+ /* FIXME: Should provide a help menu here; Bonobo needs it. */
GNOMEUIINFO_END
};
diff --git a/shell/e-shell.c b/shell/e-shell.c
index a0851af27a..19cdcdc596 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -28,8 +28,11 @@
#include <gtk/gtkobject.h>
#include <gtk/gtktypeutils.h>
+#include "Evolution.h"
+
#include "e-util/e-util.h"
+#include "e-corba-storage-registry.h"
#include "e-folder-type-repository.h"
#include "e-local-storage.h"
#include "e-shell-view.h"
@@ -39,8 +42,8 @@
#include "e-shell.h"
-#define PARENT_TYPE GTK_TYPE_OBJECT
-static GtkObjectClass *parent_class = NULL;
+#define PARENT_TYPE BONOBO_OBJECT_TYPE
+static BonoboObjectClass *parent_class = NULL;
struct _EShellPrivate {
char *local_directory;
@@ -50,6 +53,8 @@ struct _EShellPrivate {
EStorageSet *storage_set;
EShortcuts *shortcuts;
EFolderTypeRepository *folder_type_repository;
+
+ ECorbaStorageRegistry *corba_storage_registry;
};
#define SHORTCUTS_FILE_NAME "shortcuts.xml"
@@ -63,9 +68,63 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
+/* CORBA interface implementation. */
+
+static POA_Evolution_Shell__vepv shell_vepv;
+
+static POA_Evolution_Shell *
+create_servant (void)
+{
+ POA_Evolution_Shell *servant;
+ CORBA_Environment ev;
+
+ servant = (POA_Evolution_Shell *) g_new0 (BonoboObjectServant, 1);
+ servant->vepv = &shell_vepv;
+
+ CORBA_exception_init (&ev);
+
+ POA_Evolution_Shell__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;
+}
+
+static void
+impl_Shell_dummy_method (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ g_print ("Evolution::Shell::dummy_method invoked!\n");
+}
+
+
/* Initialization of the storages. */
static gboolean
+setup_corba_storages (EShell *shell)
+{
+ EShellPrivate *priv;
+
+ priv = shell->priv;
+
+ g_assert (priv->storage_set != NULL);
+ priv->corba_storage_registry = e_corba_storage_registry_new (priv->storage_set);
+
+ if (priv->corba_storage_registry == NULL)
+ return FALSE;
+
+ bonobo_object_add_interface (BONOBO_OBJECT (shell),
+ BONOBO_OBJECT (priv->corba_storage_registry));
+
+ return TRUE;
+}
+
+static gboolean
setup_storages (EShell *shell)
{
EStorage *local_storage;
@@ -89,7 +148,7 @@ setup_storages (EShell *shell)
priv->storage_set = e_storage_set_new (shell->priv->folder_type_repository);
e_storage_set_add_storage (priv->storage_set, local_storage);
- return TRUE;
+ return setup_corba_storages (shell);
}
@@ -144,18 +203,43 @@ destroy (GtkObject *object)
g_list_free (priv->views);
+ if (priv->corba_storage_registry != NULL)
+ bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry));
+
g_free (priv);
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
+/* Initialization. */
+
+static void
+corba_class_init (void)
+{
+ POA_Evolution_Shell__vepv *vepv;
+ POA_Evolution_Shell__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_Evolution_Shell__epv, 1);
+ epv->dummy_method = impl_Shell_dummy_method;
+
+ vepv = &shell_vepv;
+ vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
+ vepv->Evolution_Shell_epv = epv;
+}
+
static void
class_init (EShellClass *klass)
{
GtkObjectClass *object_class;
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = gtk_type_class (PARENT_TYPE);
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = destroy;
@@ -169,6 +253,8 @@ class_init (EShellClass *klass)
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+
+ corba_class_init ();
}
static void
@@ -184,6 +270,7 @@ init (EShell *shell)
priv->storage_set = NULL;
priv->shortcuts = NULL;
priv->folder_type_repository = NULL;
+ priv->corba_storage_registry = NULL;
shell->priv = priv;
}
@@ -191,6 +278,7 @@ init (EShell *shell)
void
e_shell_construct (EShell *shell,
+ Evolution_Shell corba_object,
const char *local_directory)
{
EShellPrivate *priv;
@@ -201,12 +289,11 @@ e_shell_construct (EShell *shell,
g_return_if_fail (local_directory != NULL);
g_return_if_fail (g_path_is_absolute (local_directory));
- GTK_OBJECT_UNSET_FLAGS (shell, GTK_FLOATING);
+ bonobo_object_construct (BONOBO_OBJECT (shell), corba_object);
priv = shell->priv;
priv->local_directory = g_strdup (local_directory);
-
priv->folder_type_repository = e_folder_type_repository_new ();
if (! setup_storages (shell))
@@ -231,14 +318,22 @@ e_shell_new (const char *local_directory)
{
EShell *new;
EShellPrivate *priv;
+ Evolution_Shell corba_object;
+ POA_Evolution_Shell *servant;
+
+ servant = create_servant ();
+ if (servant == NULL)
+ return NULL;
new = gtk_type_new (e_shell_get_type ());
- e_shell_construct (new, local_directory);
+
+ corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant);
+ e_shell_construct (new, corba_object, local_directory);
priv = new->priv;
if (priv->shortcuts == NULL || priv->storage_set == NULL) {
- gtk_object_unref (GTK_OBJECT (new));
+ bonobo_object_unref (BONOBO_OBJECT (new));
return NULL;
}
@@ -303,7 +398,7 @@ e_shell_quit (EShell *shell)
g_return_if_fail (shell != NULL);
g_return_if_fail (E_IS_SHELL (shell));
- gtk_object_destroy (GTK_OBJECT (shell));
+ bonobo_object_unref (BONOBO_OBJECT (shell));
}
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 10b42f527d..503b056986 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -28,8 +28,9 @@
#include <config.h>
#endif
-#include <gtk/gtkobject.h>
+#include <bonobo/bonobo-object.h>
+#include "Evolution.h"
#include "e-shortcuts.h"
#ifdef __cplusplus
@@ -49,25 +50,26 @@ typedef struct _EShellPrivate EShellPrivate;
typedef struct _EShellClass EShellClass;
struct _EShell {
- GtkObject parent;
+ BonoboObject parent;
EShellPrivate *priv;
};
struct _EShellClass {
- GtkObjectClass parent_class;
+ BonoboObjectClass parent_class;
void (* no_views_left) (EShell *shell);
};
-GtkType e_shell_get_type (void);
-void e_shell_construct (EShell *shell,
- const char *local_directory);
-EShell *e_shell_new (const char *local_directory);
-
-GtkWidget *e_shell_new_view (EShell *shell,
- const char *uri);
+GtkType e_shell_get_type (void);
+void e_shell_construct (EShell *shell,
+ Evolution_Shell corba_object,
+ const char *local_directory);
+EShell *e_shell_new (const char *local_directory);
+
+GtkWidget *e_shell_new_view (EShell *shell,
+ const char *uri);
EShortcuts *e_shell_get_shortcuts (EShell *shell);
EStorageSet *e_shell_get_storage_set (EShell *shell);
diff --git a/shell/e-storage-set.h b/shell/e-storage-set.h
index fddf0f0ce9..da4687d642 100644
--- a/shell/e-storage-set.h
+++ b/shell/e-storage-set.h
@@ -28,8 +28,9 @@
#include <config.h>
#endif
-#include "e-folder-type-repository.h"
+#include <gtk/gtkwidget.h>
+#include "e-folder-type-repository.h"
#include "e-storage.h"
#ifdef __cplusplus
diff --git a/shell/e-storage.c b/shell/e-storage.c
index 5d5b1dd7a8..974626e7b8 100644
--- a/shell/e-storage.c
+++ b/shell/e-storage.c
@@ -400,7 +400,7 @@ e_storage_get_name (EStorage *storage)
/* These functions are used by subclasses to add and remove folders from the
state stored in the storage object. */
-void
+gboolean
e_storage_new_folder (EStorage *storage,
const char *path,
EFolder *e_folder)
@@ -411,12 +411,12 @@ e_storage_new_folder (EStorage *storage,
const char *name;
char *full_path;
- g_return_if_fail (storage != NULL);
- g_return_if_fail (E_IS_STORAGE (storage));
- g_return_if_fail (path != NULL);
- g_return_if_fail (g_path_is_absolute (path));
- g_return_if_fail (e_folder != NULL);
- g_return_if_fail (E_IS_FOLDER (e_folder));
+ g_return_val_if_fail (storage != NULL, FALSE);
+ g_return_val_if_fail (E_IS_STORAGE (storage), FALSE);
+ g_return_val_if_fail (path != NULL, FALSE);
+ g_return_val_if_fail (g_path_is_absolute (path), FALSE);
+ g_return_val_if_fail (e_folder != NULL, FALSE);
+ g_return_val_if_fail (E_IS_FOLDER (e_folder), FALSE);
priv = storage->priv;
@@ -424,12 +424,12 @@ e_storage_new_folder (EStorage *storage,
if (parent_folder == NULL) {
g_warning ("%s: Trying to add a subfolder to a path that does not exist yet -- %s",
__FUNCTION__, path);
- return;
+ return FALSE;
}
name = e_folder_get_name (e_folder);
g_assert (name != NULL);
- g_return_if_fail (*name != G_DIR_SEPARATOR);
+ g_return_val_if_fail (*name != G_DIR_SEPARATOR, FALSE);
full_path = g_concat_dir_and_file (path, name);
@@ -437,36 +437,40 @@ e_storage_new_folder (EStorage *storage,
if (folder != NULL) {
g_warning ("%s: Trying to add a subfolder for a path that already exists -- %s",
__FUNCTION__, full_path);
- return;
+ return FALSE;
}
folder = folder_new (e_folder);
folder_add_subfolder (parent_folder, folder);
g_hash_table_insert (priv->path_to_folder, full_path, folder);
+
+ return TRUE;
}
-void
+gboolean
e_storage_remove_folder (EStorage *storage,
const char *path)
{
EStoragePrivate *priv;
Folder *folder;
- g_return_if_fail (storage != NULL);
- g_return_if_fail (E_IS_STORAGE (storage));
- g_return_if_fail (path != NULL);
- g_return_if_fail (g_path_is_absolute (path));
+ g_return_val_if_fail (storage != NULL, FALSE);
+ g_return_val_if_fail (E_IS_STORAGE (storage), FALSE);
+ g_return_val_if_fail (path != NULL, FALSE);
+ g_return_val_if_fail (g_path_is_absolute (path), FALSE);
priv = storage->priv;
folder = g_hash_table_lookup (priv->path_to_folder, path);
if (folder == NULL) {
g_warning ("%s: Folder not found -- %s", __FUNCTION__, path);
- return;
+ return FALSE;
}
folder_destroy (folder);
+
+ return TRUE;
}
diff --git a/shell/e-storage.h b/shell/e-storage.h
index 9c54f05eb8..2639497854 100644
--- a/shell/e-storage.h
+++ b/shell/e-storage.h
@@ -73,18 +73,15 @@ EStorage *e_storage_new (void);
gboolean e_storage_path_is_relative (const char *path);
gboolean e_storage_path_is_absolute (const char *path);
-GList *e_storage_list_folders (EStorage *storage,
- const char *path);
-EStorageWatcher *e_storage_get_watcher_for_path (EStorage *storage,
- const char *path);
-EFolder *e_storage_get_folder (EStorage *storage,
- const char *path);
+GList *e_storage_list_folders (EStorage *storage, const char *path);
+EStorageWatcher *e_storage_get_watcher_for_path (EStorage *storage, const char *path);
+EFolder *e_storage_get_folder (EStorage *storage, const char *path);
const char *e_storage_get_name (EStorage *storage);
/* Protected. C++ anyone? */
-void e_storage_new_folder (EStorage *storage, const char *path, EFolder *folder);
-void e_storage_remove_folder (EStorage *storage, const char *path);
+gboolean e_storage_new_folder (EStorage *storage, const char *path, EFolder *folder);
+gboolean e_storage_remove_folder (EStorage *storage, const char *path);
#ifdef __cplusplus
}
diff --git a/shell/evolution-service-repository.c b/shell/evolution-service-repository.c
deleted file mode 100644
index 3714ac5a62..0000000000
--- a/shell/evolution-service-repository.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author:
- * Bertrand Guiheneuf (bg@aful.org)
- *
- * Dumped from bonobo/bonobo-persist-stream.c
- *
- * (C) 2000 Helix Code, Inc.
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkmarshal.h>
-#include "evolution-service-repository.h"
-
-/* Parent class */
-static BonoboObjectClass *evolution_service_repository_parent_class;
-
-
-/* CORBA implementation Entry Point Vector */
-POA_Evolution_ServiceRepository__vepv evolution_service_repository_vepv;
-
-
-
-
-
-/*
- *function assigned to the
- * Evolution::ServiceRepository::set_shell
- * method.
- * This function calls the set_shell_fn in
- * the EvolutionServiceRepository
- */
-static void
-impl_set_shell (PortableServer_Servant servant,
- Evolution_Shell shell,
- CORBA_Environment *ev)
-{
- BonoboObject *object = bonobo_object_from_servant (servant);
- EvolutionServiceRepository *sr = EVOLUTION_SERVICE_REPOSITORY (object);
-
- if (sr->set_shell_fn != NULL) {
- (*sr->set_shell_fn)(sr, shell, sr->closure);
- } else {
- GtkObjectClass *oc = GTK_OBJECT (sr)->klass;
- EvolutionServiceRepositoryClass *class = EVOLUTION_SERVICE_REPOSITORY_CLASS (oc);
- (*class->set_shell)(sr, shell);
- }
-
-}
-
-/**
- * evolution_service_repository_get_epv:
- * create and initialize the ServiceRepository
- * epv.
- */
-POA_Evolution_ServiceRepository__epv *
-evolution_service_repository_get_epv (void)
-{
- POA_Evolution_ServiceRepository__epv *epv;
-
- epv = g_new0 (POA_Evolution_ServiceRepository__epv, 1);
-
- epv->set_shell = impl_set_shell;
-
- return epv;
-}
-
-
-/* create the Evolution_ServiceRepository vepv */
-static void
-init_service_repository_corba_class (void)
-{
- /* create the Bonobo interface epv */
- evolution_service_repository_vepv.Bonobo_Unknown_epv =
- bonobo_object_get_epv ();
-
- /* create the ServiceRepository interface epv.
- * Defined above */
- evolution_service_repository_vepv.Evolution_ServiceRepository_epv =
- evolution_service_repository_get_epv ();
-}
-
-
-/* default implementation for the ::set_shell method */
-static void
-evolution_service_repository_set_shell_default (EvolutionServiceRepository *service_repository,
- Evolution_Shell shell)
-{
- /* do nothing */
-}
-
-
-
-static void
-evolution_service_repository_destroy (GtkObject *object)
-{
- GTK_OBJECT_CLASS (evolution_service_repository_parent_class)->destroy (object);
-}
-
-
-/* initialize the Gtk object class */
-static void
-evolution_service_repository_class_init (EvolutionServiceRepositoryClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- evolution_service_repository_parent_class = gtk_type_class (bonobo_object_get_type ());
-
- /*
- * Override and initialize methods
- */
- object_class->destroy = evolution_service_repository_destroy;
- klass->set_shell = evolution_service_repository_set_shell_default;
-
- /* create the corba class */
- init_service_repository_corba_class ();
-}
-
-static void
-evolution_service_repository_init (EvolutionServiceRepository *service_repository)
-{
-}
-
-
-/**
- * evolution_service_repository_get_type:
- *
- * Returns: the GtkType for the EvolutionServiceRepository class.
- */
-GtkType
-evolution_service_repository_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "EvolutionServiceRepository",
- sizeof (EvolutionServiceRepository),
- sizeof (EvolutionServiceRepositoryClass),
- (GtkClassInitFunc) evolution_service_repository_class_init,
- (GtkObjectInitFunc) evolution_service_repository_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (bonobo_object_get_type (), &info);
- }
-
- return type;
-}
-
-
-
-
-/**
- * evolution_service_repository_construct: construct the object
- * @sr: the gtk service repository object to construct
- * @corba_service_repository: the corresponding corba object
- * @set_shell_fn: the ::set_shell implementation for this object
- * @closure: data to pass to the set_shell operation
- *
- * This construct an EvolutionServiceRepository object.
- * The caller can give the function that will implement
- * the Corba interface. If those methods are %NULL then the
- * default class method will be called instead.
- *
- * Return value: The constructed service repository.
- **/
-EvolutionServiceRepository *
-evolution_service_repository_construct (EvolutionServiceRepository *sr,
- Evolution_ServiceRepository corba_service_repository,
- EvolutionServiceRepositorySetShellFn set_shell_fn,
- void *closure)
-{
- g_return_val_if_fail (sr != NULL, NULL);
- g_return_val_if_fail (EVOLUTION_IS_SERVICE_REPOSITORY (sr), NULL);
- g_return_val_if_fail (corba_service_repository != CORBA_OBJECT_NIL, NULL);
-
- bonobo_object_construct (BONOBO_OBJECT (sr),
- corba_service_repository);
-
- sr->closure = closure;
- sr->set_shell_fn = set_shell_fn;
-
- return sr;
-}
-
-
-/*
- * construct the corba
- * Evolution_ServiceRepository object
- */
-static Evolution_ServiceRepository
-create_evolution_service_repository (BonoboObject *object)
-{
- POA_Evolution_ServiceRepository *servant;
- CORBA_Environment ev;
-
- /* create a servant */
- servant = (POA_Evolution_ServiceRepository *) g_new0 (BonoboObjectServant, 1);
-
- /* initialize its virtual entry point vector */
- servant->vepv = &evolution_service_repository_vepv;
-
- CORBA_exception_init (&ev);
-
- /* initialise the servant */
- POA_Evolution_ServiceRepository__init ((PortableServer_Servant) servant, &ev);
- if (ev._major != CORBA_NO_EXCEPTION){
- g_free (servant);
- CORBA_exception_free (&ev);
- return CORBA_OBJECT_NIL;
- }
- CORBA_exception_free (&ev);
-
- /* activate it and return */
- return (Evolution_ServiceRepository) bonobo_object_activate_servant (object, servant);
-}
-
-
-
-
-
-/**
- * evolution_service_repository_new: create a new EvolutionServiceRepository object
- * @set_shell_fn: The ::set_shell method
- * @closure: The data passed to the ::set_shell method
- *
- * Create a full EvolutionServiceRepository. Also create the correspoding
- * servant. The ::set_shell method calls set_shell_fn unless set_shell_fn
- * is %NULL, in which case, the class default method is called.
- *
- * Return value: The newly created EvolutionServiceRepository object
- **/
-EvolutionServiceRepository *
-evolution_service_repository_new (EvolutionServiceRepositorySetShellFn set_shell_fn,
- void *closure)
-{
- Evolution_ServiceRepository corba_sr;
- EvolutionServiceRepository *sr;
-
- /* create the gtk object */
- sr = gtk_type_new (evolution_service_repository_get_type ());
-
- /* create the Corba object */
- corba_sr = create_evolution_service_repository (
- BONOBO_OBJECT (sr));
-
- /* check for an error in the creation of the corba object */
- if (corba_sr == CORBA_OBJECT_NIL){
- gtk_object_destroy (GTK_OBJECT (sr));
- return NULL;
- }
-
- /* construct the object */
- evolution_service_repository_construct (sr, corba_sr, set_shell_fn, closure);
-
- return sr;
-}
diff --git a/shell/evolution-service-repository.h b/shell/evolution-service-repository.h
deleted file mode 100644
index 88a0f621d7..0000000000
--- a/shell/evolution-service-repository.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _EVOLUTION_SERVICE_REPOSITORY_H
-#define _EVOLUTION_SERVICE_REPOSITORY_H 1
-
-#include <bonobo/bonobo-object.h>
-#include "Evolution.h"
-
-BEGIN_GNOME_DECLS
-
-#define EVOLUTION_SERVICE_REPOSITORY_TYPE (evolution_service_repository_get_type ())
-#define EVOLUTION_SERVICE_REPOSITORY(o) (GTK_CHECK_CAST ((o), EVOLUTION_SERVICE_REPOSITORY_TYPE, EvolutionServiceRepository))
-#define EVOLUTION_SERVICE_REPOSITORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), EVOLUTION_SERVICE_REPOSITORY_TYPE, EvolutionServiceRepositoryClass))
-#define EVOLUTION_IS_SERVICE_REPOSITORY(o) (GTK_CHECK_TYPE ((o), EVOLUTION_SERVICE_REPOSITORY_TYPE))
-#define EVOLUTION_IS_SERVICE_REPOSITORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), EVOLUTION_SERVICE_REPOSITORY_TYPE))
-
-typedef struct _EvolutionServiceRepository EvolutionServiceRepositoryPrivate;
-typedef struct _EvolutionServiceRepository EvolutionServiceRepository;
-
-typedef void (*EvolutionServiceRepositorySetShellFn) (EvolutionServiceRepository *sr, const Evolution_Shell shell, void *closure);
-
-
-struct _EvolutionServiceRepository {
- BonoboObject object;
-
-
- EvolutionServiceRepositorySetShellFn set_shell_fn;
-
- void *closure;
-
- EvolutionServiceRepositoryPrivate *priv;
-
-};
-
-
-
-typedef struct {
- BonoboObjectClass parent_class;
-
- void (*set_shell) (EvolutionServiceRepository *sr, Evolution_Shell shell);
-
-} EvolutionServiceRepositoryClass;
-
-
-
-GtkType evolution_service_repository_get_type (void);
-
-EvolutionServiceRepository * evolution_service_repository_new (
- EvolutionServiceRepositorySetShellFn set_shell_fn,
- void *closure);
-
-EvolutionServiceRepository * evolution_service_repository_construct (
- EvolutionServiceRepository *sr,
- Evolution_ServiceRepository corba_service_repository,
- EvolutionServiceRepositorySetShellFn set_shell_fn,
- void *closure);
-
-
-POA_Evolution_ServiceRepository__epv *evolution_service_repository_get_epv (void);
-
-extern POA_Evolution_ServiceRepository__vepv evolution_service_repository_vepv;
-
-END_GNOME_DECLS
-
-
-#endif /* _EVOLUTION_SERVICE_REPOSITORY_H */
-
diff --git a/shell/evolution-service-repository.idl b/shell/evolution-service-repository.idl
deleted file mode 100644
index 809ccbdc21..0000000000
--- a/shell/evolution-service-repository.idl
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Component Interface
- *
- * Authors:
- * Bertrand Guiheneuf (bg@aful.org)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <Bonobo.idl>
-
-module Evolution {
- interface ServiceRepository : Bonobo::Unknown {
-
- void set_shell (in Shell shell);
-
-
- };
-};
-