diff options
-rw-r--r-- | mail/ChangeLog | 18 | ||||
-rw-r--r-- | mail/Makefile.am | 11 | ||||
-rw-r--r-- | mail/component-factory.c | 25 | ||||
-rw-r--r-- | mail/mail-account-gui.c | 2 | ||||
-rw-r--r-- | mail/mail-accounts.c | 241 | ||||
-rw-r--r-- | mail/mail-config.c | 87 | ||||
-rw-r--r-- | mail/mail-config.h | 5 | ||||
-rw-r--r-- | mail/mail.h | 2 | ||||
-rw-r--r-- | mail/subscribe-dialog.c | 4 |
9 files changed, 31 insertions, 364 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index a109d53263..0d72a06085 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,21 @@ +2002-07-04 Jeffrey Stedfast <fejj@ximian.com> + + * mail-accounts.c: Removed special-case code for NNTP support. + + * mail-account-gui.c (mail_account_gui_setup): Allow configuration + of both mail and news accounts. + + * component-factory.c (mail_load_storages): No longer need the + is-account argument. + + * subscribe-dialog.c (populate_store_list): Don't special-case + news accounts anymore. + + * mail-config.c (mail_config_get_default_news): Removed. + (mail_config_get_news): Removed. + (mail_config_add_news): Removed. + (mail_config_remove_news): Removed. + 2002-07-03 Jeffrey Stedfast <fejj@ximian.com> * mail-vfolder.c (vfolder_load_storage): Pass TRUE as the diff --git a/mail/Makefile.am b/mail/Makefile.am index f85e1ace6a..7bc4d8b498 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -34,12 +34,6 @@ EVOLUTION_MAIL_CORBA_GENERATED = \ Mail-skels.c \ Mail-stubs.c -if ENABLE_NNTP -EVOLUTION_MAIL_NNTP = \ - mail-account-editor-news.c \ - mail-account-editor-news.h -endif - SPELL_IDL = Spell.idl IDL_GENERATED = \ @@ -56,7 +50,6 @@ Spell-impl.o: Spell.h evolution_mail_SOURCES = \ $(EVOLUTION_MAIL_CORBA_GENERATED) \ - $(EVOLUTION_MAIL_NNTP) \ $(IDL_GENERATED) \ component-factory.c \ component-factory.h \ @@ -184,9 +177,7 @@ EXTRA_DIST = \ $(glade_DATA) \ $(oaf_in_files) \ $(oaf_DATA) \ - $(etspec_DATA) \ - mail-account-editor-news.c \ - mail-account-editor-news.h + $(etspec_DATA) if ENABLE_PURIFY PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ diff --git a/mail/component-factory.c b/mail/component-factory.c index 6667ae4f24..7fe2a4e8a1 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -701,9 +701,6 @@ owner_set_cb (EvolutionShellComponent *shell_component, { GNOME_Evolution_Shell corba_shell; const GSList *accounts; -#ifdef ENABLE_NNTP - const GSList *news; -#endif int i; /* FIXME: should we ref this? */ @@ -723,12 +720,7 @@ owner_set_cb (EvolutionShellComponent *shell_component, vfolder_load_storage(corba_shell); accounts = mail_config_get_accounts (); - mail_load_storages (corba_shell, accounts, TRUE); - -#ifdef ENABLE_NNTP - news = mail_config_get_news (); - mail_load_storages (corba_shell, news, FALSE); -#endif + mail_load_storages (corba_shell, accounts); mail_local_storage_startup (shell_client, evolution_dir); mail_importer_init (shell_client); @@ -1392,10 +1384,8 @@ mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const ch camel_object_unref (CAMEL_OBJECT (store)); } -/* FIXME: 'is_account_data' is an ugly hack, if we move support for - NNTP into the normal Account stuff, we can take it out -- fejj */ void -mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean is_account_data) +mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources) { CamelException ex; const GSList *iter; @@ -1412,14 +1402,9 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean const MailConfigService *service = NULL; char *name; - if (is_account_data) { - account = iter->data; - service = account->source; - name = account->name; - } else { - service = iter->data; - name = NULL; - } + account = iter->data; + service = account->source; + name = account->name; if (service == NULL || service->url == NULL || service->url[0] == '\0') continue; diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 4d50cada51..1f2de490c0 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -1536,7 +1536,7 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top) for (l = providers; l; l = l->next) { CamelProvider *provider = l->data; - if (strcmp (provider->domain, "mail")) + if (!(!strcmp (provider->domain, "mail") || !strcmp (provider->domain, "news"))) continue; item = NULL; diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index 18b9e6e925..c929ae1e48 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -42,7 +42,6 @@ #include "mail-config.h" #include "mail-config-druid.h" #include "mail-account-editor.h" -#include "mail-account-editor-news.h" #include "mail-send-recv.h" #include "art/mark.xpm" @@ -491,220 +490,6 @@ mail_accounts_load (MailAccountsTab *prefs) } -#ifdef ENABLE_NNTP -static void -news_load (MailAccountsTab *prefs) -{ - const MailConfigService *service; - const GSList *node; - int i = 0; - - gtk_clist_freeze (prefs->news); - - gtk_clist_clear (prefs->news); - - node = mail_config_get_news (); - - while (node) { - CamelURL *url; - char *text[1]; - - service = node->data; - - if (service->url) - url = camel_url_new (service->url, NULL); - else - url = NULL; - - text[0] = g_strdup_printf ("%s", url && url->host ? url->host : _("None")); - - if (url) - camel_url_free (url); - - gtk_clist_append (prefs->news, text); - g_free (text[0]); - - /* set the account on the row */ - gtk_clist_set_row_data (prefs->news, i, (gpointer) service); - - node = node->next; - i++; - } - - gtk_clist_thaw (prefs->news); -} - - -/* news callbacks */ -static void -news_select_row (GtkCList *clist, int row, int column, GdkEventButton *event, gpointer user_data) -{ - MailAccountsTab *prefs = user_data; - - prefs->news_row = row; - gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_edit), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_delete), TRUE); -} - -static void -news_unselect_row (GtkCList *clist, int row, int column, GdkEventButton *event, gpointer user_data) -{ - MailAccountsTab *prefs = user_data; - - prefs->news_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_delete), FALSE); -} - -static void -news_editor_destroyed (GtkWidget *widget, gpointer user_data) -{ - MailAccountsTab *prefs = user_data; - - news_load (prefs); - prefs->news_editor = NULL; -} - -static void -news_edit_clicked (GtkButton *button, gpointer user_data) -{ - MailAccountsTab *prefs = user_data; - - if (prefs->news_editor == NULL) { - if (prefs->news_row >= 0) { - MailConfigService *service; - - service = gtk_clist_get_row_data (prefs->news, prefs->news_row); - prefs->news_editor = mail_account_editor_news_new (service); - gtk_signal_connect (GTK_OBJECT (prefs->news_editor), "destroy", - GTK_SIGNAL_FUNC (news_editor_destroyed), - prefs); - gtk_widget_show (GTK_WIDGET (prefs->news_editor)); - } - } else { - gdk_window_raise (GTK_WIDGET (prefs->news_editor)->window); - } -} - -static void -news_add_destroyed (GtkWidget *widget, gpointer user_data) -{ - gpointer *send = user_data; - MailAccountsTab *prefs; - MailConfigService *service; - - service = send[0]; - prefs = send[1]; - g_free (send); - - news_load (prefs); - - mail_load_storage_by_uri (prefs->shell, service->url, NULL); - - /* FIXME: why do we re-load? */ - news_load (prefs); -} - -static void -news_add_clicked (GtkButton *button, gpointer user_data) -{ - MailAccountsTab *prefs = user_data; - MailConfigService *service; - gpointer *send; - - if (prefs->news_editor == NULL) { - send = g_new (gpointer, 2); - - service = g_new0 (MailConfigService, 1); - service->url = NULL; - - prefs->news_editor = mail_account_editor_news_new (service); - send[0] = service; - send[1] = prefs; - gtk_signal_connect (GTK_OBJECT (prefs->news_editor), "destroy", - GTK_SIGNAL_FUNC (news_add_destroyed), - send); - gtk_widget_show (GTK_WIDGET (prefs->news_editor)); - } else { - gdk_window_raise (GTK_WIDGET (prefs->news_editor)->window); - } -} - -static void -news_delete_clicked (GtkButton *button, gpointer user_data) -{ - MailAccountsTab *prefs = user_data; - GtkWidget *window, *label; - MailConfigService *server; - GnomeDialog *confirm; - int ans; - - /* don't allow user to delete an account if he might be editing it */ - if (prefs->news_row < 0 || prefs->news_editor != NULL) - return; - - window = gtk_widget_get_ancestor (GTK_WIDGET (prefs), GTK_TYPE_WINDOW); - - confirm = GNOME_DIALOG (gnome_dialog_new (_("Are you sure you want to delete this news account?"), - GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL)); - gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE); - gtk_window_set_modal (GTK_WINDOW (confirm), TRUE); - label = gtk_label_new (_("Are you sure you want to delete this news account?")); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_box_pack_start (GTK_BOX (confirm->vbox), label, TRUE, TRUE, 0); - gtk_widget_show (label); - gnome_dialog_set_parent (confirm, GTK_WINDOW (window)); - ans = gnome_dialog_run_and_close (confirm); - - if (ans == 0) { - const GSList *servers; - int row, len; - - server = gtk_clist_get_row_data (prefs->news, prefs->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 */ - servers = mail_config_remove_news (server); - mail_config_write (); - - gtk_clist_remove (prefs->news, prefs->news_row); - - len = servers ? g_slist_length ((GSList *) servers) : 0; - if (len > 0) { - row = prefs->news_row; - row = row >= len ? len - 1 : row; - gtk_clist_select_row (prefs->news, row, 0); - } else { - prefs->news_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_delete), FALSE); - } - } -} -#endif /* ENABLE_NNTP */ - GtkWidget *mail_accounts_etable_new (char *widget_name, char *string1, char *string2, int int1, int int2); @@ -772,11 +557,7 @@ mail_accounts_tab_construct (MailAccountsTab *prefs) prefs->gui = gui; /* get our toplevel widget */ -#ifdef ENABLE_NNTP - toplevel = glade_xml_get_widget (gui, "toplevel_notebook"); -#else toplevel = glade_xml_get_widget (gui, "toplevel"); -#endif /* reparent */ gtk_widget_ref (toplevel); @@ -834,28 +615,6 @@ mail_accounts_tab_construct (MailAccountsTab *prefs) prefs->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAble")); gtk_signal_connect (GTK_OBJECT (prefs->mail_able), "clicked", account_able_clicked, prefs); - -#ifdef ENABLE_NNTP - prefs->news = GTK_CLIST (gtk_object_get_data (GTK_OBJECT (widget), "clistNews")); - gtk_signal_connect (GTK_OBJECT (prefs->news), "select-row", - news_select_row, prefs); - gtk_signal_connect (GTK_OBJECT (prefs->news), "unselect-row", - news_unselect_row, prefs); - - news_load (prefs); - - prefs->news_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsAdd")); - gtk_signal_connect (GTK_OBJECT (prefs->news_add), "clicked", - news_add_clicked, prefs); - - prefs->news_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsEdit")); - gtk_signal_connect (GTK_OBJECT (prefs->news_edit), "clicked", - news_edit_clicked, prefs); - - prefs->news_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsDelete")); - gtk_signal_connect (GTK_OBJECT (prefs->news_delete), "clicked", - news_delete_clicked, prefs); -#endif /* ENABLE_NNTP */ } diff --git a/mail/mail-config.c b/mail/mail-config.c index e3151513b3..58bb0f5ce8 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -104,8 +104,6 @@ typedef struct { GSList *accounts; int default_account; - GSList *news; - char *pgp_path; int pgp_type; @@ -148,17 +146,17 @@ MailConfigSignature * signature_copy (const MailConfigSignature *sig) { MailConfigSignature *ns; - + g_return_val_if_fail (sig != NULL, NULL); ns = g_new (MailConfigSignature, 1); - + ns->id = sig->id; ns->name = g_strdup (sig->name); ns->filename = g_strdup (sig->filename); ns->script = g_strdup (sig->script); ns->html = sig->html; - + return ns; } @@ -186,7 +184,7 @@ identity_copy (const MailConfigIdentity *id) new->organization = g_strdup (id->organization); new->def_signature = id->def_signature; new->auto_signature = id->auto_signature; - + return new; } @@ -351,12 +349,6 @@ mail_config_clear (void) config->accounts = NULL; } - if (config->news) { - g_slist_foreach (config->news, service_destroy_each, NULL); - g_slist_free (config->news); - config->news = NULL; - } - g_free (config->pgp_path); config->pgp_path = NULL; @@ -807,29 +799,6 @@ config_read (void) mail_config_set_default_account_num (default_num); -#ifdef ENABLE_NNTP - /* News */ - - len = bonobo_config_get_long_with_default (config->db, - "/News/Sources/num", 0, NULL); - for (i = 0; i < len; i++) { - MailConfigService *n; - char *path, *r; - - path = g_strdup_printf ("/News/Sources/url_%d", i); - - if ((r = bonobo_config_get_string (config->db, path, NULL))) { - n = g_new0 (MailConfigService, 1); - n->url = r; - n->enabled = TRUE; - config->news = g_slist_append (config->news, n); - } - - g_free (path); - - } -#endif - /* Format */ config->send_html = bonobo_config_get_boolean_with_default (config->db, "/Mail/Format/send_html", FALSE, NULL); @@ -1175,24 +1144,6 @@ mail_config_write (void) g_free (path); } -#ifdef ENABLE_NNTP - /* News */ - - len = g_slist_length (config->news); - bonobo_config_set_long (config->db, "/News/Sources/num", len, NULL); - for (i = 0; i < len; i++) { - MailConfigService *n; - char *path; - - n = g_slist_nth_data (config->news, i); - - path = g_strdup_printf ("/News/Sources/url_%d", i); - bonobo_config_set_string_wrapper (config->db, path, n->url, NULL); - g_free (path); - } - -#endif - CORBA_exception_init (&ev); Bonobo_ConfigDatabase_sync (config->db, &ev); CORBA_exception_free (&ev); @@ -2457,36 +2408,6 @@ mail_config_get_default_transport (void) return NULL; } -const MailConfigService * -mail_config_get_default_news (void) -{ - if (!config->news) - return NULL; - - return (MailConfigService *)config->news->data; -} - -const GSList * -mail_config_get_news (void) -{ - return config->news; -} - -void -mail_config_add_news (MailConfigService *news) -{ - config->news = g_slist_append (config->news, news); -} - -const GSList * -mail_config_remove_news (MailConfigService *news) -{ - config->news = g_slist_remove (config->news, news); - service_destroy (news); - - return config->news; -} - GSList * mail_config_get_sources (void) { diff --git a/mail/mail-config.h b/mail/mail-config.h index 25b02fe9a4..b6dd15bd80 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -273,10 +273,7 @@ void mail_config_set_default_account (const MailConfi const MailConfigIdentity *mail_config_get_default_identity (void); const MailConfigService *mail_config_get_default_transport (void); -const MailConfigService *mail_config_get_default_news (void); -const GSList *mail_config_get_news (void); -void mail_config_add_news (MailConfigService *news); -const GSList *mail_config_remove_news (MailConfigService *news); + GtkType evolution_mail_config_get_type (void); /* convenience functions to help ease the transition over to the new codebase */ diff --git a/mail/mail.h b/mail/mail.h index ecf49f4155..3e5319116f 100644 --- a/mail/mail.h +++ b/mail/mail.h @@ -74,7 +74,7 @@ char *mail_identify_mime_part (CamelMimePart *part, MailDisplay *md); void mail_add_storage (CamelStore *store, const char *name, const char *uri, gboolean auto_connect); void mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const char *name, gboolean auto_connect); /*takes a GSList of MailConfigServices */ -void mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean is_account_data); +void mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources); void mail_hash_storage (CamelService *store, EvolutionStorage *storage); EvolutionStorage *mail_lookup_storage (CamelStore *store); diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c index b7a65e3089..0d553dd326 100644 --- a/mail/subscribe-dialog.c +++ b/mail/subscribe-dialog.c @@ -1485,7 +1485,6 @@ got_sd_store (StoreData *sd, CamelStore *store, gpointer data) static void populate_store_list (SubscribeDialog *sc) { - const GSList *news; GSList *sources; GList *iter; GtkWidget *menu; @@ -1495,9 +1494,6 @@ populate_store_list (SubscribeDialog *sc) g_slist_foreach (sources, (GFunc) populate_store_foreach, sc); g_slist_free (sources); - news = mail_config_get_news (); - g_slist_foreach ((GSList *) news, (GFunc) populate_store_foreach, sc); - menu = gtk_menu_new (); for (iter = sc->priv->store_list; iter; iter = iter->next) { |