diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-06-11 01:56:46 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-06-11 01:56:46 +0800 |
commit | bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2 (patch) | |
tree | edcd34154f3281bd860ce40f67d7fc736d340e75 /shell/e-local-folder.c | |
parent | e8e0d04d0c8a5eb18a62d98e5a62d126756fa79f (diff) | |
download | gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.gz gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.bz2 gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.lz gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.xz gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.zst gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.zip |
Implemented folder creation dialog (File -> New -> Folder). To make
it really work though, the components should implement creation
functionality by passing an appropriate function pointer in
`e_shell_component_new()' for @create_folder_fn.
svn path=/trunk/; revision=3504
Diffstat (limited to 'shell/e-local-folder.c')
-rw-r--r-- | shell/e-local-folder.c | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/shell/e-local-folder.c b/shell/e-local-folder.c index 23cd106390..80cee7d7bc 100644 --- a/shell/e-local-folder.c +++ b/shell/e-local-folder.c @@ -138,7 +138,8 @@ save_metadata (ELocalFolder *local_folder) EFolder *folder; xmlDoc *doc; xmlNode *root; - const char *physical_path; + const char *physical_directory; + char *physical_path; folder = E_FOLDER (local_folder); @@ -146,16 +147,25 @@ save_metadata (ELocalFolder *local_folder) root = xmlNewDocNode (doc, NULL, (xmlChar *) "efolder", NULL); xmlDocSetRootElement (doc, root); - xmlNewChild (root, NULL, (xmlChar *) "type", (xmlChar *) e_folder_get_type_string (folder)); - xmlNewChild (root, NULL, (xmlChar *) "description", (xmlChar *) e_folder_get_description (folder)); + xmlNewChild (root, NULL, (xmlChar *) "type", + (xmlChar *) e_folder_get_type_string (folder)); - physical_path = e_folder_get_physical_uri (folder) + URI_PREFIX_LEN - 1; + if (e_folder_get_description (folder) != NULL) + xmlNewChild (root, NULL, (xmlChar *) "description", + (xmlChar *) e_folder_get_description (folder)); + + physical_directory = e_folder_get_physical_uri (folder) + URI_PREFIX_LEN - 1; + physical_path = g_concat_dir_and_file (physical_directory, METADATA_FILE_NAME); if (xmlSaveFile (physical_path, doc) < 0) { + unlink (physical_path); + g_free (physical_path); xmlFreeDoc (doc); return FALSE; } + g_free (physical_path); + xmlFreeDoc (doc); return TRUE; } @@ -189,6 +199,37 @@ init (ELocalFolder *local_folder) } +void +e_local_folder_construct (ELocalFolder *local_folder, + const char *name, + const char *type, + const char *description) +{ + g_return_if_fail (local_folder != NULL); + g_return_if_fail (E_IS_LOCAL_FOLDER (local_folder)); + g_return_if_fail (name != NULL); + g_return_if_fail (type != NULL); + + e_folder_construct (E_FOLDER (local_folder), name, type, description); +} + +EFolder * +e_local_folder_new (const char *name, + const char *type, + const char *description) +{ + ELocalFolder *local_folder; + + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (type != NULL, NULL); + + local_folder = gtk_type_new (e_local_folder_get_type ()); + + e_local_folder_construct (local_folder, name, type, description); + + return E_FOLDER (local_folder); +} + EFolder * e_local_folder_new_from_path (const char *path) { @@ -211,6 +252,7 @@ e_local_folder_save (ELocalFolder *local_folder) { g_return_val_if_fail (local_folder != NULL, FALSE); g_return_val_if_fail (E_IS_LOCAL_FOLDER (local_folder), FALSE); + g_return_val_if_fail (e_folder_get_physical_uri (E_FOLDER (local_folder)) != NULL, FALSE); return save_metadata (local_folder); } |