+2009-01-18 Tomeu Vizoso <tomeu@sugarlabs.org>
+
+ * libdocument/Makefile.am:
+ * libdocument/ev-document-info.h:
+ * libdocument/ev-document-type-builtins.c.template:
+ * libdocument/ev-document-type-builtins.h.template:
+ * libdocument/ev-document.c: (ev_document_info_get_type),
+ (ev_document_info_copy):
+
+ Make EvDocumentInfo and enums definded in ev-document-info.h
+ GTypes. Fixes bug #567789.
+
2009-01-18 Michal Vaner <vorner+evince@ucw.cz>
* shell/main.c (arguments_parse): Fix for a minor code typo.
ev-backends-manager.h \
ev-debug.h \
ev-document-factory.h \
+ ev-document-type-builtins.h \
ev-module.h
INST_H_FILES = \
ev-document-find.c \
ev-document-transition.c \
ev-document-forms.c \
+ ev-document-type-builtins.c \
ev-form-field.c \
ev-debug.c \
ev-file-exporter.c \
$(NOINST_H_FILES) \
$(INST_H_FILES)
+BUILT_SOURCES = \
+ ev-document-type-builtins.c \
+ ev-document-type-builtins.h
+CLEANFILES = $(BUILT_SOURCES)
+ev-document-type-builtins.h: stamp-ev-document-type-builtins.h
+ @true
+
+stamp-ev-document-type-builtins.h: ev-document-type-builtins.h.template ev-document-info.h
+ $(GLIB_MKENUMS) --template $< $(filter-out $<,$^) > xgen-etbh \
+ && (cmp -s xgen-etbh ev-document-type-builtins.h || cp xgen-etbh ev-document-type-builtins.h ) \
+ && rm -f xgen-etbh \
+ && echo timestamp > $(@F)
+
+ev-document-type-builtins.c: ev-document-type-builtins.c.template ev-document-info.h
+ $(GLIB_MKENUMS) --template $< $(filter-out $<,$^) > xgen-etbc \
+ && (cmp -s xgen-etbc ev-document-type-builtins.c || cp xgen-etbc ev-document-type-builtins.c ) \
+ && rm -f xgen-etbc
EV_DOCUMENT_LAYOUT_TWO_COLUMN_LEFT,
EV_DOCUMENT_LAYOUT_TWO_COLUMN_RIGHT,
EV_DOCUMENT_LAYOUT_TWO_PAGE_LEFT,
- EV_DOCUMENT_LAYOUT_TWO_PAGE_RIGHT,
+ EV_DOCUMENT_LAYOUT_TWO_PAGE_RIGHT
} EvDocumentLayout;
typedef enum
EV_DOCUMENT_UI_HINT_FIT_WINDOW = 1 << 3,
EV_DOCUMENT_UI_HINT_CENTER_WINDOW = 1 << 4,
EV_DOCUMENT_UI_HINT_DISPLAY_DOC_TITLE = 1 << 5,
- EV_DOCUMENT_UI_HINT_DIRECTION_RTL = 1 << 6,
+ EV_DOCUMENT_UI_HINT_DIRECTION_RTL = 1 << 6
} EvDocumentUIHints;
+/* This define is needed because glib-mkenums chokes with multiple lines */
+#define PERMISSIONS_FULL (EV_DOCUMENT_PERMISSIONS_OK_TO_PRINT \
+ | EV_DOCUMENT_PERMISSIONS_OK_TO_MODIFY \
+ | EV_DOCUMENT_PERMISSIONS_OK_TO_COPY \
+ | EV_DOCUMENT_PERMISSIONS_OK_TO_ADD_NOTES)
typedef enum
{
EV_DOCUMENT_PERMISSIONS_OK_TO_MODIFY = 1 << 1,
EV_DOCUMENT_PERMISSIONS_OK_TO_COPY = 1 << 2,
EV_DOCUMENT_PERMISSIONS_OK_TO_ADD_NOTES = 1 << 3,
- EV_DOCUMENT_PERMISSIONS_FULL = (EV_DOCUMENT_PERMISSIONS_OK_TO_PRINT
- | EV_DOCUMENT_PERMISSIONS_OK_TO_MODIFY
- | EV_DOCUMENT_PERMISSIONS_OK_TO_COPY
- | EV_DOCUMENT_PERMISSIONS_OK_TO_ADD_NOTES),
+ EV_DOCUMENT_PERMISSIONS_FULL = PERMISSIONS_FULL
} EvDocumentPermissions;
typedef enum
guint fields_mask;
};
-void ev_document_info_free (EvDocumentInfo *info);
+GType ev_document_info_get_type (void) G_GNUC_CONST;
+EvDocumentInfo *ev_document_info_copy (EvDocumentInfo *info);
+void ev_document_info_free (EvDocumentInfo *info);
G_END_DECLS
--- /dev/null
+/*** BEGIN file-header ***/
+#include "ev-document-type-builtins.h"
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+#include "@filename@"
+/*** END file-production ***/
+
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+ static volatile gsize g_define_type_id__volatile = 0;
+
+ if (g_once_init_enter (&g_define_type_id__volatile)) {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ GType g_define_type_id = \
+ g_@type@_register_static (/* g_intern_static_string */ ("@EnumName@"), values);
+
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+ }
+
+ return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+
+/*** END file-tail ***/
--- /dev/null
+/*** BEGIN file-header ***/
+
+#ifndef EV_DOCUMENT_TYPE_BUILTINS_H
+#define EV_DOCUMENT_TYPE_BUILTINS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define EV_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* !EV_DOCUMENT_TYPE_BUILTINS_H */
+/*** END file-tail ***/
return retval;
}
+/* EvDocumentInfo */
+GType
+ev_document_info_get_type (void)
+{
+ static GType type = 0;
+ if (type == 0)
+ type = g_boxed_type_register_static ("EvDocumentInfo",
+ (GBoxedCopyFunc)ev_document_info_copy,
+ (GBoxedFreeFunc)ev_document_info_free);
+ return type;
+}
+
+EvDocumentInfo *
+ev_document_info_copy (EvDocumentInfo *info)
+{
+ EvDocumentInfo *copy;
+
+ g_return_val_if_fail (info != NULL, NULL);
+
+ copy = g_new0 (EvDocumentInfo, 1);
+ copy->title = info->title ? g_strdup (info->title) : NULL;
+ copy->format = info->format ? g_strdup (info->format) : NULL;
+ copy->author = info->author ? g_strdup (info->author) : NULL;
+ copy->subject = info->subject ? g_strdup (info->subject) : NULL;
+ copy->keywords = info->keywords ? g_strdup (info->keywords) : NULL;
+ copy->security = info->security ? g_strdup (info->security) : NULL;
+ copy->creator = info->creator ? g_strdup (info->creator) : NULL;
+ copy->producer = info->producer ? g_strdup (info->producer) : NULL;
+ copy->linearized = info->linearized ? g_strdup (info->linearized) : NULL;
+
+ copy->creation_date = info->creation_date;
+ copy->modified_date = info->modified_date;
+ copy->layout = info->layout;
+ copy->mode = info->mode;
+ copy->ui_hints = info->ui_hints;
+ copy->permissions = info->permissions;
+ copy->n_pages = info->n_pages;
+ copy->fields_mask = info->fields_mask;
+
+ return copy;
+}
+
void
ev_document_info_free (EvDocumentInfo *info)
{