diff options
-rw-r--r-- | shell/ChangeLog | 52 | ||||
-rw-r--r-- | shell/e-folder-dnd-bridge.c | 3 | ||||
-rw-r--r-- | shell/e-folder-tree.c | 14 | ||||
-rw-r--r-- | shell/e-local-storage.c | 18 | ||||
-rw-r--r-- | shell/e-shell-constants.h | 3 | ||||
-rw-r--r-- | shell/e-shell-folder-title-bar.c | 1 | ||||
-rw-r--r-- | shell/e-shell-utils.c | 2 | ||||
-rw-r--r-- | shell/e-shell-view.c | 8 | ||||
-rw-r--r-- | shell/e-shortcuts-view.c | 2 | ||||
-rw-r--r-- | shell/e-storage-set-view.c | 14 | ||||
-rw-r--r-- | shell/e-storage-set.c | 30 | ||||
-rw-r--r-- | shell/e-storage.c | 15 | ||||
-rw-r--r-- | shell/evolution-storage-set-view.c | 1 | ||||
-rw-r--r-- | shell/evolution-storage.c | 10 |
14 files changed, 122 insertions, 51 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index b8f86eee38..fd5be3a1f1 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,55 @@ +2002-07-18 Ettore Perazzoli <ettore@ximian.com> + + * evolution-storage-set-view.c + (impl_StorageSetView__set_checkedFolders): Removed unused + variable. + + * e-shell-folder-title-bar.c (e_shell_folder_title_bar_construct): + Removed unused variable. + + Mass-replaced G_DIR_SEPARATOR and G_DIR_SEPARATOR_S with + E_PATH_SEPARATOR and E_PATH_SEPARATOR_S: + + * e-storage.c + (e_storage_path_is_absolute) + (e_storage_path_is_relative) + (e_storage_async_xfer_folder) + * e-storage-set.c + (make_full_path) + (get_storage_for_path) + (signal_new_folder_for_all_folders_under_paths) + (signal_new_folder_for_all_folders_in_storage) + (e_storage_set_get_path_for_physical_uri) + * e-storage-set-view.c + (storage_sort_callback) + (new_storage_cb) + (removed_storage_cb) + (new_folder_cb) + * e-shortcuts-view.c + (get_shortcut_info): + * e-shell-view.c + (handle_current_folder_removed) + * e-shell-utils.c + (e_shell_folder_name_is_valid): + * e-local-storage.c + (construct): + * e-folder-tree.c + (get_parent_path) + (get_parent_path) + (e_folder_tree_destroy) + (e_folder_tree_add) + (e_folder_tree_foreach) + * e-folder-dnd-bridge.c + (handle_data_received_path) + * evolution-storage.c + (make_full_uri): + + * e-shell-constants.h: New #defines E_PATH_SEPARATOR and + E_PATH_SEPARATOR_S. + + * e-local-storage.c (load_folder): Don't add the folder if its + type isn't registered. + 2002-07-17 Ettore Perazzoli <ettore@ximian.com> * e-shortcuts-view-model.c (get_icon_for_item): Get the diff --git a/shell/e-folder-dnd-bridge.c b/shell/e-folder-dnd-bridge.c index 5614574e92..e17bf86146 100644 --- a/shell/e-folder-dnd-bridge.c +++ b/shell/e-folder-dnd-bridge.c @@ -29,6 +29,7 @@ #include "Evolution.h" #include "e-storage-set-view.h" +#include "e-shell-constants.h" #include <gal/widgets/e-gui-utils.h> @@ -350,7 +351,7 @@ handle_data_received_path (GdkDragContext *context, source_path = (const char *) selection_data->data; /* (Basic sanity checks.) */ - if (source_path == NULL || source_path[0] != G_DIR_SEPARATOR || source_path[1] == '\0') + if (source_path == NULL || source_path[0] != E_PATH_SEPARATOR || source_path[1] == '\0') return FALSE; destination_path = g_concat_dir_and_file (path, g_basename (source_path)); diff --git a/shell/e-folder-tree.c b/shell/e-folder-tree.c index 46e7897711..f6decb4fc0 100644 --- a/shell/e-folder-tree.c +++ b/shell/e-folder-tree.c @@ -26,6 +26,8 @@ #include "e-folder-tree.h" +#include "e-shell-constants.h" + #include <string.h> #include <glib.h> @@ -56,10 +58,10 @@ get_parent_path (const char *path) g_assert (g_path_is_absolute (path)); - last_separator = strrchr (path, G_DIR_SEPARATOR); + last_separator = strrchr (path, E_PATH_SEPARATOR); if (last_separator == path) - return g_strdup (G_DIR_SEPARATOR_S); + return g_strdup (E_PATH_SEPARATOR_S); return g_strndup (path, last_separator - path); } @@ -186,7 +188,7 @@ e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify, 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); - e_folder_tree_add (new, G_DIR_SEPARATOR_S, NULL); + e_folder_tree_add (new, E_PATH_SEPARATOR_S, NULL); return new; } @@ -204,7 +206,7 @@ e_folder_tree_destroy (EFolderTree *folder_tree) g_return_if_fail (folder_tree != NULL); - root_folder = g_hash_table_lookup (folder_tree->path_to_folder, G_DIR_SEPARATOR_S); + root_folder = g_hash_table_lookup (folder_tree->path_to_folder, E_PATH_SEPARATOR_S); remove_folder (folder_tree, root_folder); g_hash_table_destroy (folder_tree->path_to_folder); @@ -238,7 +240,7 @@ e_folder_tree_add (EFolderTree *folder_tree, g_return_val_if_fail (g_path_is_absolute (path), FALSE); /* Can only "add" a new root folder if the tree is empty */ - if (! strcmp (path, G_DIR_SEPARATOR_S)) { + if (! strcmp (path, E_PATH_SEPARATOR_S)) { folder = g_hash_table_lookup (folder_tree->path_to_folder, path); if (folder) { if (folder->subfolders) { @@ -428,7 +430,7 @@ e_folder_tree_foreach (EFolderTree *folder_tree, g_return_if_fail (foreach_func != NULL); root_node = g_hash_table_lookup (folder_tree->path_to_folder, - G_DIR_SEPARATOR_S); + E_PATH_SEPARATOR_S); if (root_node == NULL) { g_warning ("e_folder_tree_foreach -- What?! No root node!?"); return; diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 393c1aa4da..8c263d1e76 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -184,17 +184,29 @@ setup_stock_folders (ELocalStorage *local_storage) } static gboolean -load_folder (const char *physical_path, const char *path, gpointer data) +load_folder (const char *physical_path, + const char *path, + void *data) { - ELocalStorage *local_storage = data; + ELocalStorage *local_storage; EFolder *folder; + local_storage = E_LOCAL_STORAGE (data); + folder = e_local_folder_new_from_path (physical_path); if (folder == NULL) { g_warning ("No folder metadata in %s... ignoring", physical_path); return TRUE; } + /* Ignore the folder if it uses an unknown type. */ + if (! e_folder_type_register_type_registered (local_storage->priv->folder_type_registry, + e_folder_get_type_string (folder))) { + g_warning ("Folder in %s has unknown type (%s)... ignoring", + physical_path, e_folder_get_type_string (folder)); + return FALSE; + } + new_folder (local_storage, path, folder); return TRUE; } @@ -1095,7 +1107,7 @@ construct (ELocalStorage *local_storage, priv = local_storage->priv; base_path_len = strlen (base_path); - while (base_path_len > 0 && base_path[base_path_len - 1] == G_DIR_SEPARATOR) + while (base_path_len > 0 && base_path[base_path_len - 1] == E_PATH_SEPARATOR) base_path_len--; g_return_val_if_fail (base_path_len != 0, FALSE); diff --git a/shell/e-shell-constants.h b/shell/e-shell-constants.h index 0d5e5f37d4..9e0d7a5379 100644 --- a/shell/e-shell-constants.h +++ b/shell/e-shell-constants.h @@ -35,6 +35,9 @@ #define E_SHELL_ICON_SIZE 48 #define E_SHELL_MINI_ICON_SIZE 16 +#define E_PATH_SEPARATOR '/' +#define E_PATH_SEPARATOR_S "/" + #define E_LOCAL_STORAGE_NAME "local" #define E_SUMMARY_STORAGE_NAME "summary" diff --git a/shell/e-shell-folder-title-bar.c b/shell/e-shell-folder-title-bar.c index c3750f8cdc..80257a6d50 100644 --- a/shell/e-shell-folder-title-bar.c +++ b/shell/e-shell-folder-title-bar.c @@ -521,7 +521,6 @@ e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar) EShellFolderTitleBarPrivate *priv; GtkWidget *title_button_hbox; GtkWidget *widget; - GtkRequisition button_requisition; g_return_if_fail (folder_title_bar != NULL); g_return_if_fail (E_IS_SHELL_FOLDER_TITLE_BAR (folder_title_bar)); diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c index 5ba0304331..7eb54d8218 100644 --- a/shell/e-shell-utils.c +++ b/shell/e-shell-utils.c @@ -122,7 +122,7 @@ e_shell_folder_name_is_valid (const char *name, return FALSE; } - if (strchr (name, G_DIR_SEPARATOR) != NULL) { + if (strchr (name, E_PATH_SEPARATOR) != NULL) { if (reason_return != NULL) *reason_return = _("Folder name cannot contain slashes."); return FALSE; diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 6e12ed4323..ad016da488 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -423,22 +423,22 @@ handle_current_folder_removed (EShellView *shell_view) current_path = priv->uri + E_SHELL_URI_PREFIX_LEN; - g_assert (*current_path == G_DIR_SEPARATOR); + g_assert (*current_path == E_PATH_SEPARATOR); new_path = NULL; /* If we have a parent folder (not a parent storage), try to display that one. */ - p = strrchr (current_path + 1, G_DIR_SEPARATOR); - if (p != NULL && p[1] != '\0' && strchr (current_path + 1, G_DIR_SEPARATOR) != p) { + p = strrchr (current_path + 1, E_PATH_SEPARATOR); + if (p != NULL && p[1] != '\0' && strchr (current_path + 1, E_PATH_SEPARATOR) != p) { new_path = g_strndup (current_path, p - current_path); } else { /* We don't have a parent folder, so try to see if there is an Inbox folder in the same storage. */ /* Extract the storage name. */ - p = strchr (current_path + 1, G_DIR_SEPARATOR); + p = strchr (current_path + 1, E_PATH_SEPARATOR); if (p == NULL) { /* The URL points itself to a storage, so just redirect to the default case. */ diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c index adebe59ab1..ab3841b3aa 100644 --- a/shell/e-shortcuts-view.c +++ b/shell/e-shortcuts-view.c @@ -519,7 +519,7 @@ get_shortcut_info (EShortcutsView *shortcuts_view, return; } - path = strchr (item_url, G_DIR_SEPARATOR); + path = strchr (item_url, E_PATH_SEPARATOR); storage_set = e_shell_get_storage_set (e_shortcuts_get_shell (priv->shortcuts)); folder = e_storage_set_get_folder (storage_set, path); diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 6f2c520654..02ac2d2986 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -160,13 +160,13 @@ storage_sort_callback (ETreeMemory *etmm, /* FIXME bad hack to put the "my evolution" and "local" storages on top. */ - if (strcmp (folder_path_1, G_DIR_SEPARATOR_S E_SUMMARY_STORAGE_NAME) == 0) + if (strcmp (folder_path_1, E_PATH_SEPARATOR_S E_SUMMARY_STORAGE_NAME) == 0) return -1; - if (strcmp (folder_path_2, G_DIR_SEPARATOR_S E_SUMMARY_STORAGE_NAME) == 0) + if (strcmp (folder_path_2, E_PATH_SEPARATOR_S E_SUMMARY_STORAGE_NAME) == 0) return +1; - path_1_local = ! strcmp (folder_path_1, G_DIR_SEPARATOR_S E_LOCAL_STORAGE_NAME); - path_2_local = ! strcmp (folder_path_2, G_DIR_SEPARATOR_S E_LOCAL_STORAGE_NAME); + path_1_local = ! strcmp (folder_path_1, E_PATH_SEPARATOR_S E_LOCAL_STORAGE_NAME); + path_2_local = ! strcmp (folder_path_2, E_PATH_SEPARATOR_S E_LOCAL_STORAGE_NAME); if (path_1_local && path_2_local) return 0; @@ -1446,7 +1446,7 @@ new_storage_cb (EStorageSet *storage_set, storage_set_view = E_STORAGE_SET_VIEW (data); priv = storage_set_view->priv; - path = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage), NULL); + path = g_strconcat (E_PATH_SEPARATOR_S, e_storage_get_name (storage), NULL); node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), priv->root_node, -1, path); e_tree_memory_sort_node (E_TREE_MEMORY(priv->etree_model), priv->root_node, @@ -1473,7 +1473,7 @@ removed_storage_cb (EStorageSet *storage_set, priv = storage_set_view->priv; etree = priv->etree_model; - path = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage), NULL); + path = g_strconcat (E_PATH_SEPARATOR_S, e_storage_get_name (storage), NULL); node = lookup_node_in_hash (storage_set_view, path); g_free (path); @@ -1500,7 +1500,7 @@ new_folder_cb (EStorageSet *storage_set, priv = storage_set_view->priv; etree = priv->etree_model; - last_separator = strrchr (path, G_DIR_SEPARATOR); + last_separator = strrchr (path, E_PATH_SEPARATOR); parent_path = g_strndup (path, last_separator - path); parent_node = g_hash_table_lookup (priv->path_to_etree_node, parent_path); diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c index 0eb7b48014..f4e91594e7 100644 --- a/shell/e-storage-set.c +++ b/shell/e-storage-set.c @@ -24,7 +24,10 @@ #include <config.h> #endif -#include <string.h> +#include "e-storage-set.h" + +#include "e-storage-set-view.h" +#include "e-shell-constants.h" #include <glib.h> #include <gtk/gtkobject.h> @@ -33,8 +36,7 @@ #include <gal/util/e-util.h> -#include "e-storage-set-view.h" -#include "e-storage-set.h" +#include <string.h> #define PARENT_TYPE GTK_TYPE_OBJECT @@ -154,14 +156,14 @@ make_full_path (EStorage *storage, storage_name = e_storage_get_name (storage); - if (strcmp (path, G_DIR_SEPARATOR_S) == 0) - full_path = g_strconcat (G_DIR_SEPARATOR_S, storage_name, + if (strcmp (path, E_PATH_SEPARATOR_S) == 0) + full_path = g_strconcat (E_PATH_SEPARATOR_S, storage_name, NULL); else if (! g_path_is_absolute (path)) - full_path = g_strconcat (G_DIR_SEPARATOR_S, storage_name, - G_DIR_SEPARATOR_S, path, NULL); + full_path = g_strconcat (E_PATH_SEPARATOR_S, storage_name, + E_PATH_SEPARATOR_S, path, NULL); else - full_path = g_strconcat (G_DIR_SEPARATOR_S, storage_name, + full_path = g_strconcat (E_PATH_SEPARATOR_S, storage_name, path, NULL); return full_path; @@ -238,16 +240,16 @@ get_storage_for_path (EStorageSet *storage_set, const char *first_separator; g_return_val_if_fail (g_path_is_absolute (path), NULL); - g_return_val_if_fail (path[1] != G_DIR_SEPARATOR, NULL); + g_return_val_if_fail (path[1] != E_PATH_SEPARATOR, NULL); /* Skip initial separator. */ path++; - first_separator = strchr (path, G_DIR_SEPARATOR); + first_separator = strchr (path, E_PATH_SEPARATOR); if (first_separator == NULL || first_separator[1] == 0) { storage = e_storage_set_get_storage (storage_set, path); - *subpath_return = G_DIR_SEPARATOR_S; + *subpath_return = E_PATH_SEPARATOR_S; } else { storage_name = g_strndup (path, first_separator - path); storage = e_storage_set_get_storage (storage_set, storage_name); @@ -273,7 +275,7 @@ signal_new_folder_for_all_folders_under_paths (EStorageSet *storage_set, path = (const char *) p->data; - path_with_storage = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage), path, NULL); + path_with_storage = g_strconcat (E_PATH_SEPARATOR_S, e_storage_get_name (storage), path, NULL); gtk_signal_emit (GTK_OBJECT (storage_set), signals[NEW_FOLDER], path_with_storage); g_free (path_with_storage); @@ -291,7 +293,7 @@ signal_new_folder_for_all_folders_in_storage (EStorageSet *storage_set, { GList *path_list; - path_list = e_storage_get_subfolder_paths (storage, G_DIR_SEPARATOR_S); + path_list = e_storage_get_subfolder_paths (storage, E_PATH_SEPARATOR_S); signal_new_folder_for_all_folders_under_paths (storage_set, storage, path_list); @@ -763,7 +765,7 @@ e_storage_set_get_path_for_physical_uri (EStorageSet *storage_set, if (storage_path != NULL) { char *storage_set_path; - storage_set_path = g_strconcat (G_DIR_SEPARATOR_S, + storage_set_path = g_strconcat (E_PATH_SEPARATOR_S, e_storage_get_name (storage), storage_path, NULL); diff --git a/shell/e-storage.c b/shell/e-storage.c index 4f7fc7d134..5983f7c535 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -28,6 +28,11 @@ #include <config.h> #endif +#include "e-storage.h" + +#include "e-folder-tree.h" +#include "e-shell-constants.h" + #include <gtk/gtkobject.h> #include <gtk/gtksignal.h> @@ -35,10 +40,6 @@ #include <libgnome/gnome-i18n.h> #include <gal/util/e-util.h> -#include "e-folder-tree.h" - -#include "e-storage.h" - #define PARENT_TYPE GTK_TYPE_OBJECT static GtkObjectClass *parent_class = NULL; @@ -342,7 +343,7 @@ e_storage_path_is_absolute (const char *path) { g_return_val_if_fail (path != NULL, FALSE); - return *path == G_DIR_SEPARATOR; + return *path == E_PATH_SEPARATOR; } gboolean @@ -350,7 +351,7 @@ e_storage_path_is_relative (const char *path) { g_return_val_if_fail (path != NULL, FALSE); - return *path != G_DIR_SEPARATOR; + return *path != E_PATH_SEPARATOR; } @@ -451,7 +452,7 @@ e_storage_async_xfer_folder (EStorage *storage, destination_len = strlen (destination_path); if (source_len < destination_len - && destination_path[source_len] == G_DIR_SEPARATOR + && destination_path[source_len] == E_PATH_SEPARATOR && strncmp (destination_path, source_path, source_len) == 0) { (* callback) (storage, E_STORAGE_CANTMOVETODESCENDANT, data); return; diff --git a/shell/evolution-storage-set-view.c b/shell/evolution-storage-set-view.c index 0e0c4c16f7..26e4bf53a9 100644 --- a/shell/evolution-storage-set-view.c +++ b/shell/evolution-storage-set-view.c @@ -306,7 +306,6 @@ impl_StorageSetView__set_checkedFolders (PortableServer_Servant servant, EvolutionStorageSetView *storage_set_view; EvolutionStorageSetViewPrivate *priv; GList *path_list = NULL; - GList *p; int i; bonobo_object = bonobo_object_from_servant (servant); diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index b8468790e0..2ef04cdc2c 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -955,17 +955,17 @@ make_full_uri (EvolutionStorage *storage, storage_name = storage->priv->name; - if (strcmp (path, G_DIR_SEPARATOR_S) == 0) + if (strcmp (path, E_PATH_SEPARATOR_S) == 0) full_path = g_strconcat (E_SHELL_URI_PREFIX, - G_DIR_SEPARATOR_S, storage_name, + E_PATH_SEPARATOR_S, storage_name, NULL); else if (! g_path_is_absolute (path)) full_path = g_strconcat (E_SHELL_URI_PREFIX, - G_DIR_SEPARATOR_S, storage_name, - G_DIR_SEPARATOR_S, path, NULL); + E_PATH_SEPARATOR_S, storage_name, + E_PATH_SEPARATOR_S, path, NULL); else full_path = g_strconcat (E_SHELL_URI_PREFIX, - G_DIR_SEPARATOR_S, storage_name, + E_PATH_SEPARATOR_S, storage_name, path, NULL); return full_path; |