aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-local-storage.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-08-12 22:00:02 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-08-12 22:00:02 +0800
commit51f77f649b27e6013038c642c532d0547c7fdddd (patch)
tree4f06a410fd1c1a908baf01196929daf88998977d /shell/e-local-storage.c
parentca62294adb3b70870297ffb9b18bde44899f2af3 (diff)
downloadgsoc2013-evolution-51f77f649b27e6013038c642c532d0547c7fdddd.tar
gsoc2013-evolution-51f77f649b27e6013038c642c532d0547c7fdddd.tar.gz
gsoc2013-evolution-51f77f649b27e6013038c642c532d0547c7fdddd.tar.bz2
gsoc2013-evolution-51f77f649b27e6013038c642c532d0547c7fdddd.tar.lz
gsoc2013-evolution-51f77f649b27e6013038c642c532d0547c7fdddd.tar.xz
gsoc2013-evolution-51f77f649b27e6013038c642c532d0547c7fdddd.tar.zst
gsoc2013-evolution-51f77f649b27e6013038c642c532d0547c7fdddd.zip
[Finally! Fix #413, "Support for stock folders", and #786, "i18n:
default folder names are not translated".] * e-local-storage.c (setup_folder_as_stock): New helper function. (setup_stock_folders): Use it to set the default folders as "stock" folders. This will give them a translated name and also make them unmodifiable. (load_all_folders): Call `setup_stock_folders()' here. * e-shell-folder-commands.c (delete_cb): Display an error dialog if the deletion fails. (e_shell_command_delete_folder): Pass the shell view to the delete callback. * e-storage.c (e_storage_result_to_string): Add a string for `E_STORAGE_CANTCHANGESTOCKFOLDER' as well. * e-local-storage.c (remove_folder): Don't allow a stock folder to be removed. (impl_async_xfer_folder): Don't allow a stock folder to be moved. * e-corba-storage.c (async_remove_folder): Don't allow a stock folder to be removed. * e-storage.h: New enum value `E_STORAGE_CANTCHANGESTOCKFOLDER' in `EStorageResult'. * e-folder.c: Make member `self_highlight' a :1 int. New :1 int member `is_stock'. (init): Init `is_stock' to %FALSE. (e_folder_set_is_stock): New. (e_folder_get_is_stock): New. * e-local-storage.c (bonobo_interface_update_folder_cb): For now, don't set the display name. svn path=/trunk/; revision=11931
Diffstat (limited to 'shell/e-local-storage.c')
-rw-r--r--shell/e-local-storage.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c
index 61bd85777e..3281f0bb58 100644
--- a/shell/e-local-storage.c
+++ b/shell/e-local-storage.c
@@ -147,6 +147,36 @@ new_folder (ELocalStorage *local_storage,
}
static gboolean
+setup_folder_as_stock (ELocalStorage *local_storage,
+ const char *path,
+ const char *name)
+{
+ EFolder *folder;
+
+ folder = e_storage_get_folder (E_STORAGE (local_storage), path);
+ if (folder == NULL)
+ return FALSE;
+
+ e_folder_set_name (folder, name);
+ e_folder_set_is_stock (folder, TRUE);
+
+ return TRUE;
+}
+
+static void
+setup_stock_folders (ELocalStorage *local_storage)
+{
+ setup_folder_as_stock (local_storage, "/Calendar", _("Calendar"));
+ setup_folder_as_stock (local_storage, "/Contacts", _("Contacts"));
+ setup_folder_as_stock (local_storage, "/Drafts", _("Drafts"));
+ setup_folder_as_stock (local_storage, "/Inbox", _("Inbox"));
+ setup_folder_as_stock (local_storage, "/Outbox", _("Outbox"));
+ setup_folder_as_stock (local_storage, "/Sent", _("Sent"));
+ setup_folder_as_stock (local_storage, "/Tasks", _("Tasks"));
+ setup_folder_as_stock (local_storage, "/Trash", _("Trash"));
+}
+
+static gboolean
load_folder (const char *physical_path, const char *path, gpointer data)
{
ELocalStorage *local_storage = data;
@@ -169,7 +199,12 @@ load_all_folders (ELocalStorage *local_storage)
base_path = e_local_storage_get_base_path (local_storage);
- return e_path_find_folders (base_path, load_folder, local_storage);
+ if (! e_path_find_folders (base_path, load_folder, local_storage))
+ return FALSE;
+
+ setup_stock_folders (local_storage);
+
+ return TRUE;
}
@@ -472,6 +507,9 @@ remove_folder (ELocalStorage *local_storage,
storage = E_STORAGE (local_storage);
folder = e_storage_get_folder (storage, path);
+ if (e_folder_get_is_stock (folder))
+ return E_STORAGE_CANTCHANGESTOCKFOLDER;
+
component_client = e_folder_type_registry_get_handler_for_type (priv->folder_type_registry,
e_folder_get_type_string (folder));
if (component_client == NULL)
@@ -816,6 +854,9 @@ impl_async_xfer_folder (EStorage *storage,
local_storage = E_LOCAL_STORAGE (storage);
priv = local_storage->priv;
+ if (remove_source && e_folder_get_is_stock (e_storage_get_folder (storage, source_path)))
+ (* callback) (storage, E_STORAGE_CANTCHANGESTOCKFOLDER, callback_data);
+
folder_items = NULL;
append_xfer_item_list (storage, g_strdup (source_path), g_strdup (destination_path), &folder_items);
folder_items = g_list_reverse (folder_items); /* lame */
@@ -884,7 +925,7 @@ bonobo_interface_update_folder_cb (EvolutionStorage *storage,
if (folder == NULL)
return;
- e_folder_set_name (folder, display_name);
+ /* e_folder_set_name (folder, display_name); */
e_folder_set_unread_count (folder, unread_count);
return;