Mon May 23 00:22:41 2005 Jonathan Blandford <jrb@redhat.com>

        * glib/poppler-document.h: Add a permissions flag to the glib
        bindings.
parent 1f677e2f
Mon May 23 00:22:41 2005 Jonathan Blandford <jrb@redhat.com>
* glib/poppler-document.h: Add a permissions flag to the glib
bindings.
2005-05-21 Kristian Høgsberg <krh@redhat.com>
* glib/poppler-document.cc (poppler_ps_file_new): Fix off-by-one
......
......@@ -41,6 +41,7 @@ enum {
PROP_PAGE_LAYOUT,
PROP_PAGE_MODE,
PROP_VIEWER_PREFERENCES,
PROP_PERMISSIONS,
};
typedef struct _PopplerDocumentClass PopplerDocumentClass;
......@@ -274,6 +275,7 @@ poppler_document_get_property (GObject *object,
Object obj;
Catalog *catalog;
gchar *str;
guint flag;
switch (prop_id)
{
......@@ -323,6 +325,18 @@ poppler_document_get_property (GObject *object,
/* FIXME: write... */
g_value_set_flags (value, POPPLER_VIEWER_PREFERENCES_UNSET);
break;
case PROP_PERMISSIONS:
flag = 0;
if (document->doc->okToPrint ())
flag |= POPPLER_PERMISSIONS_OK_TO_PRINT;
if (document->doc->okToChange ())
flag |= POPPLER_PERMISSIONS_OK_TO_MODIFY;
if (document->doc->okToCopy ())
flag |= POPPLER_PERMISSIONS_OK_TO_COPY;
if (document->doc->okToAddNotes ())
flag |= POPPLER_PERMISSIONS_OK_TO_ADD_NOTES;
g_value_set_flags (value, flag);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
......@@ -410,6 +424,16 @@ poppler_document_class_init (PopplerDocumentClass *klass)
POPPLER_TYPE_VIEWER_PREFERENCES,
POPPLER_VIEWER_PREFERENCES_UNSET,
G_PARAM_READABLE));
g_object_class_install_property
(G_OBJECT_CLASS (klass),
PROP_PERMISSIONS,
g_param_spec_flags ("permissions",
"Permissions",
"Permissions",
POPPLER_TYPE_PERMISSIONS,
POPPLER_PERMISSIONS_FULL,
G_PARAM_READABLE));
}
static void
......
......@@ -66,13 +66,15 @@ typedef enum /*< flags >*/
typedef enum /*< flags >*/
{
POPPLER_PERMISSIONS_PRINT = 1 << 0,
POPPLER_PERMISSIONS_MODIFY = 1 << 1,
POPPLER_PERMISSIONS_COPY = 1 << 2,
POPPLER_PERMISSIONS_EXTRACT_TEXT = 1 << 3,
POPPLER_PERMISSIONS_ANNOTATIONS_AND_FORMS = 1 << 4,
POPPLER_PERMISSIONS_FORMS = 1 << 5,
POPPLER_PERMISSIONS_PRINT_LOW_QUALITY = 1 << 6,
POPPLER_PERMISSIONS_OK_TO_PRINT = 1 << 0,
POPPLER_PERMISSIONS_OK_TO_MODIFY = 1 << 1,
POPPLER_PERMISSIONS_OK_TO_COPY = 1 << 2,
POPPLER_PERMISSIONS_OK_TO_ADD_NOTES = 1 << 3,
POPPLER_PERMISSIONS_FULL = (POPPLER_PERMISSIONS_OK_TO_PRINT
| POPPLER_PERMISSIONS_OK_TO_MODIFY
| POPPLER_PERMISSIONS_OK_TO_COPY
| POPPLER_PERMISSIONS_OK_TO_ADD_NOTES),
} PopplerPermissions;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment