evolution-3.6.4/modules/imap-features/evolution-imap-features.c

No issues found

  1 /*
  2  * evolution-imap-features.c
  3  *
  4  * This program is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2 of the License, or (at your option) version 3.
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with the program; if not, see <http://www.gnu.org/licenses/>
 16  *
 17  */
 18 
 19 #include <config.h>
 20 #include <glib/gi18n-lib.h>
 21 
 22 #include <libebackend/libebackend.h>
 23 
 24 #include <mail/e-mail-config-notebook.h>
 25 
 26 #include "e-mail-config-header-manager.h"
 27 #include "e-mail-config-imap-headers-page.h"
 28 
 29 typedef EExtension EvolutionImapFeatures;
 30 typedef EExtensionClass EvolutionImapFeaturesClass;
 31 
 32 /* Module Entry Points */
 33 void e_module_load (GTypeModule *type_module);
 34 void e_module_unload (GTypeModule *type_module);
 35 
 36 /* Forward Declarations */
 37 GType evolution_imap_features_get_type (void);
 38 
 39 G_DEFINE_DYNAMIC_TYPE (
 40 	EvolutionImapFeatures,
 41 	evolution_imap_features,
 42 	E_TYPE_EXTENSION)
 43 
 44 static void
 45 evolution_imap_features_constructed (GObject *object)
 46 {
 47 	EExtension *extension;
 48 	EExtensible *extensible;
 49 	ESource *source;
 50 	ESourceBackend *backend_ext;
 51 	EMailConfigNotebook *notebook;
 52 	const gchar *backend_name;
 53 	const gchar *extension_name;
 54 	gboolean add_page = FALSE;
 55 
 56 	extension = E_EXTENSION (object);
 57 	extensible = e_extension_get_extensible (extension);
 58 
 59 	/* Chain up to parent's constructed() method. */
 60 	G_OBJECT_CLASS (evolution_imap_features_parent_class)->
 61 		constructed (object);
 62 
 63 	notebook = E_MAIL_CONFIG_NOTEBOOK (extensible);
 64 	source = e_mail_config_notebook_get_account_source (notebook);
 65 
 66 	extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
 67 	backend_ext = e_source_get_extension (source, extension_name);
 68 	backend_name = e_source_backend_get_backend_name (backend_ext);
 69 
 70 	if (g_strcmp0 (backend_name, "imap") == 0)
 71 		add_page = TRUE;
 72 
 73 	if (add_page) {
 74 		EMailConfigPage *page;
 75 		page = e_mail_config_imap_headers_page_new (source);
 76 		e_mail_config_notebook_add_page (notebook, page);
 77 	}
 78 }
 79 
 80 static void
 81 evolution_imap_features_class_init (EvolutionImapFeaturesClass *class)
 82 {
 83 	GObjectClass *object_class;
 84 	EExtensionClass *extension_class;
 85 
 86 	object_class = G_OBJECT_CLASS (class);
 87 	object_class->constructed = evolution_imap_features_constructed;
 88 
 89 	extension_class = E_EXTENSION_CLASS (class);
 90 	extension_class->extensible_type = E_TYPE_MAIL_CONFIG_NOTEBOOK;
 91 }
 92 
 93 static void
 94 evolution_imap_features_class_finalize (EvolutionImapFeaturesClass *class)
 95 {
 96 }
 97 
 98 static void
 99 evolution_imap_features_init (EvolutionImapFeatures *extension)
100 {
101 }
102 
103 G_MODULE_EXPORT void
104 e_module_load (GTypeModule *type_module)
105 {
106 	evolution_imap_features_register_type (type_module);
107 	e_mail_config_header_manager_type_register (type_module);
108 	e_mail_config_imap_headers_page_type_register (type_module);
109 }
110 
111 G_MODULE_EXPORT void
112 e_module_unload (GTypeModule *type_module)
113 {
114 }