diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-08-04 02:21:47 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-08-04 02:21:47 +0800 |
commit | 49fd4ffbc41c4270efcc28d108b5a66d8773e178 (patch) | |
tree | 0c3ee5b15690e5214cf14bcac364cd435e66334a /shell/e-storage.c | |
parent | f273b40d5edeb4da6408c265097c44d70ae861eb (diff) | |
download | gsoc2013-evolution-49fd4ffbc41c4270efcc28d108b5a66d8773e178.tar.gz gsoc2013-evolution-49fd4ffbc41c4270efcc28d108b5a66d8773e178.tar.zst gsoc2013-evolution-49fd4ffbc41c4270efcc28d108b5a66d8773e178.zip |
Update the ::user_select_folder() interface so that it accepts both a
physical URI or an evolution: one for specifying the default folder.
svn path=/trunk/; revision=4508
Diffstat (limited to 'shell/e-storage.c')
-rw-r--r-- | shell/e-storage.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/shell/e-storage.c b/shell/e-storage.c index 8963f85759..eb03cb36a0 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -436,6 +436,76 @@ e_storage_result_to_string (EStorageResult result) } +/* Utility functions. */ + +struct _GetPathForPhysicalUriForeachData { + const char *physical_uri; + char *retval; +}; +typedef struct _GetPathForPhysicalUriForeachData GetPathForPhysicalUriForeachData; + +static void +get_path_for_physical_uri_foreach (void *key, + void *value, + void *data) +{ + GetPathForPhysicalUriForeachData *foreach_data; + const char *physical_uri; + Folder *folder; + + foreach_data = (GetPathForPhysicalUriForeachData *) data; + if (foreach_data->retval != NULL) + return; + + folder = (Folder *) value; + if (folder->e_folder == NULL) + return; + + physical_uri = e_folder_get_physical_uri (folder->e_folder); + + if (strcmp (foreach_data->physical_uri, physical_uri) == 0) { + const char *path; + + path = (const char *) key; + foreach_data->retval = g_strdup (path); + } +} + +/** + * e_storage_get_path_for_physical_uri: + * @storage: A storage + * @physical_uri: A physical URI + * + * Look for the folder having the specified @physical_uri. + * + * Return value: The path of the folder having the specified @physical_uri in + * @storage. If such a folder does not exist, just return NULL. The return + * value must be freed by the caller. + **/ +char * +e_storage_get_path_for_physical_uri (EStorage *storage, + const char *physical_uri) +{ + GetPathForPhysicalUriForeachData foreach_data; + EStoragePrivate *priv; + + g_return_val_if_fail (storage != NULL, NULL); + g_return_val_if_fail (E_IS_STORAGE (storage), NULL); + g_return_val_if_fail (physical_uri != NULL, NULL); + + priv = storage->priv; + + foreach_data.physical_uri = physical_uri; + foreach_data.retval = NULL; + + g_hash_table_foreach (priv->path_to_folder, get_path_for_physical_uri_foreach, &foreach_data); + + return foreach_data.retval; +} + + +/* Protected functions. */ + /* These functions are used by subclasses to add and remove folders from the state stored in the storage object. */ |