aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-12-09 08:55:57 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-12-09 08:55:57 +0800
commita66eae167484718678ceae7368c167aacb322b38 (patch)
tree109b1873d637de6411d3aa1bb67fab865ecc2e08
parent25ad3092eb60a6dcdbb810cf684ce6dc8715ac4c (diff)
downloadgsoc2013-evolution-a66eae167484718678ceae7368c167aacb322b38.tar
gsoc2013-evolution-a66eae167484718678ceae7368c167aacb322b38.tar.gz
gsoc2013-evolution-a66eae167484718678ceae7368c167aacb322b38.tar.bz2
gsoc2013-evolution-a66eae167484718678ceae7368c167aacb322b38.tar.lz
gsoc2013-evolution-a66eae167484718678ceae7368c167aacb322b38.tar.xz
gsoc2013-evolution-a66eae167484718678ceae7368c167aacb322b38.tar.zst
gsoc2013-evolution-a66eae167484718678ceae7368c167aacb322b38.zip
Complete the code to associate a URI and a folder type to the toplevel
node in a storage. It sucks a bit and needs a little more refactoring. svn path=/trunk/; revision=6878
-rw-r--r--addressbook/ChangeLog6
-rw-r--r--addressbook/gui/component/e-ldap-storage.c2
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/component-factory.c2
-rw-r--r--mail/mail-vfolder.c2
-rw-r--r--shell/ChangeLog60
-rw-r--r--shell/Evolution-Storage.idl5
-rw-r--r--shell/e-corba-storage-registry.c6
-rw-r--r--shell/e-corba-storage.c9
-rw-r--r--shell/e-corba-storage.h2
-rw-r--r--shell/e-local-storage.c2
-rw-r--r--shell/e-shell-view.c142
-rw-r--r--shell/e-shortcuts-view.c2
-rw-r--r--shell/e-storage.c41
-rw-r--r--shell/e-storage.h17
-rw-r--r--shell/evolution-local-storage.c2
-rw-r--r--shell/evolution-shell-component-client.c13
-rw-r--r--shell/evolution-shell-component-client.h9
-rw-r--r--shell/evolution-storage.c25
-rw-r--r--shell/evolution-storage.h52
-rw-r--r--shell/main.c7
21 files changed, 304 insertions, 109 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 07d6aecbdd..257aa98954 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,9 @@
+2000-12-07 Ettore Perazzoli <ettore@helixcode.com>
+
+ * gui/component/e-ldap-storage.c (setup_ldap_storage): Pass NULL
+ as the @toplevel_node_handler_id argument to
+ `evolution_storage_new'.
+
2000-12-08 Christopher James Lahey <clahey@helixcode.com>
* backend/ebook/e-card.c: Fixed some formatting.
diff --git a/addressbook/gui/component/e-ldap-storage.c b/addressbook/gui/component/e-ldap-storage.c
index 32b4334348..065adbf50f 100644
--- a/addressbook/gui/component/e-ldap-storage.c
+++ b/addressbook/gui/component/e-ldap-storage.c
@@ -85,7 +85,7 @@ setup_ldap_storage (EvolutionShellComponent *shell_component,
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
- storage = evolution_storage_new (_("External Directories"), NULL);
+ storage = evolution_storage_new (_("External Directories"), NULL, NULL);
if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) {
g_warning ("Cannot register storage");
return;
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 7097b1a744..df089af812 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2000-12-07 Ettore Perazzoli <ettore@helixcode.com>
+
+ * component-factory.c (add_storage): Pass `NULL' as the
+ @toplevel_node_handler_id arg in `evolution_storage_new()'.
+ FIXME: We should be passing the ID of the mail component here.
+ * mail-vfolder.c (vfolder_create_storage): Likewise.
+
2000-12-08 Jeffrey Stedfast <fejj@helixcode.com>
* message-list.c (message_list_get_layout): Set the "Size" field
diff --git a/mail/component-factory.c b/mail/component-factory.c
index a54f329a60..63a1d606a4 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -223,7 +223,7 @@ add_storage (const char *uri, CamelService *store,
char *name;
name = camel_service_get_name (store, TRUE);
- storage = evolution_storage_new (name, NULL);
+ storage = evolution_storage_new (name, NULL, NULL);
g_free (name);
res = evolution_storage_register_on_shell (storage, corba_shell);
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index cc1821fc68..08bdc6771a 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -144,7 +144,7 @@ vfolder_create_storage(EvolutionShellComponent *shell_component)
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
- storage = evolution_storage_new (_("VFolders"), NULL);
+ storage = evolution_storage_new (_("VFolders"), NULL, NULL);
if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) {
g_warning ("Cannot register storage");
return;
diff --git a/shell/ChangeLog b/shell/ChangeLog
index f4f57bc83c..170a92e22f 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,63 @@
+2000-12-08 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-shortcuts-view.c (e_shortcuts_view_construct): Ooops. We were
+ reffing a bogus pointer that was not assigned yet.
+
+ * e-corba-storage-registry.c (impl_StorageRegistry_addStorage):
+ Updated according to the new IDL.
+
+ * e-local-storage.c (construct): Pass `NULL' to
+ `e_storage_construct' as the @toplevel_node_type arg.
+
+ * evolution-shell-component-client.c
+ (evolution_shell_component_client_new_for_objref): New.
+ (evolution_shell_component_client_new): Refactored to use it.
+
+ * e-corba-storage.c (e_corba_storage_construct): New arg
+ @toplevel_node_type. Pass it to `e_storage_construct'.
+ (e_corba_storage_new): New arg @toplevel_node_type. Pass it to
+ `e_corba_storage_construct'.
+
+ * e-storage.c: New member `toplevel_node_uri_type' in
+ `EStoragePrivate'.
+ (init): Init to NULL.
+ (destroy): Unref.
+ (e_storage_construct): New arg @toplevel_node_type. Set the
+ private member value accordingly.
+ (e_storage_new): New arg @toplevel_node_type. Pass to
+ `e_storage_construct'.
+ (e_storage_get_toplevel_node_type): New.
+
+ * e-shell-view.c (get_physical_uri_for_evolution_uri): New arg
+ @shell_view.
+ (get_physical_uri_for_storage): Filled in. New arg @shell_view.
+ (get_physical_uri_for_folder): Filled in. New arg @shell_view.
+
+ * evolution-local-storage.c (evolution_local_storage_construct):
+ Pass `NULL' as the @toplevel_node_type arg to
+ `evolution_storage_construct'.
+
+ * evolution-storage.c: New member `toplevel_node_type' in
+ `EvolutionStoragePrivate'.
+ (destroy): Free.
+ (init): Init to NULL.
+ (evolution_storage_construct): New arg @toplevel_node_handler
+ to initialize the corresponding field in `->priv'.
+ (evolution_storage_new): New arg @toplevel_node_type. Pass
+ it to `evolution_storage_construct'.
+ (evolution_storage_register): Pass the @toplevel_node_type
+ arg to `::addStorage'.
+
+ * Evolution-Storage.idl: Add arg @toplevel_node_type to
+ `StorageRegistry::addStorage'.
+
+ * main.c (new_view_on_running_shell): Deal with an exception in
+ `::createNewView' gracefully.
+
+ * e-shell-view.c (switch_on_folder_tree_click): New.
+ (folder_selected_cb): Refactored to use it.
+ (storage_selected_cb): Use it.
+
2000-12-07 Michael Meeks <michael@helixcode.com>
* Makefile.am (oaf_DATA): update to GNOME_Evolution_Shell.oafinfo
diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl
index 4884a05fa9..d71b7843be 100644
--- a/shell/Evolution-Storage.idl
+++ b/shell/Evolution-Storage.idl
@@ -61,9 +61,12 @@ module Evolution {
exception Exists {};
exception NotFound {};
+ /* FIXME: The toplevel attributes should probably be attributes
+ of the storage instead of being passed here. */
StorageListener addStorage (in Storage storage,
in string name,
- in string toplevel_node_uri)
+ in string toplevel_node_uri,
+ in string toplevel_node_type)
raises (Exists);
void removeStorageByName (in string name)
diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c
index 982bd76e49..c740bbe9b5 100644
--- a/shell/e-corba-storage-registry.c
+++ b/shell/e-corba-storage-registry.c
@@ -72,6 +72,7 @@ impl_StorageRegistry_addStorage (PortableServer_Servant servant,
const GNOME_Evolution_Storage storage_interface,
const CORBA_char *name,
const CORBA_char *toplevel_node_uri,
+ const CORBA_char *toplevel_node_type,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
@@ -86,7 +87,10 @@ impl_StorageRegistry_addStorage (PortableServer_Servant servant,
storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object);
priv = storage_registry->priv;
- storage = e_corba_storage_new (toplevel_node_uri, storage_interface, name);
+ storage = e_corba_storage_new (toplevel_node_uri,
+ toplevel_node_type,
+ storage_interface,
+ name);
if (! e_storage_set_add_storage (priv->storage_set, storage)) {
CORBA_exception_set (ev,
diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c
index 06573974d5..2a0d61d4ee 100644
--- a/shell/e-corba-storage.c
+++ b/shell/e-corba-storage.c
@@ -326,6 +326,7 @@ init (ECorbaStorage *corba_storage)
void
e_corba_storage_construct (ECorbaStorage *corba_storage,
const char *toplevel_node_uri,
+ const char *toplevel_node_type,
const GNOME_Evolution_Storage storage_interface,
const char *name)
{
@@ -337,7 +338,7 @@ e_corba_storage_construct (ECorbaStorage *corba_storage,
g_return_if_fail (storage_interface != CORBA_OBJECT_NIL);
g_return_if_fail (name != NULL);
- e_storage_construct (E_STORAGE (corba_storage), toplevel_node_uri);
+ e_storage_construct (E_STORAGE (corba_storage), toplevel_node_uri, toplevel_node_type);
priv = corba_storage->priv;
@@ -359,6 +360,7 @@ e_corba_storage_construct (ECorbaStorage *corba_storage,
EStorage *
e_corba_storage_new (const char *toplevel_node_uri,
+ const char *toplevel_node_type,
const GNOME_Evolution_Storage storage_interface,
const char *name)
{
@@ -369,7 +371,10 @@ e_corba_storage_new (const char *toplevel_node_uri,
new = gtk_type_new (e_corba_storage_get_type ());
- e_corba_storage_construct (E_CORBA_STORAGE (new), toplevel_node_uri, storage_interface, name);
+ e_corba_storage_construct (E_CORBA_STORAGE (new),
+ toplevel_node_uri,
+ toplevel_node_type,
+ storage_interface, name);
return new;
}
diff --git a/shell/e-corba-storage.h b/shell/e-corba-storage.h
index 9fed54a316..4f92231840 100644
--- a/shell/e-corba-storage.h
+++ b/shell/e-corba-storage.h
@@ -62,9 +62,11 @@ struct _ECorbaStorageClass {
GtkType e_corba_storage_get_type (void);
void e_corba_storage_construct (ECorbaStorage *corba_storage,
const char *toplevel_node_uri,
+ const char *toplevel_node_type,
const GNOME_Evolution_Storage storage_interface,
const char *name);
EStorage *e_corba_storage_new (const char *toplevel_node_uri,
+ const char *toplevel_node_type,
const GNOME_Evolution_Storage storage_interface,
const char *name);
diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c
index d672465219..a149e21fca 100644
--- a/shell/e-local-storage.c
+++ b/shell/e-local-storage.c
@@ -593,7 +593,7 @@ construct (ELocalStorage *local_storage,
ELocalStoragePrivate *priv;
int base_path_len;
- e_storage_construct (E_STORAGE (local_storage), NULL);
+ e_storage_construct (E_STORAGE (local_storage), NULL, NULL);
priv = local_storage->priv;
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index c6618e31c6..38507668ce 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -290,6 +290,36 @@ pop_up_folder_bar (EShellView *shell_view)
}
+/* Switching views on a tree view click. */
+
+static void new_folder_cb (EStorageSet *storage_set, const char *path, void *data);
+
+static void
+switch_on_folder_tree_click (EShellView *shell_view,
+ const char *path)
+{
+ EShellViewPrivate *priv;
+ char *uri;
+
+ priv = shell_view->priv;
+
+ uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
+ e_shell_view_display_uri (shell_view, uri);
+ g_free (uri);
+
+ if (priv->delayed_selection) {
+ g_free (priv->delayed_selection);
+ priv->delayed_selection = NULL;
+ gtk_signal_disconnect_by_func (GTK_OBJECT (e_shell_get_storage_set(priv->shell)),
+ GTK_SIGNAL_FUNC (new_folder_cb),
+ shell_view);
+ }
+
+ if (priv->folder_bar_mode == E_SHELL_VIEW_SUBWINDOW_TRANSIENT)
+ popdown_transient_folder_bar (shell_view);
+}
+
+
/* Callbacks. */
/* Callback when a new folder is added. removed when we clear the
@@ -342,27 +372,10 @@ folder_selected_cb (EStorageSetView *storage_set_view,
void *data)
{
EShellView *shell_view;
- EShellViewPrivate *priv;
-
- char *uri;
shell_view = E_SHELL_VIEW (data);
- priv = shell_view->priv;
-
- uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
- e_shell_view_display_uri (shell_view, uri);
- g_free (uri);
-
- if (priv->delayed_selection) {
- g_free (priv->delayed_selection);
- priv->delayed_selection = NULL;
- gtk_signal_disconnect_by_func (GTK_OBJECT (e_shell_get_storage_set(priv->shell)),
- GTK_SIGNAL_FUNC (new_folder_cb),
- shell_view);
- }
- if (priv->folder_bar_mode == E_SHELL_VIEW_SUBWINDOW_TRANSIENT)
- popdown_transient_folder_bar (shell_view);
+ switch_on_folder_tree_click (shell_view, path);
}
/* Callback called when a storage in the tree view is clicked. */
@@ -372,18 +385,16 @@ storage_selected_cb (EStorageSetView *storage_set_view,
void *data)
{
EShellView *shell_view;
- EShellViewPrivate *priv;
- EStorageSet *storage_set;
- EStorage *storage;
- const char *uri;
+ char *path;
shell_view = E_SHELL_VIEW (data);
- priv = shell_view->priv;
- storage_set = e_shell_get_storage_set (priv->shell);
+ path = g_strconcat (G_DIR_SEPARATOR_S, name, NULL);
+ switch_on_folder_tree_click (shell_view, path);
- storage = e_storage_set_get_storage (storage_set, name);
- g_assert (storage != NULL);
+ puts (__FUNCTION__);
+
+ g_free (path);
}
/* Callback called when the button on the tree's title bar is clicked. */
@@ -1227,24 +1238,65 @@ socket_destroy_cb (GtkWidget *socket_widget, gpointer data)
}
+static const char *
+get_type_for_storage (EShellView *shell_view,
+ const char *name,
+ const char **physical_uri_return)
+{
+ EShellViewPrivate *priv;
+ EStorageSet *storage_set;
+ EStorage *storage;
+
+ priv = shell_view->priv;
+
+ storage_set = e_shell_get_storage_set (priv->shell);
+ storage = e_storage_set_get_storage (storage_set, name);
+
+ *physical_uri_return = e_storage_get_toplevel_node_uri (storage);
+
+ return e_storage_get_toplevel_node_type (storage);
+}
+
+static const char *
+get_type_for_folder (EShellView *shell_view,
+ const char *path,
+ const char **physical_uri_return)
+{
+ EShellViewPrivate *priv;
+ EStorageSet *storage_set;
+ EFolderTypeRegistry *folder_type_registry;
+ EFolder *folder;
+
+ priv = shell_view->priv;
+
+ storage_set = e_shell_get_storage_set (priv->shell);
+ folder = e_storage_set_get_folder (storage_set, path);
+
+ *physical_uri_return = e_folder_get_physical_uri (folder);
+
+ folder_type_registry = e_shell_get_folder_type_registry (e_shell_view_get_shell (shell_view));
+
+ return e_folder_get_type_string (folder);
+}
+
/* Create a new view for @uri with @control. It assumes a view for @uri does not exist yet. */
static GtkWidget *
get_control_for_uri (EShellView *shell_view,
const char *uri)
{
EShellViewPrivate *priv;
- EFolderTypeRegistry *folder_type_registry;
- EStorageSet *storage_set;
- EFolder *folder;
+ CORBA_Environment ev;
EvolutionShellComponentClient *handler_client;
- Bonobo_Control corba_control;
+ EFolderTypeRegistry *folder_type_registry;
GNOME_Evolution_ShellComponent handler;
- const char *path;
- const char *folder_type;
- GtkWidget *control;
- CORBA_Environment ev;
Bonobo_UIContainer container;
+ GtkWidget *control;
GtkWidget *socket;
+ Bonobo_Control corba_control;
+ const char *path;
+ const char *slash;
+ const char *physical_uri;
+ const char *folder_type;
int destroy_connection_id;
priv = shell_view->priv;
@@ -1257,29 +1309,25 @@ get_control_for_uri (EShellView *shell_view,
if (*path == '\0')
return NULL;
- storage_set = e_shell_get_storage_set (priv->shell);
- folder_type_registry = e_shell_get_folder_type_registry (priv->shell);
+ /* FIXME: This code needs to be made more robust. */
- folder = e_storage_set_get_folder (storage_set, path);
- if (folder == NULL)
- return NULL;
+ slash = strchr (path, G_DIR_SEPARATOR);
+ if (slash == NULL || slash[1] == '\0')
+ folder_type = get_type_for_storage (shell_view, path, &physical_uri);
+ else
+ folder_type = get_type_for_folder (shell_view, path, &physical_uri);
- folder_type = e_folder_get_type_string (folder);
- if (folder_type == NULL)
- return NULL;
+ folder_type_registry = e_shell_get_folder_type_registry (e_shell_view_get_shell (shell_view));
handler_client = e_folder_type_registry_get_handler_for_type (folder_type_registry, folder_type);
- if (handler_client == NULL)
+ if (handler_client == CORBA_OBJECT_NIL)
return NULL;
handler = bonobo_object_corba_objref (BONOBO_OBJECT (handler_client));
- if (handler_client == CORBA_OBJECT_NIL)
- return NULL;
CORBA_exception_init (&ev);
- corba_control = GNOME_Evolution_ShellComponent_createView (handler, e_folder_get_physical_uri (folder),
- folder_type, &ev);
+ corba_control = GNOME_Evolution_ShellComponent_createView (handler, physical_uri, folder_type, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c
index 59eef10833..30ced8d61f 100644
--- a/shell/e-shortcuts-view.c
+++ b/shell/e-shortcuts-view.c
@@ -522,8 +522,8 @@ e_shortcuts_view_construct (EShortcutsView *shortcuts_view,
priv = shortcuts_view->priv;
- gtk_object_ref (GTK_OBJECT (priv->shortcuts));
priv->shortcuts = shortcuts;
+ gtk_object_ref (GTK_OBJECT (priv->shortcuts));
e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcuts_view), icon_callback,
shortcuts);
diff --git a/shell/e-storage.c b/shell/e-storage.c
index ab07bd13a9..9e99a61e95 100644
--- a/shell/e-storage.c
+++ b/shell/e-storage.c
@@ -49,6 +49,9 @@ struct _EStoragePrivate {
/* URI for the toplevel node. */
char *toplevel_node_uri;
+
+ /* Toplevel node type. */
+ char *toplevel_node_type;
};
enum {
@@ -96,6 +99,7 @@ destroy (GtkObject *object)
e_folder_tree_destroy (priv->folder_tree);
g_free (priv->toplevel_node_uri);
+ g_free (priv->toplevel_node_type);
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -208,8 +212,9 @@ init (EStorage *storage)
priv = g_new (EStoragePrivate, 1);
- priv->folder_tree = e_folder_tree_new (folder_destroy_notify, NULL);
- priv->toplevel_node_uri = NULL;
+ priv->folder_tree = e_folder_tree_new (folder_destroy_notify, NULL);
+ priv->toplevel_node_uri = NULL;
+ priv->toplevel_node_type = NULL;
storage->priv = priv;
}
@@ -219,7 +224,8 @@ init (EStorage *storage)
void
e_storage_construct (EStorage *storage,
- const char *toplevel_node_uri)
+ const char *toplevel_node_uri,
+ const char *toplevel_node_type)
{
EStoragePrivate *priv;
@@ -227,19 +233,22 @@ e_storage_construct (EStorage *storage,
g_return_if_fail (E_IS_STORAGE (storage));
priv = storage->priv;
- priv->toplevel_node_uri = g_strdup (toplevel_node_uri);
+
+ priv->toplevel_node_uri = g_strdup (toplevel_node_uri);
+ priv->toplevel_node_type = g_strdup (toplevel_node_type);
GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (storage), GTK_FLOATING);
}
EStorage *
-e_storage_new (const char *toplevel_node_uri)
+e_storage_new (const char *toplevel_node_uri,
+ const char *toplevel_node_type)
{
EStorage *new;
new = gtk_type_new (e_storage_get_type ());
- e_storage_construct (new, toplevel_node_uri);
+ e_storage_construct (new, toplevel_node_uri, toplevel_node_type);
return new;
}
@@ -315,6 +324,26 @@ e_storage_get_toplevel_node_uri (EStorage *storage)
return priv->toplevel_node_uri;
}
+/**
+ * e_storage_get_toplevel_node_type:
+ * @storage: A pointer to an EStorage object.
+ *
+ * Get the folder type for the toplevel node.
+ *
+ * Return value: A string identifying the type of the toplevel node.
+ **/
+const char *
+e_storage_get_toplevel_node_type (EStorage *storage)
+{
+ EStoragePrivate *priv;
+
+ g_return_val_if_fail (storage != NULL, NULL);
+ g_return_val_if_fail (E_IS_STORAGE (storage), NULL);
+
+ priv = storage->priv;
+ return priv->toplevel_node_type;
+}
+
/* Folder operations. */
diff --git a/shell/e-storage.h b/shell/e-storage.h
index d44a4161df..3bddafe73a 100644
--- a/shell/e-storage.h
+++ b/shell/e-storage.h
@@ -30,6 +30,8 @@
#include <gtk/gtkobject.h>
+#include "evolution-shell-component-client.h"
+
#ifdef __cplusplus
extern "C" {
#pragma }
@@ -94,10 +96,12 @@ struct _EStorageClass {
};
-GtkType e_storage_get_type (void);
-void e_storage_construct (EStorage *storage,
- const char *toplevel_node_uri);
-EStorage *e_storage_new (const char *toplevel_node_uri);
+GtkType e_storage_get_type (void);
+void e_storage_construct (EStorage *storage,
+ const char *toplevel_node_uri,
+ const char *toplevel_node_type);
+EStorage *e_storage_new (const char *toplevel_node_uri,
+ const char *toplevel_node_type);
gboolean e_storage_path_is_relative (const char *path);
gboolean e_storage_path_is_absolute (const char *path);
@@ -107,8 +111,9 @@ GList *e_storage_get_subfolder_paths (EStorage *storage,
EFolder *e_storage_get_folder (EStorage *storage,
const char *path);
-const char *e_storage_get_name (EStorage *storage);
-const char *e_storage_get_toplevel_node_uri (EStorage *storage);
+const char *e_storage_get_name (EStorage *storage);
+const char *e_storage_get_toplevel_node_uri (EStorage *storage);
+const char *e_storage_get_toplevel_node_type (EStorage *storage);
/* Folder operations. */
diff --git a/shell/evolution-local-storage.c b/shell/evolution-local-storage.c
index b3a9183b57..96a1af33dd 100644
--- a/shell/evolution-local-storage.c
+++ b/shell/evolution-local-storage.c
@@ -186,7 +186,7 @@ evolution_local_storage_construct (EvolutionLocalStorage *local_storage,
g_return_if_fail (name != NULL);
g_return_if_fail (name[0] != '\0');
- evolution_storage_construct (EVOLUTION_STORAGE (local_storage), corba_object, name, NULL);
+ evolution_storage_construct (EVOLUTION_STORAGE (local_storage), corba_object, name, NULL, NULL);
}
EvolutionLocalStorage *
diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c
index 6a96bc3b33..218379fd03 100644
--- a/shell/evolution-shell-component-client.c
+++ b/shell/evolution-shell-component-client.c
@@ -315,7 +315,6 @@ evolution_shell_component_client_construct (EvolutionShellComponentClient *shell
EvolutionShellComponentClient *
evolution_shell_component_client_new (const char *id)
{
- EvolutionShellComponentClient *new;
CORBA_Environment ev;
CORBA_Object corba_object;
@@ -338,8 +337,18 @@ evolution_shell_component_client_new (const char *id)
return NULL;
}
+ return evolution_shell_component_client_new_for_objref (corba_object);
+}
+
+EvolutionShellComponentClient *
+evolution_shell_component_client_new_for_objref (const GNOME_Evolution_ShellComponent objref)
+{
+ EvolutionShellComponentClient *new;
+
+ g_return_val_if_fail (objref != CORBA_OBJECT_NIL, NULL);
+
new = gtk_type_new (evolution_shell_component_client_get_type ());
- evolution_shell_component_client_construct (new, corba_object);
+ evolution_shell_component_client_construct (new, objref);
return new;
}
diff --git a/shell/evolution-shell-component-client.h b/shell/evolution-shell-component-client.h
index 621e5cda49..319902198f 100644
--- a/shell/evolution-shell-component-client.h
+++ b/shell/evolution-shell-component-client.h
@@ -60,10 +60,11 @@ typedef void (* EvolutionShellComponentClientCallback) (EvolutionShellComponentC
/* Construction. */
-GtkType evolution_shell_component_client_get_type (void);
-void evolution_shell_component_client_construct (EvolutionShellComponentClient *shell_component_client,
- CORBA_Object corba_object);
-EvolutionShellComponentClient *evolution_shell_component_client_new (const char *id);
+GtkType evolution_shell_component_client_get_type (void);
+void evolution_shell_component_client_construct (EvolutionShellComponentClient *shell_component_client,
+ CORBA_Object corba_object);
+EvolutionShellComponentClient *evolution_shell_component_client_new (const char *id);
+EvolutionShellComponentClient *evolution_shell_component_client_new_for_objref (const GNOME_Evolution_ShellComponent objref);
/* Synchronous operations. */
EvolutionShellComponentResult evolution_shell_component_client_set_owner (EvolutionShellComponentClient *shell_component_client,
diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c
index 81d923b803..5ad51472a3 100644
--- a/shell/evolution-storage.c
+++ b/shell/evolution-storage.c
@@ -48,6 +48,9 @@ struct _EvolutionStoragePrivate {
/* URI for the toplevel node of the storage. */
char *toplevel_node_uri;
+ /* Type for the toplevel node of the storage. */
+ char *toplevel_node_type;
+
/* The set of folders we have in this storage. */
EFolderTree *folder_tree;
@@ -280,7 +283,7 @@ destroy (GtkObject *object)
g_free (priv->name);
g_free (priv->toplevel_node_uri);
-
+ g_free (priv->toplevel_node_type);
if (priv->folder_tree != NULL)
e_folder_tree_destroy (priv->folder_tree);
@@ -346,6 +349,7 @@ init (EvolutionStorage *storage)
priv = g_new (EvolutionStoragePrivate, 1);
priv->name = NULL;
priv->toplevel_node_uri = NULL;
+ priv->toplevel_node_type = NULL;
priv->folder_tree = e_folder_tree_new (folder_destroy_notify, storage);
priv->corba_storage_listeners = NULL;
@@ -370,9 +374,11 @@ void
evolution_storage_construct (EvolutionStorage *storage,
GNOME_Evolution_Storage corba_object,
const char *name,
- const char *toplevel_node_uri)
+ const char *toplevel_node_uri,
+ const char *toplevel_node_type)
{
EvolutionStoragePrivate *priv;
+ CORBA_Environment ev;
g_return_if_fail (storage != NULL);
g_return_if_fail (EVOLUTION_IS_STORAGE (storage));
@@ -380,16 +386,22 @@ evolution_storage_construct (EvolutionStorage *storage,
g_return_if_fail (name != NULL);
g_return_if_fail (name[0] != '\0');
+ CORBA_exception_init (&ev);
+
bonobo_object_construct (BONOBO_OBJECT (storage), corba_object);
priv = storage->priv;
- priv->name = g_strdup (name);
- priv->toplevel_node_uri = g_strdup (toplevel_node_uri);
+ priv->name = g_strdup (name);
+ priv->toplevel_node_uri = g_strdup (toplevel_node_uri);
+ priv->toplevel_node_type = g_strdup (toplevel_node_type);
+
+ CORBA_exception_free (&ev);
}
EvolutionStorage *
evolution_storage_new (const char *name,
- const char *toplevel_node_uri)
+ const char *toplevel_node_uri,
+ const char *toplevel_node_type)
{
EvolutionStorage *new;
POA_GNOME_Evolution_Storage *servant;
@@ -405,7 +417,7 @@ evolution_storage_new (const char *name,
new = gtk_type_new (evolution_storage_get_type ());
corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant);
- evolution_storage_construct (new, corba_object, name, toplevel_node_uri);
+ evolution_storage_construct (new, corba_object, name, toplevel_node_uri, toplevel_node_type);
return new;
}
@@ -439,6 +451,7 @@ evolution_storage_register (EvolutionStorage *evolution_storage,
corba_storage,
priv->name,
e_safe_corba_string (priv->toplevel_node_uri),
+ e_safe_corba_string (priv->toplevel_node_type),
&ev);
if (ev._major == CORBA_NO_EXCEPTION) {
diff --git a/shell/evolution-storage.h b/shell/evolution-storage.h
index 037ad75b15..4457d9f9b8 100644
--- a/shell/evolution-storage.h
+++ b/shell/evolution-storage.h
@@ -74,31 +74,33 @@ struct _EvolutionStorageClass {
POA_GNOME_Evolution_Storage__epv *evolution_storage_get_epv (void);
-GtkType evolution_storage_get_type (void);
-void evolution_storage_construct (EvolutionStorage *storage,
- GNOME_Evolution_Storage corba_object,
- const char *name,
- const char *toplevel_node_uri);
-EvolutionStorage *evolution_storage_new (const char *name,
- const char *toplevel_node_uri);
-
-EvolutionStorageResult evolution_storage_register (EvolutionStorage *storage,
- GNOME_Evolution_StorageRegistry corba_registry);
-EvolutionStorageResult evolution_storage_register_on_shell (EvolutionStorage *evolution_storage,
- GNOME_Evolution_Shell corba_shell);
-EvolutionStorageResult evolution_storage_new_folder (EvolutionStorage *evolution_storage,
- const char *path,
- const char *display_name,
- const char *type,
- const char *physical_uri,
- const char *description,
- gboolean highlighted);
-EvolutionStorageResult evolution_storage_update_folder (EvolutionStorage *evolution_storage,
- const char *path,
- const char *display_name,
- gboolean highlighted);
-EvolutionStorageResult evolution_storage_removed_folder (EvolutionStorage *evolution_storage,
- const char *path);
+GtkType evolution_storage_get_type (void);
+void evolution_storage_construct (EvolutionStorage *storage,
+ GNOME_Evolution_Storage corba_object,
+ const char *name,
+ const char *toplevel_node_uri,
+ const char *toplevel_node_type);
+EvolutionStorage *evolution_storage_new (const char *name,
+ const char *toplevel_node_uri,
+ const char *toplevel_node_type);
+
+EvolutionStorageResult evolution_storage_register (EvolutionStorage *storage,
+ GNOME_Evolution_StorageRegistry corba_registry);
+EvolutionStorageResult evolution_storage_register_on_shell (EvolutionStorage *evolution_storage,
+ GNOME_Evolution_Shell corba_shell);
+EvolutionStorageResult evolution_storage_new_folder (EvolutionStorage *evolution_storage,
+ const char *path,
+ const char *display_name,
+ const char *type,
+ const char *physical_uri,
+ const char *description,
+ gboolean highlighted);
+EvolutionStorageResult evolution_storage_update_folder (EvolutionStorage *evolution_storage,
+ const char *path,
+ const char *display_name,
+ gboolean highlighted);
+EvolutionStorageResult evolution_storage_removed_folder (EvolutionStorage *evolution_storage,
+ const char *path);
#ifdef __cplusplus
}
diff --git a/shell/main.c b/shell/main.c
index a628348049..dff0514f11 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -134,9 +134,10 @@ new_view_on_running_shell (void)
}
shell_view = GNOME_Evolution_Shell_createNewView ((GNOME_Evolution_Shell) corba_object, STARTUP_URI, &ev);
-
- Bonobo_Unknown_unref ((Bonobo_Unknown) shell_view, &ev);
- CORBA_Object_release ((CORBA_Object) shell_view, &ev);
+ if (ev._major == CORBA_NO_EXCEPTION) {
+ Bonobo_Unknown_unref ((Bonobo_Unknown) shell_view, &ev);
+ CORBA_Object_release ((CORBA_Object) shell_view, &ev);
+ }
CORBA_exception_free (&ev);
}