[gnome-latex/wip/misc] Implement LatexilaFactory class
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex/wip/misc] Implement LatexilaFactory class
- Date: Sun, 19 Apr 2020 17:48:25 +0000 (UTC)
commit 8958e20bab0ce3e2b64a88e358354c2d99fa042b
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Apr 19 19:33:54 2020 +0200
Implement LatexilaFactory class
To have a maximum of code in C.
docs/reference/gnome-latex-docs.xml | 1 +
docs/reference/gnome-latex-sections.txt | 15 ++++++++
po/POTFILES.in | 1 +
src/liblatexila/Makefile.am | 2 ++
src/liblatexila/latexila-factory.c | 64 +++++++++++++++++++++++++++++++++
src/liblatexila/latexila-factory.h | 53 +++++++++++++++++++++++++++
src/liblatexila/latexila.h | 1 +
7 files changed, 137 insertions(+)
---
diff --git a/docs/reference/gnome-latex-docs.xml b/docs/reference/gnome-latex-docs.xml
index b8be0fd..3b78d2f 100644
--- a/docs/reference/gnome-latex-docs.xml
+++ b/docs/reference/gnome-latex-docs.xml
@@ -14,6 +14,7 @@
<chapter>
<title>Main Classes</title>
+ <xi:include href="xml/factory.xml"/>
<xi:include href="xml/view.xml"/>
</chapter>
diff --git a/docs/reference/gnome-latex-sections.txt b/docs/reference/gnome-latex-sections.txt
index 4506187..9db4d71 100644
--- a/docs/reference/gnome-latex-sections.txt
+++ b/docs/reference/gnome-latex-sections.txt
@@ -130,6 +130,21 @@ LatexilaBuildViewPrivate
latexila_build_view_get_type
</SECTION>
+<SECTION>
+<FILE>factory</FILE>
+LatexilaFactory
+latexila_factory_new
+<SUBSECTION Standard>
+LATEXILA_FACTORY
+LATEXILA_FACTORY_CLASS
+LATEXILA_FACTORY_GET_CLASS
+LATEXILA_IS_FACTORY
+LATEXILA_IS_FACTORY_CLASS
+LATEXILA_TYPE_FACTORY
+LatexilaFactoryClass
+latexila_factory_get_type
+</SECTION>
+
<SECTION>
<FILE>latex-commands</FILE>
latexila_latex_commands_add_action_infos
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8c2bf9b..b8c5bb1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -31,6 +31,7 @@ src/liblatexila/latexila-build-tools.c
src/liblatexila/latexila-build-tools-default.c
src/liblatexila/latexila-build-tools-personal.c
src/liblatexila/latexila-build-view.c
+src/liblatexila/latexila-factory.c
src/liblatexila/latexila-latex-commands.c
src/liblatexila/latexila-post-processor-all-output.c
src/liblatexila/latexila-post-processor.c
diff --git a/src/liblatexila/Makefile.am b/src/liblatexila/Makefile.am
index cfb7629..2198f71 100644
--- a/src/liblatexila/Makefile.am
+++ b/src/liblatexila/Makefile.am
@@ -31,6 +31,7 @@ liblatexila_public_headers = \
latexila-build-tools-default.h \
latexila-build-tools-personal.h \
latexila-build-view.h \
+ latexila-factory.h \
latexila-latex-commands.h \
latexila-post-processor.h \
latexila-post-processor-all-output.h \
@@ -53,6 +54,7 @@ liblatexila_public_c_files = \
latexila-build-tools-default.c \
latexila-build-tools-personal.c \
latexila-build-view.c \
+ latexila-factory.c \
latexila-latex-commands.c \
latexila-post-processor.c \
latexila-post-processor-all-output.c \
diff --git a/src/liblatexila/latexila-factory.c b/src/liblatexila/latexila-factory.c
new file mode 100644
index 0000000..6269e15
--- /dev/null
+++ b/src/liblatexila/latexila-factory.c
@@ -0,0 +1,64 @@
+/*
+ * This file is part of GNOME LaTeX.
+ *
+ * Copyright (C) 2020 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * GNOME LaTeX 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.
+ *
+ * GNOME LaTeX 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 GNOME LaTeX. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "latexila-factory.h"
+
+/**
+ * SECTION:factory
+ * @title: LatexilaFactory
+ * @short_description: #TeplAbstractFactory subclass
+ *
+ * #LatexilaFactory is a #TeplAbstractFactory subclass to implement some virtual
+ * functions for the GNOME LaTeX application.
+ */
+
+G_DEFINE_TYPE (LatexilaFactory, latexila_factory, TEPL_TYPE_ABSTRACT_FACTORY)
+
+static GFile *
+latexila_factory_create_metadata_manager_file (TeplAbstractFactory *factory)
+{
+ return g_file_new_build_filename (g_get_user_data_dir (),
+ "gnome-latex",
+ "gnome-latex-metadata.xml",
+ NULL);
+}
+
+static void
+latexila_factory_class_init (LatexilaFactoryClass *klass)
+{
+ TeplAbstractFactoryClass *factory_class = TEPL_ABSTRACT_FACTORY_CLASS (klass);
+
+ factory_class->create_metadata_manager_file = latexila_factory_create_metadata_manager_file;
+}
+
+static void
+latexila_factory_init (LatexilaFactory *factory)
+{
+}
+
+/**
+ * latexila_factory_new:
+ *
+ * Returns: a new #LatexilaFactory object.
+ */
+LatexilaFactory *
+latexila_factory_new (void)
+{
+ return g_object_new (LATEXILA_TYPE_FACTORY, NULL);
+}
diff --git a/src/liblatexila/latexila-factory.h b/src/liblatexila/latexila-factory.h
new file mode 100644
index 0000000..687b7cb
--- /dev/null
+++ b/src/liblatexila/latexila-factory.h
@@ -0,0 +1,53 @@
+/*
+ * This file is part of GNOME LaTeX.
+ *
+ * Copyright (C) 2020 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * GNOME LaTeX 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.
+ *
+ * GNOME LaTeX 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 GNOME LaTeX. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LATEXILA_FACTORY_H
+#define LATEXILA_FACTORY_H
+
+#include <tepl/tepl.h>
+
+G_BEGIN_DECLS
+
+#define LATEXILA_TYPE_FACTORY (latexila_factory_get_type ())
+#define LATEXILA_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LATEXILA_TYPE_FACTORY,
LatexilaFactory))
+#define LATEXILA_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LATEXILA_TYPE_FACTORY,
LatexilaFactoryClass))
+#define LATEXILA_IS_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LATEXILA_TYPE_FACTORY))
+#define LATEXILA_IS_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LATEXILA_TYPE_FACTORY))
+#define LATEXILA_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LATEXILA_TYPE_FACTORY,
LatexilaFactoryClass))
+
+typedef struct _LatexilaFactory LatexilaFactory;
+typedef struct _LatexilaFactoryClass LatexilaFactoryClass;
+
+struct _LatexilaFactory
+{
+ TeplAbstractFactory parent;
+};
+
+struct _LatexilaFactoryClass
+{
+ TeplAbstractFactoryClass parent_class;
+};
+
+GType latexila_factory_get_type (void);
+
+LatexilaFactory * latexila_factory_new (void);
+
+G_END_DECLS
+
+#endif /* LATEXILA_FACTORY_H */
diff --git a/src/liblatexila/latexila.h b/src/liblatexila/latexila.h
index bbe12df..89c7134 100644
--- a/src/liblatexila/latexila.h
+++ b/src/liblatexila/latexila.h
@@ -33,6 +33,7 @@
#include "latexila-build-tools-default.h"
#include "latexila-build-tools-personal.h"
#include "latexila-build-view.h"
+#include "latexila-factory.h"
#include "latexila-latex-commands.h"
#include "latexila-post-processor.h"
#include "latexila-post-processor-all-output.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]