[four-in-a-row] buildsystem: switch to using meson



commit 12d56a048eb924e7c61032e1ae8a3c831f87b865
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Sun Jan 13 13:52:15 2019 +0100

    buildsystem: switch to using meson

 .gitignore                                         |   1 +
 build-aux/meson_post_install.py                    |  14 ++++
 ...ur-in-a-row.png => org.gnome.four-in-a-row.png} | Bin
 ...ur-in-a-row.png => org.gnome.four-in-a-row.png} | Bin
 ...ur-in-a-row.png => org.gnome.four-in-a-row.png} | Bin
 ...ur-in-a-row.png => org.gnome.four-in-a-row.png} | Bin
 ...ur-in-a-row.png => org.gnome.four-in-a-row.png} | Bin
 ...ur-in-a-row.png => org.gnome.four-in-a-row.png} | Bin
 ...ur-in-a-row.png => org.gnome.four-in-a-row.png} | Bin
 ...ic.svg => org.gnome.four-in-a-row-symbolic.svg} |   0
 data/icons/meson.build                             |  14 ++++
 data/meson.build                                   |  73 +++++++++++++++++++++
 ...l.in => org.gnome.four-in-a-row.appdata.xml.in} |  16 +++--
 ...sktop.in => org.gnome.four-in-a-row.desktop.in} |   2 +-
 data/{ => sounds}/bad.ogg                          | Bin
 data/{ => sounds}/bonus.ogg                        | Bin
 data/{ => sounds}/reverse.ogg                      | Bin
 data/{ => sounds}/slide.ogg                        | Bin
 .../tileset_50x50_faenza-glines-icon1.svg          |   0
 .../tileset_50x50_faenza-glines-icon2.svg          |   0
 .../tileset_50x50_faenza-gnect-icon.svg            |   0
 data/{ => themes}/tileset_50x50_hcinverse.svg      |   0
 data/{ => themes}/tileset_50x50_hcontrast.svg      |   0
 help/LINGUAS                                       |  21 ++++++
 help/meson.build                                   |  22 +++++++
 meson.build                                        |  40 +++++++++++
 po/POTFILES.in                                     |   4 +-
 po/meson.build                                     |   0
 src/config.vapi                                    |  20 ------
 src/four-in-a-row.vala                             |  18 ++---
 src/game-board-view.vala                           |   6 +-
 src/games-controls-list.vala                       |   2 +-
 src/meson.build                                    |  48 ++++++++++++++
 src/theme.vala                                     |   2 +-
 src/vapi/config.vapi                               |   5 ++
 src/vapi/libcanberra-gtk3.vapi                     |  33 ++++++++++
 36 files changed, 297 insertions(+), 44 deletions(-)
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c6a151b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+_build/
\ No newline at end of file
diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py
new file mode 100644
index 0000000..6d18340
--- /dev/null
+++ b/build-aux/meson_post_install.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+
+from os import environ, path
+from subprocess import call
+
+if not environ.get('DESTDIR', ''):
+    PREFIX = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
+    DATA_DIR = path.join(PREFIX, 'share')
+    print('Updating icon cache...')
+    call(['gtk-update-icon-cache', '-qtf', path.join(DATA_DIR, 'icons/hicolor')])
+    print("Compiling new schemas")
+    call(["glib-compile-schemas", path.join(DATA_DIR, 'glib-2.0/schemas')])
+    print("Updating desktop database")
+    call(["update-desktop-database", path.join(DATA_DIR, 'applications')])
diff --git a/data/icons/hicolor/16x16/four-in-a-row.png b/data/icons/hicolor/16x16/org.gnome.four-in-a-row.png
similarity index 100%
rename from data/icons/hicolor/16x16/four-in-a-row.png
rename to data/icons/hicolor/16x16/org.gnome.four-in-a-row.png
diff --git a/data/icons/hicolor/22x22/four-in-a-row.png b/data/icons/hicolor/22x22/org.gnome.four-in-a-row.png
similarity index 100%
rename from data/icons/hicolor/22x22/four-in-a-row.png
rename to data/icons/hicolor/22x22/org.gnome.four-in-a-row.png
diff --git a/data/icons/hicolor/24x24/four-in-a-row.png b/data/icons/hicolor/24x24/org.gnome.four-in-a-row.png
similarity index 100%
rename from data/icons/hicolor/24x24/four-in-a-row.png
rename to data/icons/hicolor/24x24/org.gnome.four-in-a-row.png
diff --git a/data/icons/hicolor/256x256/four-in-a-row.png 
b/data/icons/hicolor/256x256/org.gnome.four-in-a-row.png
similarity index 100%
rename from data/icons/hicolor/256x256/four-in-a-row.png
rename to data/icons/hicolor/256x256/org.gnome.four-in-a-row.png
diff --git a/data/icons/hicolor/32x32/four-in-a-row.png b/data/icons/hicolor/32x32/org.gnome.four-in-a-row.png
similarity index 100%
rename from data/icons/hicolor/32x32/four-in-a-row.png
rename to data/icons/hicolor/32x32/org.gnome.four-in-a-row.png
diff --git a/data/icons/hicolor/48x48/four-in-a-row.png b/data/icons/hicolor/48x48/org.gnome.four-in-a-row.png
similarity index 100%
rename from data/icons/hicolor/48x48/four-in-a-row.png
rename to data/icons/hicolor/48x48/org.gnome.four-in-a-row.png
diff --git a/data/icons/hicolor/512x512/four-in-a-row.png 
b/data/icons/hicolor/512x512/org.gnome.four-in-a-row.png
similarity index 100%
rename from data/icons/hicolor/512x512/four-in-a-row.png
rename to data/icons/hicolor/512x512/org.gnome.four-in-a-row.png
diff --git a/data/icons/hicolor/symbolic/four-in-a-row-symbolic.svg 
b/data/icons/hicolor/symbolic/org.gnome.four-in-a-row-symbolic.svg
similarity index 100%
rename from data/icons/hicolor/symbolic/four-in-a-row-symbolic.svg
rename to data/icons/hicolor/symbolic/org.gnome.four-in-a-row-symbolic.svg
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..f1ceaa2
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,14 @@
+sizes = ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256', '512x512']
+
+themedir = join_paths(get_option('prefix'), get_option('datadir'), 'icons', 'hicolor')
+foreach size: sizes
+    install_data(
+        join_paths('hicolor', size, '@0@.png'.format(application_id)),
+        install_dir: join_paths(themedir, size, 'apps')
+    )
+endforeach
+
+install_data(
+    join_paths('hicolor', 'symbolic', '@0 -symbolic svg'.format(application_id)),
+    install_dir: join_paths(themedir, 'symbolic', 'apps')
+)
\ No newline at end of file
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..5ab5b99
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,73 @@
+# Desktop file
+desktop_file = i18n.merge_file(
+    input: '@0  desktop in'.format(application_id),
+    output: '@0@.desktop'.format(application_id),
+    po_dir: join_paths(meson.source_root(), 'po'),
+    type: 'desktop',
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'applications')
+)
+
+# Validate desktop file
+desktop_file_validate = find_program('desktop-file-validate', required: false)
+if desktop_file_validate.found()
+  test(
+    'validate-desktop',
+    desktop_file_validate,
+    args: [
+      desktop_file.full_path()
+    ]
+  )
+endif
+
+# AppData file
+appdata_file = i18n.merge_file(
+    input: '@0  appdata xml in'.format(application_id),
+    output: '@0  appdata xml'.format(application_id),
+    po_dir: join_paths(meson.source_root(), 'po'),
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'metainfo')
+)
+
+# Validate AppData file
+appstream_util = find_program('appstream-util', required: false)
+if appstream_util.found()
+  test(
+    'validate-appdata', appstream_util,
+    args: [
+      'validate-relax', '--nonet', appdata_file.full_path()
+    ]
+  )
+endif
+
+# Install man page
+install_man('@0@.6'.format(meson.project_name()))
+
+# Install GSchema file
+install_data(
+  '@0  gschema xml'.format(application_id),
+  install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
+)
+install_data(
+    [
+        'themes/tileset_50x50_faenza-glines-icon1.svg',
+        'themes/tileset_50x50_faenza-glines-icon2.svg',
+        'themes/tileset_50x50_faenza-gnect-icon.svg',
+        'themes/tileset_50x50_hcinverse.svg',
+        'themes/tileset_50x50_hcontrast.svg',
+        'bg_toplight.png',
+        'four-in-a-row.ui'
+    ],
+    install_dir: datadir
+)
+
+install_data(
+    [
+        'sounds/bad.ogg',
+        'sounds/bonus.ogg',
+        'sounds/reverse.ogg',
+        'sounds/slide.ogg'
+    ],
+    install_dir: join_paths(datadir, 'sounds')
+)
+subdir('icons')
\ No newline at end of file
diff --git a/data/four-in-a-row.appdata.xml.in b/data/org.gnome.four-in-a-row.appdata.xml.in
similarity index 90%
rename from data/four-in-a-row.appdata.xml.in
rename to data/org.gnome.four-in-a-row.appdata.xml.in
index c28e71f..e6369e1 100644
--- a/data/four-in-a-row.appdata.xml.in
+++ b/data/org.gnome.four-in-a-row.appdata.xml.in
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Copyright 2013 Michael Catanzaro -->
-<component type="desktop">
-  <id>four-in-a-row.desktop</id>
+<component type="desktop-application">
+  <id>org.gnome.four-in-a-row</id>
   <metadata_license>CC0-1.0</metadata_license>
   <project_license>GPL-3.0+</project_license>
   <name>Four-in-a-row</name>
@@ -23,22 +23,24 @@
       <image>https://people.gnome.org/~mcatanzaro/four-in-a-row.png</image>
     </screenshot>
   </screenshots>
+  <provides>
+    <id>four-in-a-row.desktop</id>
+  </provides>
+  <launchable type="dekstop-id">org.gnome.four-in-a-row.desktop</launchable>
   <url type="homepage">https://wiki.gnome.org/Apps/Four-in-a-row</url>
-  <url type="bugtracker">https://bugzilla.gnome.org/enter_bug.cgi?product=four-in-a-row</url>
-  <url type="donation">http://www.gnome.org/friends/</url>
+  <url type="bugtracker">https://gitlab.gnome.org/GNOME/four-in-a-row/issues</url>
+  <url type="translate">https://wiki.gnome.org/TranslationProject</url>
+  <url type="donation">https://www.gnome.org/friends/</url>
   <url type="help">https://help.gnome.org/users/four-in-a-row/stable/</url>
   <update_contact>mcatanzaro_at_gnome.org</update_contact>
   <project_group>GNOME</project_group>
   <developer_name>The GNOME Project</developer_name>
   <kudos>
-    <kudo>AppMenu</kudo>
     <kudo>HiDpiIcon</kudo>
     <kudo>ModernToolkit</kudo>
     <kudo>UserDocs</kudo>
   </kudos>
   <translation type="gettext">four-in-a-row</translation>
-  <url type="translate">https://wiki.gnome.org/TranslationProject</url>
-  <url type="donation">https://www.gnome.org/friends/</url>
   <content_rating type="oars-1.0">
     <content_attribute id="violence-cartoon">none</content_attribute>
     <content_attribute id="violence-fantasy">none</content_attribute>
diff --git a/data/four-in-a-row.desktop.in b/data/org.gnome.four-in-a-row.desktop.in
similarity index 93%
rename from data/four-in-a-row.desktop.in
rename to data/org.gnome.four-in-a-row.desktop.in
index f39feb0..6c51a0f 100644
--- a/data/four-in-a-row.desktop.in
+++ b/data/org.gnome.four-in-a-row.desktop.in
@@ -1,6 +1,6 @@
 [Desktop Entry]
 # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=four-in-a-row
+Icon=org.gnome.four-in-a-row
 Name=Four-in-a-row
 Comment=Make lines of the same color to win
 # Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list 
MUST also end with a semicolon!
diff --git a/data/bad.ogg b/data/sounds/bad.ogg
similarity index 100%
rename from data/bad.ogg
rename to data/sounds/bad.ogg
diff --git a/data/bonus.ogg b/data/sounds/bonus.ogg
similarity index 100%
rename from data/bonus.ogg
rename to data/sounds/bonus.ogg
diff --git a/data/reverse.ogg b/data/sounds/reverse.ogg
similarity index 100%
rename from data/reverse.ogg
rename to data/sounds/reverse.ogg
diff --git a/data/slide.ogg b/data/sounds/slide.ogg
similarity index 100%
rename from data/slide.ogg
rename to data/sounds/slide.ogg
diff --git a/data/tileset_50x50_faenza-glines-icon1.svg b/data/themes/tileset_50x50_faenza-glines-icon1.svg
similarity index 100%
rename from data/tileset_50x50_faenza-glines-icon1.svg
rename to data/themes/tileset_50x50_faenza-glines-icon1.svg
diff --git a/data/tileset_50x50_faenza-glines-icon2.svg b/data/themes/tileset_50x50_faenza-glines-icon2.svg
similarity index 100%
rename from data/tileset_50x50_faenza-glines-icon2.svg
rename to data/themes/tileset_50x50_faenza-glines-icon2.svg
diff --git a/data/tileset_50x50_faenza-gnect-icon.svg b/data/themes/tileset_50x50_faenza-gnect-icon.svg
similarity index 100%
rename from data/tileset_50x50_faenza-gnect-icon.svg
rename to data/themes/tileset_50x50_faenza-gnect-icon.svg
diff --git a/data/tileset_50x50_hcinverse.svg b/data/themes/tileset_50x50_hcinverse.svg
similarity index 100%
rename from data/tileset_50x50_hcinverse.svg
rename to data/themes/tileset_50x50_hcinverse.svg
diff --git a/data/tileset_50x50_hcontrast.svg b/data/themes/tileset_50x50_hcontrast.svg
similarity index 100%
rename from data/tileset_50x50_hcontrast.svg
rename to data/themes/tileset_50x50_hcontrast.svg
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..8d0514e
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,21 @@
+ca
+cs
+da
+de
+el
+en_GB
+es
+eu
+fi
+fr
+hu
+it
+ko
+oc
+pl
+pt_BR
+sl
+sr
+sr@latin
+sv
+zh_CN
\ No newline at end of file
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..ec8e463
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,22 @@
+help_media = [
+    'figures/logo.png'
+]
+
+help_pages = [
+    'appearance.page',
+    'basics.page',
+    'choose-opponent.page',
+    'controls-change.page',
+    'controls-default.page',
+    'index.page',
+    'legal.xml',
+    'make-easy.page',
+    'scores.page',
+    'sound-animation.page'
+]
+
+gnome.yelp(meson.project_name(),
+    sources: help_pages,
+    media: help_media,
+    symlink_media: true
+)
\ No newline at end of file
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..ec36231
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,40 @@
+project('four-in-a-row', 'c', 'vala',
+    version: '3.28.0'
+)
+
+add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language: 'c')
+
+gnome = import('gnome')
+i18n = import('i18n')
+python3 = import('python3')
+
+application_id = 'org.gnome.four-in-a-row'
+
+gio_dependency = dependency('gio-2.0', version: '>= 2.40.0')
+glib_dependency = dependency('glib-2.0', version: '>= 2.40.0')
+gtk_dependency = dependency('gtk+-3.0', version: '>= 3.13.2')
+rsvg_dependency = dependency('librsvg-2.0', version: '>= 2.32.0')
+canberra_dependency = dependency('libcanberra')
+canberra_gtk3_dependency = dependency('libcanberra-gtk3', version: '>= 0.26')
+
+datadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
+
+conf = configuration_data ()
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('SOUND_DIRECTORY', join_paths(datadir, 'sounds'))
+conf.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
+conf.set_quoted('DATA_DIRECTORY', datadir)
+
+configure_file(output: 'config.h', configuration: conf)
+config_h_dir = include_directories('.')
+
+
+subdir('data')
+subdir('help')
+subdir('po')
+subdir('src')
+
+meson.add_install_script(python3.find_python().path(), join_paths(meson.source_root(), 
+                                                                  'build-aux', 
+                                                                  'meson_post_install.py'))
\ No newline at end of file
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b40eae4..2bbc056 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,8 +1,8 @@
 # List of source files containing translatable strings.
 # Please keep this file in alphabetical order.
-data/four-in-a-row.appdata.xml.in
-data/four-in-a-row.desktop.in
 data/four-in-a-row.ui
+data/org.gnome.four-in-a-row.appdata.xml.in
+data/org.gnome.four-in-a-row.desktop.in
 data/org.gnome.four-in-a-row.gschema.xml
 src/four-in-a-row.vala
 src/games-controls-list.vala
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..e69de29
diff --git a/src/four-in-a-row.vala b/src/four-in-a-row.vala
index 1590ece..383c125 100644
--- a/src/four-in-a-row.vala
+++ b/src/four-in-a-row.vala
@@ -326,7 +326,7 @@ class FourInARow : Gtk.Application {
         string filename, path;
 
         filename = name + ".ogg";
-        path = Path.build_filename(Config.SOUND_DIRECTORY, filename);
+        path = Path.build_filename(SOUND_DIRECTORY, filename);
 
         CanberraGtk.context_get().play(
                 id,
@@ -651,8 +651,8 @@ class FourInARow : Gtk.Application {
         const string documenters[] = {"Timothy Musson", null};
 
         Gtk.show_about_dialog(window,
-            name: _(Config.APPNAME_LONG),
-            version: Config.VERSION,
+            name: _(APPNAME_LONG),
+            version: VERSION,
             copyright: "Copyright © 1999–2008 Tim Musson and David Neary\n" +
                        "Copyright © 2014 Michael Catanzaro\n" +
                        "Copyright © 2018 Jacob Humphrey",
@@ -662,7 +662,7 @@ class FourInARow : Gtk.Application {
             documenters: documenters,
             artists: artists,
             translator_credits: _("translator-credits"),
-            logo_icon_name: "four-in-a-row",
+            logo_icon_name: "org.gnome.four-in-a-row",
             website: "https://wiki.gnome.org/Apps/Four-in-a-row";);
     }
 
@@ -707,7 +707,7 @@ class FourInARow : Gtk.Application {
         Gtk.Builder builder;
         Gtk.CssProvider css_provider;
 
-        Gtk.Window.set_default_icon_name("four-in-a-row");
+        Gtk.Window.set_default_icon_name("org.gnome.four-in-a-row");
 
         css_provider = new Gtk.CssProvider();
         try {
@@ -720,7 +720,7 @@ class FourInARow : Gtk.Application {
                                                  css_provider,
                                                  Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
         game_board_view = new GameBoardView(game_board);
-        builder = new Gtk.Builder.from_file(Config.DATA_DIRECTORY + "/four-in-a-row.ui");
+        builder = new Gtk.Builder.from_file(DATA_DIRECTORY + "/four-in-a-row.ui");
 
         window = builder.get_object("fiar-window") as Gtk.ApplicationWindow;
         window.application = this;
@@ -838,9 +838,9 @@ public int main(string[] argv) {
 
     var application = new FourInARow();
 
-    Intl.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
-    Intl.bind_textdomain_codeset(Config.GETTEXT_PACKAGE, "UTF-8");
-    Intl.textdomain(Config.GETTEXT_PACKAGE);
+    Intl.bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
+    Intl.bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+    Intl.textdomain(GETTEXT_PACKAGE);
 
     var context = new OptionContext();
     context.add_group(Gtk.get_option_group(true));
diff --git a/src/game-board-view.vala b/src/game-board-view.vala
index f6294ab..89dcaf2 100644
--- a/src/game-board-view.vala
+++ b/src/game-board-view.vala
@@ -151,7 +151,7 @@ class GameBoardView : Gtk.DrawingArea {
 
         dialog = new Gtk.MessageDialog(get_window() as Gtk.Window, Gtk.DialogFlags.MODAL,
             Gtk.MessageType.WARNING, Gtk.ButtonsType.CLOSE,
-        dgettext(Config.GETTEXT_PACKAGE, "Unable to load image:\n%s"), fname);
+        dgettext(GETTEXT_PACKAGE, "Unable to load image:\n%s"), fname);
 
         dialog.run();
         dialog.destroy();
@@ -209,7 +209,7 @@ class GameBoardView : Gtk.DrawingArea {
 
         /* Try the theme pixmaps, fallback to the default and then give up */
         while (true) {
-            fname = Path.build_filename(Config.DATA_DIRECTORY, theme[Prefs.instance.theme_id].fname_tileset, 
null);
+            fname = Path.build_filename(DATA_DIRECTORY, theme[Prefs.instance.theme_id].fname_tileset, null);
             try {
                 pb_tileset_tmp = new Gdk.Pixbuf.from_file(fname);
             } catch (Error e) {
@@ -227,7 +227,7 @@ class GameBoardView : Gtk.DrawingArea {
         pb_tileset_raw = pb_tileset_tmp;
 
         if (theme[Prefs.instance.theme_id].fname_bground != null) {
-            fname = Path.build_filename(Config.DATA_DIRECTORY, theme[Prefs.instance.theme_id].fname_bground, 
null);
+            fname = Path.build_filename(DATA_DIRECTORY, theme[Prefs.instance.theme_id].fname_bground, null);
             try {
                 pb_bground_tmp = new Gdk.Pixbuf.from_file(fname);
             } catch (Error e) {
diff --git a/src/games-controls-list.vala b/src/games-controls-list.vala
index 281b56a..f28e479 100644
--- a/src/games-controls-list.vala
+++ b/src/games-controls-list.vala
@@ -23,7 +23,7 @@
  * Needed to force vala to include headers in the correct order.
  * See https://gitlab.gnome.org/GNOME/vala/issues/98
  */
-const string games_controls_gettext_package = Config.GETTEXT_PACKAGE;
+const string games_controls_gettext_package = GETTEXT_PACKAGE;
 
 enum Columns {
     CONFKEY_COLUMN = 0,
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..97c02be
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,48 @@
+
+four_in_a_row_tests = executable('four-in-a-row-tests', 
+    [
+        'ai.vala',
+        'test-ai.vala'
+    ],
+    dependencies: [
+        gio_dependency,
+        glib_dependency
+    ]
+)
+test('four-in-a-row-tests', four_in_a_row_tests)
+
+
+
+sources = files(
+    'vapi/config.vapi',
+    'ai.vala',
+    'four-in-a-row.vala',
+    'game-board-view.vala',
+    'game-board.vala',
+    'games-controls-list.vala',
+    'prefs-box.vala',
+    'prefs.vala',
+    'scorebox.vala',
+    'theme.vala'
+)
+
+executable(
+    meson.project_name(),
+    sources,
+    dependencies: [
+        gtk_dependency,
+        rsvg_dependency,
+        canberra_dependency,
+        canberra_gtk3_dependency,
+        glib_dependency
+    ],
+    c_args: [
+        '-include', 'config.h'
+    ],
+    vala_args: [
+        '--target-glib', '2.44',
+        '--vapidir', join_paths(meson.current_source_dir(), 'vapi')
+    ],
+    install: true,
+    install_dir: get_option('bindir')
+)
\ No newline at end of file
diff --git a/src/theme.vala b/src/theme.vala
index 25bd06a..91d7c32 100644
--- a/src/theme.vala
+++ b/src/theme.vala
@@ -36,7 +36,7 @@ struct Theme {
  * Needed to force vala to include headers in the correct order.
  * See https://gitlab.gnome.org/GNOME/vala/issues/98
  */
-const string theme_gettext_package = Config.GETTEXT_PACKAGE;
+const string theme_gettext_package = GETTEXT_PACKAGE;
 
 string theme_get_title(int id) {
     return theme[id].title;
diff --git a/src/vapi/config.vapi b/src/vapi/config.vapi
new file mode 100644
index 0000000..fbcc70d
--- /dev/null
+++ b/src/vapi/config.vapi
@@ -0,0 +1,5 @@
+public const string GETTEXT_PACKAGE;
+public const string DATA_DIRECTORY;
+public const string VERSION;
+public const string SOUND_DIRECTORY;
+public const string LOCALEDIR;
diff --git a/src/vapi/libcanberra-gtk3.vapi b/src/vapi/libcanberra-gtk3.vapi
new file mode 100644
index 0000000..4e5295c
--- /dev/null
+++ b/src/vapi/libcanberra-gtk3.vapi
@@ -0,0 +1,33 @@
+/***
+  This file is part of libcanberra.
+  Copyright 2009 Lennart Poettering
+  libcanberra is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation, either version 2.1 of the
+  License, or (at your option) any later version.
+  libcanberra 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
+  Lesser General Public License for more details.
+  You should have received a copy of the GNU Lesser General Public
+  License along with libcanberra. If not, see
+  <http://www.gnu.org/licenses/>.
+***/
+
+using Canberra;
+using Gdk;
+using Gtk;
+
+[CCode (cprefix = "CA_GTK_", lower_case_cprefix = "ca_gtk_", cheader_filename = "canberra-gtk.h")]
+namespace CanberraGtk {
+
+        public unowned Context? context_get();
+        public unowned Context? context_get_for_screen(Gdk.Screen? screen);
+
+        public int proplist_set_for_widget(Proplist p, Gtk.Widget w);
+        public int play_for_widget(Gtk.Widget w, uint32 id, ...);
+        public int proplist_set_for_event(Proplist p, Gdk.Event e);
+        public int play_for_event(Gdk.Event e, uint32 id, ...);
+
+        public void widget_disable_sounds(Gtk.Widget w, bool enable = false);
+}


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