aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
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 /widgets/misc
parentf35931919049a645681207856c384d70a749020c (diff)
downloadgsoc2013-evolution-ba6a2343869f6be82f44261f183cd6925659d5ee.tar
gsoc2013-evolution-ba6a2343869f6be82f44261f183cd6925659d5ee.tar.gz
gsoc2013-evolution-ba6a2343869f6be82f44261f183cd6925659d5ee.tar.bz2
gsoc2013-evolution-ba6a2343869f6be82f44261f183cd6925659d5ee.tar.lz
gsoc2013-evolution-ba6a2343869f6be82f44261f183cd6925659d5ee.tar.xz
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 'widgets/misc')
-rw-r--r--widgets/misc/e-signature-manager.c62
-rw-r--r--widgets/misc/e-signature-manager.h6
-rw-r--r--widgets/misc/e-signature-preview.c60
-rw-r--r--widgets/misc/e-signature-preview.h6
-rw-r--r--widgets/misc/e-web-view.c26
5 files changed, 116 insertions, 44 deletions
diff --git a/widgets/misc/e-signature-manager.c b/widgets/misc/e-signature-manager.c
index 3da2312cec..8c210300ea 100644
--- a/widgets/misc/e-signature-manager.c
+++ b/widgets/misc/e-signature-manager.c
@@ -36,13 +36,13 @@ struct _ESignatureManagerPrivate {
GtkWidget *edit_button;
GtkWidget *remove_button;
- guint allow_scripts : 1;
- guint prefer_html : 1;
+ guint disable_command_line : 1;
+ guint prefer_html : 1;
};
enum {
PROP_0,
- PROP_ALLOW_SCRIPTS,
+ PROP_DISABLE_COMMAND_LINE,
PROP_PREFER_HTML,
PROP_SIGNATURE_LIST
};
@@ -171,8 +171,8 @@ signature_manager_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_ALLOW_SCRIPTS:
- e_signature_manager_set_allow_scripts (
+ case PROP_DISABLE_COMMAND_LINE:
+ e_signature_manager_set_disable_command_line (
E_SIGNATURE_MANAGER (object),
g_value_get_boolean (value));
return;
@@ -200,10 +200,10 @@ signature_manager_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_ALLOW_SCRIPTS:
+ case PROP_DISABLE_COMMAND_LINE:
g_value_set_boolean (
value,
- e_signature_manager_get_allow_scripts (
+ e_signature_manager_get_disable_command_line (
E_SIGNATURE_MANAGER (object)));
return;
@@ -267,6 +267,26 @@ signature_manager_dispose (GObject *object)
}
static void
+signature_manager_constructed (GObject *object)
+{
+#ifndef G_OS_WIN32
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.desktop.lockdown");
+
+ g_settings_bind (
+ settings, "disable-command-line",
+ object, "disable-command-line",
+ G_SETTINGS_BIND_GET);
+
+ g_object_unref (settings);
+#endif
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_signature_manager_parent_class)->constructed (object);
+}
+
+static void
signature_manager_add_signature (ESignatureManager *manager)
{
ESignatureTreeView *tree_view;
@@ -407,6 +427,7 @@ e_signature_manager_class_init (ESignatureManagerClass *class)
object_class->set_property = signature_manager_set_property;
object_class->get_property = signature_manager_get_property;
object_class->dispose = signature_manager_dispose;
+ object_class->constructed = signature_manager_constructed;
class->add_signature = signature_manager_add_signature;
class->add_signature_script = signature_manager_add_signature_script;
@@ -416,12 +437,12 @@ e_signature_manager_class_init (ESignatureManagerClass *class)
g_object_class_install_property (
object_class,
- PROP_ALLOW_SCRIPTS,
+ PROP_DISABLE_COMMAND_LINE,
g_param_spec_boolean (
- "allow-scripts",
- "Allow Scripts",
+ "disable-command-line",
+ "Disable Command Line",
NULL,
- TRUE,
+ FALSE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
@@ -583,9 +604,10 @@ e_signature_manager_init (ESignatureManager *manager)
gtk_widget_show (widget);
g_object_bind_property (
- manager, "allow-scripts",
- widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ manager, "disable-command-line",
+ widget, "visible",
+ G_BINDING_SYNC_CREATE |
+ G_BINDING_INVERT_BOOLEAN);
g_signal_connect_swapped (
widget, "clicked",
@@ -656,22 +678,22 @@ e_signature_manager_remove_signature (ESignatureManager *manager)
}
gboolean
-e_signature_manager_get_allow_scripts (ESignatureManager *manager)
+e_signature_manager_get_disable_command_line (ESignatureManager *manager)
{
g_return_val_if_fail (E_IS_SIGNATURE_MANAGER (manager), FALSE);
- return manager->priv->allow_scripts;
+ return manager->priv->disable_command_line;
}
void
-e_signature_manager_set_allow_scripts (ESignatureManager *manager,
- gboolean allow_scripts)
+e_signature_manager_set_disable_command_line (ESignatureManager *manager,
+ gboolean disable_command_line)
{
g_return_if_fail (E_IS_SIGNATURE_MANAGER (manager));
- manager->priv->allow_scripts = allow_scripts;
+ manager->priv->disable_command_line = disable_command_line;
- g_object_notify (G_OBJECT (manager), "allow-scripts");
+ g_object_notify (G_OBJECT (manager), "disable-command-line");
}
gboolean
diff --git a/widgets/misc/e-signature-manager.h b/widgets/misc/e-signature-manager.h
index 662836e4ef..88ee391564 100644
--- a/widgets/misc/e-signature-manager.h
+++ b/widgets/misc/e-signature-manager.h
@@ -78,11 +78,11 @@ void e_signature_manager_edit_signature
(ESignatureManager *manager);
void e_signature_manager_remove_signature
(ESignatureManager *manager);
-gboolean e_signature_manager_get_allow_scripts
+gboolean e_signature_manager_get_disable_command_line
(ESignatureManager *manager);
-void e_signature_manager_set_allow_scripts
+void e_signature_manager_set_disable_command_line
(ESignatureManager *manager,
- gboolean allow_scripts);
+ gboolean disable_command_line);
gboolean e_signature_manager_get_prefer_html
(ESignatureManager *manager);
void e_signature_manager_set_prefer_html
diff --git a/widgets/misc/e-signature-preview.c b/widgets/misc/e-signature-preview.c
index 2ccb14bbaa..c48c929bea 100644
--- a/widgets/misc/e-signature-preview.c
+++ b/widgets/misc/e-signature-preview.c
@@ -29,7 +29,7 @@
enum {
PROP_0,
- PROP_ALLOW_SCRIPTS,
+ PROP_DISABLE_COMMAND_LINE,
PROP_SIGNATURE
};
@@ -40,7 +40,7 @@ enum {
struct _ESignaturePreviewPrivate {
ESignature *signature;
- guint allow_scripts : 1;
+ guint disable_command_line : 1;
};
static guint signals[LAST_SIGNAL];
@@ -57,8 +57,8 @@ signature_preview_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_ALLOW_SCRIPTS:
- e_signature_preview_set_allow_scripts (
+ case PROP_DISABLE_COMMAND_LINE:
+ e_signature_preview_set_disable_command_line (
E_SIGNATURE_PREVIEW (object),
g_value_get_boolean (value));
return;
@@ -80,15 +80,17 @@ signature_preview_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_ALLOW_SCRIPTS:
+ case PROP_DISABLE_COMMAND_LINE:
g_value_set_boolean (
- value, e_signature_preview_get_allow_scripts (
+ value,
+ e_signature_preview_get_disable_command_line (
E_SIGNATURE_PREVIEW (object)));
return;
case PROP_SIGNATURE:
g_value_set_object (
- value, e_signature_preview_get_signature (
+ value,
+ e_signature_preview_get_signature (
E_SIGNATURE_PREVIEW (object)));
return;
}
@@ -113,6 +115,26 @@ signature_preview_dispose (GObject *object)
}
static void
+signature_preview_constructed (GObject *object)
+{
+#ifndef G_OS_WIN32
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.desktop.lockdown");
+
+ g_settings_bind (
+ settings, "disable-command-line",
+ object, "disable-command-line",
+ G_SETTINGS_BIND_GET);
+
+ g_object_unref (settings);
+#endif
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_signature_preview_parent_class)->constructed (object);
+}
+
+static void
signature_preview_refresh (ESignaturePreview *preview)
{
EWebView *web_view;
@@ -132,7 +154,7 @@ signature_preview_refresh (ESignaturePreview *preview)
filename = e_signature_get_filename (signature);
is_script = e_signature_get_is_script (signature);
- if (is_script && !preview->priv->allow_scripts)
+ if (is_script && preview->priv->disable_command_line)
goto clear;
if (is_script)
@@ -174,17 +196,18 @@ e_signature_preview_class_init (ESignaturePreviewClass *class)
object_class->set_property = signature_preview_set_property;
object_class->get_property = signature_preview_get_property;
object_class->dispose = signature_preview_dispose;
+ object_class->constructed = signature_preview_constructed;
class->refresh = signature_preview_refresh;
g_object_class_install_property (
object_class,
- PROP_ALLOW_SCRIPTS,
+ PROP_DISABLE_COMMAND_LINE,
g_param_spec_boolean (
- "allow-scripts",
- "Allow Scripts",
+ "disable-command-line",
+ "Disable Command Line",
NULL,
- TRUE,
+ FALSE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
@@ -230,21 +253,22 @@ e_signature_preview_refresh (ESignaturePreview *preview)
}
gboolean
-e_signature_preview_get_allow_scripts (ESignaturePreview *preview)
+e_signature_preview_get_disable_command_line (ESignaturePreview *preview)
{
g_return_val_if_fail (E_IS_SIGNATURE_PREVIEW (preview), FALSE);
- return preview->priv->allow_scripts;
+ return preview->priv->disable_command_line;
}
void
-e_signature_preview_set_allow_scripts (ESignaturePreview *preview,
- gboolean allow_scripts)
+e_signature_preview_set_disable_command_line (ESignaturePreview *preview,
+ gboolean disable_command_line)
{
g_return_if_fail (E_IS_SIGNATURE_PREVIEW (preview));
- preview->priv->allow_scripts = allow_scripts;
- g_object_notify (G_OBJECT (preview), "allow-scripts");
+ preview->priv->disable_command_line = disable_command_line;
+
+ g_object_notify (G_OBJECT (preview), "disable-command-line");
}
ESignature *
diff --git a/widgets/misc/e-signature-preview.h b/widgets/misc/e-signature-preview.h
index d0d5c22eff..1a884b8563 100644
--- a/widgets/misc/e-signature-preview.h
+++ b/widgets/misc/e-signature-preview.h
@@ -65,11 +65,11 @@ struct _ESignaturePreviewClass {
GType e_signature_preview_get_type (void);
GtkWidget * e_signature_preview_new (void);
void e_signature_preview_refresh (ESignaturePreview *preview);
-gboolean e_signature_preview_get_allow_scripts
+gboolean e_signature_preview_get_disable_command_line
(ESignaturePreview *preview);
-void e_signature_preview_set_allow_scripts
+void e_signature_preview_set_disable_command_line
(ESignaturePreview *preview,
- gboolean allow_scripts);
+ gboolean disable_command_line);
ESignature * e_signature_preview_get_signature
(ESignaturePreview *preview);
void e_signature_preview_set_signature
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index b4bb4b5019..ff507d8476 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -733,6 +733,31 @@ web_view_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static void
+web_view_constructed (GObject *object)
+{
+#ifndef G_OS_WIN32
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.desktop.lockdown");
+
+ g_settings_bind (
+ settings, "disable-printing",
+ object, "disable-printing",
+ G_SETTINGS_BIND_GET);
+
+ g_settings_bind (
+ settings, "disable-save-to-disk",
+ object, "disable-save-to-disk",
+ G_SETTINGS_BIND_GET);
+
+ g_object_unref (settings);
+#endif
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+}
+
static gboolean
web_view_button_press_event (GtkWidget *widget,
GdkEventButton *event)
@@ -1121,6 +1146,7 @@ e_web_view_class_init (EWebViewClass *class)
object_class->get_property = web_view_get_property;
object_class->dispose = web_view_dispose;
object_class->finalize = web_view_finalize;
+ object_class->constructed = web_view_constructed;
widget_class = GTK_WIDGET_CLASS (class);
widget_class->button_press_event = web_view_button_press_event;