From faf4db97fab2375f9b13c35b95702eacf590eec4 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 25 Sep 2002 21:41:53 +0000 Subject: add "mail/public". Leave "vtrash" as it is rather than renaming it to * component-factory.c (folder_types): add "mail/public". Leave "vtrash" as it is rather than renaming it to "mail/vtrash", because we want it to behave differently from normal mail folders more often than we want it to behave the same. (type_is_mail, type_is_vtrash): utility funcs (create_view, create_folder, remove_folder, xfer_folder, populate_folder_context_menu, unpopulate_folder_context_menu, destination_folder_handle_drop, storage_create_folder): Use type_is_mail/type_is_vtrash. (create_component): Register "New Post" with "mail/public" instead of "mail" so it becomes the default New icon for it. (29024) * mail-callbacks.c (transfer_msg): Use "mail/*" for allowed type. * message-browser.c (transfer_msg): Likewise. * mail-account-gui.c (mail_account_gui_new): Use "mail/*" instead of "mail" here for sent/drafts allowed type. (?) svn path=/trunk/; revision=18223 --- mail/component-factory.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'mail/component-factory.c') diff --git a/mail/component-factory.c b/mail/component-factory.c index ca18001533..c5ca3c4d14 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -100,6 +100,7 @@ static char *exported_dnd_types[] = { static const EvolutionShellComponentFolderType folder_types[] = { { "mail", "evolution-inbox.png", N_("Mail"), N_("Folder containing mail"), TRUE, accepted_dnd_types, exported_dnd_types }, + { "mail/public", "evolution-inbox.png", N_("Public Mail"), N_("Public folder containing mail"), FALSE, accepted_dnd_types, exported_dnd_types }, { "vtrash", "evolution-trash.png", N_("Virtual Trash"), N_("Virtual Trash folder"), FALSE, accepted_dnd_types, exported_dnd_types }, { NULL, NULL, NULL, NULL, FALSE, NULL, NULL } }; @@ -109,6 +110,18 @@ static const char *schema_types[] = { NULL }; +static inline gboolean +type_is_mail (const char *type) +{ + return !strcmp (type, "mail") || !strcmp (type, "mail/public"); +} + +static inline gboolean +type_is_vtrash (const char *type) +{ + return !strcmp (type, "vtrash"); +} + /* EvolutionShellComponent methods and signals. */ static BonoboControl * @@ -136,7 +149,7 @@ create_view (EvolutionShellComponent *shell_component, shell_client = evolution_shell_component_get_owner (shell_component); corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - if (!g_strcasecmp (folder_type, "mail")) { + if (type_is_mail (folder_type)) { const char *noselect; CamelURL *url; @@ -148,7 +161,7 @@ create_view (EvolutionShellComponent *shell_component, control = folder_browser_factory_new_control (physical_uri, corba_shell); camel_url_free (url); - } else if (!g_strcasecmp (folder_type, "vtrash")) { + } else if (type_is_vtrash (folder_type)) { if (!g_strncasecmp (physical_uri, "file:", 5)) control = folder_browser_factory_new_control ("vtrash:file:/", corba_shell); else @@ -193,7 +206,7 @@ create_folder (EvolutionShellComponent *shell_component, CORBA_exception_init (&ev); - if (!strcmp (type, "mail")) { + if (type_is_mail (type)) { mail_get_folder (physical_uri, CAMEL_STORE_FOLDER_CREATE, create_folder_done, CORBA_Object_duplicate (listener, &ev), mail_thread_new); } else { @@ -233,7 +246,7 @@ remove_folder (EvolutionShellComponent *shell_component, CORBA_exception_init (&ev); - if (strcmp (type, "mail") != 0) { + if (!type_is_mail (type)) { GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); CORBA_exception_free (&ev); @@ -295,7 +308,7 @@ xfer_folder (EvolutionShellComponent *shell_component, CORBA_exception_init (&ev); - if (strcmp (type, "mail") != 0) { + if (!type_is_mail (type)) { GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); return; @@ -417,7 +430,7 @@ populate_folder_context_menu (EvolutionShellComponent *shell_component, ""; - if (strcmp (type, "mail") != 0) + if (!type_is_mail (type)) return; /* FIXME: handle other types */ @@ -438,7 +451,7 @@ unpopulate_folder_context_menu (EvolutionShellComponent *shell_component, const char *type, void *closure) { - if (strcmp (type, "mail") != 0) + if (!type_is_mail (type)) return; /* FIXME: handle other types */ @@ -571,7 +584,7 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des camel_exception_init (&ex); /* if this is a local vtrash folder, then it's uri is vtrash:file:/ */ - if (!strcmp (folder_type, "vtrash") && !strncmp (physical_uri, "file:", 5)) + if (type_is_vtrash (folder_type) && !strncmp (physical_uri, "file:", 5)) physical_uri = "vtrash:file:/"; switch (type) { @@ -1035,7 +1048,7 @@ create_component (void) evolution_shell_component_add_user_creatable_item (shell_component, "post", _("New Message Post"), _("_Post Message"), _("Post a new mail message"), - "mail", 'p', + "mail/public", 'p', icon); if (icon != NULL) gdk_pixbuf_unref (icon); @@ -1140,7 +1153,7 @@ storage_create_folder (EvolutionStorage *storage, /* We could just use 'path' always here? */ - if (strcmp (type, "mail") != 0) { + if (!type_is_mail (type)) { notify_listener (listener, GNOME_Evolution_Storage_UNSUPPORTED_TYPE); return; } -- cgit v1.2.3