aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog39
-rw-r--r--shell/Evolution-LocalStorage.idl32
-rw-r--r--shell/e-corba-storage.c2
-rw-r--r--shell/e-folder-tree.c34
-rw-r--r--shell/e-folder-tree.h37
-rw-r--r--shell/e-folder.c2
-rw-r--r--shell/e-local-storage.c20
-rw-r--r--shell/e-local-storage.h2
-rw-r--r--shell/e-shell-view.c37
-rw-r--r--shell/e-storage.c46
-rw-r--r--shell/e-storage.h1
11 files changed, 162 insertions, 90 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 8cc0dea1c5..dd7b7201ce 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,6 +1,45 @@
+2001-01-23 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-corba-storage.c (impl_StorageListener_update_folder): Don't
+ call `e_storage_updated_folder()' as it's supposed to happen
+ automatically now.
+
+ * e-storage.c (e_storage_updated_folder): Removed.
+ (folder_changed_cb): New callback for the "changed" signal on the
+ EFolders.
+ (e_storage_new_folder): Connect it.
+
+ * e-folder-tree.c: New member `data_to_path' in `EFolderTree'.
+ (e_folder_tree_new): Init here.
+ (e_folder_tree_destroy): Destroy it here.
+ (e_folder_tree_add): Add to the `data_to_path' hash. Make sure
+ we are not adding the same folder twice.
+ (remove_folder): Remove from the `data_to_path' hash.
+ (e_folder_tree_get_path_for_folder): New.
+
+ * e-shell-view.c (e_shell_view_construct): Don't connect to the
+ "folder_updated" signal of the local storage anymore.
+ (folder_updated_cb): Removed.
+ (updated_folder_cb): New.
+ (e_shell_view_construct): Connect it to the "updated_folder"
+ signal.
+
+ * e-local-storage.c: Remove `FOLDER_UPDATED' enum value and the
+ `signals' variable, as we don't want to define any custom signals
+ here anymore.
+ (bonobo_interface_update_folder_cb): No need to emit the
+ "folder_updated" signal here. The base class will take care of
+ this already.
+ (class_init): Don't install the "folder_updated" signal here.
+
+ * e-local-storage.h: Removed signal "folder_updated". It is not
+ necessary, as we already have an `updated_folder' in `EStorage',
+ which is the parent class of `ELocalStorage'.
+
2001-01-24 Iain Holmes <iain@ximian.com>
* importer/GNOME_Evolution_Importer.idl: Removed the busy exception.
+
2001-01-19 Iain Holmes <iain@ximian.com>
* importer/GNOME_Evolution_Importer.idl: Make the processItem oneway.
diff --git a/shell/Evolution-LocalStorage.idl b/shell/Evolution-LocalStorage.idl
index 04d04c7150..8ade4e9813 100644
--- a/shell/Evolution-LocalStorage.idl
+++ b/shell/Evolution-LocalStorage.idl
@@ -27,5 +27,37 @@ module Evolution {
in string display_name,
in boolean highlighted);
};
+
+ interface LocalStorageOpsListener : Bonobo::Unknown {
+ enum Result {
+ OK,
+ UNSUPPORTED_OPERATION,
+ UNSUPPORTED_TYPE,
+ EXISTS,
+ INVALID_URI,
+ PERMISSION_DENIED,
+ HAS_SUBFOLDERS,
+ NO_SPACE
+ };
+
+ void notifyResult (in Result result);
+ };
+
+ interface LocalStorageOps : Bonobo::Unknown {
+ exception Busy {};
+
+ void addFolderAsync (in ShellComponentListener listener,
+ in string physical_uri,
+ in string type)
+ raises (Busy);
+
+ void removeFolderAsync (in ShellComponentListener listener,
+ in string physical_uri)
+ raises (Busy);
+
+ void populateFolderContextMenu (in Bonobo::UIContainer uih,
+ in string physical_uri,
+ in string type);
+ };
};
};
diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c
index 2a0d61d4ee..9326f6ca5c 100644
--- a/shell/e-corba-storage.c
+++ b/shell/e-corba-storage.c
@@ -150,8 +150,6 @@ impl_StorageListener_update_folder (PortableServer_Servant servant,
e_folder_set_name (e_folder, display_name);
e_folder_set_highlighted (e_folder, highlighted);
-
- e_storage_updated_folder (storage, path);
}
static void
diff --git a/shell/e-folder-tree.c b/shell/e-folder-tree.c
index 9962fa508f..a3f5d661ee 100644
--- a/shell/e-folder-tree.c
+++ b/shell/e-folder-tree.c
@@ -41,6 +41,7 @@ typedef struct _Folder Folder;
struct _EFolderTree {
GHashTable *path_to_folder;
+ GHashTable *data_to_path;
EFolderDestroyNotify folder_destroy_notify;
void *folder_destroy_notify_closure;
@@ -149,6 +150,7 @@ remove_folder (EFolderTree *folder_tree,
}
g_hash_table_remove (folder_tree->path_to_folder, folder->path);
+ g_hash_table_remove (folder_tree->data_to_path, folder->data);
if (folder_tree->folder_destroy_notify != NULL)
(* folder_tree->folder_destroy_notify) (folder_tree,
@@ -182,9 +184,11 @@ e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify,
new->folder_destroy_notify_closure = closure;
new->path_to_folder = g_hash_table_new (g_str_hash, g_str_equal);
+ new->data_to_path = g_hash_table_new (g_direct_hash, g_direct_equal);
root_folder = folder_new (G_DIR_SEPARATOR_S, NULL);
g_hash_table_insert (new->path_to_folder, root_folder->path, root_folder);
+ g_hash_table_insert (new->data_to_path, root_folder->data, root_folder->path);
return new;
}
@@ -206,6 +210,7 @@ e_folder_tree_destroy (EFolderTree *folder_tree)
remove_folder (folder_tree, root_folder);
g_hash_table_destroy (folder_tree->path_to_folder);
+ g_hash_table_destroy (folder_tree->data_to_path);
g_free (folder_tree);
}
@@ -227,6 +232,7 @@ e_folder_tree_add (EFolderTree *folder_tree,
{
Folder *parent_folder;
Folder *folder;
+ const char *existing_path;
char *parent_path;
g_return_val_if_fail (folder_tree != NULL, FALSE);
@@ -249,10 +255,18 @@ e_folder_tree_add (EFolderTree *folder_tree,
return FALSE;
}
+ existing_path = g_hash_table_lookup (folder_tree->data_to_path, data);
+ if (existing_path != NULL) {
+ g_warning ("%s: Trying to add a folder with duplicate data -- %s",
+ __FUNCTION__, path);
+ return FALSE;
+ }
+
folder = folder_new (path, data);
folder_add_subfolder (parent_folder, folder);
g_hash_table_insert (folder_tree->path_to_folder, folder->path, folder);
+ g_hash_table_insert (folder_tree->data_to_path, data, folder->path);
g_free (parent_path);
@@ -378,3 +392,23 @@ e_folder_tree_foreach (EFolderTree *folder_tree,
traverse_subtree (folder_tree, root_node, foreach_func, data);
}
+
+
+/**
+ * e_folder_tree_get_path_for_data:
+ * @folder_tree: A pointer to an EFolderTree
+ * @data: The data for the folder for which the path is needed
+ *
+ * Look up the path for the specified @data.
+ *
+ * Return value: The path for the folder that holds that @data.
+ **/
+const char *
+e_folder_tree_get_path_for_data (EFolderTree *folder_tree,
+ const void *data)
+{
+ g_return_val_if_fail (folder_tree != NULL, NULL);
+ g_return_val_if_fail (data != NULL, NULL);
+
+ return (const char *) g_hash_table_lookup (folder_tree->data_to_path, data);
+}
diff --git a/shell/e-folder-tree.h b/shell/e-folder-tree.h
index 59613cbaba..26fa4b13a4 100644
--- a/shell/e-folder-tree.h
+++ b/shell/e-folder-tree.h
@@ -31,22 +31,27 @@ typedef void (* EFolderDestroyNotify) (EFolderTree *tree, const char *path, vo
typedef void (* EFolderTreeForeachFunc) (EFolderTree *tree, const char *path, void *data, void *closure);
-EFolderTree *e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify,
- void *closure);
-void e_folder_tree_destroy (EFolderTree *folder_tree);
-gboolean e_folder_tree_add (EFolderTree *folder_tree,
- const char *path,
- void *data);
-gboolean e_folder_tree_remove (EFolderTree *folder_tree,
- const char *path);
+EFolderTree *e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify,
+ void *closure);
+
+void e_folder_tree_destroy (EFolderTree *folder_tree);
+
+gboolean e_folder_tree_add (EFolderTree *folder_tree,
+ const char *path,
+ void *data);
+gboolean e_folder_tree_remove (EFolderTree *folder_tree,
+ const char *path);
+
+void *e_folder_tree_get_folder (EFolderTree *folder_tree,
+ const char *path);
+GList *e_folder_tree_get_subfolders (EFolderTree *folder_tree,
+ const char *path);
+
+void e_folder_tree_foreach (EFolderTree *folder_tree,
+ EFolderTreeForeachFunc foreach_func,
+ void *data);
-void *e_folder_tree_get_folder (EFolderTree *folder_tree,
- const char *path);
-GList *e_folder_tree_get_subfolders (EFolderTree *folder_tree,
- const char *path);
-
-void e_folder_tree_foreach (EFolderTree *folder_tree,
- EFolderTreeForeachFunc foreach_func,
- void *data);
+const char *e_folder_tree_get_path_for_data (EFolderTree *folder_tree,
+ const void *data);
#endif /* _E_FOLDER_TREE_H_ */
diff --git a/shell/e-folder.c b/shell/e-folder.c
index 28f72fc705..bad986fac6 100644
--- a/shell/e-folder.c
+++ b/shell/e-folder.c
@@ -241,7 +241,7 @@ e_folder_get_highlighted (EFolder *folder)
void
e_folder_set_name (EFolder *folder,
- const char *name)
+ const char *name)
{
g_return_if_fail (folder != NULL);
g_return_if_fail (E_IS_FOLDER (folder));
diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c
index 2ab98555da..a149e21fca 100644
--- a/shell/e-local-storage.c
+++ b/shell/e-local-storage.c
@@ -69,13 +69,6 @@ struct _ELocalStoragePrivate {
EvolutionLocalStorage *bonobo_interface;
};
-enum {
- FOLDER_UPDATED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
/* Utility functions. */
@@ -555,8 +548,6 @@ bonobo_interface_update_folder_cb (EvolutionLocalStorage *bonobo_local_storage,
e_folder_set_name (folder, display_name);
e_folder_set_highlighted (folder, highlighted);
-
- gtk_signal_emit (GTK_OBJECT (local_storage), signals[FOLDER_UPDATED], path);
}
@@ -577,17 +568,6 @@ class_init (ELocalStorageClass *class)
storage_class->get_name = impl_get_name;
storage_class->async_create_folder = impl_async_create_folder;
storage_class->async_remove_folder = impl_async_remove_folder;
-
- signals[FOLDER_UPDATED] =
- gtk_signal_new ("folder_updated",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ELocalStorageClass, folder_updated),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_STRING);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
static void
diff --git a/shell/e-local-storage.h b/shell/e-local-storage.h
index 8b1d6f2846..a7cb520ba1 100644
--- a/shell/e-local-storage.h
+++ b/shell/e-local-storage.h
@@ -54,8 +54,6 @@ struct _ELocalStorage {
struct _ELocalStorageClass {
EStorageClass parent_class;
-
- void (* folder_updated) (ELocalStorage *local_storage, const char *path);
};
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 0b9a6a13c3..b8b3aad980 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -883,33 +883,22 @@ unmerge_on_error (BonoboObject *object,
win = bonobo_ui_container_get_win (BONOBO_UI_CONTAINER (object));
if (win)
- bonobo_window_deregister_component_by_ref (
- win, cobject);
+ bonobo_window_deregister_component_by_ref (win, cobject);
}
static void
-folder_updated_cb (EStorage *storage,
+updated_folder_cb (EStorageSet *storage_set,
const char *path,
- void *data)
+ void *data)
{
EShellView *shell_view;
EShellViewPrivate *priv;
- char *full_path;
char *uri;
shell_view = E_SHELL_VIEW (data);
priv = shell_view->priv;
- /* Build the URI from the @path we're given */
- if (! g_path_is_absolute (path))
- full_path = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage),
- G_DIR_SEPARATOR_S, path, NULL);
- else
- full_path = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage),
- path, NULL);
-
- uri = g_strconcat (E_SHELL_URI_PREFIX, full_path, NULL);
- g_free (full_path);
+ uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
/* Update the shortcut bar */
e_shortcuts_update_shortcut_by_uri (e_shell_get_shortcuts (priv->shell), uri);
@@ -945,20 +934,16 @@ e_shell_view_construct (EShellView *shell_view,
window = GTK_OBJECT (view);
- gtk_signal_connect (window, "delete_event",
- (GtkSignalFunc) delete_event, NULL);
+ gtk_signal_connect (window, "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL);
priv->shell = shell;
- gtk_signal_connect (GTK_OBJECT (e_shell_get_local_storage (priv->shell)), "folder_updated",
- folder_updated_cb, shell_view);
gtk_signal_connect (GTK_OBJECT (e_shell_get_storage_set (priv->shell)), "updated_folder",
- folder_updated_cb, shell_view);
+ updated_folder_cb, shell_view);
container = bonobo_ui_container_new ();
bonobo_ui_container_set_win (container, BONOBO_WINDOW (shell_view));
- gtk_signal_connect (GTK_OBJECT (container), "system_exception",
- (GtkSignalFunc) unmerge_on_error, NULL);
+ gtk_signal_connect (GTK_OBJECT (container), "system_exception", GTK_SIGNAL_FUNC (unmerge_on_error), NULL);
priv->ui_component = bonobo_ui_component_new ("evolution");
bonobo_ui_component_set_container (priv->ui_component,
@@ -966,14 +951,12 @@ e_shell_view_construct (EShellView *shell_view,
bonobo_ui_component_freeze (priv->ui_component, NULL);
- bonobo_ui_util_set_ui (priv->ui_component, EVOLUTION_DATADIR,
- "evolution.xml", "evolution");
+ bonobo_ui_util_set_ui (priv->ui_component, EVOLUTION_DATADIR, "evolution.xml", "evolution");
setup_widgets (shell_view);
- bonobo_ui_engine_config_set_path (
- bonobo_window_get_ui_engine (BONOBO_WINDOW (shell_view)),
- "/evolution/UIConf/kvps");
+ bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (BONOBO_WINDOW (shell_view)),
+ "/evolution/UIConf/kvps");
e_shell_view_menu_setup (shell_view);
diff --git a/shell/e-storage.c b/shell/e-storage.c
index 9e99a61e95..72670d832d 100644
--- a/shell/e-storage.c
+++ b/shell/e-storage.c
@@ -84,6 +84,28 @@ folder_destroy_notify (EFolderTree *tree,
}
+/* Signal callbacks for the EFolders. */
+
+static void
+folder_changed_cb (EFolder *folder,
+ void *data)
+{
+ EStorage *storage;
+ EStoragePrivate *priv;
+ const char *path;
+
+ g_assert (E_IS_STORAGE (data));
+
+ storage = E_STORAGE (data);
+ priv = storage->priv;
+
+ path = e_folder_tree_get_path_for_data (priv->folder_tree, folder);
+ g_assert (path != NULL);
+
+ gtk_signal_emit (GTK_OBJECT (storage), signals[UPDATED_FOLDER], path);
+}
+
+
/* GtkObject methods. */
static void
@@ -502,28 +524,10 @@ e_storage_new_folder (EStorage *storage,
if (! e_folder_tree_add (priv->folder_tree, path, e_folder))
return FALSE;
- gtk_signal_emit (GTK_OBJECT (storage), signals[NEW_FOLDER], path);
-
- return TRUE;
-}
+ gtk_signal_connect_while_alive (GTK_OBJECT (e_folder), "changed", folder_changed_cb,
+ storage, GTK_OBJECT (storage));
-gboolean
-e_storage_updated_folder (EStorage *storage,
- const char *path)
-{
- EStoragePrivate *priv;
-
- 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;
-
- if (e_folder_tree_get_folder (priv->folder_tree, path) == NULL)
- return FALSE;
-
- gtk_signal_emit (GTK_OBJECT (storage), signals[UPDATED_FOLDER], path);
+ gtk_signal_emit (GTK_OBJECT (storage), signals[NEW_FOLDER], path);
return TRUE;
}
diff --git a/shell/e-storage.h b/shell/e-storage.h
index 3bddafe73a..188ef4eb05 100644
--- a/shell/e-storage.h
+++ b/shell/e-storage.h
@@ -137,7 +137,6 @@ char *e_storage_get_path_for_physical_uri (EStorage *storage,
/* Protected. C++ anyone? */
gboolean e_storage_new_folder (EStorage *storage, const char *path, EFolder *folder);
-gboolean e_storage_updated_folder (EStorage *storage, const char *path);
gboolean e_storage_removed_folder (EStorage *storage, const char *path);
#ifdef __cplusplus