From ba6a2343869f6be82f44261f183cd6925659d5ee Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 27 Mar 2011 15:16:39 -0400 Subject: 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. --- doc/reference/shell/eshell-sections.txt | 1 - doc/reference/shell/tmpl/e-shell-utils.sgml | 9 ---- mail/e-mail-reader.c | 68 +++++++++++++++---------- mail/mail-config.c | 8 --- modules/addressbook/e-book-shell-content.c | 1 - modules/addressbook/e-book-shell-view-actions.c | 24 ++++----- modules/calendar/e-cal-shell-view-actions.c | 37 ++++++++++---- modules/calendar/e-cal-shell-view-memopad.c | 23 ++++++--- modules/calendar/e-cal-shell-view-taskpad.c | 23 ++++++--- modules/calendar/e-memo-shell-content.c | 1 - modules/calendar/e-task-shell-content.c | 1 - modules/mail/em-composer-prefs.c | 24 --------- shell/e-shell-utils.c | 36 ------------- shell/e-shell-utils.h | 3 -- shell/e-shell-window-private.c | 46 ++++++++--------- shell/e-shell.c | 26 ---------- widgets/misc/e-signature-manager.c | 62 ++++++++++++++-------- widgets/misc/e-signature-manager.h | 6 +-- widgets/misc/e-signature-preview.c | 60 +++++++++++++++------- widgets/misc/e-signature-preview.h | 6 +-- widgets/misc/e-web-view.c | 26 ++++++++++ 21 files changed, 248 insertions(+), 243 deletions(-) diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt index 81ff256188..5d9402fafc 100644 --- a/doc/reference/shell/eshell-sections.txt +++ b/doc/reference/shell/eshell-sections.txt @@ -256,7 +256,6 @@ EShellTaskbarPrivate e-shell-utils Shell Utilities e_shell_configure_ui_manager -e_shell_configure_web_view e_shell_run_open_dialog e_shell_run_save_dialog e_shell_utils_import_uris diff --git a/doc/reference/shell/tmpl/e-shell-utils.sgml b/doc/reference/shell/tmpl/e-shell-utils.sgml index 84d8367310..2b41b82167 100644 --- a/doc/reference/shell/tmpl/e-shell-utils.sgml +++ b/doc/reference/shell/tmpl/e-shell-utils.sgml @@ -29,15 +29,6 @@ Shell Utilities @ui_manager: - - - - - -@shell: -@web_view: - - 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); diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c index 4f3905181e..35167e330a 100644 --- a/modules/addressbook/e-book-shell-content.c +++ b/modules/addressbook/e-book-shell-content.c @@ -268,7 +268,6 @@ book_shell_content_constructed (GObject *object) widget, "orientation", G_BINDING_SYNC_CREATE); - e_shell_configure_web_view (shell, E_WEB_VIEW (widget)); gtk_widget_show (widget); g_signal_connect_swapped ( diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c index b2c63b872a..fc7c841fad 100644 --- a/modules/addressbook/e-book-shell-view-actions.c +++ b/modules/addressbook/e-book-shell-view-actions.c @@ -717,13 +717,6 @@ static GtkActionEntry contact_entries[] = { N_("Rename the selected address book"), G_CALLBACK (action_address_book_rename_cb) }, - { "address-book-save-as", - GTK_STOCK_SAVE_AS, - N_("S_ave Address Book as vCard"), - NULL, - N_("Save the contacts of the selected address book as a vCard"), - G_CALLBACK (action_address_book_save_as_cb) }, - { "address-book-stop", GTK_STOCK_STOP, NULL, @@ -825,11 +818,6 @@ static EPopupActionEntry contact_popup_entries[] = { NULL, "address-book-rename" }, - { "address-book-popup-save-as", - /* Translators: This is an action label */ - N_("_Save as vCard..."), - "address-book-save-as" }, - { "contact-popup-copy", NULL, "contact-copy" }, @@ -970,6 +958,13 @@ static EPopupActionEntry lockdown_printing_popup_entries[] = { static GtkActionEntry lockdown_save_to_disk_entries[] = { + { "address-book-save-as", + GTK_STOCK_SAVE_AS, + N_("S_ave Address Book as vCard"), + NULL, + N_("Save the contacts of the selected address book as a vCard"), + G_CALLBACK (action_address_book_save_as_cb) }, + { "contact-save-as", GTK_STOCK_SAVE_AS, /* Translators: This is an action label */ @@ -981,6 +976,11 @@ static GtkActionEntry lockdown_save_to_disk_entries[] = { static EPopupActionEntry lockdown_save_to_disk_popup_entries[] = { + { "address-book-popup-save-as", + /* Translators: This is an action label */ + N_("_Save as vCard..."), + "address-book-save-as" }, + { "contact-popup-save-as", NULL, "contact-save-as" } diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 5e16b6db5b..ba72a41748 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1467,13 +1467,6 @@ static GtkActionEntry calendar_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_event_reply_all_cb) }, - { "event-save-as", - GTK_STOCK_SAVE_AS, - N_("Save as iCalendar..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_event_save_as_cb) }, - { "event-schedule", NULL, N_("_Schedule Meeting..."), @@ -1587,10 +1580,6 @@ static EPopupActionEntry calendar_popup_entries[] = { NULL, "event-reply-all" }, - { "event-popup-save-as", - NULL, - "event-save-as" }, - { "event-popup-schedule", NULL, "event-schedule" }, @@ -1741,6 +1730,23 @@ static EPopupActionEntry lockdown_printing_popup_entries[] = { "event-print" } }; +static GtkActionEntry lockdown_save_to_disk_entries[] = { + + { "event-save-as", + GTK_STOCK_SAVE_AS, + N_("Save as iCalendar..."), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_event_save_as_cb) }, +}; + +static EPopupActionEntry lockdown_save_to_disk_popup_entries[] = { + + { "event-popup-save-as", + NULL, + "event-save-as" }, +}; + void e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) { @@ -1790,6 +1796,15 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) action_group, lockdown_printing_popup_entries, G_N_ELEMENTS (lockdown_printing_popup_entries)); + /* Lockdown Save-to-Disk Actions */ + action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); + gtk_action_group_add_actions ( + action_group, lockdown_save_to_disk_entries, + G_N_ELEMENTS (lockdown_save_to_disk_entries), cal_shell_view); + e_action_group_add_popup_actions ( + action_group, lockdown_save_to_disk_popup_entries, + G_N_ELEMENTS (lockdown_save_to_disk_popup_entries)); + /* Fine tuning. */ action = ACTION (CALENDAR_GO_TODAY); diff --git a/modules/calendar/e-cal-shell-view-memopad.c b/modules/calendar/e-cal-shell-view-memopad.c index c4b67a88f4..2f625df75b 100644 --- a/modules/calendar/e-cal-shell-view-memopad.c +++ b/modules/calendar/e-cal-shell-view-memopad.c @@ -272,13 +272,6 @@ static GtkActionEntry calendar_memopad_entries[] = { NULL, NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_calendar_memopad_open_url_cb) }, - - { "calendar-memopad-save-as", - GTK_STOCK_SAVE_AS, - N_("Save as iCalendar..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_calendar_memopad_save_as_cb) } }; static GtkActionEntry lockdown_printing_entries[] = { @@ -291,6 +284,16 @@ static GtkActionEntry lockdown_printing_entries[] = { G_CALLBACK (action_calendar_memopad_print_cb) } }; +static GtkActionEntry lockdown_save_to_disk_entries[] = { + + { "calendar-memopad-save-as", + GTK_STOCK_SAVE_AS, + N_("Save as iCalendar..."), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_calendar_memopad_save_as_cb) } +}; + void e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view) { @@ -312,6 +315,12 @@ e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view) gtk_action_group_add_actions ( action_group, lockdown_printing_entries, G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view); + + /* Lockdown Save-to-Disk Actions */ + action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); + gtk_action_group_add_actions ( + action_group, lockdown_save_to_disk_entries, + G_N_ELEMENTS (lockdown_save_to_disk_entries), cal_shell_view); } void diff --git a/modules/calendar/e-cal-shell-view-taskpad.c b/modules/calendar/e-cal-shell-view-taskpad.c index ead28ae351..8afff2c767 100644 --- a/modules/calendar/e-cal-shell-view-taskpad.c +++ b/modules/calendar/e-cal-shell-view-taskpad.c @@ -359,13 +359,6 @@ static GtkActionEntry calendar_taskpad_entries[] = { NULL, NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_calendar_taskpad_open_url_cb) }, - - { "calendar-taskpad-save-as", - GTK_STOCK_SAVE_AS, - N_("_Save as iCalendar..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_calendar_taskpad_save_as_cb) } }; static GtkActionEntry lockdown_printing_entries[] = { @@ -378,6 +371,16 @@ static GtkActionEntry lockdown_printing_entries[] = { G_CALLBACK (action_calendar_taskpad_print_cb) } }; +static GtkActionEntry lockdown_save_to_disk_entries[] = { + + { "calendar-taskpad-save-as", + GTK_STOCK_SAVE_AS, + N_("_Save as iCalendar..."), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_calendar_taskpad_save_as_cb) } +}; + void e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view) { @@ -399,6 +402,12 @@ e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view) gtk_action_group_add_actions ( action_group, lockdown_printing_entries, G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view); + + /* Lockdown Save-to-Disk Actions */ + action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); + gtk_action_group_add_actions ( + action_group, lockdown_save_to_disk_entries, + G_N_ELEMENTS (lockdown_save_to_disk_entries), cal_shell_view); } void diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index bbf12de7db..9e280e36ff 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -473,7 +473,6 @@ memo_shell_content_constructed (GObject *object) container = priv->paned; widget = e_cal_component_preview_new (); - e_shell_configure_web_view (shell, E_WEB_VIEW (widget)); gtk_widget_show (widget); g_signal_connect_swapped ( diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index f2d10e4a4d..dbfa5fb7fc 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -469,7 +469,6 @@ task_shell_content_constructed (GObject *object) container = priv->paned; widget = e_cal_component_preview_new (); - e_shell_configure_web_view (shell, E_WEB_VIEW (widget)); gtk_widget_show (widget); g_signal_connect_swapped ( diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index 3added6de1..18f12e8c9e 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -563,18 +563,6 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, widget, "prefer-html", G_BINDING_SYNC_CREATE); -#if 0 /* XXX Lockdown keys have moved to gsettings-desktop-schemas, - * so disable lockdown integration until we're ready for - * GSettings. */ -#ifndef G_OS_WIN32 - g_object_bind_property ( - shell_settings, "disable-command-line", - widget, "allow-scripts", - G_BINDING_SYNC_CREATE | - G_BINDING_INVERT_BOOLEAN); -#endif -#endif - signature_tree_view = e_signature_manager_get_tree_view ( E_SIGNATURE_MANAGER (widget)); @@ -584,18 +572,6 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); -#if 0 /* XXX Lockdown keys have moved to gsettings-desktop-schemas, - * so disable lockdown integration until we're ready for - * GSettings. */ -#ifndef G_OS_WIN32 - g_object_bind_property ( - shell_settings, "disable-command-line", - widget, "allow-scripts", - G_BINDING_SYNC_CREATE | - G_BINDING_INVERT_BOOLEAN); -#endif -#endif - g_object_bind_property ( signature_tree_view, "selected", widget, "signature", diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c index b1de7119a8..4676a2d2e9 100644 --- a/shell/e-shell-utils.c +++ b/shell/e-shell-utils.c @@ -53,42 +53,6 @@ e_shell_configure_ui_manager (EShell *shell, G_BINDING_SYNC_CREATE); } -/** - * e_shell_configure_web_view: - * @shell: an #EShell - * @web_view: an #EWebView - * - * Adds shell integration to @web_view. In particular, it configures - * @web_view to honor the printing and save-to-disk lockdown options. - **/ -void -e_shell_configure_web_view (EShell *shell, - EWebView *web_view) -{ -#if 0 /* XXX Lockdown keys have moved to gsettings-desktop-scheams, - * so disable lockdown integration until we're ready for - * GSettings. */ - EShellSettings *shell_settings; - - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (E_IS_WEB_VIEW (web_view)); - - shell_settings = e_shell_get_shell_settings (shell); - -#ifndef G_OS_WIN32 - g_object_bind_property ( - shell_settings, "disable-printing", - web_view, "disable-printing", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( - shell_settings, "disable-save-to-disk", - web_view, "disable-save-to-disk", - G_BINDING_SYNC_CREATE); -#endif -#endif -} - /** * e_shell_run_open_dialog: * @shell: an #EShell diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h index a45ecdb1ca..178c26d20f 100644 --- a/shell/e-shell-utils.h +++ b/shell/e-shell-utils.h @@ -31,9 +31,6 @@ G_BEGIN_DECLS void e_shell_configure_ui_manager (EShell *shell, EUIManager *ui_manager); -void e_shell_configure_web_view (EShell *shell, - EWebView *web_view); - GFile * e_shell_run_open_dialog (EShell *shell, const gchar *title, GtkCallback customize_func, diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index db2bf069a9..613529419b 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -261,16 +261,10 @@ void e_shell_window_private_constructed (EShellWindow *shell_window) { EShellWindowPrivate *priv = shell_window->priv; -#if 0 - EShellSettings *shell_settings; -#endif EShell *shell; GConfBridge *bridge; GtkAction *action; GtkAccelGroup *accel_group; -#if 0 - GtkActionGroup *action_group; -#endif GtkUIManager *ui_manager; GtkBox *box; GtkPaned *paned; @@ -281,12 +275,14 @@ e_shell_window_private_constructed (EShellWindow *shell_window) const gchar *key; const gchar *id; +#ifndef G_OS_WIN32 + GSettings *settings; + GtkActionGroup *action_group; +#endif + window = GTK_WINDOW (shell_window); shell = e_shell_window_get_shell (shell_window); -#if 0 - shell_settings = e_shell_get_shell_settings (shell); -#endif ui_manager = e_shell_window_get_ui_manager (shell_window); e_shell_configure_ui_manager (shell, E_UI_MANAGER (ui_manager)); @@ -362,37 +358,37 @@ e_shell_window_private_constructed (EShellWindow *shell_window) shell_window, "notify::active-view", G_CALLBACK (e_shell_window_update_search_menu), NULL); -#if 0 /* XXX Lockdown keys have moved to gsettings-desktop-schemas, - * so disable lockdown integration until we're ready for - * GSettings. */ #ifndef G_OS_WIN32 /* Support lockdown. */ + settings = g_settings_new ("org.gnome.desktop.lockdown"); + action_group = ACTION_GROUP (LOCKDOWN_PRINTING); - g_object_bind_property ( - shell_settings, "disable-printing", + g_settings_bind ( + settings, "disable-printing", action_group, "visible", - G_BINDING_SYNC_CREATE | - G_BINDING_INVERT_BOOLEAN); + G_SETTINGS_BIND_GET | + G_SETTINGS_BIND_INVERT_BOOLEAN); action_group = ACTION_GROUP (LOCKDOWN_PRINT_SETUP); - g_object_bind_property ( - shell_settings, "disable-print-setup", + g_settings_bind ( + settings, "disable-print-setup", action_group, "visible", - G_BINDING_SYNC_CREATE | - G_BINDING_INVERT_BOOLEAN); + G_SETTINGS_BIND_GET | + G_SETTINGS_BIND_INVERT_BOOLEAN); action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); - g_object_bind_property ( - shell_settings, "disable-save-to-disk", + g_settings_bind ( + settings, "disable-save-to-disk", action_group, "visible", - G_BINDING_SYNC_CREATE | - G_BINDING_INVERT_BOOLEAN); + G_SETTINGS_BIND_GET | + G_SETTINGS_BIND_INVERT_BOOLEAN); + + g_object_unref (settings); #endif /* G_OS_WIN32 */ -#endif /* Bind GObject properties to GObject properties. */ diff --git a/shell/e-shell.c b/shell/e-shell.c index d7ecf69d8c..d9c3508161 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1244,32 +1244,6 @@ e_shell_init (EShell *shell) "start-offline", "/apps/evolution/shell/start_offline"); -#if 0 /* XXX Lockdown keys have moved to gsettings-desktop-schemas, - * so disable lockdown integration until we're ready for - * GSettings. */ -#ifndef G_OS_WIN32 - e_shell_settings_install_property_for_key ( - "disable-application-handlers", - "/desktop/gnome/lockdown/disable_application_handlers"); - - e_shell_settings_install_property_for_key ( - "disable-command-line", - "/desktop/gnome/lockdown/disable_command_line"); - - e_shell_settings_install_property_for_key ( - "disable-printing", - "/desktop/gnome/lockdown/disable_printing"); - - e_shell_settings_install_property_for_key ( - "disable-print-setup", - "/desktop/gnome/lockdown/disable_print_setup"); - - e_shell_settings_install_property_for_key ( - "disable-save-to-disk", - "/desktop/gnome/lockdown/disable_save_to_disk"); -#endif /* G_OS_WIN32 */ -#endif - /*** Session Management ***/ sm_client = egg_sm_client_get (); 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; @@ -266,6 +266,26 @@ signature_manager_dispose (GObject *object) G_OBJECT_CLASS (e_signature_manager_parent_class)->dispose (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) { @@ -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; } @@ -112,6 +114,26 @@ signature_preview_dispose (GObject *object) G_OBJECT_CLASS (e_signature_preview_parent_class)->dispose (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) { @@ -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; -- cgit