aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-06-20 04:39:12 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-06-20 04:39:12 +0800
commit8a7a3f7770d9770d87b06a5641b28796efb02621 (patch)
tree772a331c5739ccabce5901767ef779cdfe7491dc /mail
parent2012e35e52d580a20649c5a762465681274abd31 (diff)
downloadgsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.gz
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.bz2
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.lz
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.xz
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.zst
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.zip
#include "folder-browser-factory.h"
2001-06-19 Jeffrey Stedfast <fejj@ximian.com> * mail-display.c: #include "folder-browser-factory.h" * component-factory.c (mail_remove_storage): New function to remove an EvolutionStorage. * mail-accounts.c (mail_delete): Remove the storage from the folder-tree. (news_delete): Same. svn path=/trunk/; revision=10304
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/component-factory.c49
-rw-r--r--mail/mail-accounts.c63
-rw-r--r--mail/mail-display.c1
-rw-r--r--mail/mail.h1
5 files changed, 105 insertions, 20 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 149d88cb3a..a28c8d787e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,16 @@
2001-06-19 Jeffrey Stedfast <fejj@ximian.com>
+ * mail-display.c: #include "folder-browser-factory.h"
+
+ * component-factory.c (mail_remove_storage): New function to
+ remove an EvolutionStorage.
+
+ * mail-accounts.c (mail_delete): Remove the storage from the
+ folder-tree.
+ (news_delete): Same.
+
+2001-06-19 Jeffrey Stedfast <fejj@ximian.com>
+
* component-factory.c (destination_folder_handle_drop): Accept
text/uri-list mime types - this allows us to drag messages from
Nautilus into an Evolution folder.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index e561a45c78..b38fb10528 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -535,9 +535,9 @@ owner_set_cb (EvolutionShellComponent *shell_component,
static void
free_storage (gpointer service, gpointer storage, gpointer data)
{
- camel_service_disconnect (service, TRUE, NULL);
- camel_object_unref (service);
- bonobo_object_unref (storage);
+ camel_service_disconnect (CAMEL_SERVICE (service), TRUE, NULL);
+ camel_object_unref (CAMEL_OBJECT (service));
+ bonobo_object_unref (BONOBO_OBJECT (storage));
}
static gboolean
@@ -761,19 +761,19 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
const GSList *iter;
camel_exception_init (&ex);
-
+
/* Load each service (don't connect!). Check its provider and
* see if this belongs in the shell's folder list. If so, add
* it.
*/
-
+
for (iter = sources; iter; iter = iter->next) {
const MailConfigAccount *account = NULL;
const MailConfigService *service = NULL;
CamelService *store;
CamelProvider *prov;
char *name;
-
+
if (is_account_data) {
account = iter->data;
service = account->source;
@@ -783,7 +783,7 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
if (service->url == NULL || service->url[0] == '\0')
continue;
-
+
prov = camel_session_get_provider (session, service->url, &ex);
if (prov == NULL) {
/* FIXME: real error dialog */
@@ -792,7 +792,7 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
camel_exception_clear (&ex);
continue;
}
-
+
/* FIXME: this case is ambiguous for things like the
* mbox provider, which can really be a spool
* (/var/spool/mail/user) or a storage (~/mail/, eg).
@@ -805,7 +805,7 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
&& !((strcmp(prov->protocol, "spool") == 0)
|| strcmp(prov->protocol, "maildir") == 0))
continue;
-
+
store = camel_session_get_service (session, service->url,
CAMEL_PROVIDER_STORE, &ex);
if (store == NULL) {
@@ -815,15 +815,15 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
camel_exception_clear (&ex);
continue;
}
-
+
if (is_account_data)
name = g_strdup (account->name);
else
name = camel_service_get_name (store, TRUE);
-
+
add_storage (name, service->url, store, shell, &ex);
g_free (name);
-
+
if (camel_exception_is_set (&ex)) {
/* FIXME: real error dialog */
g_warning ("Cannot load storage: %s",
@@ -846,20 +846,39 @@ EvolutionStorage*
mail_lookup_storage (CamelStore *store)
{
EvolutionStorage *storage;
-
+
/* Because the storages_hash holds a reference to each store
* used as a key in it, none of them will ever be gc'ed, meaning
* any call to camel_session_get_{service,store} with the same
* URL will always return the same object. So this works.
*/
-
+
storage = g_hash_table_lookup (storages_hash, store);
if (storage)
gtk_object_ref (GTK_OBJECT (storage));
-
+
return storage;
}
+void
+mail_remove_storage (CamelStore *store)
+{
+ EvolutionStorage *storage;
+
+ /* Because the storages_hash holds a reference to each store
+ * used as a key in it, none of them will ever be gc'ed, meaning
+ * any call to camel_session_get_{service,store} with the same
+ * URL will always return the same object. So this works.
+ */
+
+ storage = g_hash_table_lookup (storages_hash, store);
+ g_hash_table_remove (storages_hash, store);
+
+ camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL);
+ bonobo_object_unref (BONOBO_OBJECT (storage));
+ camel_object_unref (CAMEL_OBJECT (store));
+}
+
int
mail_storages_count (void)
{
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 47dc311107..080eaf3d7a 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -32,10 +32,12 @@
#include <camel/camel-pgp-context.h>
#include <gal/widgets/e-charset-picker.h>
+#include "mail.h"
#include "mail-accounts.h"
#include "mail-config.h"
#include "mail-config-druid.h"
#include "mail-account-editor.h"
+#include "mail-session.h"
static void mail_accounts_dialog_class_init (MailAccountsDialogClass *class);
static void mail_accounts_dialog_init (MailAccountsDialog *dialog);
@@ -311,6 +313,32 @@ mail_delete (GtkButton *button, gpointer data)
sel = dialog->accounts_row;
account = gtk_clist_get_row_data (dialog->mail_accounts, sel);
+
+ /* remove it from the folder-tree in the shell */
+ if (account->source && account->source->url) {
+ MailConfigService *service = account->source;
+ CamelProvider *prov;
+ CamelException ex;
+
+ camel_exception_init (&ex);
+ prov = camel_session_get_provider (session, service->url, &ex);
+ if (prov != NULL && prov->flags & CAMEL_PROVIDER_IS_STORAGE &&
+ prov->flags & CAMEL_PROVIDER_IS_REMOTE) {
+ CamelService *store;
+
+ store = camel_session_get_service (session, service->url,
+ CAMEL_PROVIDER_STORE, &ex);
+ if (store != NULL) {
+ g_warning ("removing storage: %s", service->url);
+ mail_remove_storage (CAMEL_STORE (store));
+ camel_object_unref (CAMEL_OBJECT (store));
+ }
+ } else
+ g_warning ("%s is not a remote storage.", service->url);
+ camel_exception_clear (&ex);
+ }
+
+ /* remove it from the config file */
dialog->accounts = mail_config_remove_account (account);
mail_config_write ();
@@ -447,6 +475,31 @@ news_delete (GtkButton *button, gpointer data)
int row, len;
server = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row);
+
+ /* remove it from the folder-tree in the shell */
+ if (server && server->url) {
+ CamelProvider *prov;
+ CamelException ex;
+
+ camel_exception_init (&ex);
+ prov = camel_session_get_provider (session, server->url, &ex);
+ if (prov != NULL && prov->flags & CAMEL_PROVIDER_IS_STORAGE &&
+ prov->flags & CAMEL_PROVIDER_IS_REMOTE) {
+ CamelService *store;
+
+ store = camel_session_get_service (session, server->url,
+ CAMEL_PROVIDER_STORE, &ex);
+ if (store != NULL) {
+ g_warning ("removing news storage: %s", server->url);
+ mail_remove_storage (CAMEL_STORE (store));
+ camel_object_unref (CAMEL_OBJECT (store));
+ }
+ } else
+ g_warning ("%s is not a remote news storage.", server->url);
+ camel_exception_clear (&ex);
+ }
+
+ /* remove it from the config file */
dialog->news = mail_config_remove_news (server);
mail_config_write ();
@@ -519,7 +572,7 @@ pgp_path_changed (GtkEntry *entry, gpointer data)
type = CAMEL_PGP_TYPE_PGP2;
else if (!strcmp (bin, "pgpv") || !strcmp (bin, "pgpe") || !strcmp (bin, "pgpk") || !strcmp (bin, "pgps"))
type = CAMEL_PGP_TYPE_PGP5;
- else if (!strcmp (bin, "gpg"))
+ else if (!strncmp (bin, "gpg", 3))
type = CAMEL_PGP_TYPE_GPG;
mail_config_set_pgp_path (path && *path ? path : NULL);
@@ -651,7 +704,7 @@ construct (MailAccountsDialog *dialog)
set_color (dialog->citation_color);
gtk_signal_connect (GTK_OBJECT (dialog->citation_color), "color_set",
GTK_SIGNAL_FUNC (citation_color_set), dialog);
-
+
dialog->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout"));
gtk_spin_button_set_value (dialog->timeout, (1.0 * mail_config_get_mark_as_seen_timeout ()) / 1000.0);
gtk_signal_connect (GTK_OBJECT (dialog->timeout), "changed",
@@ -669,7 +722,7 @@ construct (MailAccountsDialog *dialog)
gtk_toggle_button_set_active (dialog->images_always, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS);
gtk_signal_connect (GTK_OBJECT (dialog->images_always), "toggled",
GTK_SIGNAL_FUNC (images_radio_toggled), dialog);
-
+
/* Composer page */
dialog->send_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSendHTML"));
gtk_toggle_button_set_active (dialog->send_html, mail_config_get_send_html ());
@@ -682,7 +735,7 @@ construct (MailAccountsDialog *dialog)
num = 0;
gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (dialog->forward_style)),
attach_forward_style_signal, &num);
-
+
/* Other page */
dialog->pgp_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "filePgpPath"));
gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->pgp_path)),
@@ -696,7 +749,7 @@ construct (MailAccountsDialog *dialog)
gtk_option_menu_set_menu (dialog->charset, menu);
gtk_signal_connect (GTK_OBJECT (menu), "deactivate",
GTK_SIGNAL_FUNC (charset_menu_deactivate), NULL);
-
+
/* now to fill in the clists */
dialog->accounts_row = -1;
dialog->accounts = mail_config_get_accounts ();
diff --git a/mail/mail-display.c b/mail/mail-display.c
index f0957b5234..35afdf67a5 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -39,6 +39,7 @@
#include "addressbook/backend/ebook/e-book-util.h"
#include "e-searching-tokenizer.h"
+#include "folder-browser-factory.h"
#include "mail-display.h"
#include "mail-config.h"
#include "mail-ops.h"
diff --git a/mail/mail.h b/mail/mail.h
index 5c592a1263..98b437b4ca 100644
--- a/mail/mail.h
+++ b/mail/mail.h
@@ -70,6 +70,7 @@ void mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gbo
void mail_hash_storage (CamelService *store, EvolutionStorage *storage);
EvolutionStorage *mail_lookup_storage (CamelStore *store);
+void mail_remove_storage (CamelStore *store);
void mail_storages_foreach (GHFunc func, gpointer data);
int mail_storages_count (void);