From e69764da3aebb5017080dbe59747e2983e3a9788 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 13 Sep 2005 13:57:08 +0000 Subject: [PATCH] Allow the user to override document restrictions. Fix for bug 305818. * data/evince.schemas.in: * shell/ev-window.c: (update_action_sensitivity): Allow the user to override document restrictions. Fix for bug 305818. --- ChangeLog | 8 ++++++++ data/evince.schemas.in | 11 +++++++++++ shell/ev-window.c | 18 ++++++++++++------ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e13a501..807f3aa9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-09-13 Nickolay V. Shmyrev + + * data/evince.schemas.in: + * shell/ev-window.c: (update_action_sensitivity): + + Allow the user to override document restrictions. Fix for bug + 305818. + 2005-09-13 Christian Persch * shell/ev-window.c: (ev_window_update_fullscreen_popup), diff --git a/data/evince.schemas.in b/data/evince.schemas.in index 8b5fb332..69141573 100644 --- a/data/evince.schemas.in +++ b/data/evince.schemas.in @@ -11,5 +11,16 @@ Toolbar is the top bar that contains navigation and zoom controls. Two boolean options, true makes toolbar visible by default while false makes toolbar not visible by default. + + /schemas/apps/evince/override_restrictions + /apps/evince/override_restrictions + evince + bool + false + + Override document restrictions + Override document restrictions, like restriction to copy or to print. + + diff --git a/shell/ev-window.c b/shell/ev-window.c index 7cdea4cc..ed10ada9 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -148,9 +148,10 @@ static const GtkTargetEntry ev_drop_types[] = { #define PAGE_SELECTOR_ACTION "PageSelector" #define ZOOM_CONTROL_ACTION "ViewZoom" -#define GCONF_CHROME_TOOLBAR "/apps/evince/show_toolbar" -#define GCONF_LOCKDOWN_SAVE "/desktop/gnome/lockdown/disable_save_to_disk" -#define GCONF_LOCKDOWN_PRINT "/desktop/gnome/lockdown/disable_printing" +#define GCONF_CHROME_TOOLBAR "/apps/evince/show_toolbar" +#define GCONF_OVERRIDE_RESTRICTIONS "/apps/evince/override_restrictions" +#define GCONF_LOCKDOWN_SAVE "/desktop/gnome/lockdown/disable_save_to_disk" +#define GCONF_LOCKDOWN_PRINT "/desktop/gnome/lockdown/disable_printing" #define SIDEBAR_DEFAULT_SIZE 132 #define LINKS_SIDEBAR_ID "links" @@ -211,6 +212,7 @@ update_action_sensitivity (EvWindow *ev_window) gboolean ok_to_print = TRUE; gboolean ok_to_copy = TRUE; gboolean has_properties = TRUE; + gboolean override_restrictions = FALSE; GConfClient *client; view = EV_VIEW (ev_window->priv->view); @@ -229,7 +231,11 @@ update_action_sensitivity (EvWindow *ev_window) has_pages = has_document && n_pages > 0; } - if (info && info->fields_mask & EV_DOCUMENT_INFO_PERMISSIONS) { + client = gconf_client_get_default (); + override_restrictions = gconf_client_get_bool (client, + GCONF_OVERRIDE_RESTRICTIONS, + NULL); + if (!override_restrictions && info && info->fields_mask & EV_DOCUMENT_INFO_PERMISSIONS) { ok_to_print = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_PRINT); ok_to_copy = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_COPY); } @@ -241,8 +247,6 @@ update_action_sensitivity (EvWindow *ev_window) has_properties = FALSE; } - client = gconf_client_get_default (); - if (gconf_client_get_bool (client, GCONF_LOCKDOWN_SAVE, NULL)) { ok_to_copy = FALSE; } @@ -250,6 +254,8 @@ update_action_sensitivity (EvWindow *ev_window) if (gconf_client_get_bool (client, GCONF_LOCKDOWN_PRINT, NULL)) { ok_to_print = FALSE; } + + g_object_unref (client); /* File menu */ /* "FileOpen": always sensitive */ -- 2.43.5