aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-reader.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-03-28 03:16:39 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-03-28 06:38:39 +0800
commitba6a2343869f6be82f44261f183cd6925659d5ee (patch)
treef7356964d4780d8889c439f9c8271c7d71315ab3 /mail/e-mail-reader.c
parentf35931919049a645681207856c384d70a749020c (diff)
downloadgsoc2013-evolution-ba6a2343869f6be82f44261f183cd6925659d5ee.tar.gz
gsoc2013-evolution-ba6a2343869f6be82f44261f183cd6925659d5ee.tar.zst
gsoc2013-evolution-ba6a2343869f6be82f44261f183cd6925659d5ee.zip
Restore lockdown integration.
With lockdown settings available through GSettings, widgets can handle lockdown integration themselves without having to use EShellSettings. Also fixed a few places where printing or save-to-disk actions were either not properly wired up or not responding to lockdown settings, but much more work needs done. Attachments, for example, are not honoring the disable-save-to-disk setting at all. This too requires the recently-added gsettings-desktop-schemas dependency.
Diffstat (limited to 'mail/e-mail-reader.c')
-rw-r--r--mail/e-mail-reader.c68
1 files changed, 41 insertions, 27 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 79439d3f08..9da57fba0f 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2962,19 +2962,12 @@ static void
mail_reader_update_actions (EMailReader *reader,
guint32 state)
{
-#if 0
- EShell *shell;
- EMailBackend *backend;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
-#endif
GtkAction *action;
const gchar *action_name;
gboolean sensitive;
/* Be descriptive. */
gboolean any_messages_selected;
- gboolean disable_printing;
gboolean enable_flag_clear;
gboolean enable_flag_completed;
gboolean enable_flag_for_followup;
@@ -2994,24 +2987,6 @@ mail_reader_update_actions (EMailReader *reader,
gboolean first_message_selected = FALSE;
gboolean last_message_selected = FALSE;
-#if 0 /* XXX Lockdown keys have moved to gsettings-desktop-schemas,
- * so disable lockdown integration until we're ready for
- * GSettings. */
- backend = e_mail_reader_get_backend (reader);
-
- shell_backend = E_SHELL_BACKEND (backend);
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
-
-#ifndef G_OS_WIN32
- disable_printing = e_shell_settings_get_boolean (
- shell_settings, "disable-printing");
-#else
- disable_printing = FALSE;
-#endif
-#endif
- disable_printing = FALSE;
-
have_enabled_account =
(state & E_MAIL_READER_HAVE_ENABLED_ACCOUNT);
single_message_selected =
@@ -3295,12 +3270,12 @@ mail_reader_update_actions (EMailReader *reader,
gtk_action_set_sensitive (action, sensitive);
action_name = "mail-print";
- sensitive = single_message_selected && !disable_printing;
+ sensitive = single_message_selected;
action = e_mail_reader_get_action (reader, action_name);
gtk_action_set_sensitive (action, sensitive);
action_name = "mail-print-preview";
- sensitive = single_message_selected && !disable_printing;
+ sensitive = single_message_selected;
action = e_mail_reader_get_action (reader, action_name);
gtk_action_set_sensitive (action, sensitive);
@@ -3546,6 +3521,10 @@ e_mail_reader_init (EMailReader *reader,
const gchar *action_name;
const gchar *key;
+#ifndef G_OS_WIN32
+ GSettings *settings;
+#endif
+
g_return_if_fail (E_IS_MAIL_READER (reader));
formatter = e_mail_reader_get_formatter (reader);
@@ -3695,6 +3674,41 @@ e_mail_reader_init (EMailReader *reader,
action, "activate",
G_CALLBACK (action_search_folder_sender_cb), reader);
+#ifndef G_OS_WIN32
+ /* Lockdown integration. */
+
+ settings = g_settings_new ("org.gnome.desktop.lockdown");
+
+ action_name = "mail-print";
+ action = e_mail_reader_get_action (reader, action_name);
+ g_settings_bind (
+ settings, "disable-printing",
+ action, "visible",
+ G_SETTINGS_BIND_GET |
+ G_SETTINGS_BIND_NO_SENSITIVITY |
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
+
+ action_name = "mail-print-preview";
+ action = e_mail_reader_get_action (reader, action_name);
+ g_settings_bind (
+ settings, "disable-printing",
+ action, "visible",
+ G_SETTINGS_BIND_GET |
+ G_SETTINGS_BIND_NO_SENSITIVITY |
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
+
+ action_name = "mail-save-as";
+ action = e_mail_reader_get_action (reader, action_name);
+ g_settings_bind (
+ settings, "disable-save-to-disk",
+ action, "visible",
+ G_SETTINGS_BIND_GET |
+ G_SETTINGS_BIND_NO_SENSITIVITY |
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
+
+ g_object_unref (settings);
+#endif
+
/* Bind properties. */
action_name = "mail-caret-mode";