]> www.fi.muni.cz Git - evince.git/commitdiff
Allow the user to override document restrictions. Fix for bug 305818.
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Tue, 13 Sep 2005 13:57:08 +0000 (13:57 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Tue, 13 Sep 2005 13:57:08 +0000 (13:57 +0000)
* data/evince.schemas.in:
* shell/ev-window.c: (update_action_sensitivity):

Allow the user to override document restrictions. Fix for bug
305818.

ChangeLog
data/evince.schemas.in
shell/ev-window.c

index 9e13a501fc88238e1f73f150f6668af5564fd1df..807f3aa98fa37a2d07d3c395680c3f9a8b1d0031 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-09-13  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * 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  <chpe@cvs.gnome.org>
 
        * shell/ev-window.c: (ev_window_update_fullscreen_popup),
index 8b5fb33207f156783859cc3bcb223d460d7bc1c9..691415735ebbf96a69e625fa99c26bdba36acb8a 100644 (file)
         <long>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.</long>
       </locale>
     </schema>
+    <schema>
+      <key>/schemas/apps/evince/override_restrictions</key>
+      <applyto>/apps/evince/override_restrictions</applyto>
+      <owner>evince</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Override document restrictions</short>
+        <long>Override document restrictions, like restriction to copy or to print.</long>
+      </locale>
+    </schema>
   </schemalist>
 </gconfschemafile>
index 7cdea4cc63929df9aa8455a46b7f24e98f833eb6..ed10ada925e39e679118339076b929a5da196539 100644 (file)
@@ -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 */