aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-accounts.c
diff options
context:
space:
mode:
authorSam Creasey <sammy@oh.verio.com>2001-07-03 10:56:39 +0800
committerSam Creasy <sammy@src.gnome.org>2001-07-03 10:56:39 +0800
commite1e2d6393df2a7e1af08a18330fe65c49d81d9c9 (patch)
treeef69ef8a56d351818f72533a6ee6b71d244589a6 /mail/mail-accounts.c
parentfd6ad06df5c3cf3928f9361d566aaaaffe498d2d (diff)
downloadgsoc2013-evolution-e1e2d6393df2a7e1af08a18330fe65c49d81d9c9.tar
gsoc2013-evolution-e1e2d6393df2a7e1af08a18330fe65c49d81d9c9.tar.gz
gsoc2013-evolution-e1e2d6393df2a7e1af08a18330fe65c49d81d9c9.tar.bz2
gsoc2013-evolution-e1e2d6393df2a7e1af08a18330fe65c49d81d9c9.tar.lz
gsoc2013-evolution-e1e2d6393df2a7e1af08a18330fe65c49d81d9c9.tar.xz
gsoc2013-evolution-e1e2d6393df2a7e1af08a18330fe65c49d81d9c9.tar.zst
gsoc2013-evolution-e1e2d6393df2a7e1af08a18330fe65c49d81d9c9.zip
Added an MailAccountEditorNews, for NNTP configuratuion. Based on
2001-07-02 Sam Creasey <sammy@oh.verio.com> * mail-account-editor-news.c: Added an MailAccountEditorNews, for NNTP configuratuion. Based on MailAccountEditor, but stripped. * Makefile.am: added mail-account-editor-news.c and mail-account-editor-news.h to SOURCES if ENABLE_NNTP is defined. * mail-accounts.c (load_news): Moved this function, and fixed some slight brokenness. (news_edit): Added functional code using MailAccountEditorNews (news_add): Added functional code using news_edit after allocation. * mail-config.glade: news_editor_window widget added. Used by MailAccountEditorNews. * mail-display.c (save_data_cb): Store the pathname used when saving messages so that the next save box will default to the previous path. * message-browser.c (message_browser_new): add signal handler for size_allocate on the message browser. Thus new windows are size as they were last allocated. (message_browser_size_allocate_cb): handler to store allocations. * message-list.c (message_list_setup_etree): connect to the info_changed signals for the state of the message_list->tree. Save the folder state to disk, so that when additional message_lists are created, they are consistant. e.g. the next buttons do the same thing in the browser, and in the message viewer after changing sorting options. * subscribe-dialog.c (build_tree): freeze sc->folder model while building the tree. Not doing so takes a very long time over 40000 newsgroups. svn path=/trunk/; revision=10719
Diffstat (limited to 'mail/mail-accounts.c')
-rw-r--r--mail/mail-accounts.c160
1 files changed, 100 insertions, 60 deletions
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 0be25756f0..f084d163e7 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -38,6 +38,9 @@
#include "mail-config.h"
#include "mail-config-druid.h"
#include "mail-account-editor.h"
+#ifdef ENABLE_NNTP
+#include "mail-account-editor-news.h"
+#endif
#include "mail-session.h"
static void mail_accounts_dialog_class_init (MailAccountsDialogClass *class);
@@ -149,50 +152,6 @@ load_accounts (MailAccountsDialog *dialog)
mail_unselect (dialog->mail_accounts, 0, 0, NULL, dialog);
}
-#ifdef ENABLE_NNTP
-static void
-load_news (MailAccountsDialog *dialog)
-{
- const MailConfigAccount *account;
- const GSList *node = dialog->accounts;
- int i = 0;
-
- gtk_clist_freeze (dialog->news_accounts);
-
- gtk_clist_clear (dialog->news_accounts);
-
- while (node) {
- CamelURL *url;
- gchar *text[3];
-
- account = node->data;
-
- if (account->source && account->source->url)
- url = camel_url_new (account->source->url, NULL);
- else
- url = NULL;
-
- text[0] = (account->source && account->source->enabled) ? "+" : "";
- text[1] = account->name;
- text[2] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"),
- account->default_account ? _(" (default)") : "");
-
- if (url)
- camel_url_free (url);
-
- gtk_clist_append (dialog->news_accounts, text);
- g_free (text[2]);
-
- /* set the account on the row */
- gtk_clist_set_row_data (dialog->news_accounts, i, (gpointer) account);
-
- node = node->next;
- i++;
- }
-
- gtk_clist_thaw (dialog->news_accounts);
-}
-#endif
/* mail callbacks */
static void
@@ -396,6 +355,47 @@ mail_able (GtkButton *button, gpointer data)
}
#ifdef ENABLE_NNTP
+static void
+load_news (MailAccountsDialog *dialog)
+{
+ const MailConfigService *service;
+ const GSList *node = dialog->news;
+ int i = 0;
+
+ gtk_clist_freeze (dialog->news_accounts);
+
+ gtk_clist_clear (dialog->news_accounts);
+
+ while (node) {
+ CamelURL *url;
+ gchar *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 (dialog->news_accounts, text);
+ g_free (text[0]);
+
+ /* set the account on the row */
+ gtk_clist_set_row_data (dialog->news_accounts, i, (gpointer) service);
+
+ node = node->next;
+ i++;
+ }
+
+ gtk_clist_thaw (dialog->news_accounts);
+}
+
+
/* news callbacks */
static void
news_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
@@ -418,35 +418,75 @@ news_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gp
}
static void
-news_add_finished(GtkWidget *widget, gpointer data)
+news_editor_destroyed (GtkWidget *widget, gpointer data)
{
- /* Either Cancel or Finished was clicked in the druid so reload the accounts */
- MailAccountsDialog *dialog = data;
-
- dialog->accounts = mail_config_get_accounts ();
- load_accounts (dialog);
+ load_news (MAIL_ACCOUNTS_DIALOG (data));
}
+
static void
-news_add (GtkButton *button, gpointer data)
+news_edit (GtkButton *button, gpointer data)
{
MailAccountsDialog *dialog = data;
- MailConfigDruid *druid;
- druid = mail_config_druid_new (dialog->shell);
- gtk_signal_connect (GTK_OBJECT (druid), "destroy",
- GTK_SIGNAL_FUNC (news_add_finished), dialog);
+ if (dialog->news_row >= 0) {
+ MailConfigService *service;
+ MailAccountEditorNews *editor;
+
+ service = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row);
+ editor = mail_account_editor_news_new (service);
+ gtk_signal_connect (GTK_OBJECT (editor), "destroy",
+ GTK_SIGNAL_FUNC (news_editor_destroyed),
+ dialog);
+ gtk_widget_show (GTK_WIDGET (editor));
+ }
+}
+
+static void
+news_add_destroyed (GtkWidget *widget, gpointer data)
+{
+
+ gpointer *send = data;
+ MailAccountsDialog *dialog;
+ MailConfigService *service;
+ GSList *mini;
+
+ service = send[0];
+ dialog = send[1];
+ g_free(send);
+
+ dialog->news = mail_config_get_news ();
+ load_news (dialog);
+
+ mini = g_slist_prepend(NULL, service);
+ mail_load_storages(dialog->shell, mini, FALSE);
+ g_slist_free(mini);
+
+ dialog->news = mail_config_get_news ();
+ load_news (dialog);
- gtk_widget_show (GTK_WIDGET (druid));
}
static void
-news_edit (GtkButton *button, gpointer data)
+news_add (GtkButton *button, gpointer data)
{
MailAccountsDialog *dialog = data;
- MailConfigService *server;
+ MailConfigService *service;
+ MailAccountEditorNews *editor;
+ gpointer *send;
- /* FIXME: open the editor and stuff */
+ send = g_new(gpointer, 2);
+
+ service = g_new0 (MailConfigService, 1);
+ service->url = NULL;
+
+ editor = mail_account_editor_news_new (service);
+ send[0] = service;
+ send[1] = dialog;
+ gtk_signal_connect (GTK_OBJECT (editor), "destroy",
+ GTK_SIGNAL_FUNC (news_add_destroyed),
+ send);
+ gtk_widget_show (GTK_WIDGET (editor));
}
static void
@@ -683,7 +723,7 @@ construct (MailAccountsDialog *dialog)
GTK_SIGNAL_FUNC (mail_able), dialog);
#ifdef ENABLE_NNTP
- dialog->news_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistAccounts"));
+ dialog->news_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistNews"));
gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "select-row",
GTK_SIGNAL_FUNC (news_select), dialog);
gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "unselect-row",