[dia] build: use the join operator



commit 139621617dbc3de50f905039f36a1fd39b3eebab
Author: Zander Brown <zbrown gnome org>
Date:   Wed Apr 1 14:39:57 2020 +0100

    build: use the join operator
    
    Less verbose than join_path and IMO more readable (since it _looks_ like a path)

 app/meson.build                  |  6 ++++++
 data/meson.build                 | 10 +++++-----
 data/ui/meson.build              |  2 +-
 doc/de/meson.build               |  6 +++---
 doc/en/meson.build               | 10 +++++-----
 doc/eu/meson.build               |  6 +++---
 doc/fr/meson.build               |  6 +++---
 doc/meson.build                  |  8 ++------
 docs/dia-app/meson.build         | 10 +++++-----
 docs/dia/meson.build             | 10 +++++-----
 lib/dia_dirs.c                   | 20 ++++++++------------
 lib/intl.h                       | 20 +++-----------------
 meson.build                      | 17 ++++++-----------
 plug-ins/python/meson.build      |  2 +-
 plug-ins/xslt/meson.build        |  2 +-
 shapes/Map/Isometric/meson.build |  2 +-
 shapes/meson.build               |  4 ++--
 sheets/meson.build               |  2 +-
 tests/meson.build                | 20 ++++++++++----------
 19 files changed, 71 insertions(+), 92 deletions(-)
---
diff --git a/app/meson.build b/app/meson.build
index 6690a247..16bc0467 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -55,6 +55,12 @@ dia_sources = [
     'dia-props.c',
     'gtkwrapbox.c',
     'gtkhwrapbox.c',
+
+    'gtklist.c',
+    'gtklist.h',
+    'gtklistitem.c',
+    'gtklistitem.h',
+
     'cursor.c',
     'splash.c',
     'recent_files.c',
diff --git a/data/meson.build b/data/meson.build
index 1f7b8782..eef2aff6 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -5,7 +5,7 @@ desktop_file = i18n.merge_file(
   type: 'desktop',
   po_dir: po_dir,
   install: true,
-  install_dir: join_paths(datadir, 'applications')
+  install_dir: datadir / 'applications'
 )
 # Validate Desktop file
 desktop_file_validate = find_program('desktop-file-validate', required: false)
@@ -24,7 +24,7 @@ appdata_file = i18n.merge_file (
   output: '@BASENAME@',
   po_dir: po_dir,
   install: true,
-  install_dir: join_paths(datadir, 'metainfo')
+  install_dir: datadir / 'metainfo'
 )
 # Validate Appdata
 appstream_util = find_program('appstream-util', required: false)
@@ -38,12 +38,12 @@ if appstream_util.found()
 endif
 
 install_data('org.gnome.Dia.svg',
-             install_dir: join_paths([datadir,'icons/hicolor/scalable/apps']))
+             install_dir: datadir / 'icons' / 'hicolor' / 'scalable' / 'apps')
 
 install_data('org.gnome.Dia-symbolic.svg',
-             install_dir: join_paths([datadir,'icons/hicolor/symbolic/apps']))
+             install_dir: datadir / 'icons' / 'hicolor' / 'symbolic' / 'apps')
 
 install_data('org.gnome.Dia.thumbnailer',
-             install_dir: join_paths(datadir, 'thumbnailers'))
+             install_dir: datadir / 'thumbnailers')
 
 subdir('ui')
diff --git a/data/ui/meson.build b/data/ui/meson.build
index 68c24bcc..4e39e8e2 100644
--- a/data/ui/meson.build
+++ b/data/ui/meson.build
@@ -11,4 +11,4 @@ ui_files = [
     'properties-dialog.ui',
 ]
 
-install_data(ui_files, install_dir: join_paths(pkgdatadir, 'ui'))
+install_data(ui_files, install_dir: pkgdatadir / 'ui')
diff --git a/doc/de/meson.build b/doc/de/meson.build
index 9a3f9fc5..69a8884b 100644
--- a/doc/de/meson.build
+++ b/doc/de/meson.build
@@ -61,7 +61,7 @@ lang = 'de'
 #)
 
 if xsltproc.found()
-    html_dir = join_paths(helpdir, lang)
+    html_dir = helpdir / lang
 
     custom_target(lang + '-dia_html',
         input: [ 'html.xsl', 'dia.xml' ],
@@ -69,7 +69,7 @@ if xsltproc.found()
         command: [
             xsltproc,
             '--stringparam', 'graphic.default.extension', 'png',
-            '-o', join_paths('@OUTDIR@', ''),
+            '-o', '@OUTDIR@',
             '@INPUT@'
         ],
         depend_files: xml_deps,
@@ -83,7 +83,7 @@ if xsltproc.found()
     )
 
     install_subdir(
-        join_paths('..', 'html'),
+        '..' / 'html',
         install_dir: html_dir,
         strip_directory: true,
     )
diff --git a/doc/en/meson.build b/doc/en/meson.build
index 267a8271..aad39cfd 100644
--- a/doc/en/meson.build
+++ b/doc/en/meson.build
@@ -75,7 +75,7 @@ custom_target(lang + '-dia.pdf',
     depend_files: xml_deps,
     command: [dblatex, '-t', 'pdf', '-q', '-o', '@OUTPUT@', '@INPUT@'],
     install: true,
-    install_dir: join_paths(docdir, lang)
+    install_dir: docdir / lang
 )
 
 if xsltproc.found()
@@ -89,12 +89,12 @@ if xsltproc.found()
             '@INPUT@'
         ],
         install: true,
-        install_dir: join_paths(get_option('mandir'), 'man1')
+        install_dir: get_option('mandir') / 'man1'
     )
     # TODO: this should fixed in meson: https://github.com/mesonbuild/meson/issues/1550
     #install_man(dia_man, language: lang)
 
-    html_dir = join_paths(helpdir, lang)
+    html_dir = helpdir / lang
 
     custom_target(lang + '-dia_html',
         input: [ 'html.xsl', 'dia.xml' ],
@@ -102,7 +102,7 @@ if xsltproc.found()
         command: [
             xsltproc,
             '--stringparam', 'graphic.default.extension', 'png',
-            '-o', join_paths('@OUTDIR@', ''),
+            '-o', '@OUTDIR@',
             '@INPUT@'
         ],
         depend_files: xml_deps,
@@ -116,7 +116,7 @@ if xsltproc.found()
     )
 
     install_subdir(
-        join_paths('..', 'html'),
+        '..' / 'html',
         install_dir: html_dir,
         strip_directory: true
     )
diff --git a/doc/eu/meson.build b/doc/eu/meson.build
index c4bb3fcf..de00c015 100644
--- a/doc/eu/meson.build
+++ b/doc/eu/meson.build
@@ -53,7 +53,7 @@ html_output = [
 lang = 'eu'
 
 if xsltproc.found()
-    html_dir = join_paths(helpdir, lang)
+    html_dir = helpdir / lang
 
     custom_target(lang + '-dia_html',
         input: [ 'html.xsl', 'dia.xml' ],
@@ -61,7 +61,7 @@ if xsltproc.found()
         command: [
             xsltproc,
             '--stringparam', 'graphic.default.extension', 'png',
-            '-o', join_paths('@OUTDIR@', ''),
+            '-o', '@OUTDIR@',
             '@INPUT@'
         ],
         depend_files: xml_deps,
@@ -75,7 +75,7 @@ if xsltproc.found()
     )
 
     install_subdir(
-        join_paths('..', 'html'),
+        '..' / 'html',
         install_dir: html_dir,
         strip_directory: true,
     )
diff --git a/doc/fr/meson.build b/doc/fr/meson.build
index 1a24e44c..c6cce846 100644
--- a/doc/fr/meson.build
+++ b/doc/fr/meson.build
@@ -64,7 +64,7 @@ html_output = [
 lang = 'fr'
 
 if xsltproc.found()
-    html_dir = join_paths(helpdir, lang)
+    html_dir = helpdir / lang
 
     custom_target(lang + '-dia_html',
         input: [ 'html.xsl', 'dia.xml' ],
@@ -72,7 +72,7 @@ if xsltproc.found()
         command: [
             xsltproc,
             '--stringparam', 'graphic.default.extension', 'png',
-            '-o', join_paths('@OUTDIR@', ''),
+            '-o', '@OUTDIR@',
             '@INPUT@'
         ],
         depend_files: xml_deps,
@@ -86,7 +86,7 @@ if xsltproc.found()
     )
 
     install_subdir(
-        join_paths('..', 'html'),
+        '..' / 'html',
         install_dir: html_dir,
         strip_directory: true,
     )
diff --git a/doc/meson.build b/doc/meson.build
index 190ee305..0d51ba86 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -1,15 +1,11 @@
-docdir = join_paths(
-    get_option('datadir'),
-    'doc',
-    meson.project_name()
-)
+docdir = datadir / 'doc'/ meson.project_name()
 
 dblatex = find_program('dblatex', required: false, disabler: true)
 xsltproc = find_program('xsltproc', required: false, disabler: true)
 
 DB2MAN = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
 
-helpdir = join_paths(pkgdatadir, 'help')
+helpdir = pkgdatadir / 'help'
 
 subdir('de')
 subdir('en')
diff --git a/docs/dia-app/meson.build b/docs/dia-app/meson.build
index 7e981cf5..d51ade52 100644
--- a/docs/dia-app/meson.build
+++ b/docs/dia-app/meson.build
@@ -12,8 +12,8 @@ content_files = [
 ]
 
 glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
-glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
-docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
+glib_docpath = glib_prefix / 'share' / 'gtk-doc' / 'html'
+docpath = datadir / 'gtk-doc' / 'html'
 
 gnome.gtkdoc('dia-app',
            main_xml: 'dia-app-docs.xml',
@@ -28,9 +28,9 @@ gnome.gtkdoc('dia-app',
                      ],
        fixxref_args: [
                        '--html-dir=@0@'.format(docpath),
-                       '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
-                       '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
-                       '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
+                       '--extra-dir=@0@'.format(glib_docpath / 'glib'),
+                       '--extra-dir=@0@'.format(glib_docpath / 'gobject'),
+                       '--extra-dir=@0@'.format(glib_docpath / 'gio'),
                      ],
         install_dir: 'dia-app',
       content_files: content_files,
diff --git a/docs/dia/meson.build b/docs/dia/meson.build
index 30c5f7e5..12a2eea1 100644
--- a/docs/dia/meson.build
+++ b/docs/dia/meson.build
@@ -12,8 +12,8 @@ content_files = [
 ]
 
 glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
-glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
-docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
+glib_docpath = glib_prefix / 'share' / 'gtk-doc' / 'html'
+docpath = datadir / 'gtk-doc' / 'html'
 
 gnome.gtkdoc('dia',
            main_xml: 'dia-docs.xml',
@@ -28,9 +28,9 @@ gnome.gtkdoc('dia',
                      ],
        fixxref_args: [
                        '--html-dir=@0@'.format(docpath),
-                       '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
-                       '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
-                       '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
+                       '--extra-dir=@0@'.format(glib_docpath / 'glib'),
+                       '--extra-dir=@0@'.format(glib_docpath / 'gobject'),
+                       '--extra-dir=@0@'.format(glib_docpath / 'gio'),
                      ],
         install_dir: 'dia',
       content_files: content_files,
diff --git a/lib/dia_dirs.c b/lib/dia_dirs.c
index 0a8fbb9f..5f0da34c 100644
--- a/lib/dia_dirs.c
+++ b/lib/dia_dirs.c
@@ -143,24 +143,20 @@ dia_get_lib_directory(void)
 #endif
 }
 
-gchar*
-dia_get_locale_directory(void)
+
+char *
+dia_get_locale_directory (void)
 {
 #ifdef G_OS_WIN32
-  gchar *sLoc = _dia_get_module_directory ();
-  gchar *returnPath = NULL;
-#  if defined(PREFIX) && defined(LOCALEDIR)
-    returnPath = replace_prefix(sLoc, LOCALEDIR);
-#  else
-  returnPath = g_strconcat (sLoc, "locale", NULL);
-#  endif
-  g_free (sLoc);
-  return returnPath;
+  g_autofree char *sLoc = _dia_get_module_directory ();
+
+  return replace_prefix (sLoc, LOCALEDIR);
 #else
-  return g_strconcat (LOCALEDIR, G_DIR_SEPARATOR_S, "", NULL);
+  return g_strdup (LOCALEDIR);
 #endif
 }
 
+
 /** Get the name of a file under the Dia config directory.  If no home
  *  directory can be found, uses a temporary directory.
  * @param subfile Name of the subfile.
diff --git a/lib/intl.h b/lib/intl.h
index 645e45a3..c5ad4256 100644
--- a/lib/intl.h
+++ b/lib/intl.h
@@ -1,20 +1,6 @@
-#ifndef INTL_H
-#define INTL_H
+#pragma once
 
 #include <glib.h>
+#include <glib/gi18n.h>
 
-#ifdef ENABLE_NLS
-#  include <glib/gi18n.h>
-#else /* NLS is disabled */
-#  define _(String) (String)
-#  define Q_(String) (String)
-#  define N_(String) (String)
-#  define NC_(Context, String) (String)
-#  define gettext(String) (String)
-#  define textdomain(Domain)
-#  define bindtextdomain(Package, Directory)
-#endif
-
-int    intl_score_locale      (const gchar *locale);
-
-#endif
+int intl_score_locale (const char *locale);
diff --git a/meson.build b/meson.build
index 9f706f26..83e07e99 100644
--- a/meson.build
+++ b/meson.build
@@ -33,18 +33,13 @@ conf.set('HAVE_OGDF', libogdf_dep.found())
 libxslt_dep = dependency('libxslt', required: false)
 conf.set('HAVE_XSLT', libxslt_dep.found())
 
-datadir = join_paths(get_option('prefix'),
-                     get_option('datadir'))
+prefix = get_option('prefix')
+datadir = prefix / get_option('datadir')
 
-po_dir = join_paths(meson.current_source_dir(), 'po')
-pkgdatadir = join_paths(datadir, meson.project_name())
-
-dialibdir = join_paths(get_option('prefix'),
-                       get_option('libdir'),
-                       meson.project_name())
-
-dialocaledir = join_paths(get_option('prefix'),
-                          get_option('localedir'))
+po_dir = meson.current_source_dir() / 'po'
+pkgdatadir = datadir / meson.project_name()
+dialibdir = prefix / get_option('libdir') / meson.project_name()
+dialocaledir = prefix / get_option('localedir')
 
 # Specify a header configuration file
 conf.set_quoted('VERSION', '@VCS_TAG@')
diff --git a/plug-ins/python/meson.build b/plug-ins/python/meson.build
index 2ac952e1..35d2b6c5 100644
--- a/plug-ins/python/meson.build
+++ b/plug-ins/python/meson.build
@@ -57,6 +57,6 @@ if py_dep.found()
         install_dir: dialibdir
     )
 
-    install_data(python_scripts, install_dir: join_paths(pkgdatadir, 'python'))
+    install_data(python_scripts, install_dir: pkgdatadir / 'python')
     install_data('python-startup.py', install_dir: pkgdatadir)
 endif
diff --git a/plug-ins/xslt/meson.build b/plug-ins/xslt/meson.build
index 83c3c07f..bab4ecff 100644
--- a/plug-ins/xslt/meson.build
+++ b/plug-ins/xslt/meson.build
@@ -16,7 +16,7 @@ xsls = files(
     'dia-uml2componentlist.xsl',
 )
 
-install_data(xsls, install_dir: join_paths(pkgdatadir, 'xslt'))
+install_data(xsls, install_dir: pkgdatadir / 'xslt')
 
 if libxslt_dep.found()
     library(
diff --git a/shapes/Map/Isometric/meson.build b/shapes/Map/Isometric/meson.build
index d0662116..591c5121 100644
--- a/shapes/Map/Isometric/meson.build
+++ b/shapes/Map/Isometric/meson.build
@@ -52,7 +52,7 @@ shape_sources = files(
 )
 
 # TODO: There is no need to join paths.  Can we avoid it?
-name = join_paths('Map', 'Isometric')
+name = 'Map' / 'Isometric'
 shapes += {
     'sources': shape_sources,
     'name': name,
diff --git a/shapes/meson.build b/shapes/meson.build
index 49ec5430..0d758f1a 100644
--- a/shapes/meson.build
+++ b/shapes/meson.build
@@ -1,4 +1,4 @@
-shapesdir = join_paths(pkgdatadir, 'shapes')
+shapesdir = pkgdatadir / 'shapes'
 
 shapes = []
 
@@ -29,6 +29,6 @@ subdir('EDPC')
 foreach shape_info : shapes
     install_data(
         shape_info.get('sources'),
-        install_dir: join_paths(shapesdir, shape_info.get('name'))
+        install_dir: shapesdir / shape_info.get('name')
     )
 endforeach
diff --git a/sheets/meson.build b/sheets/meson.build
index 4109943d..83af42b6 100644
--- a/sheets/meson.build
+++ b/sheets/meson.build
@@ -1,4 +1,4 @@
-sheetsdir = join_paths(pkgdatadir, 'sheets')
+sheetsdir = pkgdatadir / 'sheets'
 
 sheet_files = [
     'UML.sheet',
diff --git a/tests/meson.build b/tests/meson.build
index 5d889018..c5d5864b 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,12 +1,12 @@
 # Setup local environment to run dia.
 run_env_dict = {
     'DIA_BASE_PATH'  : [meson.source_root()],
-    'DIA_LIB_PATH'   : [join_paths(meson.build_root(), 'objects'),
-                        join_paths(meson.build_root(), 'plug-ins')],
-    'DIA_SHAPE_PATH' : [join_paths(meson.source_root(), 'shapes')],
-    'DIA_XSLT_PATH'  : [join_paths(meson.source_root(), 'plug-ins', 'xslt')],
-    'DIA_PYTHON_PATH': [join_paths(meson.source_root(), 'plug-ins', 'python')],
-    'DIA_SHEET_PATH' : [join_paths(meson.build_root(), 'sheets')],
+    'DIA_LIB_PATH'   : [meson.build_root() / 'objects',
+                        meson.build_root() / 'plug-ins'],
+    'DIA_SHAPE_PATH' : [meson.source_root() / 'shapes'],
+    'DIA_XSLT_PATH'  : [meson.source_root() / 'plug-ins' / 'xslt')],
+    'DIA_PYTHON_PATH': [meson.source_root() / 'plug-ins' / 'python')],
+    'DIA_SHEET_PATH' : [meson.build_root() / 'sheets'],
 }
 
 run_env = environment()
@@ -16,7 +16,7 @@ endforeach
 
 # Otherwise Windows won't be able to find libdia.dll in build directory.
 if host_machine.system() == 'windows'
-    run_env.append('PATH', join_paths(meson.build_root(), 'lib'))
+    run_env.append('PATH', meson.build_root() / 'lib')
 endif
 
 test_exes = []
@@ -35,15 +35,15 @@ endforeach
 # Unfortunately dictionaries can only contain literal strings.
 # As such we have to use indeces instead.
 test('boundinbox', test_exes[0])
-test('objects', test_exes[1], args: [join_paths(meson.build_root(), 'objects')])
+test('objects', test_exes[1], args: [meson.build_root() / 'objects'])
 test('testsvg', test_exes[2])
 
 # Not really a test, but just a helper program.
 run_target('sizeof', command: [test_exes[3]])
 
 xmllint_test = find_program('xmllint_test.sh')
-render_test_dia = files(join_paths('..', 'samples', 'render-test.dia'))[0]
-shape_dtd = files(join_paths('..', 'doc', 'shape.dtd'))[0]
+render_test_dia = files('..' / 'samples' / 'render-test.dia')[0]
+shape_dtd = files('..' / 'doc' / 'shape.dtd')[0]
 
 find_program('xmllint', required: true)
 test('xmllint',


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