Add 'mail-config' module.
This breaks a good chunk of logic out of EMAccountEditor and hopefully makes it less brittle. Because honestly, every time I fix one thing in EMAccountEditor it breaks three other things. It's unmaintainable.
This commit is contained in:
@ -1644,6 +1644,7 @@ modules/cal-config-weather/Makefile
|
||||
modules/cal-config-webcal/Makefile
|
||||
modules/composer-autosave/Makefile
|
||||
modules/imap-features/Makefile
|
||||
modules/mail-config/Makefile
|
||||
modules/mailto-handler/Makefile
|
||||
modules/mdn/Makefile
|
||||
modules/online-accounts/Makefile
|
||||
|
||||
@ -36,6 +36,7 @@ SUBDIRS = \
|
||||
cal-config-webcal \
|
||||
composer-autosave \
|
||||
imap-features \
|
||||
mail-config \
|
||||
mailto-handler \
|
||||
mdn \
|
||||
offline-alert \
|
||||
|
||||
39
modules/mail-config/Makefile.am
Normal file
39
modules/mail-config/Makefile.am
Normal file
@ -0,0 +1,39 @@
|
||||
NULL =
|
||||
|
||||
module_LTLIBRARIES = module-mail-config.la
|
||||
|
||||
module_mail_config_la_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/widgets \
|
||||
-DG_LOG_DOMAIN=\"evolution-mail-config\" \
|
||||
$(EVOLUTION_DATA_SERVER_CFLAGS) \
|
||||
$(GNOME_PLATFORM_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
module_mail_config_la_SOURCES = \
|
||||
evolution-mail-config.c \
|
||||
e-mail-config-local-accounts.c \
|
||||
e-mail-config-remote-accounts.c \
|
||||
e-mail-config-sendmail-backend.c \
|
||||
e-mail-config-sendmail-backend.h \
|
||||
e-mail-config-smtp-backend.c \
|
||||
e-mail-config-smtp-backend.h \
|
||||
e-mail-config-google-summary.c \
|
||||
e-mail-config-google-summary.h \
|
||||
e-mail-config-yahoo-summary.c \
|
||||
e-mail-config-yahoo-summary.h \
|
||||
$(NULL)
|
||||
|
||||
module_mail_config_la_LIBADD = \
|
||||
$(top_builddir)/mail/libevolution-mail.la \
|
||||
$(top_builddir)/widgets/misc/libemiscwidgets.la \
|
||||
$(top_builddir)/libemail-engine/libemail-engine.la \
|
||||
$(EVOLUTION_DATA_SERVER_LIBS) \
|
||||
$(GNOME_PLATFORM_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
module_mail_config_la_LDFLAGS = \
|
||||
-module -avoid-version $(NO_UNDEFINED)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
68
modules/mail-config/e-mail-config-google-summary.h
Normal file
68
modules/mail-config/e-mail-config-google-summary.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* e-mail-config-google-summary.h
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef E_MAIL_CONFIG_GOOGLE_SUMMARY_H
|
||||
#define E_MAIL_CONFIG_GOOGLE_SUMMARY_H
|
||||
|
||||
#include <libebackend/e-extension.h>
|
||||
|
||||
/* Standard GObject macros */
|
||||
#define E_TYPE_MAIL_CONFIG_GOOGLE_SUMMARY \
|
||||
(e_mail_config_google_summary_get_type ())
|
||||
#define E_MAIL_CONFIG_GOOGLE_SUMMARY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST \
|
||||
((obj), E_TYPE_MAIL_CONFIG_GOOGLE_SUMMARY, EMailConfigGoogleSummary))
|
||||
#define E_MAIL_CONFIG_GOOGLE_SUMMARY_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_CAST \
|
||||
((cls), E_TYPE_MAIL_CONFIG_GOOGLE_SUMMARY, EMailConfigGoogleSummaryClass))
|
||||
#define E_IS_MAIL_CONFIG_GOOGLE_SUMMARY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE \
|
||||
((obj), E_TYPE_MAIL_CONFIG_GOOGLE_SUMMARY))
|
||||
#define E_IS_MAIL_CONFIG_GOOGLE_SUMMARY_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE \
|
||||
((cls), E_TYPE_MAIL_CONFIG_GOOGLE_SUMMARY))
|
||||
#define E_MAIL_CONFIG_GOOGLE_SUMMARY_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS \
|
||||
((obj), E_TYPE_MAIL_CONFIG_GOOGLE_SUMMARY, EMailConfigGoogleSummaryClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _EMailConfigGoogleSummary EMailConfigGoogleSummary;
|
||||
typedef struct _EMailConfigGoogleSummaryClass EMailConfigGoogleSummaryClass;
|
||||
typedef struct _EMailConfigGoogleSummaryPrivate EMailConfigGoogleSummaryPrivate;
|
||||
|
||||
struct _EMailConfigGoogleSummary {
|
||||
EExtension parent;
|
||||
EMailConfigGoogleSummaryPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EMailConfigGoogleSummaryClass {
|
||||
EExtensionClass parent_class;
|
||||
};
|
||||
|
||||
GType e_mail_config_google_summary_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
void e_mail_config_google_summary_type_register
|
||||
(GTypeModule *type_module);
|
||||
gboolean e_mail_config_google_summary_get_applicable
|
||||
(EMailConfigGoogleSummary *extension);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* E_MAIL_CONFIG_GOOGLE_SUMMARY_H */
|
||||
|
||||
385
modules/mail-config/e-mail-config-local-accounts.c
Normal file
385
modules/mail-config/e-mail-config-local-accounts.c
Normal file
@ -0,0 +1,385 @@
|
||||
/*
|
||||
* e-mail-config-local-accounts.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <camel/camel.h>
|
||||
#include <libebackend/e-extension.h>
|
||||
|
||||
#include <mail/e-mail-config-service-page.h>
|
||||
|
||||
/* Standard GObject macros */
|
||||
#define E_TYPE_MAIL_CONFIG_LOCAL_BACKEND \
|
||||
(e_mail_config_local_backend_get_type ())
|
||||
#define E_MAIL_CONFIG_LOCAL_BACKEND(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST \
|
||||
((obj), E_TYPE_MAIL_CONFIG_LOCAL_BACKEND, EMailConfigLocalBackend))
|
||||
#define E_MAIL_CONFIG_LOCAL_BACKEND_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_CAST \
|
||||
((cls), E_TYPE_MAIL_CONFIG_LOCAL_BACKEND, EMailConfigLocalBackendClass))
|
||||
#define E_IS_MAIL_CONFIG_LOCAL_BACKEND(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE \
|
||||
((obj), E_TYPE_MAIL_CONFIG_LOCAL_BACKEND))
|
||||
#define E_IS_MAIL_CONFIG_LOCAL_BACKEND_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE \
|
||||
((cls), E_TYPE_MAIL_CONFIG_LOCAL_BACKEND))
|
||||
#define E_MAIL_CONFIG_LOCAL_BACKEND_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS \
|
||||
((obj), E_TYPE_MAIL_CONFIG_LOCAL_BACKEND, EMailConfigLocalBackendClass))
|
||||
|
||||
typedef struct _EMailConfigLocalBackend EMailConfigLocalBackend;
|
||||
typedef struct _EMailConfigLocalBackendClass EMailConfigLocalBackendClass;
|
||||
|
||||
typedef EMailConfigLocalBackend EMailConfigMhBackend;
|
||||
typedef EMailConfigLocalBackendClass EMailConfigMhBackendClass;
|
||||
|
||||
typedef EMailConfigLocalBackend EMailConfigMboxBackend;
|
||||
typedef EMailConfigLocalBackendClass EMailConfigMboxBackendClass;
|
||||
|
||||
typedef EMailConfigLocalBackend EMailConfigMaildirBackend;
|
||||
typedef EMailConfigLocalBackendClass EMailConfigMaildirBackendClass;
|
||||
|
||||
typedef EMailConfigLocalBackend EMailConfigSpoolDirBackend;
|
||||
typedef EMailConfigLocalBackendClass EMailConfigSpoolDirBackendClass;
|
||||
|
||||
typedef EMailConfigLocalBackend EMailConfigSpoolFileBackend;
|
||||
typedef EMailConfigLocalBackendClass EMailConfigSpoolFileBackendClass;
|
||||
|
||||
/* XXX For lack of a better place for this... */
|
||||
typedef EMailConfigServiceBackend EMailConfigNoneBackend;
|
||||
typedef EMailConfigServiceBackendClass EMailConfigNoneBackendClass;
|
||||
|
||||
struct _EMailConfigLocalBackend {
|
||||
EMailConfigServiceBackend parent;
|
||||
};
|
||||
|
||||
struct _EMailConfigLocalBackendClass {
|
||||
EMailConfigServiceBackendClass parent_class;
|
||||
|
||||
const gchar *file_chooser_label;
|
||||
const gchar *file_chooser_title;
|
||||
GtkFileChooserAction file_chooser_action;
|
||||
};
|
||||
|
||||
/* Forward Declarations */
|
||||
void e_mail_config_local_accounts_register_types
|
||||
(GTypeModule *type_module);
|
||||
GType e_mail_config_local_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_mh_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_mbox_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_maildir_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_spool_dir_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_spool_file_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_none_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (
|
||||
EMailConfigLocalBackend,
|
||||
e_mail_config_local_backend,
|
||||
E_TYPE_MAIL_CONFIG_SERVICE_BACKEND,
|
||||
G_TYPE_FLAG_ABSTRACT,
|
||||
/* no custom code */)
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigMhBackend,
|
||||
e_mail_config_mh_backend,
|
||||
E_TYPE_MAIL_CONFIG_LOCAL_BACKEND)
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigMboxBackend,
|
||||
e_mail_config_mbox_backend,
|
||||
E_TYPE_MAIL_CONFIG_LOCAL_BACKEND)
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigMaildirBackend,
|
||||
e_mail_config_maildir_backend,
|
||||
E_TYPE_MAIL_CONFIG_LOCAL_BACKEND)
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigSpoolDirBackend,
|
||||
e_mail_config_spool_dir_backend,
|
||||
E_TYPE_MAIL_CONFIG_LOCAL_BACKEND)
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigSpoolFileBackend,
|
||||
e_mail_config_spool_file_backend,
|
||||
E_TYPE_MAIL_CONFIG_LOCAL_BACKEND)
|
||||
|
||||
/* XXX For lack of a better place for this... */
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigNoneBackend,
|
||||
e_mail_config_none_backend,
|
||||
E_TYPE_MAIL_CONFIG_SERVICE_BACKEND)
|
||||
|
||||
static void
|
||||
mail_config_local_backend_file_set_cb (GtkFileChooserButton *file_chooser_button,
|
||||
CamelLocalSettings *local_settings)
|
||||
{
|
||||
GtkFileChooser *file_chooser;
|
||||
gchar *path;
|
||||
|
||||
file_chooser = GTK_FILE_CHOOSER (file_chooser_button);
|
||||
|
||||
path = gtk_file_chooser_get_filename (file_chooser);
|
||||
camel_local_settings_set_path (local_settings, path);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_config_local_backend_insert_widgets (EMailConfigServiceBackend *backend,
|
||||
GtkBox *parent)
|
||||
{
|
||||
CamelSettings *settings;
|
||||
EMailConfigLocalBackendClass *class;
|
||||
GtkLabel *label;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *container;
|
||||
const gchar *path;
|
||||
|
||||
class = E_MAIL_CONFIG_LOCAL_BACKEND_GET_CLASS (backend);
|
||||
settings = e_mail_config_service_backend_get_settings (backend);
|
||||
|
||||
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||
gtk_box_pack_start (parent, widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
container = widget;
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (class->file_chooser_label);
|
||||
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
widget = gtk_file_chooser_button_new (
|
||||
class->file_chooser_title,
|
||||
class->file_chooser_action);
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
g_signal_connect (
|
||||
widget, "file-set",
|
||||
G_CALLBACK (mail_config_local_backend_file_set_cb),
|
||||
CAMEL_LOCAL_SETTINGS (settings));
|
||||
|
||||
path = camel_local_settings_get_path (CAMEL_LOCAL_SETTINGS (settings));
|
||||
if (path != NULL)
|
||||
gtk_file_chooser_set_filename (
|
||||
GTK_FILE_CHOOSER (widget), path);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mail_config_local_backend_check_complete (EMailConfigServiceBackend *backend)
|
||||
{
|
||||
CamelSettings *settings;
|
||||
CamelLocalSettings *local_settings;
|
||||
const gchar *path;
|
||||
|
||||
settings = e_mail_config_service_backend_get_settings (backend);
|
||||
|
||||
local_settings = CAMEL_LOCAL_SETTINGS (settings);
|
||||
path = camel_local_settings_get_path (local_settings);
|
||||
|
||||
return (path != NULL && *path != '\0');
|
||||
}
|
||||
|
||||
static void
|
||||
mail_config_local_backend_commit_changes (EMailConfigServiceBackend *backend)
|
||||
{
|
||||
/* CamelLocalSettings "path" property is already up-to-date,
|
||||
* and it's bound to the appropriate ESourceExtension property,
|
||||
* so nothing to do here. */
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_local_backend_class_init (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->insert_widgets = mail_config_local_backend_insert_widgets;
|
||||
backend_class->check_complete = mail_config_local_backend_check_complete;
|
||||
backend_class->commit_changes = mail_config_local_backend_commit_changes;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_local_backend_class_finalize (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_local_backend_init (EMailConfigLocalBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_mh_backend_class_init (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "mh";
|
||||
|
||||
class->file_chooser_label = _("Mail _Directory:");
|
||||
class->file_chooser_title = _("Choose a MH mail directory");
|
||||
class->file_chooser_action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_mh_backend_class_finalize (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_mh_backend_init (EMailConfigLocalBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_mbox_backend_class_init (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "mbox";
|
||||
|
||||
class->file_chooser_label = _("Local Delivery _File:");
|
||||
class->file_chooser_title = _("Choose a local delivery file");
|
||||
class->file_chooser_action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_mbox_backend_class_finalize (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_mbox_backend_init (EMailConfigLocalBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_maildir_backend_class_init (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "maildir";
|
||||
|
||||
class->file_chooser_label = _("Mail _Directory:");
|
||||
class->file_chooser_title = _("Choose a Maildir mail directory");
|
||||
class->file_chooser_action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_maildir_backend_class_finalize (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_maildir_backend_init (EMailConfigLocalBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_spool_dir_backend_class_init (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "spool";
|
||||
|
||||
class->file_chooser_label = _("Spool _File:");
|
||||
class->file_chooser_title = _("Choose a mbox spool file");
|
||||
class->file_chooser_action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_spool_dir_backend_class_finalize (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_spool_dir_backend_init (EMailConfigLocalBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_spool_file_backend_class_init (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "spooldir";
|
||||
|
||||
class->file_chooser_label = _("Spool _Directory:");
|
||||
class->file_chooser_title = _("Choose a mbox spool directory");
|
||||
class->file_chooser_action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_spool_file_backend_class_finalize (EMailConfigLocalBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_spool_file_backend_init (EMailConfigLocalBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_none_backend_class_init (EMailConfigServiceBackendClass *class)
|
||||
{
|
||||
class->backend_name = "none";
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_none_backend_class_finalize (EMailConfigServiceBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_none_backend_init (EMailConfigServiceBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
e_mail_config_local_accounts_register_types (GTypeModule *type_module)
|
||||
{
|
||||
/* Abstract base type */
|
||||
e_mail_config_local_backend_register_type (type_module);
|
||||
|
||||
/* Concrete sub-types */
|
||||
e_mail_config_mh_backend_register_type (type_module);
|
||||
e_mail_config_mbox_backend_register_type (type_module);
|
||||
e_mail_config_maildir_backend_register_type (type_module);
|
||||
e_mail_config_spool_dir_backend_register_type (type_module);
|
||||
e_mail_config_spool_file_backend_register_type (type_module);
|
||||
|
||||
/* XXX For lack of a better place for this... */
|
||||
e_mail_config_none_backend_register_type (type_module);
|
||||
}
|
||||
|
||||
501
modules/mail-config/e-mail-config-remote-accounts.c
Normal file
501
modules/mail-config/e-mail-config-remote-accounts.c
Normal file
@ -0,0 +1,501 @@
|
||||
/*
|
||||
* e-mail-config-remote-accounts.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <camel/camel.h>
|
||||
#include <libebackend/e-extension.h>
|
||||
#include <libedataserver/e-source-backend.h>
|
||||
#include <libedataserver/e-data-server-util.h>
|
||||
|
||||
#include <misc/e-port-entry.h>
|
||||
|
||||
#include <mail/e-mail-config-auth-check.h>
|
||||
#include <mail/e-mail-config-service-page.h>
|
||||
|
||||
/* Standard GObject macros */
|
||||
#define E_TYPE_MAIL_CONFIG_REMOTE_BACKEND \
|
||||
(e_mail_config_remote_backend_get_type ())
|
||||
#define E_MAIL_CONFIG_REMOTE_BACKEND(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST \
|
||||
((obj), E_TYPE_MAIL_CONFIG_REMOTE_BACKEND, EMailConfigRemoteBackend))
|
||||
#define E_MAIL_CONFIG_REMOTE_BACKEND_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_CAST \
|
||||
((cls), E_TYPE_MAIL_CONFIG_REMOTE_BACKEND, EMailConfigRemoteBackendClass))
|
||||
#define E_IS_MAIL_CONFIG_REMOTE_BACKEND(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE \
|
||||
((obj), E_TYPE_MAIL_CONFIG_REMOTE_BACKEND))
|
||||
#define E_IS_MAIL_CONFIG_REMOTE_BACKEND_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE \
|
||||
((cls), E_TYPE_MAIL_CONFIG_REMOTE_BACKEND))
|
||||
#define E_MAIL_CONFIG_REMOTE_BACKEND_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS \
|
||||
((obj), E_TYPE_MAIL_CONFIG_REMOTE_BACKEND, EMailConfigRemoteBackendClass))
|
||||
|
||||
typedef struct _EMailConfigRemoteBackend EMailConfigRemoteBackend;
|
||||
typedef struct _EMailConfigRemoteBackendClass EMailConfigRemoteBackendClass;
|
||||
|
||||
typedef EMailConfigRemoteBackend EMailConfigPopBackend;
|
||||
typedef EMailConfigRemoteBackendClass EMailConfigPopBackendClass;
|
||||
|
||||
typedef EMailConfigRemoteBackend EMailConfigNntpBackend;
|
||||
typedef EMailConfigRemoteBackendClass EMailConfigNntpBackendClass;
|
||||
|
||||
typedef EMailConfigRemoteBackend EMailConfigImapBackend;
|
||||
typedef EMailConfigRemoteBackendClass EMailConfigImapBackendClass;
|
||||
|
||||
typedef EMailConfigRemoteBackend EMailConfigImapxBackend;
|
||||
typedef EMailConfigRemoteBackendClass EMailConfigImapxBackendClass;
|
||||
|
||||
struct _EMailConfigRemoteBackend {
|
||||
EMailConfigServiceBackend parent;
|
||||
|
||||
GtkWidget *host_entry; /* not referenced */
|
||||
GtkWidget *port_entry; /* not referenced */
|
||||
GtkWidget *user_entry; /* not referenced */
|
||||
GtkWidget *security_combo_box; /* not referenced */
|
||||
GtkWidget *auth_check; /* not referenced */
|
||||
};
|
||||
|
||||
struct _EMailConfigRemoteBackendClass {
|
||||
EMailConfigServiceBackendClass parent_class;
|
||||
};
|
||||
|
||||
/* Forward Declarations */
|
||||
void e_mail_config_remote_accounts_register_types
|
||||
(GTypeModule *type_module);
|
||||
GType e_mail_config_remote_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_pop_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_nntp_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_imap_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType e_mail_config_imapx_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (
|
||||
EMailConfigRemoteBackend,
|
||||
e_mail_config_remote_backend,
|
||||
E_TYPE_MAIL_CONFIG_SERVICE_BACKEND,
|
||||
G_TYPE_FLAG_ABSTRACT,
|
||||
/* no custom code */)
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigPopBackend,
|
||||
e_mail_config_pop_backend,
|
||||
E_TYPE_MAIL_CONFIG_REMOTE_BACKEND)
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigNntpBackend,
|
||||
e_mail_config_nntp_backend,
|
||||
E_TYPE_MAIL_CONFIG_REMOTE_BACKEND)
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigImapBackend,
|
||||
e_mail_config_imap_backend,
|
||||
E_TYPE_MAIL_CONFIG_REMOTE_BACKEND)
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigImapxBackend,
|
||||
e_mail_config_imapx_backend,
|
||||
E_TYPE_MAIL_CONFIG_REMOTE_BACKEND)
|
||||
|
||||
static void
|
||||
mail_config_remote_backend_insert_widgets (EMailConfigServiceBackend *backend,
|
||||
GtkBox *parent)
|
||||
{
|
||||
EMailConfigRemoteBackend *remote_backend;
|
||||
CamelProvider *provider;
|
||||
CamelSettings *settings;
|
||||
ESource *source;
|
||||
ESourceBackend *extension;
|
||||
EMailConfigServicePage *page;
|
||||
EMailConfigServicePageClass *class;
|
||||
GtkLabel *label;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *container;
|
||||
const gchar *backend_name;
|
||||
const gchar *extension_name;
|
||||
const gchar *text;
|
||||
gchar *markup;
|
||||
|
||||
remote_backend = E_MAIL_CONFIG_REMOTE_BACKEND (backend);
|
||||
|
||||
page = e_mail_config_service_backend_get_page (backend);
|
||||
source = e_mail_config_service_backend_get_source (backend);
|
||||
settings = e_mail_config_service_backend_get_settings (backend);
|
||||
|
||||
class = E_MAIL_CONFIG_SERVICE_PAGE_GET_CLASS (page);
|
||||
extension_name = class->extension_name;
|
||||
extension = e_source_get_extension (source, extension_name);
|
||||
backend_name = e_source_backend_get_backend_name (extension);
|
||||
|
||||
text = _("Configuration");
|
||||
markup = g_markup_printf_escaped ("<b>%s</b>", text);
|
||||
widget = gtk_label_new (markup);
|
||||
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
g_free (markup);
|
||||
|
||||
widget = gtk_grid_new ();
|
||||
gtk_widget_set_margin_left (widget, 12);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
container = widget;
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (_("_Server:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
widget = gtk_entry_new ();
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 1, 1);
|
||||
remote_backend->host_entry = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (_("_Port:"));
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 2, 0, 1, 1);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
widget = e_port_entry_new ();
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 3, 0, 1, 1);
|
||||
remote_backend->port_entry = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (_("User_name:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 1, 1);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
widget = gtk_entry_new ();
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 3, 1);
|
||||
remote_backend->user_entry = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
text = _("Security");
|
||||
markup = g_markup_printf_escaped ("<b>%s</b>", text);
|
||||
widget = gtk_label_new (markup);
|
||||
gtk_widget_set_margin_top (widget, 6);
|
||||
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
g_free (markup);
|
||||
|
||||
widget = gtk_grid_new ();
|
||||
gtk_widget_set_margin_left (widget, 12);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
container = widget;
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (_("Encryption _method:"));
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
/* The IDs correspond to the CamelNetworkSecurityMethod enum. */
|
||||
widget = gtk_combo_box_text_new ();
|
||||
gtk_combo_box_text_append (
|
||||
GTK_COMBO_BOX_TEXT (widget),
|
||||
"none",
|
||||
_("No encryption"));
|
||||
gtk_combo_box_text_append (
|
||||
GTK_COMBO_BOX_TEXT (widget),
|
||||
"starttls-on-standard-port",
|
||||
_("STARTTLS after connecting"));
|
||||
gtk_combo_box_text_append (
|
||||
GTK_COMBO_BOX_TEXT (widget),
|
||||
"ssl-on-alternate-port",
|
||||
_("SSL on a dedicated port"));
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_START);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 1, 1);
|
||||
remote_backend->security_combo_box = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
provider = camel_provider_get (backend_name, NULL);
|
||||
if (provider != NULL && provider->port_entries != NULL)
|
||||
e_port_entry_set_camel_entries (
|
||||
E_PORT_ENTRY (remote_backend->port_entry),
|
||||
provider->port_entries);
|
||||
|
||||
text = _("Authentication");
|
||||
markup = g_markup_printf_escaped ("<b>%s</b>", text);
|
||||
widget = gtk_label_new (markup);
|
||||
gtk_widget_set_margin_top (widget, 6);
|
||||
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
g_free (markup);
|
||||
|
||||
widget = e_mail_config_auth_check_new (backend);
|
||||
gtk_widget_set_margin_left (widget, 12);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
remote_backend->auth_check = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
g_object_bind_property (
|
||||
settings, "host",
|
||||
remote_backend->host_entry, "text",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
g_object_bind_property_full (
|
||||
settings, "security-method",
|
||||
remote_backend->security_combo_box, "active-id",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE,
|
||||
e_binding_transform_enum_value_to_nick,
|
||||
e_binding_transform_enum_nick_to_value,
|
||||
NULL, (GDestroyNotify) NULL);
|
||||
|
||||
g_object_bind_property (
|
||||
settings, "port",
|
||||
remote_backend->port_entry, "port",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
g_object_bind_property (
|
||||
settings, "security-method",
|
||||
remote_backend->port_entry, "security-method",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
g_object_bind_property (
|
||||
settings, "user",
|
||||
remote_backend->user_entry, "text",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
/* Don't use G_BINDING_SYNC_CREATE here since the widget
|
||||
* chooses its initial mechanism more intelligently than
|
||||
* a simple property binding would. */
|
||||
g_object_bind_property (
|
||||
settings, "auth-mechanism",
|
||||
remote_backend->auth_check, "active-mechanism",
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mail_config_remote_backend_check_complete (EMailConfigServiceBackend *backend)
|
||||
{
|
||||
EMailConfigRemoteBackend *remote_backend;
|
||||
CamelSettings *settings;
|
||||
CamelNetworkSettings *network_settings;
|
||||
EPortEntry *port_entry;
|
||||
const gchar *host;
|
||||
const gchar *user;
|
||||
|
||||
remote_backend = E_MAIL_CONFIG_REMOTE_BACKEND (backend);
|
||||
|
||||
settings = e_mail_config_service_backend_get_settings (backend);
|
||||
|
||||
network_settings = CAMEL_NETWORK_SETTINGS (settings);
|
||||
host = camel_network_settings_get_host (network_settings);
|
||||
user = camel_network_settings_get_user (network_settings);
|
||||
|
||||
if (host == NULL || *host == '\0')
|
||||
return FALSE;
|
||||
|
||||
port_entry = E_PORT_ENTRY (remote_backend->port_entry);
|
||||
if (!e_port_entry_is_valid (port_entry))
|
||||
return FALSE;
|
||||
|
||||
if (user == NULL || *user == '\0')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
mail_config_remote_backend_commit_changes (EMailConfigServiceBackend *backend)
|
||||
{
|
||||
/* All CamelNetworkSettings properties are already up-to-date,
|
||||
* and these properties are bound to ESourceExtension properties,
|
||||
* so nothing to do here. */
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_remote_backend_class_init (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->insert_widgets = mail_config_remote_backend_insert_widgets;
|
||||
backend_class->check_complete = mail_config_remote_backend_check_complete;
|
||||
backend_class->commit_changes = mail_config_remote_backend_commit_changes;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_remote_backend_class_finalize (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_remote_backend_init (EMailConfigRemoteBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mail_config_pop_backend_auto_configure (EMailConfigServiceBackend *backend,
|
||||
EMailAutoconfig *autoconfig)
|
||||
{
|
||||
ESource *source;
|
||||
|
||||
source = e_mail_config_service_backend_get_source (backend);
|
||||
|
||||
return e_mail_autoconfig_set_pop3_details (autoconfig, source);
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_pop_backend_class_init (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "pop";
|
||||
backend_class->auto_configure = mail_config_pop_backend_auto_configure;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_pop_backend_class_finalize (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_pop_backend_init (EMailConfigRemoteBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_nntp_backend_class_init (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "nntp";
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_nntp_backend_class_finalize (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_nntp_backend_init (EMailConfigRemoteBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mail_config_imap_backend_auto_configure (EMailConfigServiceBackend *backend,
|
||||
EMailAutoconfig *autoconfig)
|
||||
{
|
||||
ESource *source;
|
||||
|
||||
source = e_mail_config_service_backend_get_source (backend);
|
||||
|
||||
return e_mail_autoconfig_set_imap_details (autoconfig, source);
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_imap_backend_class_init (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "imap";
|
||||
backend_class->auto_configure = mail_config_imap_backend_auto_configure;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_imap_backend_class_finalize (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_imap_backend_init (EMailConfigRemoteBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mail_config_imapx_backend_auto_configure (EMailConfigServiceBackend *backend,
|
||||
EMailAutoconfig *autoconfig)
|
||||
{
|
||||
ESource *source;
|
||||
|
||||
source = e_mail_config_service_backend_get_source (backend);
|
||||
|
||||
return e_mail_autoconfig_set_imap_details (autoconfig, source);
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_imapx_backend_class_init (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "imapx";
|
||||
backend_class->auto_configure = mail_config_imapx_backend_auto_configure;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_imapx_backend_class_finalize (EMailConfigRemoteBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_imapx_backend_init (EMailConfigRemoteBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
e_mail_config_remote_accounts_register_types (GTypeModule *type_module)
|
||||
{
|
||||
/* Abstract base type */
|
||||
e_mail_config_remote_backend_register_type (type_module);
|
||||
|
||||
/* Concrete sub-types */
|
||||
e_mail_config_pop_backend_register_type (type_module);
|
||||
e_mail_config_nntp_backend_register_type (type_module);
|
||||
e_mail_config_imap_backend_register_type (type_module);
|
||||
e_mail_config_imapx_backend_register_type (type_module);
|
||||
}
|
||||
|
||||
55
modules/mail-config/e-mail-config-sendmail-backend.c
Normal file
55
modules/mail-config/e-mail-config-sendmail-backend.c
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* e-mail-config-sendmail-backend.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "e-mail-config-sendmail-backend.h"
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigSendmailBackend,
|
||||
e_mail_config_sendmail_backend,
|
||||
E_TYPE_MAIL_CONFIG_SERVICE_BACKEND)
|
||||
|
||||
static void
|
||||
e_mail_config_sendmail_backend_class_init (EMailConfigSendmailBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "sendmail";
|
||||
|
||||
/* No extra widgets for this backend. */
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_sendmail_backend_class_finalize (EMailConfigSendmailBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_sendmail_backend_init (EMailConfigSendmailBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
e_mail_config_sendmail_backend_type_register (GTypeModule *type_module)
|
||||
{
|
||||
/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
|
||||
* function, so we have to wrap it with a public function in
|
||||
* order to register types from a separate compilation unit. */
|
||||
e_mail_config_sendmail_backend_register_type (type_module);
|
||||
}
|
||||
|
||||
66
modules/mail-config/e-mail-config-sendmail-backend.h
Normal file
66
modules/mail-config/e-mail-config-sendmail-backend.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* e-mail-config-sendmail-backend.h
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef E_MAIL_CONFIG_SENDMAIL_BACKEND_H
|
||||
#define E_MAIL_CONFIG_SENDMAIL_BACKEND_H
|
||||
|
||||
#include <mail/e-mail-config-service-backend.h>
|
||||
|
||||
/* Standard GObject macros */
|
||||
#define E_TYPE_MAIL_CONFIG_SENDMAIL_BACKEND \
|
||||
(e_mail_config_sendmail_backend_get_type ())
|
||||
#define E_MAIL_CONFIG_SENDMAIL_BACKEND(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST \
|
||||
((obj), E_TYPE_MAIL_CONFIG_SENDMAIL_BACKEND, EMailConfigSendmailBackend))
|
||||
#define E_MAIL_CONFIG_SENDMAIL_BACKEND_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_CAST \
|
||||
((cls), E_TYPE_MAIL_CONFIG_SENDMAIL_BACKEND, EMailConfigSendmailBackendClass))
|
||||
#define E_IS_MAIL_CONFIG_SENDMAIL_BACKEND(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE \
|
||||
((obj), E_TYPE_MAIL_CONFIG_SENDMAIL_BACKEND))
|
||||
#define E_IS_MAIL_CONFIG_SENDMAIL_BACKEND_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE \
|
||||
((cls), E_TYPE_MAIL_CONFIG_SENDMAIL_BACKEND))
|
||||
#define E_MAIL_CONFIG_SENDMAIL_BACKEND_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS \
|
||||
((obj), E_TYPE_MAIL_CONFIG_SENDMAIL_BACKEND, EMailConfigSendmailBackendClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _EMailConfigSendmailBackend EMailConfigSendmailBackend;
|
||||
typedef struct _EMailConfigSendmailBackendClass EMailConfigSendmailBackendClass;
|
||||
typedef struct _EMailConfigSendmailBackendPrivate EMailConfigSendmailBackendPrivate;
|
||||
|
||||
struct _EMailConfigSendmailBackend {
|
||||
EMailConfigServiceBackend parent;
|
||||
EMailConfigSendmailBackendPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EMailConfigSendmailBackendClass {
|
||||
EMailConfigServiceBackendClass parent_class;
|
||||
};
|
||||
|
||||
GType e_mail_config_sendmail_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
void e_mail_config_sendmail_backend_type_register
|
||||
(GTypeModule *type_module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* E_MAIL_CONFIG_SENDMAIL_BACKEND_H */
|
||||
|
||||
393
modules/mail-config/e-mail-config-smtp-backend.c
Normal file
393
modules/mail-config/e-mail-config-smtp-backend.c
Normal file
@ -0,0 +1,393 @@
|
||||
/*
|
||||
* e-mail-config-smtp-backend.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "e-mail-config-smtp-backend.h"
|
||||
|
||||
#include <config.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <camel/camel.h>
|
||||
#include <libebackend/e-extension.h>
|
||||
#include <libedataserver/e-source-backend.h>
|
||||
#include <libedataserver/e-data-server-util.h>
|
||||
|
||||
#include <misc/e-port-entry.h>
|
||||
|
||||
#include <mail/e-mail-config-auth-check.h>
|
||||
#include <mail/e-mail-config-service-page.h>
|
||||
|
||||
#define E_MAIL_CONFIG_SMTP_BACKEND_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE \
|
||||
((obj), E_TYPE_MAIL_CONFIG_SMTP_BACKEND, EMailConfigSmtpBackendPrivate))
|
||||
|
||||
struct _EMailConfigSmtpBackendPrivate {
|
||||
GtkWidget *host_entry; /* not referenced */
|
||||
GtkWidget *port_entry; /* not referenced */
|
||||
GtkWidget *user_entry; /* not referenced */
|
||||
GtkWidget *security_combo_box; /* not referenced */
|
||||
GtkWidget *auth_required_toggle; /* not referenced */
|
||||
GtkWidget *auth_check; /* not referenced */
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (
|
||||
EMailConfigSmtpBackend,
|
||||
e_mail_config_smtp_backend,
|
||||
E_TYPE_MAIL_CONFIG_SERVICE_BACKEND)
|
||||
|
||||
static void
|
||||
mail_config_smtp_backend_insert_widgets (EMailConfigServiceBackend *backend,
|
||||
GtkBox *parent)
|
||||
{
|
||||
EMailConfigSmtpBackendPrivate *priv;
|
||||
CamelProvider *provider;
|
||||
CamelSettings *settings;
|
||||
ESource *source;
|
||||
ESourceBackend *extension;
|
||||
EMailConfigServicePage *page;
|
||||
EMailConfigServicePageClass *class;
|
||||
GtkLabel *label;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *container;
|
||||
const gchar *backend_name;
|
||||
const gchar *extension_name;
|
||||
const gchar *mechanism;
|
||||
const gchar *text;
|
||||
gchar *markup;
|
||||
|
||||
priv = E_MAIL_CONFIG_SMTP_BACKEND_GET_PRIVATE (backend);
|
||||
|
||||
page = e_mail_config_service_backend_get_page (backend);
|
||||
source = e_mail_config_service_backend_get_source (backend);
|
||||
settings = e_mail_config_service_backend_get_settings (backend);
|
||||
|
||||
class = E_MAIL_CONFIG_SERVICE_PAGE_GET_CLASS (page);
|
||||
extension_name = class->extension_name;
|
||||
extension = e_source_get_extension (source, extension_name);
|
||||
backend_name = e_source_backend_get_backend_name (extension);
|
||||
|
||||
text = _("Configuration");
|
||||
markup = g_markup_printf_escaped ("<b>%s</b>", text);
|
||||
widget = gtk_label_new (markup);
|
||||
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
g_free (markup);
|
||||
|
||||
widget = gtk_grid_new ();
|
||||
gtk_widget_set_margin_left (widget, 12);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
container = widget;
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (_("_Server:"));
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
widget = gtk_entry_new ();
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 1, 1);
|
||||
priv->host_entry = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (_("_Port:"));
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 2, 0, 1, 1);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
widget = e_port_entry_new ();
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 3, 0, 1, 1);
|
||||
priv->port_entry = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
text = _("Ser_ver requires authentication");
|
||||
widget = gtk_check_button_new_with_mnemonic (text);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 3, 1);
|
||||
priv->auth_required_toggle = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
text = _("Security");
|
||||
markup = g_markup_printf_escaped ("<b>%s</b>", text);
|
||||
widget = gtk_label_new (markup);
|
||||
gtk_widget_set_margin_top (widget, 6);
|
||||
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
g_free (markup);
|
||||
|
||||
widget = gtk_grid_new ();
|
||||
gtk_widget_set_margin_left (widget, 12);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
container = widget;
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (_("Encryption _method:"));
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
/* The IDs correspond to the CamelNetworkSecurityMethod enum. */
|
||||
widget = gtk_combo_box_text_new ();
|
||||
gtk_combo_box_text_append (
|
||||
GTK_COMBO_BOX_TEXT (widget),
|
||||
"none",
|
||||
_("No encryption"));
|
||||
gtk_combo_box_text_append (
|
||||
GTK_COMBO_BOX_TEXT (widget),
|
||||
"starttls-on-standard-port",
|
||||
_("STARTTLS after connecting"));
|
||||
gtk_combo_box_text_append (
|
||||
GTK_COMBO_BOX_TEXT (widget),
|
||||
"ssl-on-alternate-port",
|
||||
_("SSL on a dedicated port"));
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_START);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 1, 1);
|
||||
priv->security_combo_box = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
provider = camel_provider_get (backend_name, NULL);
|
||||
if (provider != NULL && provider->port_entries != NULL)
|
||||
e_port_entry_set_camel_entries (
|
||||
E_PORT_ENTRY (priv->port_entry),
|
||||
provider->port_entries);
|
||||
|
||||
text = _("Authentication");
|
||||
markup = g_markup_printf_escaped ("<b>%s</b>", text);
|
||||
widget = gtk_label_new (markup);
|
||||
gtk_widget_set_margin_top (widget, 6);
|
||||
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
g_free (markup);
|
||||
|
||||
g_object_bind_property (
|
||||
priv->auth_required_toggle, "active",
|
||||
widget, "sensitive",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
widget = gtk_grid_new ();
|
||||
gtk_widget_set_margin_left (widget, 12);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
|
||||
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
g_object_bind_property (
|
||||
priv->auth_required_toggle, "active",
|
||||
widget, "sensitive",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
container = widget;
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (_("T_ype:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 1);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
/* We can't bind GSettings:auth-mechanism directly to this
|
||||
* because the toggle button above influences the value we
|
||||
* choose: "none" if the toggle button is inactive or else
|
||||
* the active mechanism name from this widget. */
|
||||
widget = e_mail_config_auth_check_new (backend);
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 1, 1);
|
||||
priv->auth_check = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
widget = gtk_label_new_with_mnemonic (_("User_name:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 1, 1);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
label = GTK_LABEL (widget);
|
||||
|
||||
widget = gtk_entry_new ();
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_label_set_mnemonic_widget (label, widget);
|
||||
gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 2, 1);
|
||||
priv->user_entry = widget; /* do not reference */
|
||||
gtk_widget_show (widget);
|
||||
|
||||
g_object_bind_property (
|
||||
settings, "host",
|
||||
priv->host_entry, "text",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
g_object_bind_property_full (
|
||||
settings, "security-method",
|
||||
priv->security_combo_box, "active-id",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE,
|
||||
e_binding_transform_enum_value_to_nick,
|
||||
e_binding_transform_enum_nick_to_value,
|
||||
NULL, (GDestroyNotify) NULL);
|
||||
|
||||
g_object_bind_property (
|
||||
settings, "port",
|
||||
priv->port_entry, "port",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
g_object_bind_property (
|
||||
settings, "security-method",
|
||||
priv->port_entry, "security-method",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
g_object_bind_property (
|
||||
settings, "user",
|
||||
priv->user_entry, "text",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
/* Enable the auth-required toggle button if
|
||||
* we have an authentication mechanism name. */
|
||||
mechanism = camel_network_settings_get_auth_mechanism (
|
||||
CAMEL_NETWORK_SETTINGS (settings));
|
||||
gtk_toggle_button_set_active (
|
||||
GTK_TOGGLE_BUTTON (priv->auth_required_toggle),
|
||||
(mechanism != NULL && *mechanism != '\0'));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mail_config_smtp_backend_auto_configure (EMailConfigServiceBackend *backend,
|
||||
EMailAutoconfig *autoconfig)
|
||||
{
|
||||
ESource *source;
|
||||
|
||||
source = e_mail_config_service_backend_get_source (backend);
|
||||
|
||||
return e_mail_autoconfig_set_smtp_details (autoconfig, source);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mail_config_smtp_backend_check_complete (EMailConfigServiceBackend *backend)
|
||||
{
|
||||
EMailConfigSmtpBackendPrivate *priv;
|
||||
CamelSettings *settings;
|
||||
CamelNetworkSettings *network_settings;
|
||||
GtkToggleButton *toggle_button;
|
||||
EPortEntry *port_entry;
|
||||
const gchar *host;
|
||||
const gchar *user;
|
||||
|
||||
priv = E_MAIL_CONFIG_SMTP_BACKEND_GET_PRIVATE (backend);
|
||||
|
||||
settings = e_mail_config_service_backend_get_settings (backend);
|
||||
|
||||
network_settings = CAMEL_NETWORK_SETTINGS (settings);
|
||||
host = camel_network_settings_get_host (network_settings);
|
||||
user = camel_network_settings_get_user (network_settings);
|
||||
|
||||
if (host == NULL || *host == '\0')
|
||||
return FALSE;
|
||||
|
||||
port_entry = E_PORT_ENTRY (priv->port_entry);
|
||||
|
||||
if (!e_port_entry_is_valid (port_entry))
|
||||
return FALSE;
|
||||
|
||||
toggle_button = GTK_TOGGLE_BUTTON (priv->auth_required_toggle);
|
||||
|
||||
if (gtk_toggle_button_get_active (toggle_button))
|
||||
if (user == NULL || *user == '\0')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
mail_config_smtp_backend_commit_changes (EMailConfigServiceBackend *backend)
|
||||
{
|
||||
EMailConfigSmtpBackendPrivate *priv;
|
||||
GtkToggleButton *toggle_button;
|
||||
CamelSettings *settings;
|
||||
const gchar *mechanism = NULL;
|
||||
|
||||
/* The authentication mechanism name depends on both the
|
||||
* toggle button and the EMailConfigAuthCheck widget, so
|
||||
* we have to set it manually here. */
|
||||
|
||||
priv = E_MAIL_CONFIG_SMTP_BACKEND_GET_PRIVATE (backend);
|
||||
|
||||
settings = e_mail_config_service_backend_get_settings (backend);
|
||||
|
||||
toggle_button = GTK_TOGGLE_BUTTON (priv->auth_required_toggle);
|
||||
|
||||
if (gtk_toggle_button_get_active (toggle_button))
|
||||
mechanism = e_mail_config_auth_check_get_active_mechanism (
|
||||
E_MAIL_CONFIG_AUTH_CHECK (priv->auth_check));
|
||||
|
||||
camel_network_settings_set_auth_mechanism (
|
||||
CAMEL_NETWORK_SETTINGS (settings), mechanism);
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_smtp_backend_class_init (EMailConfigSmtpBackendClass *class)
|
||||
{
|
||||
EMailConfigServiceBackendClass *backend_class;
|
||||
|
||||
g_type_class_add_private (
|
||||
class, sizeof (EMailConfigSmtpBackendPrivate));
|
||||
|
||||
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
|
||||
backend_class->backend_name = "smtp";
|
||||
backend_class->insert_widgets = mail_config_smtp_backend_insert_widgets;
|
||||
backend_class->auto_configure = mail_config_smtp_backend_auto_configure;
|
||||
backend_class->check_complete = mail_config_smtp_backend_check_complete;
|
||||
backend_class->commit_changes = mail_config_smtp_backend_commit_changes;
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_smtp_backend_class_finalize (EMailConfigSmtpBackendClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
e_mail_config_smtp_backend_init (EMailConfigSmtpBackend *backend)
|
||||
{
|
||||
backend->priv = E_MAIL_CONFIG_SMTP_BACKEND_GET_PRIVATE (backend);
|
||||
}
|
||||
|
||||
void
|
||||
e_mail_config_smtp_backend_type_register (GTypeModule *type_module)
|
||||
{
|
||||
/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
|
||||
* function, so we have to wrap it with a public function in
|
||||
* order to register types from a separate compilation unit. */
|
||||
e_mail_config_smtp_backend_register_type (type_module);
|
||||
}
|
||||
|
||||
66
modules/mail-config/e-mail-config-smtp-backend.h
Normal file
66
modules/mail-config/e-mail-config-smtp-backend.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* e-mail-config-smtp-backend.h
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef E_MAIL_CONFIG_SMTP_BACKEND_H
|
||||
#define E_MAIL_CONFIG_SMTP_BACKEND_H
|
||||
|
||||
#include <mail/e-mail-config-service-backend.h>
|
||||
|
||||
/* Standard GObject macros */
|
||||
#define E_TYPE_MAIL_CONFIG_SMTP_BACKEND \
|
||||
(e_mail_config_smtp_backend_get_type ())
|
||||
#define E_MAIL_CONFIG_SMTP_BACKEND(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST \
|
||||
((obj), E_TYPE_MAIL_CONFIG_SMTP_BACKEND, EMailConfigSmtpBackend))
|
||||
#define E_MAIL_CONFIG_SMTP_BACKEND_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_CAST \
|
||||
((cls), E_TYPE_MAIL_CONFIG_SMTP_BACKEND, EMailConfigSmtpBackendClass))
|
||||
#define E_IS_MAIL_CONFIG_SMTP_BACKEND(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE \
|
||||
((obj), E_TYPE_MAIL_CONFIG_SMTP_BACKEND))
|
||||
#define E_IS_MAIL_CONFIG_SMTP_BACKEND_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE \
|
||||
((cls), E_TYPE_MAIL_CONFIG_SMTP_BACKEND))
|
||||
#define E_MAIL_CONFIG_SMTP_BACKEND_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS \
|
||||
((obj), E_TYPE_MAIL_CONFIG_SMTP_BACKEND, EMailConfigSmtpBackendClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _EMailConfigSmtpBackend EMailConfigSmtpBackend;
|
||||
typedef struct _EMailConfigSmtpBackendClass EMailConfigSmtpBackendClass;
|
||||
typedef struct _EMailConfigSmtpBackendPrivate EMailConfigSmtpBackendPrivate;
|
||||
|
||||
struct _EMailConfigSmtpBackend {
|
||||
EMailConfigServiceBackend parent;
|
||||
EMailConfigSmtpBackendPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EMailConfigSmtpBackendClass {
|
||||
EMailConfigServiceBackendClass parent_class;
|
||||
};
|
||||
|
||||
GType e_mail_config_smtp_backend_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
void e_mail_config_smtp_backend_type_register
|
||||
(GTypeModule *type_module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* E_MAIL_CONFIG_SMTP_BACKEND_H */
|
||||
|
||||
@ -253,7 +253,7 @@ mail_config_yahoo_summary_constructed (GObject *object)
|
||||
gtk_widget_show (widget);
|
||||
g_free (markup);
|
||||
|
||||
text = _("Add Yahoo! Ca_lendar to this account");
|
||||
text = _("Add Yahoo! Ca_lendar and Tasks to this account");
|
||||
widget = gtk_check_button_new_with_mnemonic (text);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
|
||||
gtk_widget_set_margin_left (widget, 12);
|
||||
|
||||
68
modules/mail-config/e-mail-config-yahoo-summary.h
Normal file
68
modules/mail-config/e-mail-config-yahoo-summary.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* e-mail-config-yahoo-summary.h
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef E_MAIL_CONFIG_YAHOO_SUMMARY_H
|
||||
#define E_MAIL_CONFIG_YAHOO_SUMMARY_H
|
||||
|
||||
#include <libebackend/e-extension.h>
|
||||
|
||||
/* Standard GObject macros */
|
||||
#define E_TYPE_MAIL_CONFIG_YAHOO_SUMMARY \
|
||||
(e_mail_config_yahoo_summary_get_type ())
|
||||
#define E_MAIL_CONFIG_YAHOO_SUMMARY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST \
|
||||
((obj), E_TYPE_MAIL_CONFIG_YAHOO_SUMMARY, EMailConfigYahooSummary))
|
||||
#define E_MAIL_CONFIG_YAHOO_SUMMARY_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_CAST \
|
||||
((cls), E_TYPE_MAIL_CONFIG_YAHOO_SUMMARY, EMailConfigYahooSummaryClass))
|
||||
#define E_IS_MAIL_CONFIG_YAHOO_SUMMARY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE \
|
||||
((obj), E_TYPE_MAIL_CONFIG_YAHOO_SUMMARY))
|
||||
#define E_IS_MAIL_CONFIG_YAHOO_SUMMARY_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE \
|
||||
((cls), E_TYPE_MAIL_CONFIG_YAHOO_SUMMARY))
|
||||
#define E_MAIL_CONFIG_YAHOO_SUMMARY_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS \
|
||||
((obj), E_TYPE_MAIL_CONFIG_YAHOO_SUMMARY, EMailConfigYahooSummaryClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _EMailConfigYahooSummary EMailConfigYahooSummary;
|
||||
typedef struct _EMailConfigYahooSummaryClass EMailConfigYahooSummaryClass;
|
||||
typedef struct _EMailConfigYahooSummaryPrivate EMailConfigYahooSummaryPrivate;
|
||||
|
||||
struct _EMailConfigYahooSummary {
|
||||
EExtension parent;
|
||||
EMailConfigYahooSummaryPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EMailConfigYahooSummaryClass {
|
||||
EExtensionClass parent_class;
|
||||
};
|
||||
|
||||
GType e_mail_config_yahoo_summary_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
void e_mail_config_yahoo_summary_type_register
|
||||
(GTypeModule *type_module);
|
||||
gboolean e_mail_config_yahoo_summary_get_applicable
|
||||
(EMailConfigYahooSummary *extension);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* E_MAIL_CONFIG_YAHOO_SUMMARY_H */
|
||||
|
||||
51
modules/mail-config/evolution-mail-config.c
Normal file
51
modules/mail-config/evolution-mail-config.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* evolution-mail-config.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gmodule.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "e-mail-config-sendmail-backend.h"
|
||||
#include "e-mail-config-smtp-backend.h"
|
||||
|
||||
#include "e-mail-config-google-summary.h"
|
||||
#include "e-mail-config-yahoo-summary.h"
|
||||
|
||||
/* Module Entry Points */
|
||||
void e_module_load (GTypeModule *type_module);
|
||||
void e_module_unload (GTypeModule *type_module);
|
||||
|
||||
void e_mail_config_local_accounts_register_types (GTypeModule *type_module);
|
||||
void e_mail_config_remote_accounts_register_types (GTypeModule *type_module);
|
||||
void e_mail_config_transports_register_types (GTypeModule *type_module);
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
e_module_load (GTypeModule *type_module)
|
||||
{
|
||||
e_mail_config_local_accounts_register_types (type_module);
|
||||
e_mail_config_remote_accounts_register_types (type_module);
|
||||
e_mail_config_sendmail_backend_type_register (type_module);
|
||||
e_mail_config_smtp_backend_type_register (type_module);
|
||||
|
||||
e_mail_config_google_summary_type_register (type_module);
|
||||
e_mail_config_yahoo_summary_type_register (type_module);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
e_module_unload (GTypeModule *type_module)
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user