From e6ed01dad46d39358ce7245235ea2448ef39e757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Mon, 29 Jul 2019 11:19:25 +0200 Subject: [PATCH 1/2] build: Fix indentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want two spaces. Signed-off-by: Guido Günther --- src/meson.build | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/meson.build b/src/meson.build index bfff5c365..acf41b4cb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -5,10 +5,10 @@ subdir('wwan') subdir('settings') phosh_resources = gnome.compile_resources( - 'phosh-resources', - 'phosh.gresources.xml', + 'phosh-resources', + 'phosh.gresources.xml', - c_name: 'phosh', + c_name: 'phosh', ) phosh_settings_sources = [ @@ -113,11 +113,11 @@ phosh_lib = static_library('phosh', libphosh_sources, dependencies: phosh_deps) phosh_inc = include_directories('.') phosh_dep = declare_dependency(sources: libphosh_sources, - include_directories: [root_inc, phosh_inc], - link_with: phosh_lib, - dependencies: phosh_deps) + include_directories: [root_inc, phosh_inc], + link_with: phosh_lib, + dependencies: phosh_deps) phosh = executable('phosh', phosh_sources, - dependencies: phosh_dep, + dependencies: phosh_dep, install: true, - install_dir: libexecdir) + install_dir: libexecdir) -- GitLab From 093caf775892f6e7053a467aa2b0c7d6c813acc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Mon, 29 Jul 2019 10:48:48 +0200 Subject: [PATCH 2/2] Use glib-mkenums MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow us to use enums as types. Signed-off-by: Guido Günther --- src/meson.build | 10 ++++++++++ src/phosh-enums.c.in | 37 +++++++++++++++++++++++++++++++++++++ src/phosh-enums.h.in | 21 +++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 src/phosh-enums.c.in create mode 100644 src/phosh-enums.h.in diff --git a/src/meson.build b/src/meson.build index acf41b4cb..1e963ea7a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -11,12 +11,22 @@ phosh_resources = gnome.compile_resources( c_name: 'phosh', ) +phosh_enum_headers = [ +] + +phosh_enums = gnome.mkenums('phosh-enums', + h_template: 'phosh-enums.h.in', + c_template: 'phosh-enums.c.in', + sources: phosh_enum_headers, +) + phosh_settings_sources = [ 'settings.c', phosh_settings_widgets_sources, ] libphosh_sources = [ + phosh_enums, 'app.c', 'app.h', 'favorites.c', diff --git a/src/phosh-enums.c.in b/src/phosh-enums.c.in new file mode 100644 index 000000000..00452aee1 --- /dev/null +++ b/src/phosh-enums.c.in @@ -0,0 +1,37 @@ +/*** BEGIN file-header ***/ + +#include "config.h" +#include "phosh-enums.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/phosh-enums.h.in b/src/phosh-enums.h.in new file mode 100644 index 000000000..2070d010f --- /dev/null +++ b/src/phosh-enums.h.in @@ -0,0 +1,21 @@ +/*** BEGIN file-header ***/ +#pragma once + +#include + +G_BEGIN_DECLS +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@basename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void); +#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) +/*** END value-header ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS +/*** END file-tail ***/ -- GitLab