2 * e-settings-mail-reader.c
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #include "evolution-config.h"
20 #include "e-settings-mail-reader.h"
22 #include <shell/e-shell.h>
23 #include <mail/e-mail-reader.h>
25 #define E_SETTINGS_MAIL_READER_GET_PRIVATE(obj) \
26 (G_TYPE_INSTANCE_GET_PRIVATE \
27 ((obj), E_TYPE_SETTINGS_MAIL_READER, ESettingsMailReaderPrivate))
29 struct _ESettingsMailReaderPrivate
{
33 G_DEFINE_DYNAMIC_TYPE (
35 e_settings_mail_reader
,
39 settings_mail_reader_idle_cb (EExtension
*extension
)
41 EExtensible
*extensible
;
42 GtkActionGroup
*action_group
;
43 ESourceRegistry
*registry
;
48 extensible
= e_extension_get_extensible (extension
);
52 settings
= e_util_ref_settings ("org.gnome.evolution.mail");
55 settings
, "forward-style-name",
56 extensible
, "forward-style",
60 settings
, "reply-style-name",
61 extensible
, "reply-style",
65 settings
, "mark-seen-always",
66 extensible
, "mark-seen-always",
70 settings
, "delete-selects-previous",
71 extensible
, "delete-selects-previous",
74 g_object_unref (settings
);
76 action_group
= e_mail_reader_get_action_group (
77 E_MAIL_READER (extensible
),
78 E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS
);
80 shell
= e_shell_get_default ();
81 registry
= e_shell_get_registry (shell
);
83 source
= e_source_registry_ref_source (registry
, "vfolder");
85 e_binding_bind_property (
87 action_group
, "visible",
88 G_BINDING_SYNC_CREATE
);
90 g_object_unref (source
);
96 settings_mail_reader_constructed (GObject
*object
)
98 /* Bind properties to settings from an idle callback so the
99 * EMailReader interface has a chance to be initialized first.
100 * Prioritize ahead of GTK+ redraws. */
102 G_PRIORITY_HIGH_IDLE
,
103 (GSourceFunc
) settings_mail_reader_idle_cb
,
104 g_object_ref (object
),
105 (GDestroyNotify
) g_object_unref
);
107 /* Chain up to parent's constructed() method. */
108 G_OBJECT_CLASS (e_settings_mail_reader_parent_class
)->constructed (object
);
112 e_settings_mail_reader_class_init (ESettingsMailReaderClass
*class)
114 GObjectClass
*object_class
;
115 EExtensionClass
*extension_class
;
117 g_type_class_add_private (class, sizeof (ESettingsMailReaderPrivate
));
119 object_class
= G_OBJECT_CLASS (class);
120 object_class
->constructed
= settings_mail_reader_constructed
;
122 extension_class
= E_EXTENSION_CLASS (class);
123 extension_class
->extensible_type
= E_TYPE_MAIL_READER
;
127 e_settings_mail_reader_class_finalize (ESettingsMailReaderClass
*class)
132 e_settings_mail_reader_init (ESettingsMailReader
*extension
)
134 extension
->priv
= E_SETTINGS_MAIL_READER_GET_PRIVATE (extension
);
138 e_settings_mail_reader_type_register (GTypeModule
*type_module
)
140 /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
141 * function, so we have to wrap it with a public function in
142 * order to register types from a separate compilation unit. */
143 e_settings_mail_reader_register_type (type_module
);