summaryrefslogtreecommitdiff
path: root/libdocument
diff options
context:
space:
mode:
Diffstat (limited to 'libdocument')
-rw-r--r--libdocument/Makefile.am2
-rw-r--r--libdocument/ev-document-attachments.c1
-rw-r--r--libdocument/ev-document-factory.c4
-rw-r--r--libdocument/ev-document-fonts.h1
-rw-r--r--libdocument/ev-document-misc.c1
-rw-r--r--libdocument/ev-document-security.h1
-rw-r--r--libdocument/ev-document-text.c1
-rw-r--r--libdocument/ev-document.c1
-rw-r--r--libdocument/ev-document.h5
-rw-r--r--libdocument/ev-file-helpers.c87
-rw-r--r--libdocument/ev-file-helpers.h1
-rw-r--r--libdocument/ev-form-field.h1
-rw-r--r--libdocument/ev-image.h1
-rw-r--r--libdocument/ev-init.c7
-rw-r--r--libdocument/ev-render-context.h2
-rw-r--r--libdocument/ev-transition-effect.c2
-rw-r--r--libdocument/ev-transition-effect.h2
-rw-r--r--libdocument/meson.build172
18 files changed, 178 insertions, 114 deletions
diff --git a/libdocument/Makefile.am b/libdocument/Makefile.am
index d1db419c..fc81c891 100644
--- a/libdocument/Makefile.am
+++ b/libdocument/Makefile.am
@@ -168,7 +168,7 @@ AtrilDocument-$(EV_API_VERSION).gir: libatrildocument.la Makefile $(INST_H_FILES
--include=Gdk-3.0 \
--include=GdkPixbuf-2.0 \
--include=Gtk-3.0 \
- --library=atrildocument \
+ --library=libatrildocument.la \
--libtool="$(LIBTOOL)" \
--output $@ \
--pkg atril-document-$(EV_API_VERSION) \
diff --git a/libdocument/ev-document-attachments.c b/libdocument/ev-document-attachments.c
index 6b1b695f..cdc840d5 100644
--- a/libdocument/ev-document-attachments.c
+++ b/libdocument/ev-document-attachments.c
@@ -52,4 +52,3 @@ ev_document_attachments_get_attachments (EvDocumentAttachments *document_attachm
return iface->get_attachments (document_attachments);
}
-
diff --git a/libdocument/ev-document-factory.c b/libdocument/ev-document-factory.c
index b1454c64..4d07f065 100644
--- a/libdocument/ev-document-factory.c
+++ b/libdocument/ev-document-factory.c
@@ -106,7 +106,6 @@ get_compression_from_mime_type (const gchar *mime_type)
return EV_COMPRESSION_NONE;
}
-
/*
* get_document_from_uri:
* @uri: the document URI
@@ -384,8 +383,7 @@ ev_document_factory_add_filters (GtkWidget *chooser, EvDocument *document)
}
}
- g_list_foreach (all_types, (GFunc)g_free, NULL);
- g_list_free (all_types);
+ g_list_free_full (all_types, g_free);
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All Files"));
diff --git a/libdocument/ev-document-fonts.h b/libdocument/ev-document-fonts.h
index 6251644a..bd5d4220 100644
--- a/libdocument/ev-document-fonts.h
+++ b/libdocument/ev-document-fonts.h
@@ -37,7 +37,6 @@
G_BEGIN_DECLS
-
#define EV_TYPE_DOCUMENT_FONTS (ev_document_fonts_get_type ())
#define EV_DOCUMENT_FONTS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_FONTS, EvDocumentFonts))
#define EV_DOCUMENT_FONTS_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_FONTS, EvDocumentFontsInterface))
diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c
index 80948936..06dce9c5 100644
--- a/libdocument/ev-document-misc.c
+++ b/libdocument/ev-document-misc.c
@@ -149,7 +149,6 @@ ev_document_misc_get_page_border_size (gint page_width,
}
}
-
void
ev_document_misc_paint_one_page (cairo_t *cr,
GtkWidget *widget,
diff --git a/libdocument/ev-document-security.h b/libdocument/ev-document-security.h
index 1f411562..beef49af 100644
--- a/libdocument/ev-document-security.h
+++ b/libdocument/ev-document-security.h
@@ -35,7 +35,6 @@
G_BEGIN_DECLS
-
#define EV_TYPE_DOCUMENT_SECURITY (ev_document_security_get_type ())
#define EV_DOCUMENT_SECURITY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_SECURITY, EvDocumentSecurity))
#define EV_DOCUMENT_SECURITY_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_SECURITY, EvDocumentSecurityInterface))
diff --git a/libdocument/ev-document-text.c b/libdocument/ev-document-text.c
index 8fdc916c..072782f6 100644
--- a/libdocument/ev-document-text.c
+++ b/libdocument/ev-document-text.c
@@ -42,7 +42,6 @@ ev_document_text_get_text (EvDocumentText *document_text,
return iface->get_text (document_text, page);
}
-
gboolean
ev_document_text_get_text_layout (EvDocumentText *document_text,
EvPage *page,
diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c
index f7c87895..96b80946 100644
--- a/libdocument/ev-document.c
+++ b/libdocument/ev-document.c
@@ -388,7 +388,6 @@ ev_document_get_page (EvDocument *document,
return klass->get_page (document, index);
}
-
#ifdef ENABLE_SYNCTEX
static gboolean
_ev_document_support_synctex (EvDocument *document)
diff --git a/libdocument/ev-document.h b/libdocument/ev-document.h
index 7fb1bf2f..ea0016c0 100644
--- a/libdocument/ev-document.h
+++ b/libdocument/ev-document.h
@@ -56,6 +56,7 @@ typedef struct _EvDocumentPrivate EvDocumentPrivate;
typedef enum
{
EV_DOCUMENT_ERROR_INVALID,
+ EV_DOCUMENT_ERROR_UNSUPPORTED_CONTENT,
EV_DOCUMENT_ERROR_ENCRYPTED
} EvDocumentError;
@@ -277,10 +278,6 @@ register_atril_backend (GTypeModule *module) \
(GInstanceInitFunc) backend_name##_init \
}; \
\
- /* Initialise the i18n stuff */ \
- bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); \
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \
- \
g_define_type_id = g_type_module_register_type (module, \
EV_TYPE_DOCUMENT, \
#BackendName, \
diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c
index 9b22e93a..f077e9fc 100644
--- a/libdocument/ev-file-helpers.c
+++ b/libdocument/ev-file-helpers.c
@@ -197,91 +197,6 @@ ev_mkstemp_file (const char *template,
}
/**
- * This function is copied from
- * http://bugzilla.gnome.org/show_bug.cgi?id=524831
- * and renamed from g_mkdtemp to _ev_g_mkdtemp.
- *
- * If/when this function gets added to glib, it can be removed from
- * atril' sources.
- *
- *
- * g_mkdtemp:
- * @tmpl: template directory name
- *
- * Creates a temporary directory. See the mkdtemp() documentation
- * on most UNIX-like systems.
- *
- * The parameter is a string that should follow the rules for
- * mkdtemp() templates, i.e. contain the string "XXXXXX". g_mkdtemp()
- * is slightly more flexible than mkdtemp() in that the sequence does
- * not have to occur at the very end of the template. The X string
- * will be modified to form the name of a directory that didn't
- * already exist. The string should be in the GLib file name
- * encoding. Most importantly, on Windows it should be in UTF-8.
- *
- * Return value: If a temporary directory was successfully created,
- * @tmpl will be returned with the XXXXXX string modified in such a
- * way as to make the path unique. In case of errors, %NULL is
- * returned.
- */
-static gchar *
-_ev_g_mkdtemp (gchar *tmpl)
-{
- static const char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- static const int NLETTERS = sizeof (letters) - 1;
- static int counter = 0;
- char *XXXXXX;
- GTimeVal tv;
- glong value;
- int count;
-
- /* find the last occurrence of "XXXXXX" */
- XXXXXX = g_strrstr (tmpl, "XXXXXX");
-
- if (!XXXXXX || strncmp (XXXXXX, "XXXXXX", 6))
- {
- errno = EINVAL;
- return NULL;
- }
-
- /* Get some more or less random data. */
- g_get_current_time (&tv);
- value = (tv.tv_usec ^ tv.tv_sec) + counter++;
-
- for (count = 0; count < 100; value += 7777, ++count)
- {
- glong v = value;
-
- /* Fill in the random bits. */
- XXXXXX[0] = letters[v % NLETTERS];
- v /= NLETTERS;
- XXXXXX[1] = letters[v % NLETTERS];
- v /= NLETTERS;
- XXXXXX[2] = letters[v % NLETTERS];
- v /= NLETTERS;
- XXXXXX[3] = letters[v % NLETTERS];
- v /= NLETTERS;
- XXXXXX[4] = letters[v % NLETTERS];
- v /= NLETTERS;
- XXXXXX[5] = letters[v % NLETTERS];
-
- /* tmpl is in UTF-8 on Windows, thus use g_mkdir() */
- if (g_mkdir (tmpl, 0700) == 0)
- return tmpl;
-
- if (errno != EEXIST)
- /* Any other error will apply also to other names we might
- * try, and there are 2^32 or so of them, so give up now.
- */
- return NULL;
- }
-
- /* We got out of the loop because we ran out of combinations to try. */
- errno = EEXIST;
- return NULL;
-}
-
-/**
* ev_mkdtemp:
* @template: a template string; must end in 'XXXXXX'
* @error: a location to store a #GError
@@ -302,7 +217,7 @@ ev_mkdtemp (const char *template,
return NULL;
name = g_build_filename (tmp, template, NULL);
- if (_ev_g_mkdtemp (name) == NULL) {
+ if (g_mkdtemp (name) == NULL) {
int errsv = errno;
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv),
diff --git a/libdocument/ev-file-helpers.h b/libdocument/ev-file-helpers.h
index 0a6ff7e0..d55ef267 100644
--- a/libdocument/ev-file-helpers.h
+++ b/libdocument/ev-file-helpers.h
@@ -66,7 +66,6 @@ gchar *ev_file_compress (const gchar *uri,
EvCompressionType type,
GError **error);
-
G_END_DECLS
#endif /* EV_FILE_HELPERS_H */
diff --git a/libdocument/ev-form-field.h b/libdocument/ev-form-field.h
index c0795463..45db85d9 100644
--- a/libdocument/ev-form-field.h
+++ b/libdocument/ev-form-field.h
@@ -209,7 +209,6 @@ EvFormField *ev_form_field_choice_new (gint id,
GType ev_form_field_signature_get_type (void) G_GNUC_CONST;
EvFormField *ev_form_field_signature_new (gint id);
-
G_END_DECLS
#endif /* !EV_FORM_FIELD_H */
diff --git a/libdocument/ev-image.h b/libdocument/ev-image.h
index 738b7fd5..899d502f 100644
--- a/libdocument/ev-image.h
+++ b/libdocument/ev-image.h
@@ -62,7 +62,6 @@ const gchar *ev_image_save_tmp (EvImage *image,
GdkPixbuf *pixbuf);
const gchar *ev_image_get_tmp_uri (EvImage *image);
-
G_END_DECLS
#endif /* __EV_IMAGE_H__ */
diff --git a/libdocument/ev-init.c b/libdocument/ev-init.c
index 15cb555e..21aca668 100644
--- a/libdocument/ev-init.c
+++ b/libdocument/ev-init.c
@@ -38,8 +38,7 @@ ev_get_locale_dir (void)
/**
* ev_init:
*
- * Initializes the atril document library, and binds the atril
- * gettext domain.
+ * Initializes the atril document library.
*
* You must call this before calling any other function in the atril
* document library.
@@ -54,10 +53,6 @@ ev_init (void)
if (ev_init_count++ > 0)
return have_backends;
- /* set up translation catalog */
- bindtextdomain (GETTEXT_PACKAGE, ev_get_locale_dir ());
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
_ev_debug_init ();
_ev_file_helpers_init ();
have_backends = _ev_backends_manager_init ();
diff --git a/libdocument/ev-render-context.h b/libdocument/ev-render-context.h
index 4366842d..e071cb01 100644
--- a/libdocument/ev-render-context.h
+++ b/libdocument/ev-render-context.h
@@ -52,7 +52,6 @@ struct _EvRenderContext
gdouble scale;
};
-
GType ev_render_context_get_type (void) G_GNUC_CONST;
EvRenderContext *ev_render_context_new (EvPage *page,
gint rotation,
@@ -64,7 +63,6 @@ void ev_render_context_set_rotation (EvRenderContext *rc,
void ev_render_context_set_scale (EvRenderContext *rc,
gdouble scale);
-
G_END_DECLS
#endif /* !EV_RENDER_CONTEXT */
diff --git a/libdocument/ev-transition-effect.c b/libdocument/ev-transition-effect.c
index ce6798f4..b521ff91 100644
--- a/libdocument/ev-transition-effect.c
+++ b/libdocument/ev-transition-effect.c
@@ -81,7 +81,7 @@ ev_transition_effect_set_property (GObject *object,
priv->scale = g_value_get_double (value);
break;
case PROP_RECTANGULAR:
- priv->rectangular = g_value_get_boolean (value);
+ priv->rectangular = (g_value_get_boolean (value) != FALSE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/libdocument/ev-transition-effect.h b/libdocument/ev-transition-effect.h
index b9d00c0b..5cb91dd1 100644
--- a/libdocument/ev-transition-effect.h
+++ b/libdocument/ev-transition-effect.h
@@ -61,7 +61,6 @@ typedef enum {
EV_TRANSITION_DIRECTION_OUTWARD
} EvTransitionEffectDirection;
-
typedef struct EvTransitionEffect EvTransitionEffect;
typedef struct EvTransitionEffectClass EvTransitionEffectClass;
@@ -75,7 +74,6 @@ struct EvTransitionEffectClass
GObjectClass parent_class;
};
-
GType ev_transition_effect_get_type (void) G_GNUC_CONST;
EvTransitionEffect *ev_transition_effect_new (EvTransitionEffectType type,
diff --git a/libdocument/meson.build b/libdocument/meson.build
new file mode 100644
index 00000000..b19242e3
--- /dev/null
+++ b/libdocument/meson.build
@@ -0,0 +1,172 @@
+libdocument_private_headers = [
+ 'ev-debug.h',
+ 'ev-module.h'
+]
+
+libdocument_headers = [
+ 'ev-annotation.h',
+ 'ev-async-renderer.h',
+ 'ev-attachment.h',
+ 'ev-backends-manager.h',
+ 'ev-document-factory.h',
+ 'ev-document-annotations.h',
+ 'ev-document-attachments.h',
+ 'ev-document-find.h',
+ 'ev-document-fonts.h',
+ 'ev-document-forms.h',
+ 'ev-document.h',
+ 'ev-document-images.h',
+ 'ev-document-info.h',
+ 'ev-document-layers.h',
+ 'ev-document-links.h',
+ 'ev-document-misc.h',
+ 'ev-document-print.h',
+ 'ev-document-security.h',
+ 'ev-document-thumbnails.h',
+ 'ev-document-transition.h',
+ 'ev-document-text.h',
+ 'ev-file-exporter.h',
+ 'ev-file-helpers.h',
+ 'ev-form-field.h',
+ 'ev-image.h',
+ 'ev-init.h',
+ 'ev-layer.h',
+ 'ev-link-action.h',
+ 'ev-link-dest.h',
+ 'ev-link.h',
+ 'ev-macros.h',
+ 'ev-mapping-list.h',
+ 'ev-page.h',
+ 'ev-render-context.h',
+ 'ev-selection.h',
+ 'ev-transition-effect.h',
+]
+
+libdocument_sources = [
+ 'ev-annotation.c',
+ 'ev-async-renderer.c',
+ 'ev-attachment.c',
+ 'ev-backends-manager.c',
+ 'ev-layer.c',
+ 'ev-link.c',
+ 'ev-link-action.c',
+ 'ev-link-dest.c',
+ 'ev-image.c',
+ 'ev-init.c',
+ 'ev-document.c',
+ 'ev-document-annotations.c',
+ 'ev-document-attachments.c',
+ 'ev-document-factory.c',
+ 'ev-document-thumbnails.c',
+ 'ev-document-fonts.c',
+ 'ev-document-layers.c',
+ 'ev-document-links.c',
+ 'ev-document-images.c',
+ 'ev-document-print.c',
+ 'ev-document-security.c',
+ 'ev-document-find.c',
+ 'ev-document-transition.c',
+ 'ev-document-forms.c',
+ 'ev-document-text.c',
+ 'ev-form-field.c',
+ 'ev-debug.c',
+ 'ev-file-exporter.c',
+ 'ev-file-helpers.c',
+ 'ev-mapping-list.c',
+ 'ev-module.c',
+ 'ev-page.c',
+ 'ev-render-context.c',
+ 'ev-selection.c',
+ 'ev-transition-effect.c',
+ 'ev-document-misc.c',
+ libdocument_headers,
+]
+
+libdoc_header_dir = join_paths(header_dir, 'libdocument')
+
+libdoc_include = include_directories('.')
+
+libdoc_enums = gnome.mkenums(
+ 'ev-document-type-builtins',
+ sources : libdocument_headers,
+ c_template : 'ev-document-type-builtins.c.template',
+ h_template : 'ev-document-type-builtins.h.template',
+ identifier_prefix : 'Ev',
+ symbol_prefix : 'ev',
+ install_header: true,
+ install_dir: join_paths(includedir, libdoc_header_dir),
+)
+
+libdocument_sources += libdoc_enums
+
+libdoc_version_conf = configuration_data()
+libdoc_version_conf.set('EV_MAJOR_VERSION', major_version)
+libdoc_version_conf.set('EV_MINOR_VERSION', minor_version)
+libdoc_version_conf.set('EV_MICRO_VERSION', micro_version)
+
+libdoc_version = configure_file(
+ input: 'ev-version.h.in',
+ output: 'ev-version.h',
+ configuration: libdoc_version_conf,
+ install: true,
+ install_dir: join_paths(includedir, libdoc_header_dir),
+)
+
+libdocument_sources += libdoc_version
+
+libdocument_deps = [
+ config_h,
+ cairo,
+ glib,
+ gmodule,
+ gtk,
+ math,
+]
+
+libdocument = library(
+ 'document',
+ libdocument_private_headers + libdocument_sources,
+ dependencies: libdocument_deps,
+ include_directories: include_root,
+ soversion: binary_major_version,
+ version: binary_version,
+ install: true,
+)
+
+# this is needed so targets that depend on generated headers can do so
+libdocument_dep = declare_dependency(
+ link_with: libdocument,
+ dependencies: libdocument_deps,
+ include_directories: include_root,
+ sources: libdoc_enums[1]
+)
+
+install_headers(
+ libdocument_headers,
+ subdir: libdoc_header_dir,
+)
+
+if get_option('introspection')
+ introspection_includes = [
+ 'Gdk-3.0',
+ 'GdkPixbuf-2.0',
+ 'Gio-2.0',
+ 'GLib-2.0',
+ 'GObject-2.0',
+ 'Gtk-3.0',
+ ]
+
+ libdocument_gir = gnome.generate_gir(
+ libdocument,
+ namespace: 'AtrilDocument',
+ nsversion: api_version,
+ sources: libdocument_sources,
+ identifier_prefix: 'Ev',
+ symbol_prefix: 'ev',
+ includes: introspection_includes,
+ install: true,
+ install_dir_typelib: join_paths(libdir, 'girepository-1.0'),
+ install_dir_gir: join_paths(datadir, 'gir-1.0'),
+ export_packages: 'libdocument-' + api_version,
+ )
+endif