diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-03-28 03:16:39 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:50 +0800 |
commit | 392973975c3e4a4e8fe17731b5e397ae10a91517 (patch) | |
tree | 40d5e138d9d116af9da0fbc58b304b2e4ffad774 /mail | |
parent | 6e996d8023dc195cb07290a729d7d8a3ccb76e65 (diff) | |
download | gsoc2013-evolution-392973975c3e4a4e8fe17731b5e397ae10a91517.tar.gz gsoc2013-evolution-392973975c3e4a4e8fe17731b5e397ae10a91517.tar.zst gsoc2013-evolution-392973975c3e4a4e8fe17731b5e397ae10a91517.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')
-rw-r--r-- | mail/e-mail-reader.c | 68 | ||||
-rw-r--r-- | mail/mail-config.c | 8 |
2 files changed, 41 insertions, 35 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"; diff --git a/mail/mail-config.c b/mail/mail-config.c index d1f87b9dd6..ac5d078ebf 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -52,7 +52,6 @@ typedef struct { gboolean jh_check; gboolean book_lookup; gboolean book_lookup_local_only; - gboolean scripts_disabled; } MailConfig; extern gint camel_header_param_encode_filenames_in_rfc_2047; @@ -496,13 +495,6 @@ mail_config_init (EMailSession *session) config->book_lookup_local_only = gconf_client_get_bool (client, key, NULL); - key = "/desktop/gnome/lockdown/disable_command_line"; - func = (GConfClientNotifyFunc) gconf_bool_value_changed; - gconf_client_notify_add ( - client, key, func, - &config->scripts_disabled, NULL, NULL); - config->scripts_disabled = gconf_client_get_bool (client, key, NULL); - gconf_jh_check_changed (client, 0, NULL, session); folder_cache = e_mail_session_get_folder_cache (session); |