[latexila/wip/build-tools-revamp] LatexilaSynctex (not finished)



commit a826d8603fcad97f07a8af76ba81a20311fbe6b7
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat May 17 01:25:32 2014 +0200

    LatexilaSynctex (not finished)
    
    It is needed for the build tools for opening a PDF file with synctex
    support with evince. Since I don't want to use the Vala code in C, a
    rewrite of synctex.vala in C was needed.
    
    synctex.vala uses the synchronous API, which is bad. The rewrite in C
    uses the asynchronous API (it's better).

 configure.ac                       |    2 +
 src/Makefile.am                    |    2 +-
 src/evince/Makefile.am             |   22 ++++++++++++++
 src/evince/evince-gdbus.xml        |   30 +++++++++++++++++++
 src/liblatexila/Makefile.am        |   28 ++++++++++++------
 src/liblatexila/latexila-synctex.c |   56 ++++++++++++++++++++++++++++++++++++
 src/liblatexila/latexila-synctex.h |   54 ++++++++++++++++++++++++++++++++++
 src/liblatexila/latexila.h         |    1 +
 8 files changed, 185 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 07a1342..d420cc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,7 @@ AC_PROG_INSTALL
 AM_PROG_CC_C_O
 AC_PATH_PROG([GLIB_COMPILE_RESOURCES], [glib-compile-resources])
 AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])
+AC_PATH_PROG([GDBUS_CODEGEN], [gdbus-codegen])
 AM_PROG_VALAC([${VALA_REQUIRED_VERSION}],
               [found_vala=true]
              [found_vala=false])
@@ -168,6 +169,7 @@ AC_CONFIG_FILES([Makefile
                 man/Makefile
                 po/Makefile.in
                  src/Makefile
+                src/evince/Makefile
                 src/gedit/Makefile
                 src/liblatexila/Makefile
                 src/ui/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 508fd87..92f905e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = gedit liblatexila ui
+SUBDIRS = evince gedit liblatexila ui
 
 bin_PROGRAMS = latexila
 
diff --git a/src/evince/Makefile.am b/src/evince/Makefile.am
new file mode 100644
index 0000000..b787b83
--- /dev/null
+++ b/src/evince/Makefile.am
@@ -0,0 +1,22 @@
+noinst_LTLIBRARIES = libevince.la
+
+libevince_la_CFLAGS = $(WARN_CFLAGS)
+
+libevince_built_sources =              \
+       evince-gdbus-generated.c        \
+       evince-gdbus-generated.h
+
+nodist_libevince_la_SOURCES = $(libevince_built_sources)
+
+BUILT_SOURCES = $(libevince_built_sources)
+
+evince-gdbus-generated.c evince-gdbus-generated.h: evince-gdbus.xml Makefile
+       $(AM_V_GEN) $(GDBUS_CODEGEN) \
+                       --interface-prefix=org.gnome.evince. \
+                       --c-namespace=Evince \
+                       --generate-c-code evince-gdbus-generated \
+                       evince-gdbus.xml
+
+EXTRA_DIST = evince-gdbus.xml
+
+-include $(top_srcdir)/git.mk
diff --git a/src/evince/evince-gdbus.xml b/src/evince/evince-gdbus.xml
new file mode 100644
index 0000000..0da995f
--- /dev/null
+++ b/src/evince/evince-gdbus.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Introspection 0.1//EN"
+                      "http://www.freedesktop.org/software/dbus/introspection.dtd";>
+<node>
+  <interface name="org.gnome.evince.Daemon">
+    <method name="FindDocument">
+      <arg type="s" name="uri" direction="in"/>
+      <arg type="b" name="spawn" direction="in"/>
+      <arg type="s" name="owner" direction="out"/>
+    </method>
+  </interface>
+  <interface name='org.gnome.evince.Application'>
+    <method name='GetWindowList'>
+      <arg type='ao' name='window_list' direction='out'/>
+    </method>
+  </interface>
+  <interface name='org.gnome.evince.Window'>
+    <method name='SyncView'>
+      <arg type='s' name='source_file' direction='in'/>
+      <arg type='(ii)' name='source_point' direction='in'/>
+      <arg type='u' name='timestamp' direction='in'/>
+    </method>
+    <signal name='SyncSource'>
+      <arg type='s' name='source_file' direction='out'/>
+      <arg type='(ii)' name='source_point' direction='out'/>
+      <arg type='u' name='timestamp' direction='out'/>
+    </signal>
+    <signal name='Closed'/>
+  </interface>
+</node>
diff --git a/src/liblatexila/Makefile.am b/src/liblatexila/Makefile.am
index 538c4e5..f971b79 100644
--- a/src/liblatexila/Makefile.am
+++ b/src/liblatexila/Makefile.am
@@ -4,8 +4,10 @@ noinst_LTLIBRARIES = liblatexila.la
 
 liblatexila_la_CFLAGS = $(WARN_CFLAGS) $(CODE_COVERAGE_CFLAGS)
 liblatexila_la_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
+liblatexila_la_LIBADD = ../evince/libevince.la
 
 liblatexila_headers =                          \
+       latexila.h                              \
        latexila-build-job.h                    \
        latexila-build-tool.h                   \
        latexila-build-tools.h                  \
@@ -14,14 +16,11 @@ liblatexila_headers =                               \
        latexila-build-view.h                   \
        latexila-post-processor.h               \
        latexila-post-processor-all-output.h    \
+       latexila-synctex.h                      \
        latexila-types.h                        \
        latexila-utils.h
 
-BUILT_SOURCES =                        \
-       latexila-enum-types.c   \
-       latexila-enum-types.h
-
-liblatexila_la_SOURCES =                       \
+liblatexila_sources =                          \
        latexila-build-job.c                    \
        latexila-build-tool.c                   \
        latexila-build-tools.c                  \
@@ -30,9 +29,20 @@ liblatexila_la_SOURCES =                     \
        latexila-build-view.c                   \
        latexila-post-processor.c               \
        latexila-post-processor-all-output.c    \
-       latexila-utils.c                        \
-       $(liblatexila_headers)                  \
-       $(BUILT_SOURCES)
+       latexila-synctex.c                      \
+       latexila-utils.c
+
+liblatexila_built_sources =    \
+       latexila-enum-types.c   \
+       latexila-enum-types.h
+
+liblatexila_la_SOURCES =               \
+       $(liblatexila_headers)          \
+       $(liblatexila_sources)
+
+nodist_liblatexila_la_SOURCES = $(liblatexila_built_sources)
+
+BUILT_SOURCES = $(liblatexila_built_sources)
 
 ENUM_TYPES = $(liblatexila_headers)
 
@@ -64,7 +74,7 @@ Latexila.gir: liblatexila.la
 Latexila_gir_NAMESPACE = Latexila
 Latexila_gir_INCLUDES = Gtk-3.0
 Latexila_gir_LIBS = liblatexila.la
-Latexila_gir_FILES = $(liblatexila_la_SOURCES)
+Latexila_gir_FILES = $(liblatexila_la_SOURCES) $(nodist_liblatexila_la_SOURCES)
 
 noinst_DATA += Latexila.gir Latexila.typelib
 CLEANFILES += Latexila.gir Latexila.typelib
diff --git a/src/liblatexila/latexila-synctex.c b/src/liblatexila/latexila-synctex.c
new file mode 100644
index 0000000..540b69b
--- /dev/null
+++ b/src/liblatexila/latexila-synctex.c
@@ -0,0 +1,56 @@
+/*
+ * This file is part of LaTeXila.
+ *
+ * Copyright (C) 2014 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * LaTeXila is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LaTeXila is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "latexila-synctex.h"
+
+struct _LatexilaSynctexPrivate
+{
+  gint something;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (LatexilaSynctex, latexila_synctex, G_TYPE_OBJECT)
+
+static void
+latexila_synctex_dispose (GObject *object)
+{
+
+  G_OBJECT_CLASS (latexila_synctex_parent_class)->dispose (object);
+}
+
+static void
+latexila_synctex_finalize (GObject *object)
+{
+
+  G_OBJECT_CLASS (latexila_synctex_parent_class)->finalize (object);
+}
+
+static void
+latexila_synctex_class_init (LatexilaSynctexClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->dispose = latexila_synctex_dispose;
+  object_class->finalize = latexila_synctex_finalize;
+}
+
+static void
+latexila_synctex_init (LatexilaSynctex *self)
+{
+  self->priv = latexila_synctex_get_instance_private (self);
+}
diff --git a/src/liblatexila/latexila-synctex.h b/src/liblatexila/latexila-synctex.h
new file mode 100644
index 0000000..e362856
--- /dev/null
+++ b/src/liblatexila/latexila-synctex.h
@@ -0,0 +1,54 @@
+/*
+ * This file is part of LaTeXila.
+ *
+ * Copyright (C) 2014 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * LaTeXila is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LaTeXila is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __LATEXILA_SYNCTEX_H__
+#define __LATEXILA_SYNCTEX_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define LATEXILA_TYPE_SYNCTEX             (latexila_synctex_get_type ())
+#define LATEXILA_SYNCTEX(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), LATEXILA_TYPE_SYNCTEX, 
LatexilaSynctex))
+#define LATEXILA_SYNCTEX_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), LATEXILA_TYPE_SYNCTEX, 
LatexilaSynctexClass))
+#define LATEXILA_IS_SYNCTEX(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LATEXILA_TYPE_SYNCTEX))
+#define LATEXILA_IS_SYNCTEX_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), LATEXILA_TYPE_SYNCTEX))
+#define LATEXILA_SYNCTEX_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), LATEXILA_TYPE_SYNCTEX, 
LatexilaSynctexClass))
+
+typedef struct _LatexilaSynctex        LatexilaSynctex;
+typedef struct _LatexilaSynctexClass   LatexilaSynctexClass;
+typedef struct _LatexilaSynctexPrivate LatexilaSynctexPrivate;
+
+struct _LatexilaSynctex
+{
+  GObject parent;
+
+  LatexilaSynctexPrivate *priv;
+};
+
+struct _LatexilaSynctexClass
+{
+  GObjectClass parent_class;
+};
+
+GType latexila_synctex_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __LATEXILA_SYNCTEX_H__ */
diff --git a/src/liblatexila/latexila.h b/src/liblatexila/latexila.h
index 0d799f0..a200ab9 100644
--- a/src/liblatexila/latexila.h
+++ b/src/liblatexila/latexila.h
@@ -31,6 +31,7 @@
 #include "latexila-build-view.h"
 #include "latexila-post-processor.h"
 #include "latexila-post-processor-all-output.h"
+#include "latexila-synctex.h"
 #include "latexila-utils.h"
 
 #endif /* __LATEXILA_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]