[gnome-photos/gnome-3-30] Remove unused GTypes for enums, and declarations from the thumbnailer
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/gnome-3-30] Remove unused GTypes for enums, and declarations from the thumbnailer
- Date: Wed, 3 Oct 2018 09:19:57 +0000 (UTC)
commit 03be033628e0140109fcb8d19b5e5552d7cb5308
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Oct 2 13:34:37 2018 +0200
Remove unused GTypes for enums, and declarations from the thumbnailer
... by splitting the generated type definitions into separate files.
Currently all the generated GTypes for enumerated types were being
added to the thumbnailer, even though the thumbnailer didn't need them.
This was made worse by the fact that the enumerated types were defined
in header files that declared new GObject classes or functions. So,
when these header files were included to register the GTypes, it also
pulled in those other declarations in them.
https://gitlab.gnome.org/GNOME/gnome-photos/merge_requests/65
src/Makefile.am | 37 ++++++++++++++++++++++++---
src/meson.build | 20 ++++++++++++---
src/photos-enums-gegl.c.template | 51 +++++++++++++++++++++++++++++++++++++
src/photos-enums-gegl.h.template | 34 +++++++++++++++++++++++++
src/photos-enums.c.template | 1 -
src/photos-operation-insta-curve.c | 4 +--
src/photos-operation-insta-filter.c | 4 +--
7 files changed, 138 insertions(+), 13 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 3e984eb5..b13dfb6e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,6 +7,8 @@ gnome_photos_built_sources = \
photos-about-data.h \
photos-enums.c \
photos-enums.h \
+ photos-enums-gegl.c \
+ photos-enums-gegl.h \
photos-dleyna-renderer-device.c \
photos-dleyna-renderer-device.h \
photos-dleyna-renderer-manager.c \
@@ -301,12 +303,12 @@ gnome_photos_SOURCES = \
$(NULL)
gnome_photos_thumbnailer_built_sources = \
+ photos-enums-gegl.c \
+ photos-enums-gegl.h \
photos-resources-gegl.c \
photos-resources-gegl.h \
photos-thumbnailer-dbus.c \
photos-thumbnailer-dbus.h \
- photos-enums.c \
- photos-enums.h \
$(NULL)
nodist_gnome_photos_thumbnailer_SOURCES = \
@@ -365,6 +367,8 @@ EXTRA_DIST = \
org.gnome.ShellSearchProvider2.xml \
photos-enums.c.template \
photos-enums.h.template \
+ photos-enums-gegl.c.template \
+ photos-enums-gegl.h.template \
photos-generate-about \
photos.gresource.xml \
photos-gegl.gresource.xml \
@@ -470,6 +474,7 @@ CLEANFILES = \
$(BUILT_SOURCES) \
stamp-photos-about-data.h \
stamp-photos-enums.h \
+ stamp-photos-enums-gegl.h \
stamp-photos-marshalers.h \
xgen-ac \
xgen-ah \
@@ -477,6 +482,8 @@ CLEANFILES = \
xgen-etbh \
xgen-gmc \
xgen-gmh \
+ xgen-pegc \
+ xgen-pegh \
xgen-tmc \
xgen-tmh \
$(NULL)
@@ -512,7 +519,6 @@ stamp-photos-enums.h: photos-enums.h.template
--template $(srcdir)/photos-enums.h.template \
$(srcdir)/photos-gesture-zoom.h \
$(srcdir)/photos-item-manager.h \
- $(srcdir)/photos-operation-insta-common.h \
$(srcdir)/photos-utils.h \
) >> xgen-etbh \
&& ( cmp -s xgen-etbh photos-enums.h || cp xgen-etbh photos-enums.h ) \
@@ -526,13 +532,36 @@ photos-enums.c: photos-enums.c.template
--template $(srcdir)/photos-enums.c.template \
$(srcdir)/photos-gesture-zoom.h \
$(srcdir)/photos-item-manager.h \
- $(srcdir)/photos-operation-insta-common.h \
$(srcdir)/photos-utils.h \
) >> xgen-etbc \
&& ( cmp -s xgen-etbc photos-enums.c || cp xgen-etbc photos-enums.c ) \
&& rm -f xgen-etbc \
)
+photos-enums-gegl.h: stamp-photos-enums-gegl.h
+ @true
+
+stamp-photos-enums-gegl.h: photos-enums-gegl.h.template
+ $(AM_V_GEN) ( \
+ ( glib-mkenums \
+ --template $(srcdir)/photos-enums-gegl.h.template \
+ $(srcdir)/photos-operation-insta-common.h \
+ ) >> xgen-pegh \
+ && ( cmp -s xgen-pegh photos-enums-gegl.h || cp xgen-pegh photos-enums-gegl.h ) \
+ && rm -f xgen-pegh \
+ && echo timestamp > $(@F) \
+ )
+
+photos-enums-gegl.c: photos-enums-gegl.c.template
+ $(AM_V_GEN) ( \
+ ( glib-mkenums \
+ --template $(srcdir)/photos-enums-gegl.c.template \
+ $(srcdir)/photos-operation-insta-common.h \
+ ) >> xgen-pegc \
+ && ( cmp -s xgen-pegc photos-enums-gegl.c || cp xgen-pegc photos-enums-gegl.c ) \
+ && rm -f xgen-pegc \
+ )
+
photos-marshalers.h: stamp-photos-marshalers.h
@true
diff --git a/src/meson.build b/src/meson.build
index 88dfc4ba..7b8c7290 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -19,13 +19,10 @@ common_sources = files(
)
enum_headers = files(
- 'photos-gesture-zoom.h',
- 'photos-item-manager.h',
'photos-operation-insta-common.h',
- 'photos-utils.h',
)
-enum = 'photos-enums'
+enum = 'photos-enums-gegl'
common_sources += gnome.mkenums(
enum,
@@ -210,6 +207,21 @@ sources += custom_target(
command: [photos_generate_about, '--body', artists, authors],
)
+enum_headers = files(
+ 'photos-gesture-zoom.h',
+ 'photos-item-manager.h',
+ 'photos-utils.h',
+)
+
+enum = 'photos-enums'
+
+sources += gnome.mkenums(
+ enum,
+ sources: enum_headers,
+ c_template: enum + '.c.template',
+ h_template: enum + '.h.template',
+)
+
marshal = 'photos-marshalers'
sources += gnome.genmarshal(
diff --git a/src/photos-enums-gegl.c.template b/src/photos-enums-gegl.c.template
new file mode 100644
index 00000000..8827a631
--- /dev/null
+++ b/src/photos-enums-gegl.c.template
@@ -0,0 +1,51 @@
+/*** BEGIN file-header ***/
+
+#include "config.h"
+
+#include "photos-enums-gegl.h"
+#include "photos-operation-insta-common.h"
+
+/*** END file-header ***/
+
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+
+/*** END file-production ***/
+
+
+/*** BEGIN value-header ***/
+
+GType
+@enum_name@_get_type (void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const G@Type@Value values[] = {
+
+/*** END value-header ***/
+
+
+/*** BEGIN value-production ***/
+
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+
+/*** END value-production ***/
+
+
+/*** BEGIN value-tail ***/
+
+ { 0, NULL, NULL }
+ };
+ etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+ }
+ return etype;
+}
+
+/*** END value-tail ***/
+
+
+/*** BEGIN file-tail ***/
+
+/*** END file-tail ***/
diff --git a/src/photos-enums-gegl.h.template b/src/photos-enums-gegl.h.template
new file mode 100644
index 00000000..ac1699ac
--- /dev/null
+++ b/src/photos-enums-gegl.h.template
@@ -0,0 +1,34 @@
+/*** BEGIN file-header ***/
+
+#ifndef PHOTOS_ENUMS_GEGL_H
+#define PHOTOS_ENUMS_GEGL_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 PHOTOS_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+
+/*** END value-header ***/
+
+
+/*** BEGIN file-tail ***/
+
+G_END_DECLS
+
+#endif /* PHOTOS_ENUMS_GEGL_H */
+
+/*** END file-tail ***/
\ No newline at end of file
diff --git a/src/photos-enums.c.template b/src/photos-enums.c.template
index 07880a83..0534d9c1 100644
--- a/src/photos-enums.c.template
+++ b/src/photos-enums.c.template
@@ -5,7 +5,6 @@
#include "photos-enums.h"
#include "photos-gesture-zoom.h"
#include "photos-item-manager.h"
-#include "photos-operation-insta-common.h"
#include "photos-utils.h"
/*** END file-header ***/
diff --git a/src/photos-operation-insta-curve.c b/src/photos-operation-insta-curve.c
index 67e00880..6563e7ec 100644
--- a/src/photos-operation-insta-curve.c
+++ b/src/photos-operation-insta-curve.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2015 – 2017 Red Hat, Inc.
+ * Copyright © 2015 – 2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
#include <babl/babl.h>
#include <gegl.h>
-#include "photos-enums.h"
+#include "photos-enums-gegl.h"
#include "photos-operation-insta-common.h"
#include "photos-operation-insta-curve.h"
diff --git a/src/photos-operation-insta-filter.c b/src/photos-operation-insta-filter.c
index 5348fd4f..e50d7e17 100644
--- a/src/photos-operation-insta-filter.c
+++ b/src/photos-operation-insta-filter.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2015 – 2017 Red Hat, Inc.
+ * Copyright © 2015 – 2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
#include <babl/babl.h>
#include <gegl.h>
-#include "photos-enums.h"
+#include "photos-enums-gegl.h"
#include "photos-operation-insta-common.h"
#include "photos-operation-insta-filter.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]