diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-27 11:50:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-27 11:50:19 +0800 |
commit | 98d262b594caefd053a2d075e2d8482b2d8a12c8 (patch) | |
tree | 1474ebf4401477049436bf89a1432447995d0b00 | |
parent | e0f414941dd4e13ea074996d10606b0dae7e494b (diff) | |
download | gsoc2013-evolution-98d262b594caefd053a2d075e2d8482b2d8a12c8.tar.gz gsoc2013-evolution-98d262b594caefd053a2d075e2d8482b2d8a12c8.tar.zst gsoc2013-evolution-98d262b594caefd053a2d075e2d8482b2d8a12c8.zip |
Add action groups to support lockdown, starting with printing.
Other categories to follow. Editors still need lockdown support.
svn path=/branches/kill-bonobo/; revision=37136
22 files changed, 453 insertions, 197 deletions
diff --git a/addressbook/gui/component/e-book-shell-view-actions.c b/addressbook/gui/component/e-book-shell-view-actions.c index 36c04eaf6b..a264f7f84b 100644 --- a/addressbook/gui/component/e-book-shell-view-actions.c +++ b/addressbook/gui/component/e-book-shell-view-actions.c @@ -667,20 +667,6 @@ static GtkActionEntry contact_entries[] = { N_("View the current contact"), G_CALLBACK (action_contact_open_cb) }, - { "contact-print", - GTK_STOCK_PRINT, - NULL, - "<Control>p", - N_("Print selected contacts"), - G_CALLBACK (action_contact_print_cb) }, - - { "contact-print-preview", - GTK_STOCK_PRINT_PREVIEW, - NULL, - NULL, - N_("Preview the contacts to be printed"), - G_CALLBACK (action_contact_print_preview_cb) }, - { "contact-save-as", GTK_STOCK_SAVE_AS, N_("Save as vCard..."), @@ -762,10 +748,6 @@ static EPopupActionEntry contact_popup_entries[] = { NULL, "contact-open" }, - { "contact-popup-print", - NULL, - "contact-print" }, - { "contact-popup-save-as", NULL, "contact-save-as" }, @@ -827,6 +809,30 @@ static GtkRadioActionEntry contact_search_entries[] = { CONTACT_SEARCH_NAME_CONTAINS } }; +static GtkActionEntry lockdown_printing_entries[] = { + + { "contact-print", + GTK_STOCK_PRINT, + NULL, + "<Control>p", + N_("Print selected contacts"), + G_CALLBACK (action_contact_print_cb) }, + + { "contact-print-preview", + GTK_STOCK_PRINT_PREVIEW, + NULL, + NULL, + N_("Preview the contacts to be printed"), + G_CALLBACK (action_contact_print_preview_cb) } +}; + +static EPopupActionEntry lockdown_printing_popup_entries[] = { + + { "contact-popup-print", + NULL, + "contact-print" } +}; + void e_book_shell_view_actions_init (EBookShellView *book_shell_view) { @@ -869,6 +875,15 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) gtk_action_group_set_translation_domain (action_group, domain); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + /* Lockdown Printing Actions */ + action_group = ACTION_GROUP (LOCKDOWN_PRINTING); + gtk_action_group_add_actions ( + action_group, lockdown_printing_entries, + G_N_ELEMENTS (lockdown_printing_entries), book_shell_view); + e_action_group_add_popup_actions ( + action_group, lockdown_printing_popup_entries, + G_N_ELEMENTS (lockdown_printing_popup_entries)); + /* Bind GObject properties to GConf keys. */ bridge = gconf_bridge_get (); diff --git a/calendar/modules/e-cal-shell-view-actions.c b/calendar/modules/e-cal-shell-view-actions.c index bc2f38e5bd..105b4a3e7d 100644 --- a/calendar/modules/e-cal-shell-view-actions.c +++ b/calendar/modules/e-cal-shell-view-actions.c @@ -630,20 +630,6 @@ static GtkActionEntry calendar_entries[] = { N_("Create a new calendar"), G_CALLBACK (action_calendar_new_cb) }, - { "calendar-print", - GTK_STOCK_PRINT, - NULL, - "<Control>p", - N_("Print this calendar"), - G_CALLBACK (action_calendar_print_cb) }, - - { "calendar-print-preview", - GTK_STOCK_PRINT_PREVIEW, - NULL, - NULL, - N_("Preview the calendar to be printed"), - G_CALLBACK (action_calendar_print_preview_cb) }, - { "calendar-properties", GTK_STOCK_PROPERTIES, NULL, @@ -777,13 +763,6 @@ static GtkActionEntry calendar_entries[] = { N_("View the current appointment"), G_CALLBACK (action_event_open_cb) }, - { "event-print", - GTK_STOCK_PRINT, - NULL, - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_event_print_cb) }, - { "event-reply", "mail-reply-sender", N_("_Reply"), @@ -904,10 +883,6 @@ static EPopupActionEntry calendar_popup_entries[] = { NULL, "event-open" }, - { "event-popup-print", - NULL, - "event-print" }, - { "event-popup-reply", NULL, "event-reply" }, @@ -1018,6 +993,37 @@ static GtkRadioActionEntry calendar_search_entries[] = { CALENDAR_SEARCH_SUMMARY_CONTAINS } }; +static GtkActionEntry lockdown_printing_entries[] = { + + { "calendar-print", + GTK_STOCK_PRINT, + NULL, + "<Control>p", + N_("Print this calendar"), + G_CALLBACK (action_calendar_print_cb) }, + + { "calendar-print-preview", + GTK_STOCK_PRINT_PREVIEW, + NULL, + NULL, + N_("Preview the calendar to be printed"), + G_CALLBACK (action_calendar_print_preview_cb) }, + + { "event-print", + GTK_STOCK_PRINT, + NULL, + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_event_print_cb) } +}; + +static EPopupActionEntry lockdown_printing_popup_entries[] = { + + { "event-popup-print", + NULL, + "event-print" } +}; + void e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) { @@ -1033,6 +1039,7 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) ui_manager = e_shell_window_get_ui_manager (shell_window); domain = GETTEXT_PACKAGE; + /* Calendar Actions */ action_group = cal_shell_view->priv->calendar_actions; gtk_action_group_set_translation_domain (action_group, domain); gtk_action_group_add_actions ( @@ -1052,6 +1059,15 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) NULL, NULL); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + /* Lockdown Printing Actions */ + action_group = ACTION_GROUP (LOCKDOWN_PRINTING); + gtk_action_group_add_actions ( + action_group, lockdown_printing_entries, + G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view); + e_action_group_add_popup_actions ( + action_group, lockdown_printing_popup_entries, + G_N_ELEMENTS (lockdown_printing_popup_entries)); + /* Fine tuning. */ action = ACTION (CALENDAR_GO_TODAY); diff --git a/calendar/modules/e-cal-shell-view-memopad.c b/calendar/modules/e-cal-shell-view-memopad.c index c30d3cfa5c..dc3c384888 100644 --- a/calendar/modules/e-cal-shell-view-memopad.c +++ b/calendar/modules/e-cal-shell-view-memopad.c @@ -317,13 +317,6 @@ static GtkActionEntry calendar_memopad_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_calendar_memopad_open_url_cb) }, - { "calendar-memopad-print", - GTK_STOCK_PRINT, - NULL, - NULL, - N_("Print the selected memo"), - G_CALLBACK (action_calendar_memopad_print_cb) }, - { "calendar-memopad-save-as", GTK_STOCK_SAVE_AS, NULL, @@ -332,6 +325,16 @@ static GtkActionEntry calendar_memopad_entries[] = { G_CALLBACK (action_calendar_memopad_save_as_cb) } }; +static GtkActionEntry lockdown_printing_entries[] = { + + { "calendar-memopad-print", + GTK_STOCK_PRINT, + NULL, + NULL, + N_("Print the selected memo"), + G_CALLBACK (action_calendar_memopad_print_cb) } +}; + void e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view) { @@ -344,10 +347,17 @@ e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view) shell_window = e_shell_view_get_shell_window (shell_view); ui_manager = e_shell_window_get_ui_manager (shell_window); + /* Calendar Actions */ action_group = cal_shell_view->priv->calendar_actions; gtk_action_group_add_actions ( action_group, calendar_memopad_entries, G_N_ELEMENTS (calendar_memopad_entries), cal_shell_view); + + /* Lockdown Printing Actions */ + action_group = ACTION_GROUP (LOCKDOWN_PRINTING); + gtk_action_group_add_actions ( + action_group, lockdown_printing_entries, + G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view); } void diff --git a/calendar/modules/e-cal-shell-view-taskpad.c b/calendar/modules/e-cal-shell-view-taskpad.c index c04ce2c6d1..9962ed62b0 100644 --- a/calendar/modules/e-cal-shell-view-taskpad.c +++ b/calendar/modules/e-cal-shell-view-taskpad.c @@ -405,13 +405,6 @@ static GtkActionEntry calendar_taskpad_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_calendar_taskpad_open_url_cb) }, - { "calendar-taskpad-print", - GTK_STOCK_PRINT, - NULL, - NULL, - N_("Print the selected task"), - G_CALLBACK (action_calendar_taskpad_print_cb) }, - { "calendar-taskpad-save-as", GTK_STOCK_SAVE_AS, N_("_Save as iCalendar..."), @@ -420,6 +413,16 @@ static GtkActionEntry calendar_taskpad_entries[] = { G_CALLBACK (action_calendar_taskpad_save_as_cb) } }; +static GtkActionEntry lockdown_printing_entries[] = { + + { "calendar-taskpad-print", + GTK_STOCK_PRINT, + NULL, + NULL, + N_("Print the selected task"), + G_CALLBACK (action_calendar_taskpad_print_cb) } +}; + void e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view) { @@ -432,10 +435,17 @@ e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view) shell_window = e_shell_view_get_shell_window (shell_view); ui_manager = e_shell_window_get_ui_manager (shell_window); + /* Calendar Actions */ action_group = cal_shell_view->priv->calendar_actions; gtk_action_group_add_actions ( action_group, calendar_taskpad_entries, G_N_ELEMENTS (calendar_taskpad_entries), cal_shell_view); + + /* Lockdown Printing Actions */ + action_group = ACTION_GROUP (LOCKDOWN_PRINTING); + gtk_action_group_add_actions ( + action_group, lockdown_printing_entries, + G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view); } void diff --git a/calendar/modules/e-memo-shell-view-actions.c b/calendar/modules/e-memo-shell-view-actions.c index 228de43651..d5ae8c967d 100644 --- a/calendar/modules/e-memo-shell-view-actions.c +++ b/calendar/modules/e-memo-shell-view-actions.c @@ -576,20 +576,6 @@ static GtkActionEntry memo_entries[] = { N_("Create a new memo list"), G_CALLBACK (action_memo_list_new_cb) }, - { "memo-list-print", - GTK_STOCK_PRINT, - NULL, - "<Control>p", - N_("Print the list of memos"), - G_CALLBACK (action_memo_list_print_cb) }, - - { "memo-list-print-preview", - GTK_STOCK_PRINT_PREVIEW, - NULL, - NULL, - N_("Preview the list of memos to be printed"), - G_CALLBACK (action_memo_list_print_preview_cb) }, - { "memo-list-properties", GTK_STOCK_PROPERTIES, NULL, @@ -632,13 +618,6 @@ static GtkActionEntry memo_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_memo_open_url_cb) }, - { "memo-print", - GTK_STOCK_PRINT, - NULL, - NULL, - N_("Print the selected memo"), - G_CALLBACK (action_memo_print_cb) }, - { "memo-save-as", GTK_STOCK_SAVE_AS, N_("_Save as iCalendar..."), @@ -697,10 +676,6 @@ static EPopupActionEntry memo_popup_entries[] = { NULL, "memo-open-url" }, - { "memo-popup-print", - NULL, - "memo-print" }, - { "memo-popup-save-as", NULL, "memo-save-as" } @@ -758,6 +733,37 @@ static GtkRadioActionEntry memo_search_entries[] = { MEMO_SEARCH_SUMMARY_CONTAINS } }; +static GtkActionEntry lockdown_printing_entries[] = { + + { "memo-list-print", + GTK_STOCK_PRINT, + NULL, + "<Control>p", + N_("Print the list of memos"), + G_CALLBACK (action_memo_list_print_cb) }, + + { "memo-list-print-preview", + GTK_STOCK_PRINT_PREVIEW, + NULL, + NULL, + N_("Preview the list of memos to be printed"), + G_CALLBACK (action_memo_list_print_preview_cb) }, + + { "memo-print", + GTK_STOCK_PRINT, + NULL, + NULL, + N_("Print the selected memo"), + G_CALLBACK (action_memo_print_cb) } +}; + +static EPopupActionEntry lockdown_printing_popup_entries[] = { + + { "memo-popup-print", + NULL, + "memo-print" } +}; + void e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) { @@ -776,6 +782,7 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) ui_manager = e_shell_window_get_ui_manager (shell_window); domain = GETTEXT_PACKAGE; + /* Memo Actions */ action_group = memo_shell_view->priv->memo_actions; gtk_action_group_set_translation_domain (action_group, domain); gtk_action_group_add_actions ( @@ -794,6 +801,15 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) NULL, NULL); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + /* Lockdown Printing Actions */ + action_group = ACTION_GROUP (LOCKDOWN_PRINTING); + gtk_action_group_add_actions ( + action_group, lockdown_printing_entries, + G_N_ELEMENTS (lockdown_printing_entries), memo_shell_view); + e_action_group_add_popup_actions ( + action_group, lockdown_printing_popup_entries, + G_N_ELEMENTS (lockdown_printing_popup_entries)); + /* Bind GObject properties to GConf keys. */ bridge = gconf_bridge_get (); diff --git a/calendar/modules/e-task-shell-view-actions.c b/calendar/modules/e-task-shell-view-actions.c index c59c55bd17..35c4ccbacf 100644 --- a/calendar/modules/e-task-shell-view-actions.c +++ b/calendar/modules/e-task-shell-view-actions.c @@ -701,20 +701,6 @@ static GtkActionEntry task_entries[] = { N_("Create a new task list"), G_CALLBACK (action_task_list_new_cb) }, - { "task-list-print", - GTK_STOCK_PRINT, - NULL, - "<Control>p", - N_("Print the list of tasks"), - G_CALLBACK (action_task_list_print_cb) }, - - { "task-list-print-preview", - GTK_STOCK_PRINT_PREVIEW, - NULL, - NULL, - N_("Preview the list of tasks to be printed"), - G_CALLBACK (action_task_list_print_preview_cb) }, - { "task-list-properties", GTK_STOCK_PROPERTIES, NULL, @@ -771,13 +757,6 @@ static GtkActionEntry task_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_task_open_url_cb) }, - { "task-print", - GTK_STOCK_PRINT, - NULL, - NULL, - N_("Print the selected task"), - G_CALLBACK (action_task_print_cb) }, - { "task-purge", NULL, N_("Purg_e"), @@ -864,10 +843,6 @@ static EPopupActionEntry task_popup_entries[] = { NULL, "task-open-url" }, - { "task-popup-print", - NULL, - "task-print" }, - { "task-popup-save-as", NULL, "task-save-as" }, @@ -960,6 +935,37 @@ static GtkRadioActionEntry task_search_entries[] = { TASK_SEARCH_SUMMARY_CONTAINS } }; +static GtkActionEntry lockdown_printing_entries[] = { + + { "task-list-print", + GTK_STOCK_PRINT, + NULL, + "<Control>p", + N_("Print the list of tasks"), + G_CALLBACK (action_task_list_print_cb) }, + + { "task-list-print-preview", + GTK_STOCK_PRINT_PREVIEW, + NULL, + NULL, + N_("Preview the list of tasks to be printed"), + G_CALLBACK (action_task_list_print_preview_cb) }, + + { "task-print", + GTK_STOCK_PRINT, + NULL, + NULL, + N_("Print the selected task"), + G_CALLBACK (action_task_print_cb) } +}; + +static EPopupActionEntry lockdown_printing_popup_entries[] = { + + { "task-popup-print", + NULL, + "task-print" } +}; + void e_task_shell_view_actions_init (ETaskShellView *task_shell_view) { @@ -978,6 +984,7 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) ui_manager = e_shell_window_get_ui_manager (shell_window); domain = GETTEXT_PACKAGE; + /* Task Actions */ action_group = task_shell_view->priv->task_actions; gtk_action_group_set_translation_domain (action_group, domain); gtk_action_group_add_actions ( @@ -996,6 +1003,15 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) NULL, NULL); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + /* Lockdown Printing Actions */ + action_group = ACTION_GROUP (LOCKDOWN_PRINTING); + gtk_action_group_add_actions ( + action_group, lockdown_printing_entries, + G_N_ELEMENTS (lockdown_printing_entries), task_shell_view); + e_action_group_add_popup_actions ( + action_group, lockdown_printing_popup_entries, + G_N_ELEMENTS (lockdown_printing_popup_entries)); + /* Bind GObject properties to GConf keys. */ bridge = gconf_bridge_get (); diff --git a/doc/reference/shell/Makefile.am b/doc/reference/shell/Makefile.am index 971b1316f6..9beff2cae2 100644 --- a/doc/reference/shell/Makefile.am +++ b/doc/reference/shell/Makefile.am @@ -82,6 +82,7 @@ GTKDOC_LIBS= \ $(top_builddir)/shell/.libs/e-shell-window-actions.o \ $(top_builddir)/shell/.libs/e-shell-window.o \ $(top_builddir)/e-util/.libs/e-bconf-map.o \ + $(top_builddir)/e-util/.libs/e-binding.o \ $(top_builddir)/e-util/.libs/e-dialog-utils.o \ $(top_builddir)/e-util/.libs/e-error.o \ $(top_builddir)/e-util/.libs/e-event.o \ diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt index 67d2b88aa1..ef017b742f 100644 --- a/doc/reference/shell/eshell-sections.txt +++ b/doc/reference/shell/eshell-sections.txt @@ -122,6 +122,7 @@ EShellModulePrivate EShellSettings e_shell_settings_install_property e_shell_settings_bind_to_gconf +e_shell_settings_enable_debug e_shell_settings_get_boolean e_shell_settings_set_boolean e_shell_settings_get_int @@ -148,6 +149,8 @@ EShellSidebar e_shell_sidebar_new e_shell_sidebar_check_state e_shell_sidebar_get_shell_view +e_shell_sidebar_get_icon_name +e_shell_sidebar_set_icon_name e_shell_sidebar_get_primary_text e_shell_sidebar_set_primary_text e_shell_sidebar_get_secondary_text @@ -333,4 +336,7 @@ E_SHELL_WINDOW_ACTION_GROUP_NEW_ITEM E_SHELL_WINDOW_ACTION_GROUP_NEW_SOURCE E_SHELL_WINDOW_ACTION_GROUP_CUSTOM_RULES E_SHELL_WINDOW_ACTION_GROUP_GAL_VIEW +E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINTING +E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINT_SETUP +E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_SAVE_TO_DISK </SECTION> diff --git a/doc/reference/shell/tmpl/action-groups.sgml b/doc/reference/shell/tmpl/action-groups.sgml index 804b870afd..6b8e165c89 100644 --- a/doc/reference/shell/tmpl/action-groups.sgml +++ b/doc/reference/shell/tmpl/action-groups.sgml @@ -65,3 +65,27 @@ Action Groups @window: +<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINTING ##### --> +<para> + +</para> + +@window: + + +<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINT_SETUP ##### --> +<para> + +</para> + +@window: + + +<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_SAVE_TO_DISK ##### --> +<para> + +</para> + +@window: + + diff --git a/doc/reference/shell/tmpl/e-shell-sidebar.sgml b/doc/reference/shell/tmpl/e-shell-sidebar.sgml index 7895a61172..45a55b127b 100644 --- a/doc/reference/shell/tmpl/e-shell-sidebar.sgml +++ b/doc/reference/shell/tmpl/e-shell-sidebar.sgml @@ -70,6 +70,24 @@ EShellSidebar @Returns: +<!-- ##### FUNCTION e_shell_sidebar_get_icon_name ##### --> +<para> + +</para> + +@shell_sidebar: +@Returns: + + +<!-- ##### FUNCTION e_shell_sidebar_set_icon_name ##### --> +<para> + +</para> + +@shell_sidebar: +@icon_name: + + <!-- ##### FUNCTION e_shell_sidebar_get_primary_text ##### --> <para> diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 1d39309361..d1ea62857c 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -2300,6 +2300,9 @@ e_mail_reader_check_state (EMailReader *reader) void e_mail_reader_update_actions (EMailReader *reader) { + EShell *shell; + EShellModule *shell_module; + EShellSettings *shell_settings; GtkAction *action; GtkActionGroup *action_group; const gchar *action_name; @@ -2308,6 +2311,7 @@ e_mail_reader_update_actions (EMailReader *reader) /* Be descriptive. */ gboolean any_messages_selected; + gboolean disable_printing; gboolean enable_flag_clear; gboolean enable_flag_completed; gboolean enable_flag_for_followup; @@ -2328,6 +2332,13 @@ e_mail_reader_update_actions (EMailReader *reader) action_group = e_mail_reader_get_action_group (reader); state = e_mail_reader_check_state (reader); + shell_module = e_mail_reader_get_shell_module (reader); + shell = e_shell_module_get_shell (shell_module); + shell_settings = e_shell_get_shell_settings (shell); + + disable_printing = e_shell_settings_get_boolean ( + shell_settings, "disable-printing"); + single_message_selected = (state & E_MAIL_READER_SELECTION_SINGLE); multiple_messages_selected = @@ -2478,12 +2489,12 @@ e_mail_reader_update_actions (EMailReader *reader) gtk_action_set_sensitive (action, sensitive); action_name = "mail-print"; - sensitive = single_message_selected; + sensitive = single_message_selected && !disable_printing; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); action_name = "mail-print-preview"; - sensitive = single_message_selected; + sensitive = single_message_selected && !disable_printing; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); diff --git a/mail/e-mail-shell-module-settings.c b/mail/e-mail-shell-module-settings.c index 4acce23ad2..d04bb23b91 100644 --- a/mail/e-mail-shell-module-settings.c +++ b/mail/e-mail-shell-module-settings.c @@ -29,11 +29,8 @@ void e_mail_shell_module_init_settings (EShell *shell) { - GConfClient *client; EShellSettings *shell_settings; - gpointer object; - client = gconf_client_get_default (); shell_settings = e_shell_get_shell_settings (shell); /* XXX Default values should match the GConf schema. @@ -433,33 +430,4 @@ e_mail_shell_module_init_settings (EShell *shell) e_shell_settings_bind_to_gconf ( shell_settings, "composer-top-signature", "/apps/evolution/mail/composer/top_signature"); - - /* These properties are not bound directly to GConf keys. - * XXX Nor should they be stored in GConf to begin with. */ - - e_shell_settings_install_property ( - g_param_spec_object ( - "accounts", - NULL, - NULL, - E_TYPE_ACCOUNT_LIST, - G_PARAM_READWRITE)); - - object = e_account_list_new (client); - e_shell_settings_set_object (shell_settings, "accounts", object); - g_object_unref (object); - - e_shell_settings_install_property ( - g_param_spec_object ( - "signatures", - NULL, - NULL, - E_TYPE_SIGNATURE_LIST, - G_PARAM_READWRITE)); - - object = e_signature_list_new (client); - e_shell_settings_set_object (shell_settings, "signatures", object); - g_object_unref (object); - - g_object_unref (client); } diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index 2609e46835..6d5da4936c 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -1044,7 +1044,9 @@ 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 && !mail_config_scripts_disabled ()); + e_binding_new_with_negation ( + G_OBJECT (shell_settings), "disable-command-line", + G_OBJECT (widget), "sensitive"); 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 fc97d3d953..00c847b3c4 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -54,11 +54,7 @@ #include <misc/e-gui-utils.h> #include "e-util/e-util-labels.h" #include "e-util/e-account-utils.h" - -#include <e-util/e-signature-list.h> - -#include "shell/e-shell.h" -#include "shell/e-shell-settings.h" +#include "e-util/e-signature-utils.h" #include <camel/camel-service.h> #include <camel/camel-stream-mem.h> @@ -77,9 +73,6 @@ typedef struct { GConfClient *gconf; - EShellSettings *shell_settings; - - gboolean corrupt; char *gtkrc; @@ -340,21 +333,13 @@ void mail_config_init (void) { GConfClientNotifyFunc func; - EShellSettings *shell_settings; - EShell *shell; const gchar *key; - g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings)); - if (config) return; - shell = e_shell_get_default (); - shell_settings = e_shell_get_shell_settings (shell); - config = g_new0 (MailConfig, 1); config->gconf = gconf_client_get_default (); - config->shell_settings = g_object_ref (shell_settings); config->mime_types = g_ptr_array_new (); config->gtkrc = g_build_filename ( e_get_user_data_dir (), "mail", @@ -554,18 +539,13 @@ mail_config_write (void) if (!config) return; - account_list = e_shell_settings_get_object ( - config->shell_settings, "accounts"); - signature_list = e_shell_settings_get_object ( - config->shell_settings, "signatures"); + account_list = e_get_account_list (); + signature_list = e_get_signature_list (); e_account_list_save (account_list); e_signature_list_save (signature_list); gconf_client_suggest_sync (config->gconf, NULL); - - g_object_unref (account_list); - g_object_unref (signature_list); } void @@ -649,12 +629,6 @@ mail_config_get_gconf_client (void) return config->gconf; } -gboolean -mail_config_is_corrupt (void) -{ - return config->corrupt; -} - int mail_config_get_address_count (void) { @@ -1123,15 +1097,6 @@ 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) { @@ -1140,7 +1105,10 @@ mail_config_signature_run_script (const char *script) int in_fds[2]; pid_t pid; - if (mail_config_scripts_disabled ()) + if (config == NULL) + mail_config_init (); + + if (config->scripts_disabled) return NULL; if (pipe (in_fds) == -1) { diff --git a/mail/mail-config.h b/mail/mail-config.h index e085a1be37..d34ecc71d8 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -96,8 +96,6 @@ void mail_config_write_on_exit (void); struct _GConfClient *mail_config_get_gconf_client (void); /* General Accessor functions */ -gboolean mail_config_is_corrupt (void); - GSList *mail_config_get_labels (void); const char **mail_config_get_allowable_mime_types (void); @@ -136,8 +134,6 @@ 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); diff --git a/shell/e-shell-settings.c b/shell/e-shell-settings.c index b494aa17c8..b529130fd1 100644 --- a/shell/e-shell-settings.c +++ b/shell/e-shell-settings.c @@ -29,6 +29,7 @@ struct _EShellSettingsPrivate { GArray *value_array; + guint debug : 1; }; static GList *instances; @@ -51,6 +52,16 @@ shell_settings_set_property (GObject *object, g_value_copy (value, dest_value); g_object_notify (object, pspec->name); + + if (priv->debug) { + gchar *contents; + + contents = g_strdup_value_contents (value); + g_debug ( + "Setting '%s' set to '%s' (%s)", + pspec->name, contents, G_VALUE_TYPE_NAME (value)); + g_free (contents); + } } static void @@ -106,6 +117,8 @@ shell_settings_init (EShellSettings *shell_settings, GObjectClass *object_class) { GArray *value_array; + GParamSpec **pspecs; + guint ii; instances = g_list_prepend (instances, shell_settings); @@ -114,6 +127,22 @@ shell_settings_init (EShellSettings *shell_settings, shell_settings->priv = E_SHELL_SETTINGS_GET_PRIVATE (shell_settings); shell_settings->priv->value_array = value_array; + + g_object_freeze_notify (G_OBJECT (shell_settings)); + + pspecs = g_object_class_list_properties (object_class, NULL); + for (ii = 0; ii < property_count; ii++) { + GParamSpec *pspec = pspecs[ii]; + GValue *value; + + value = &g_array_index (value_array, GValue, ii); + g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)); + g_param_value_set_default (pspec, value); + g_object_notify (G_OBJECT (shell_settings), pspec->name); + } + g_free (pspecs); + + g_object_thaw_notify (G_OBJECT (shell_settings)); } GType @@ -227,6 +256,20 @@ e_shell_settings_bind_to_gconf (EShellSettings *shell_settings, } /** + * e_shell_settings_enable_debug: + * @shell_settings: an #EShellSettings + * + * Print a debug message to standard output when a property value changes. + **/ +void +e_shell_settings_enable_debug (EShellSettings *shell_settings) +{ + g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings)); + + shell_settings->priv->debug = TRUE; +} + +/** * e_shell_settings_get_boolean: * @shell_settings: an #EShellSettings * @property_name: an installed property name diff --git a/shell/e-shell-settings.h b/shell/e-shell-settings.h index 41d9d94ec5..d983a3291f 100644 --- a/shell/e-shell-settings.h +++ b/shell/e-shell-settings.h @@ -76,6 +76,7 @@ void e_shell_settings_install_property void e_shell_settings_bind_to_gconf (EShellSettings *shell_settings, const gchar *property_name, const gchar *gconf_key); +void e_shell_settings_enable_debug (EShellSettings *shell_settings); /* Getters and setters for common EShellSettings property types. * These are more convenient than g_object_get() / g_object_set(). @@ -97,11 +98,6 @@ gchar * e_shell_settings_get_string (EShellSettings *shell_settings, void e_shell_settings_set_string (EShellSettings *shell_settings, const gchar *property_name, const gchar *v_string); -gpointer e_shell_settings_get_object (EShellSettings *shell_settings, - const gchar *property_name); -void e_shell_settings_set_object (EShellSettings *shell_settings, - const gchar *property_name, - gpointer v_object); G_END_DECLS diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index 3ab8b8e7dd..f944d88eb6 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -1459,13 +1459,6 @@ static GtkActionEntry shell_entries[] = { N_("Create a new window displaying this view"), G_CALLBACK (action_new_window_cb) }, - { "page-setup", - GTK_STOCK_PAGE_SETUP, - NULL, - NULL, - N_("Change the page settings for your current printer"), - G_CALLBACK (action_page_setup_cb) }, - { "preferences", GTK_STOCK_PREFERENCES, NULL, @@ -1745,6 +1738,16 @@ static GtkRadioActionEntry shell_gal_view_radio_entries[] = { -1 } }; +static GtkActionEntry shell_lockdown_print_setup_entries[] = { + + { "page-setup", + GTK_STOCK_PAGE_SETUP, + NULL, + NULL, + N_("Change the page settings for your current printer"), + G_CALLBACK (action_page_setup_cb) } +}; + static void shell_window_extract_actions (EShellWindow *shell_window, GList **source_list, @@ -1864,6 +1867,25 @@ e_shell_window_actions_init (EShellWindow *shell_window) -1, G_CALLBACK (action_switcher_cb), shell_window); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + /* Lockdown Printing Actions */ + action_group = shell_window->priv->lockdown_printing; + gtk_action_group_set_translation_domain (action_group, domain); + gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + + /* Lockdown Print Setup Actions */ + action_group = shell_window->priv->lockdown_print_setup; + gtk_action_group_set_translation_domain (action_group, domain); + gtk_action_group_add_actions ( + action_group, shell_lockdown_print_setup_entries, + G_N_ELEMENTS (shell_lockdown_print_setup_entries), + shell_window); + gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + + /* Lockdown Save-to-Disk Actions */ + action_group = shell_window->priv->lockdown_save_to_disk; + gtk_action_group_set_translation_domain (action_group, domain); + gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + /* Fine tuning. */ g_object_set (ACTION (SEND_RECEIVE), "is-important", TRUE, NULL); diff --git a/shell/e-shell-window-actions.h b/shell/e-shell-window-actions.h index 0914abcbc8..ca7e783a86 100644 --- a/shell/e-shell-window-actions.h +++ b/shell/e-shell-window-actions.h @@ -103,6 +103,12 @@ E_SHELL_WINDOW_ACTION_GROUP ((window), "custom-rules") #define E_SHELL_WINDOW_ACTION_GROUP_GAL_VIEW(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "gal-view") +#define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINTING(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "lockdown-printing") +#define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINT_SETUP(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "lockdown-print-setup") +#define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_SAVE_TO_DISK(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "lockdown-save-to-disk") #define E_SHELL_WINDOW_ACTION_GROUP_NEW_ITEM(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "new-item") #define E_SHELL_WINDOW_ACTION_GROUP_NEW_SOURCE(window) \ diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index a33f7b7852..2c2ebc5564 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -195,6 +195,12 @@ e_shell_window_private_init (EShellWindow *shell_window) priv->new_source_actions = gtk_action_group_new ("new-source"); priv->custom_rule_actions = gtk_action_group_new ("custom-rules"); priv->switcher_actions = gtk_action_group_new ("switcher"); + priv->lockdown_printing = + gtk_action_group_new ("lockdown-printing"); + priv->lockdown_print_setup = + gtk_action_group_new ("lockdown-print-setup"); + priv->lockdown_save_to_disk = + gtk_action_group_new ("lockdown-save-to-disk"); priv->loaded_views = loaded_views; priv->active_view = "unknown"; priv->signal_handler_ids = signal_handler_ids; @@ -325,15 +331,41 @@ void e_shell_window_private_constructed (EShellWindow *shell_window) { EShellWindowPrivate *priv = shell_window->priv; + EShellSettings *shell_settings; + EShell *shell; GConfBridge *bridge; + GtkActionGroup *action_group; GObject *object; const gchar *key; + shell = e_shell_window_get_shell (shell_window); + shell_settings = e_shell_get_shell_settings (shell); + /* Create the switcher actions before we set the initial * shell view, because the shell view relies on them for * default settings during construction. */ e_shell_window_create_switcher_actions (shell_window); + /* Support lockdown. */ + + action_group = ACTION_GROUP (LOCKDOWN_PRINTING); + + e_binding_new_with_negation ( + G_OBJECT (shell_settings), "disable-printing", + G_OBJECT (action_group), "sensitive"); + + action_group = ACTION_GROUP (LOCKDOWN_PRINT_SETUP); + + e_binding_new_with_negation ( + G_OBJECT (shell_settings), "disable-print-setup", + G_OBJECT (action_group), "sensitive"); + + action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); + + e_binding_new_with_negation ( + G_OBJECT (shell_settings), "disable-save-to-disk", + G_OBJECT (action_group), "sensitive"); + /* Bind GObject properties to GConf keys. */ bridge = gconf_bridge_get (); @@ -398,6 +430,9 @@ e_shell_window_private_dispose (EShellWindow *shell_window) DISPOSE (priv->new_source_actions); DISPOSE (priv->custom_rule_actions); DISPOSE (priv->switcher_actions); + DISPOSE (priv->lockdown_printing); + DISPOSE (priv->lockdown_print_setup); + DISPOSE (priv->lockdown_save_to_disk); g_hash_table_remove_all (priv->loaded_views); diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h index ea69968344..ff8e5afcb2 100644 --- a/shell/e-shell-window-private.h +++ b/shell/e-shell-window-private.h @@ -28,6 +28,7 @@ #include <glib/gi18n.h> #include <e-util/e-util.h> +#include <e-util/e-binding.h> #include <e-util/gconf-bridge.h> #include <widgets/misc/e-menu-tool-button.h> #include <widgets/misc/e-online-button.h> @@ -75,6 +76,9 @@ struct _EShellWindowPrivate { GtkActionGroup *new_source_actions; GtkActionGroup *custom_rule_actions; GtkActionGroup *switcher_actions; + GtkActionGroup *lockdown_printing; + GtkActionGroup *lockdown_print_setup; + GtkActionGroup *lockdown_save_to_disk; guint custom_rule_merge_id; guint gal_view_merge_id; diff --git a/shell/e-shell.c b/shell/e-shell.c index f0dcaeb3f1..a2ac783cb8 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -72,6 +72,14 @@ enum { LAST_SIGNAL }; +enum { + DEBUG_KEY_SETTINGS = 1 << 0 +}; + +static GDebugKey debug_keys[] = { + { "settings", DEBUG_KEY_SETTINGS } +}; + EShell *default_shell = NULL; static gpointer parent_class; static guint signals[LAST_SIGNAL]; @@ -80,6 +88,19 @@ static guint signals[LAST_SIGNAL]; void e_shell_dbus_initialize (EShell *shell); #endif +static void +shell_parse_debug_string (EShell *shell) +{ + guint flags; + + flags = g_parse_debug_string ( + g_getenv ("EVOLUTION_DEBUG"), + debug_keys, G_N_ELEMENTS (debug_keys)); + + if (flags & DEBUG_KEY_SETTINGS) + e_shell_settings_enable_debug (shell->priv->settings); +} + static gboolean shell_window_delete_event_cb (EShell *shell, EShellWindow *shell_window) @@ -663,6 +684,40 @@ shell_class_init (EShellClass *class) 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + /* Install some desktop-wide settings. */ + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "disable-command-line", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "disable-printing", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "disable-print-setup", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "disable-save-to-disk", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); } static void @@ -687,9 +742,27 @@ shell_init (EShell *shell) e_file_lock_create (); + shell_parse_debug_string (shell); + g_signal_connect ( shell, "notify::online-mode", G_CALLBACK (shell_notify_online_mode_cb), NULL); + + e_shell_settings_bind_to_gconf ( + shell->priv->settings, "disable-command-line", + "/desktop/gnome/lockdown/disable_command_line"); + + e_shell_settings_bind_to_gconf ( + shell->priv->settings, "disable-printing", + "/desktop/gnome/lockdown/disable_printing"); + + e_shell_settings_bind_to_gconf ( + shell->priv->settings, "disable-print-setup", + "/desktop/gnome/lockdown/disable_print_setup"); + + e_shell_settings_bind_to_gconf ( + shell->priv->settings, "disable-save-to-disk", + "/desktop/gnome/lockdown/disable_save_to_disk"); } GType |