aboutsummaryrefslogtreecommitdiffstats
path: root/modules/settings/e-settings-deprecated.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-06-05 00:03:24 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-06-05 01:10:02 +0800
commit5794c63f4ff48ad4abc677954fcd5e9bb578aacc (patch)
tree8fd8dcd8e6060085efa099bedf8ca0b1405f3cdd /modules/settings/e-settings-deprecated.c
parent046816123764f86f1b258195292abcdb7951fca3 (diff)
downloadgsoc2013-evolution-5794c63f4ff48ad4abc677954fcd5e9bb578aacc.tar
gsoc2013-evolution-5794c63f4ff48ad4abc677954fcd5e9bb578aacc.tar.gz
gsoc2013-evolution-5794c63f4ff48ad4abc677954fcd5e9bb578aacc.tar.bz2
gsoc2013-evolution-5794c63f4ff48ad4abc677954fcd5e9bb578aacc.tar.lz
gsoc2013-evolution-5794c63f4ff48ad4abc677954fcd5e9bb578aacc.tar.xz
gsoc2013-evolution-5794c63f4ff48ad4abc677954fcd5e9bb578aacc.tar.zst
gsoc2013-evolution-5794c63f4ff48ad4abc677954fcd5e9bb578aacc.zip
EMailBrowser: Add "close-on-reply-policy" property.
Mainly to avoid accessing GSettings directly from EMailBrowser. Also add a "browser-close-on-reply-policy" GSettings key that replaces "prompt-on-reply-close-browser", the difference being the new key uses an enum definition compatible with EAutomaticActionPolicy instead of a free-form string value. And finally add an ESettingsMailBrowser class to glue things together.
Diffstat (limited to 'modules/settings/e-settings-deprecated.c')
-rw-r--r--modules/settings/e-settings-deprecated.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/settings/e-settings-deprecated.c b/modules/settings/e-settings-deprecated.c
index b42952f67c..73f8b741ad 100644
--- a/modules/settings/e-settings-deprecated.c
+++ b/modules/settings/e-settings-deprecated.c
@@ -42,6 +42,7 @@ struct _ESettingsDeprecatedPrivate {
gulong work_day_sunday_handler_id;
GSettings *mail_settings;
+ gulong browser_close_on_reply_policy_handler_id;
gulong forward_style_name_handler_id;
gulong reply_style_name_handler_id;
gulong image_loading_policy_handler_id;
@@ -174,6 +175,28 @@ settings_deprecated_work_day_sunday_cb (GSettings *settings,
}
static void
+settings_deprecated_browser_close_on_reply_policy_cb (GSettings *settings,
+ const gchar *key)
+{
+ const gchar *deprecated_key = "prompt-on-reply-close-browser";
+
+ switch (g_settings_get_enum (settings, key)) {
+ case E_AUTOMATIC_ACTION_POLICY_ALWAYS:
+ g_settings_set_string (
+ settings, deprecated_key, "always");
+ break;
+ case E_AUTOMATIC_ACTION_POLICY_NEVER:
+ g_settings_set_string (
+ settings, deprecated_key, "never");
+ break;
+ default:
+ g_settings_set_string (
+ settings, deprecated_key, "ask");
+ break;
+ }
+}
+
+static void
settings_deprecated_forward_style_name_cb (GSettings *settings,
const gchar *key)
{
@@ -280,6 +303,13 @@ settings_deprecated_dispose (GObject *object)
priv->work_day_sunday_handler_id = 0;
}
+ if (priv->browser_close_on_reply_policy_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->mail_settings,
+ priv->browser_close_on_reply_policy_handler_id);
+ priv->browser_close_on_reply_policy_handler_id = 0;
+ }
+
if (priv->forward_style_name_handler_id > 0) {
g_signal_handler_disconnect (
priv->mail_settings,
@@ -313,6 +343,7 @@ settings_deprecated_constructed (GObject *object)
{
ESettingsDeprecatedPrivate *priv;
gulong handler_id;
+ gchar *string_value;
gint int_value;
priv = E_SETTINGS_DEPRECATED_GET_PRIVATE (object);
@@ -353,6 +384,26 @@ settings_deprecated_constructed (GObject *object)
priv->calendar_settings, "work-day-sunday",
(int_value & DEPRECATED_WORKING_DAYS_SUNDAY) != 0);
+ string_value = g_settings_get_string (
+ priv->mail_settings, "prompt-on-reply-close-browser");
+ if (g_strcmp0 (string_value, "always") == 0) {
+ g_settings_set_enum (
+ priv->mail_settings,
+ "browser-close-on-reply-policy",
+ E_AUTOMATIC_ACTION_POLICY_ALWAYS);
+ } else if (g_strcmp0 (string_value, "never") == 0) {
+ g_settings_set_enum (
+ priv->mail_settings,
+ "browser-close-on-reply-policy",
+ E_AUTOMATIC_ACTION_POLICY_NEVER);
+ } else {
+ g_settings_set_enum (
+ priv->mail_settings,
+ "browser-close-on-reply-policy",
+ E_AUTOMATIC_ACTION_POLICY_ASK);
+ }
+ g_free (string_value);
+
int_value = g_settings_get_int (
priv->mail_settings, "forward-style");
g_settings_set_enum (
@@ -438,6 +489,11 @@ settings_deprecated_constructed (GObject *object)
priv->work_day_sunday_handler_id = handler_id;
handler_id = g_signal_connect (
+ priv->mail_settings, "changed::browser-close-on-reply-policy",
+ G_CALLBACK (settings_deprecated_browser_close_on_reply_policy_cb), NULL);
+ priv->browser_close_on_reply_policy_handler_id = handler_id;
+
+ handler_id = g_signal_connect (
priv->mail_settings, "changed::forward-style-name",
G_CALLBACK (settings_deprecated_forward_style_name_cb), NULL);
priv->forward_style_name_handler_id = handler_id;