aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog63
-rw-r--r--shell/Evolution-Storage.idl4
-rw-r--r--shell/Evolution-StorageSetView.idl2
-rw-r--r--shell/e-corba-storage-registry.c21
-rw-r--r--shell/e-corba-storage.c8
-rw-r--r--shell/e-corba-storage.h10
-rw-r--r--shell/e-local-storage.c2
-rw-r--r--shell/e-shell-view.c23
-rw-r--r--shell/e-storage-set-view.c5
-rw-r--r--shell/e-storage-set-view.h4
-rw-r--r--shell/e-storage.c41
-rw-r--r--shell/e-storage.h6
-rw-r--r--shell/evolution-local-storage.c2
-rw-r--r--shell/evolution-storage-set-view.c4
-rw-r--r--shell/evolution-storage.c27
-rw-r--r--shell/evolution-storage.h8
16 files changed, 187 insertions, 43 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index e7c5c16e2f..d2cb6c1d65 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,68 @@
2000-12-04 Ettore Perazzoli <ettore@helixcode.com>
+ * Evolution-StorageSetView.idl: Arg @uri renamed to @name in
+ `StorageSetViewListener::notifyStorageSelected'.
+
+ * evolution-storage-set-view.c
+ (storage_set_view_widget_storage_selected_cb): Renamed arg @uri to
+ @name.
+
+ * e-storage-set-view.c (on_cursor_change): Only emit the name of
+ the storage for the "storage_selected" signal [i.e. remove the
+ leading slash].
+
+ * e-shell-view.c (storage_selected_cb): New callback for the
+ "storage_selected" signal on the EStorageSetView used for the
+ folder tree.
+ (setup_storage_set_subwindow): Connect it.
+
+ * evolution-local-storage.c (evolution_local_storage_construct):
+ Pass NULL as the @toplevel_node_uri arg to
+ `evolution_storage_construct()'.
+
+ * evolution-storage.c: New member `toplevel_node_uri' in
+ `EvolutionStoragePrivate'.
+ (init): Init to NULL.
+ (destroy): Free.
+ (evolution_storage_construct): New arg @toplevel_node_uri. Set
+ the @toplevel_node_uri member in the private part to its value.
+ (evolution_storage_new): New arg @toplevel_node_uri. Pass it to
+ `evolution_storage_construct()'.
+ (evolution_storage_register): Pass the @toplevel_node_uri value to
+ the `::addStorage' CORBA method.
+
+ * e-corba-storage-registry.c (impl_StorageRegistry_addStorage):
+ New arg @toplevel_node_uri, to go with the IDL change.
+
+ * Evolution-Storage.idl (StorageRegistry::addStorage): New arg
+ @toplevel_node_uri.
+
+ * e-local-storage.c (construct): Pass NULL as the
+ @toplevel_node_uri arg to `e_storage_construct()'.
+
+ * e-corba-storage.c (e_corba_storage_construct): New arg
+ @toplevel_node_uri. Pass it to `e_storage_construct()'.
+ (e_corba_storage_new): New arg @toplevel_node_uri. Pass it to
+ `e_corba_storage_construct()'.
+
+ * e-storage.c: New member `toplevel_node_uri' in
+ `EStoragePrivate'.
+ (init): Init to NULL.
+ (destroy): Free.
+ (e_storage_construct): New arg @toplevel_node_uri. Set the
+ `toplevel_node_uri' member in the private part to its value.
+ (e_storage_new): New arg @toplevel_node_uri. Pass it to
+ `e_storage_construct()'.
+ (e_storage_get_toplevel_node_uri): New.
+
+ * e-corba-storage-registry.c (impl_StorageRegistry_addStorage):
+ Renamed from `impl_StorageRegistry_register_storage'.
+ (impl_StorageRegistry_removeStorageByName): Renamed from
+ `impl_StorageRegistry_unregister_storage'.
+ (corba_class_init): Updated accordingly.
+
+2000-12-04 Ettore Perazzoli <ettore@helixcode.com>
+
* main.c (new_view_on_running_shell): Don't crash if the object
returned from `oaf_activate_from_id' is NIL and the exception
isn't set. Just handle this as a normal error condition.
diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl
index ab0aa64fa6..4884a05fa9 100644
--- a/shell/Evolution-Storage.idl
+++ b/shell/Evolution-Storage.idl
@@ -61,7 +61,9 @@ module Evolution {
exception Exists {};
exception NotFound {};
- StorageListener addStorage (in Storage storage, in string name)
+ StorageListener addStorage (in Storage storage,
+ in string name,
+ in string toplevel_node_uri)
raises (Exists);
void removeStorageByName (in string name)
diff --git a/shell/Evolution-StorageSetView.idl b/shell/Evolution-StorageSetView.idl
index 43b05fe860..ec192aea00 100644
--- a/shell/Evolution-StorageSetView.idl
+++ b/shell/Evolution-StorageSetView.idl
@@ -14,7 +14,7 @@ module GNOME {
module Evolution {
interface StorageSetViewListener {
void notifyFolderSelected (in string uri);
- void notifyStorageSelected (in string uri);
+ void notifyStorageSelected (in string name);
};
/* FIXME: Maybe we should have a generic Bonobo::Listener interface. */
diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c
index b0c4a34d74..982bd76e49 100644
--- a/shell/e-corba-storage-registry.c
+++ b/shell/e-corba-storage-registry.c
@@ -68,10 +68,11 @@ create_servant (void)
}
static GNOME_Evolution_StorageListener
-impl_StorageRegistry_register_storage (PortableServer_Servant servant,
- const GNOME_Evolution_Storage storage_interface,
- const CORBA_char *name,
- CORBA_Environment *ev)
+impl_StorageRegistry_addStorage (PortableServer_Servant servant,
+ const GNOME_Evolution_Storage storage_interface,
+ const CORBA_char *name,
+ const CORBA_char *toplevel_node_uri,
+ CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
ECorbaStorageRegistry *storage_registry;
@@ -85,7 +86,7 @@ impl_StorageRegistry_register_storage (PortableServer_Servant servant,
storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object);
priv = storage_registry->priv;
- storage = e_corba_storage_new (storage_interface, name);
+ storage = e_corba_storage_new (toplevel_node_uri, storage_interface, name);
if (! e_storage_set_add_storage (priv->storage_set, storage)) {
CORBA_exception_set (ev,
@@ -104,9 +105,9 @@ impl_StorageRegistry_register_storage (PortableServer_Servant servant,
}
static void
-impl_StorageRegistry_unregister_storage (PortableServer_Servant servant,
- const CORBA_char *name,
- CORBA_Environment *ev)
+impl_StorageRegistry_removeStorageByName (PortableServer_Servant servant,
+ const CORBA_char *name,
+ CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
ECorbaStorageRegistry *storage_registry;
@@ -165,8 +166,8 @@ corba_class_init (void)
base_epv->default_POA = NULL;
epv = g_new0 (POA_GNOME_Evolution_StorageRegistry__epv, 1);
- epv->addStorage = impl_StorageRegistry_register_storage;
- epv->removeStorageByName = impl_StorageRegistry_unregister_storage;
+ epv->addStorage = impl_StorageRegistry_addStorage;
+ epv->removeStorageByName = impl_StorageRegistry_removeStorageByName;
vepv = &storage_registry_vepv;
vepv->_base_epv = base_epv;
diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c
index 9b571d04f6..06573974d5 100644
--- a/shell/e-corba-storage.c
+++ b/shell/e-corba-storage.c
@@ -325,6 +325,7 @@ init (ECorbaStorage *corba_storage)
/* FIXME: OK to have a boolean construct function? */
void
e_corba_storage_construct (ECorbaStorage *corba_storage,
+ const char *toplevel_node_uri,
const GNOME_Evolution_Storage storage_interface,
const char *name)
{
@@ -336,7 +337,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));
+ e_storage_construct (E_STORAGE (corba_storage), toplevel_node_uri);
priv = corba_storage->priv;
@@ -357,7 +358,8 @@ e_corba_storage_construct (ECorbaStorage *corba_storage,
}
EStorage *
-e_corba_storage_new (const GNOME_Evolution_Storage storage_interface,
+e_corba_storage_new (const char *toplevel_node_uri,
+ const GNOME_Evolution_Storage storage_interface,
const char *name)
{
EStorage *new;
@@ -367,7 +369,7 @@ e_corba_storage_new (const GNOME_Evolution_Storage storage_interface,
new = gtk_type_new (e_corba_storage_get_type ());
- e_corba_storage_construct (E_CORBA_STORAGE (new), storage_interface, name);
+ e_corba_storage_construct (E_CORBA_STORAGE (new), toplevel_node_uri, storage_interface, name);
return new;
}
diff --git a/shell/e-corba-storage.h b/shell/e-corba-storage.h
index f37d41ad71..9fed54a316 100644
--- a/shell/e-corba-storage.h
+++ b/shell/e-corba-storage.h
@@ -60,11 +60,13 @@ struct _ECorbaStorageClass {
GtkType e_corba_storage_get_type (void);
-void e_corba_storage_construct (ECorbaStorage *corba_storage,
+void e_corba_storage_construct (ECorbaStorage *corba_storage,
+ const char *toplevel_node_uri,
const GNOME_Evolution_Storage storage_interface,
- const char *name);
-EStorage *e_corba_storage_new (const GNOME_Evolution_Storage storage_interface,
- const char *name);
+ const char *name);
+EStorage *e_corba_storage_new (const char *toplevel_node_uri,
+ const GNOME_Evolution_Storage storage_interface,
+ const char *name);
/* FIXME: I don't like this call. */
const GNOME_Evolution_StorageListener e_corba_storage_get_StorageListener (ECorbaStorage *corba_storage);
diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c
index 8da09893e5..d672465219 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));
+ e_storage_construct (E_STORAGE (local_storage), NULL);
priv = local_storage->priv;
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index a82ba563b8..c6618e31c6 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -365,6 +365,27 @@ folder_selected_cb (EStorageSetView *storage_set_view,
popdown_transient_folder_bar (shell_view);
}
+/* Callback called when a storage in the tree view is clicked. */
+static void
+storage_selected_cb (EStorageSetView *storage_set_view,
+ const char *name,
+ void *data)
+{
+ EShellView *shell_view;
+ EShellViewPrivate *priv;
+ EStorageSet *storage_set;
+ EStorage *storage;
+ const char *uri;
+
+ shell_view = E_SHELL_VIEW (data);
+ priv = shell_view->priv;
+
+ storage_set = e_shell_get_storage_set (priv->shell);
+
+ storage = e_storage_set_get_storage (storage_set, name);
+ g_assert (storage != NULL);
+}
+
/* Callback called when the button on the tree's title bar is clicked. */
static void
storage_set_view_button_clicked_cb (ETitleBar *title_bar,
@@ -410,6 +431,8 @@ setup_storage_set_subwindow (EShellView *shell_view)
storage_set_view = e_storage_set_view_new (e_shell_get_storage_set (priv->shell));
gtk_signal_connect (GTK_OBJECT (storage_set_view), "folder_selected",
GTK_SIGNAL_FUNC (folder_selected_cb), shell_view);
+ gtk_signal_connect (GTK_OBJECT (storage_set_view), "storage_selected",
+ GTK_SIGNAL_FUNC (storage_selected_cb), shell_view);
scroll_frame = e_scroll_frame_new (NULL, NULL);
e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll_frame), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index 6bdab60f12..41274e0c1f 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -926,11 +926,10 @@ on_cursor_change (EStorageSetView *storage_set_view, int row, gpointer user_data
/* it was a folder */
gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED],
priv->selected_row_path);
- }
- else {
+ } else {
/* it was a storage */
gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[STORAGE_SELECTED],
- priv->selected_row_path);
+ priv->selected_row_path + 1);
}
}
diff --git a/shell/e-storage-set-view.h b/shell/e-storage-set-view.h
index f1aac5acdc..2121e5ce96 100644
--- a/shell/e-storage-set-view.h
+++ b/shell/e-storage-set-view.h
@@ -59,9 +59,9 @@ struct _EStorageSetViewClass {
/* Signals. */
void (* folder_selected) (EStorageSetView *storage_set_view,
- const char *uri);
+ const char *path);
void (* storage_selected) (EStorageSetView *storage_set_view,
- const char *uri);
+ const char *name);
};
diff --git a/shell/e-storage.c b/shell/e-storage.c
index 3ea687716c..ab07bd13a9 100644
--- a/shell/e-storage.c
+++ b/shell/e-storage.c
@@ -44,7 +44,11 @@ static GtkObjectClass *parent_class = NULL;
E_STORAGE_CLASS (GTK_OBJECT (obj)->klass)
struct _EStoragePrivate {
+ /* The set of folders we have in this storage. */
EFolderTree *folder_tree;
+
+ /* URI for the toplevel node. */
+ char *toplevel_node_uri;
};
enum {
@@ -91,6 +95,8 @@ destroy (GtkObject *object)
if (priv->folder_tree != NULL)
e_folder_tree_destroy (priv->folder_tree);
+ g_free (priv->toplevel_node_uri);
+
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -202,7 +208,8 @@ init (EStorage *storage)
priv = g_new (EStoragePrivate, 1);
- priv->folder_tree = e_folder_tree_new (folder_destroy_notify, NULL);
+ priv->folder_tree = e_folder_tree_new (folder_destroy_notify, NULL);
+ priv->toplevel_node_uri = NULL;
storage->priv = priv;
}
@@ -211,22 +218,28 @@ init (EStorage *storage)
/* Creation. */
void
-e_storage_construct (EStorage *storage)
+e_storage_construct (EStorage *storage,
+ const char *toplevel_node_uri)
{
+ EStoragePrivate *priv;
+
g_return_if_fail (storage != NULL);
g_return_if_fail (E_IS_STORAGE (storage));
+ priv = storage->priv;
+ priv->toplevel_node_uri = g_strdup (toplevel_node_uri);
+
GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (storage), GTK_FLOATING);
}
EStorage *
-e_storage_new (void)
+e_storage_new (const char *toplevel_node_uri)
{
EStorage *new;
new = gtk_type_new (e_storage_get_type ());
- e_storage_construct (new);
+ e_storage_construct (new, toplevel_node_uri);
return new;
}
@@ -282,6 +295,26 @@ e_storage_get_name (EStorage *storage)
return (* ES_CLASS (storage)->get_name) (storage);
}
+/**
+ * e_storage_get_toplevel_node_uri:
+ * @storage: A pointer to an EStorage object
+ *
+ * Get the physical URI for the toplevel node in the storage.
+ *
+ * Return value: a pointer to a string representing that URI.
+ **/
+const char *
+e_storage_get_toplevel_node_uri (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_uri;
+}
+
/* Folder operations. */
diff --git a/shell/e-storage.h b/shell/e-storage.h
index 4500d9bb4f..d44a4161df 100644
--- a/shell/e-storage.h
+++ b/shell/e-storage.h
@@ -95,8 +95,9 @@ struct _EStorageClass {
GtkType e_storage_get_type (void);
-void e_storage_construct (EStorage *storage);
-EStorage *e_storage_new (void);
+void e_storage_construct (EStorage *storage,
+ const char *toplevel_node_uri);
+EStorage *e_storage_new (const char *toplevel_node_uri);
gboolean e_storage_path_is_relative (const char *path);
gboolean e_storage_path_is_absolute (const char *path);
@@ -107,6 +108,7 @@ 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);
/* Folder operations. */
diff --git a/shell/evolution-local-storage.c b/shell/evolution-local-storage.c
index c0e900087b..b3a9183b57 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);
+ evolution_storage_construct (EVOLUTION_STORAGE (local_storage), corba_object, name, NULL);
}
EvolutionLocalStorage *
diff --git a/shell/evolution-storage-set-view.c b/shell/evolution-storage-set-view.c
index 1fcac0bc01..a90bce0266 100644
--- a/shell/evolution-storage-set-view.c
+++ b/shell/evolution-storage-set-view.c
@@ -69,7 +69,7 @@ storage_set_view_widget_folder_selected_cb (EStorageSetView *storage_set_view_wi
static void
storage_set_view_widget_storage_selected_cb (EStorageSetView *storage_set_view_widget,
- const char *uri,
+ const char *name,
void *data)
{
EvolutionStorageSetView *storage_set_view;
@@ -86,7 +86,7 @@ storage_set_view_widget_storage_selected_cb (EStorageSetView *storage_set_view_w
CORBA_exception_init (&ev);
listener = (GNOME_Evolution_StorageSetViewListener) p->data;
- GNOME_Evolution_StorageSetViewListener_notifyStorageSelected (listener, uri, &ev);
+ GNOME_Evolution_StorageSetViewListener_notifyStorageSelected (listener, name, &ev);
/* FIXME: What if we fail? */
diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c
index d16d7f88c5..81d923b803 100644
--- a/shell/evolution-storage.c
+++ b/shell/evolution-storage.c
@@ -31,6 +31,8 @@
#include <gal/util/e-util.h>
+#include "e-util/e-corba-utils.h"
+
#include "e-folder-tree.h"
#include "evolution-storage.h"
@@ -40,10 +42,16 @@
static BonoboObjectClass *parent_class = NULL;
struct _EvolutionStoragePrivate {
+ /* Name of the storage. */
char *name;
+ /* URI for the toplevel node of the storage. */
+ char *toplevel_node_uri;
+
+ /* The set of folders we have in this storage. */
EFolderTree *folder_tree;
+ /* The listener registered on this storage. */
GList *corba_storage_listeners;
};
@@ -271,6 +279,7 @@ destroy (GtkObject *object)
priv = storage->priv;
g_free (priv->name);
+ g_free (priv->toplevel_node_uri);
if (priv->folder_tree != NULL)
e_folder_tree_destroy (priv->folder_tree);
@@ -335,8 +344,9 @@ init (EvolutionStorage *storage)
EvolutionStoragePrivate *priv;
priv = g_new (EvolutionStoragePrivate, 1);
- priv->folder_tree = e_folder_tree_new (folder_destroy_notify, storage);
priv->name = NULL;
+ priv->toplevel_node_uri = NULL;
+ priv->folder_tree = e_folder_tree_new (folder_destroy_notify, storage);
priv->corba_storage_listeners = NULL;
storage->priv = priv;
@@ -359,7 +369,8 @@ evolution_storage_get_epv (void)
void
evolution_storage_construct (EvolutionStorage *storage,
GNOME_Evolution_Storage corba_object,
- const char *name)
+ const char *name,
+ const char *toplevel_node_uri)
{
EvolutionStoragePrivate *priv;
@@ -372,11 +383,13 @@ evolution_storage_construct (EvolutionStorage *storage,
bonobo_object_construct (BONOBO_OBJECT (storage), corba_object);
priv = storage->priv;
- priv->name = g_strdup (name);
+ priv->name = g_strdup (name);
+ priv->toplevel_node_uri = g_strdup (toplevel_node_uri);
}
EvolutionStorage *
-evolution_storage_new (const char *name)
+evolution_storage_new (const char *name,
+ const char *toplevel_node_uri)
{
EvolutionStorage *new;
POA_GNOME_Evolution_Storage *servant;
@@ -392,7 +405,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);
+ evolution_storage_construct (new, corba_object, name, toplevel_node_uri);
return new;
}
@@ -424,7 +437,9 @@ evolution_storage_register (EvolutionStorage *evolution_storage,
corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (evolution_storage));
corba_storage_listener = GNOME_Evolution_StorageRegistry_addStorage (corba_storage_registry,
corba_storage,
- priv->name, &ev);
+ priv->name,
+ e_safe_corba_string (priv->toplevel_node_uri),
+ &ev);
if (ev._major == CORBA_NO_EXCEPTION) {
add_listener (evolution_storage, corba_storage_listener);
diff --git a/shell/evolution-storage.h b/shell/evolution-storage.h
index b59dea931c..037ad75b15 100644
--- a/shell/evolution-storage.h
+++ b/shell/evolution-storage.h
@@ -76,9 +76,11 @@ 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);
-EvolutionStorage *evolution_storage_new (const char *name);
+ 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);