aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/em-composer-prefs.c9
-rw-r--r--mail/mail-config.c24
-rw-r--r--mail/mail-config.h2
4 files changed, 47 insertions, 3 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 54d0d54365..b227cff207 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,18 @@
+2008-05-26 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #322553
+
+ * mail-config.h: (mail_config_scripts_disabled):
+ * mail-config.c: (struct MailConfig), (mail_config_init),
+ (mail_config_scripts_disabled): New helper function.
+ * em-composer-prefs.c: (sig_load_preview):
+ Write to html stream at least one character.
+ * em-composer-prefs.c: (em_composer_prefs_construct): Disable
+ signature's Add Script button when not approved running scripts.
+ * mail-config.c: (mail_config_get_gconf_client): Ensure init.
+ * mail-config.c: (mail_config_signature_run_script): Do not run
+ script when disabled in /desktop/gnome/lockdown/disable_command_line.
+
2008-05-23 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #534476
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c
index dc7b3b9c4c..41975589ef 100644
--- a/mail/em-composer-prefs.c
+++ b/mail/em-composer-prefs.c
@@ -168,8 +168,11 @@ sig_load_preview (EMComposerPrefs *prefs,
else
str = e_msg_composer_get_sig_file_content (
signature->filename, signature->html);
- if (!str)
- str = g_strdup ("");
+ if (!str || !*str) {
+ /* make html stream happy and write at least one character */
+ g_free (str);
+ str = g_strdup (" ");
+ }
if (signature->html) {
gtk_html_load_from_string (html, str, strlen (str));
@@ -1045,7 +1048,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
prefs->sig_add = GTK_BUTTON (widget);
widget = glade_xml_get_widget (gui, "cmdSignatureAddScript");
- gtk_widget_set_sensitive (widget, sensitive);
+ gtk_widget_set_sensitive (widget, sensitive && !mail_config_scripts_disabled ());
g_signal_connect (
widget, "clicked",
G_CALLBACK (sig_add_script_cb), prefs);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 43a0e8b65b..f966fff0f3 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -103,6 +103,7 @@ typedef struct {
gboolean jh_check;
gboolean book_lookup;
gboolean book_lookup_local_only;
+ gboolean scripts_disabled;
} MailConfig;
static MailConfig *config = NULL;
@@ -507,6 +508,14 @@ mail_config_init (void)
config->book_lookup_local_only =
gconf_client_get_bool (config->gconf, key, NULL);
+ key = "/desktop/gnome/lockdown/disable_command_line";
+ func = (GConfClientNotifyFunc) gconf_bool_value_changed;
+ gconf_client_notify_add (
+ config->gconf, key, func,
+ &config->scripts_disabled, NULL, NULL);
+ config->scripts_disabled =
+ gconf_client_get_bool (config->gconf, key, NULL);
+
gconf_jh_check_changed (config->gconf, 0, NULL, config);
}
@@ -616,6 +625,9 @@ mail_config_write_on_exit (void)
GConfClient *
mail_config_get_gconf_client (void)
{
+ if (!config)
+ mail_config_init ();
+
return config->gconf;
}
@@ -1186,6 +1198,15 @@ mail_config_get_lookup_book_local_only (void)
return config->book_lookup_local_only;
}
+gboolean
+mail_config_scripts_disabled (void)
+{
+ if (config == NULL)
+ mail_config_init ();
+
+ return config->scripts_disabled;
+}
+
char *
mail_config_signature_run_script (const char *script)
{
@@ -1194,6 +1215,9 @@ mail_config_signature_run_script (const char *script)
int in_fds[2];
pid_t pid;
+ if (mail_config_scripts_disabled ())
+ return NULL;
+
if (pipe (in_fds) == -1) {
g_warning ("Failed to create pipe to '%s': %s", script, g_strerror (errno));
return NULL;
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 54950a5ebf..eaf9b7bd87 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -158,6 +158,8 @@ void mail_config_reload_junk_headers (void);
gboolean mail_config_get_lookup_book (void);
gboolean mail_config_get_lookup_book_local_only (void);
+gboolean mail_config_scripts_disabled (void);
+
GType evolution_mail_config_get_type (void);
gboolean evolution_mail_config_factory_init (void);