diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-09-01 14:09:29 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-09-01 14:09:29 +0800 |
commit | 26112575da034a7a0a79ab2238a01304348eada5 (patch) | |
tree | ef90667e30709a4f74fe931be9f27b56b9baf2e2 /shell | |
parent | 7df49391da6f67a7c1abee662e0d3a2c18ea9c36 (diff) | |
download | gsoc2013-evolution-26112575da034a7a0a79ab2238a01304348eada5.tar.gz gsoc2013-evolution-26112575da034a7a0a79ab2238a01304348eada5.tar.zst gsoc2013-evolution-26112575da034a7a0a79ab2238a01304348eada5.zip |
Changed `Evolution::Storage' so that the displayed name for a folder
is decoupled from its path, and updated all the components
accordingly.
svn path=/trunk/; revision=5159
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 12 | ||||
-rw-r--r-- | shell/Evolution-Storage.idl | 2 | ||||
-rw-r--r-- | shell/e-corba-storage.c | 6 | ||||
-rw-r--r-- | shell/e-local-storage.c | 18 | ||||
-rw-r--r-- | shell/e-storage.c | 39 | ||||
-rw-r--r-- | shell/evolution-storage.c | 21 | ||||
-rw-r--r-- | shell/evolution-storage.h | 1 |
7 files changed, 62 insertions, 37 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 022ab25cd9..503ac66817 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,15 @@ +2000-09-01 Ettore Perazzoli <ettore@helixcode.com> + + * evolution-storage.c (evolution_storage_new_folder): Handle @path + as the full path. + + * e-storage.c (e_storage_new_folder): Consider @path to be the + full path, not the parent path. + * e-local-storage.c (load_folders): Updated accordingly. + + * Evolution-Storage.idl: Member `name' of `struct Folder' renamed + to `display_name'. + 2000-08-31 Chris Toshok <toshok@helixcode.com> * e-shell-view.c: add delayed_selection to _EShellViewPrivate. diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl index 4e35e859bf..46c73e2654 100644 --- a/shell/Evolution-Storage.idl +++ b/shell/Evolution-Storage.idl @@ -14,7 +14,7 @@ module Evolution { struct Folder { string type; string description; - string name; + string display_name; string physical_uri; }; diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c index b4320a4c52..3e977afaf1 100644 --- a/shell/e-corba-storage.c +++ b/shell/e-corba-storage.c @@ -105,14 +105,14 @@ impl_StorageListener_new_folder (PortableServer_Servant servant, storage_listener_servant = (StorageListenerServant *) servant; storage = storage_listener_servant->storage; - e_folder = e_folder_new (folder->name, + e_folder = e_folder_new (folder->display_name, folder->type, folder->description); e_folder_set_physical_uri (e_folder, folder->physical_uri); if (! e_storage_new_folder (storage, path, e_folder)) { - g_print ("Cannot register folder -- %s %s\n", path, folder->name); + g_print ("Cannot register folder -- %s %s\n", path, folder->display_name); CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Evolution_StorageListener_Exists, @@ -120,7 +120,7 @@ impl_StorageListener_new_folder (PortableServer_Servant servant, gtk_object_unref (GTK_OBJECT (e_folder)); } - g_print ("Folder registered successfully -- %s %s\n", path, folder->name); + g_print ("Folder registered successfully -- %s %s\n", path, folder->display_name); } static void diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 93234b4741..de8e23e704 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -169,7 +169,7 @@ load_folders (ELocalStorage *local_storage, if (folder == NULL) return FALSE; - e_storage_new_folder (E_STORAGE (local_storage), parent_path, folder); + e_storage_new_folder (E_STORAGE (local_storage), path, folder); subfolder_directory_path = g_concat_dir_and_file (physical_path, SUBFOLDER_DIR_NAME); } @@ -295,8 +295,8 @@ shell_component_result_to_storage_result (EvolutionShellComponentResult result) struct _AsyncCreateFolderCallbackData { EStorage *storage; - char *parent_path; - char *name; + char *path; + char *display_name; char *type; char *description; char *physical_uri; @@ -322,7 +322,7 @@ component_async_create_folder_callback (EvolutionShellComponentClient *shell_com } else { EFolder *folder; - folder = e_local_folder_new (callback_data->name, + folder = e_local_folder_new (callback_data->display_name, callback_data->type, callback_data->description); @@ -330,7 +330,7 @@ component_async_create_folder_callback (EvolutionShellComponentClient *shell_com if (e_local_folder_save (E_LOCAL_FOLDER (folder))) { e_storage_new_folder (callback_data->storage, - callback_data->parent_path, + callback_data->path, folder); } else { rmdir (callback_data->physical_path); @@ -345,8 +345,8 @@ component_async_create_folder_callback (EvolutionShellComponentClient *shell_com shell_component_result_to_storage_result (result), callback_data->callback_data); - g_free (callback_data->parent_path); - g_free (callback_data->name); + g_free (callback_data->path); + g_free (callback_data->display_name); g_free (callback_data->type); g_free (callback_data->description); g_free (callback_data->physical_uri); @@ -465,8 +465,8 @@ impl_async_create_folder (EStorage *storage, callback_data = g_new (AsyncCreateFolderCallbackData, 1); callback_data->storage = storage; - callback_data->parent_path = parent_path; - callback_data->name = g_strdup (folder_name); + callback_data->path = path; + callback_data->display_name = g_strdup (folder_name); callback_data->type = g_strdup (type); callback_data->description = g_strdup (description); callback_data->physical_uri = physical_uri; diff --git a/shell/e-storage.c b/shell/e-storage.c index eb03cb36a0..ae984f7a09 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -154,6 +154,24 @@ free_private (EStorage *storage) } +/* Private utility functions. */ + +static char * +get_parent_path (const char *path) +{ + const char *last_separator; + + g_assert (g_path_is_absolute (path)); + + last_separator = strrchr (path, G_DIR_SEPARATOR); + + if (last_separator == path) + return g_strdup (G_DIR_SEPARATOR_S); + + return g_strndup (path, last_separator - path); +} + + /* GtkObject methods. */ static void @@ -436,7 +454,7 @@ e_storage_result_to_string (EStorageResult result) } -/* Utility functions. */ +/* Public utility functions. */ struct _GetPathForPhysicalUriForeachData { const char *physical_uri; @@ -511,28 +529,30 @@ e_storage_get_path_for_physical_uri (EStorage *storage, gboolean e_storage_new_folder (EStorage *storage, - const char *path, + const char *full_path, EFolder *e_folder) { EStoragePrivate *priv; Folder *folder; Folder *parent_folder; const char *name; - char *full_path; + char *parent_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); + g_return_val_if_fail (full_path != NULL, FALSE); + g_return_val_if_fail (g_path_is_absolute (full_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; - parent_folder = g_hash_table_lookup (priv->path_to_folder, path); + parent_path = get_parent_path (full_path); + + parent_folder = g_hash_table_lookup (priv->path_to_folder, parent_path); if (parent_folder == NULL) { g_warning ("%s: Trying to add a subfolder to a path that does not exist yet -- %s", - __FUNCTION__, path); + __FUNCTION__, parent_path); return FALSE; } @@ -540,13 +560,10 @@ e_storage_new_folder (EStorage *storage, g_assert (name != NULL); g_return_val_if_fail (*name != G_DIR_SEPARATOR, FALSE); - full_path = g_concat_dir_and_file (path, name); - folder = g_hash_table_lookup (priv->path_to_folder, full_path); if (folder != NULL) { g_warning ("%s: Trying to add a subfolder for a path that already exists -- %s", __FUNCTION__, full_path); - g_free (full_path); return FALSE; } @@ -557,7 +574,7 @@ e_storage_new_folder (EStorage *storage, gtk_signal_emit (GTK_OBJECT (storage), signals[NEW_FOLDER], folder->path); - g_free (full_path); + g_free (parent_path); return TRUE; } diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index 2503905b13..6b768770bd 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -287,6 +287,7 @@ evolution_storage_register_on_shell (EvolutionStorage *evolution_storage, 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) @@ -313,21 +314,17 @@ evolution_storage_new_folder (EvolutionStorage *evolution_storage, path_basename = g_basename (path); /* Yuck. */ - corba_folder.name = (CORBA_char *) path_basename; - corba_folder.description = (CORBA_char *) description; - corba_folder.type = (CORBA_char *) type; + corba_folder.display_name = (CORBA_char *) display_name; + corba_folder.description = (CORBA_char *) description; + corba_folder.type = (CORBA_char *) type; corba_folder.physical_uri = (CORBA_char *) physical_uri; - if (path_basename - path > 1) { - parent_path = g_strndup (path, path_basename - path - 1); - } else { - parent_path = g_strdup (G_DIR_SEPARATOR_S); - } - CORBA_exception_init (&ev); - Evolution_StorageListener_new_folder (priv->corba_storage_listener, parent_path, - &corba_folder, &ev); + Evolution_StorageListener_new_folder (priv->corba_storage_listener, + path, + &corba_folder, + &ev); if (ev._major == CORBA_NO_EXCEPTION) result = EVOLUTION_STORAGE_OK; @@ -340,8 +337,6 @@ evolution_storage_new_folder (EvolutionStorage *evolution_storage, CORBA_exception_free (&ev); - g_free (parent_path); - return result; } diff --git a/shell/evolution-storage.h b/shell/evolution-storage.h index 4e96e28df8..ff36bef3c0 100644 --- a/shell/evolution-storage.h +++ b/shell/evolution-storage.h @@ -85,6 +85,7 @@ EvolutionStorageResult evolution_storage_register_on_shell (EvolutionStorage 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); |