0

まず、私はVala、 、Gtkおよびを初めて使用するMesonので、まったく間違った方向を見ている可能性があります。

私は Pop_OS で実行しています! 20.10.

GSettings をサポートする小さなサンプル Vala アプリケーションをコンパイルしたいと考えています。

ただし、でコンパイルしninja、でインストールしsudo ninja installてから実行すると、タイトルに記載されているエラーが発生します。

私の gschema ファイルが にコピーされていても、インストール後のスクリプト/usr/share/glib-2.0/schemasで実行glib-compile-schemasしても何も起こらないようです。

また、手動で実行glib-compile-schemasしてから dconf Editor で、自分の設定が利用可能であるかどうかを確認することで、それを確認することもできました。

データ/gschema.xml

<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
    <schema path="/com/github/mfru/vala-todo" id="com.github.mfru.vala-todo">
        <key name="pos-x" type="i">
            <default>360</default>
            <summary>Horizontal position</summary>
            <description>The saved horizontal position of our window</description>
        </key>

        <key name="pos-y" type="i">
            <default>360</default>
            <summary>Vertical position</summary>
            <description>The saved vertical position of our window</description>
        </key>

        <key name="window-width" type="i">
            <default>600</default>
            <summary>Window width</summary>
            <description>The saved width of our window</description>
        </key>

        <key name="window-height" type="i">
            <default>400</default>
            <summary>Window height</summary>
            <description>The saved height of our window</description>
        </key>
    </schema>
</schemalist>

data/meson.build

install_data(
    'gschema.xml',
    install_dir: join_paths (get_option ('datadir'), 'glib-2.0', 'schemas'),
    rename: meson.project_name () + '.geschema.xml'
)

meson/post-install.py

#!/usr/bin/env python3

import os
import subprocess

schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
print("Schemadir is", schemadir)

if 'DESTDIR' not in os.environ:
    print("Compiling the gsettings schemas...")
    subprocess.call(['glib-compile-schemas', schemadir])

meson build --prefix=/usr --reconfigureまた、最初はプレフィックスが指すようにメソンプレフィックスを再構成しまし/usr/localたが、システム上の既存のスキーマはすべて下にあります/usr/share

最後に、私のサンプル アプリケーションは、GSettings がないためにクラッシュすることなく起動することを期待しています。

私が調べたリソース:

https://mesonbuild.com/Configuring-a-build-directory.html

https://developer.gnome.org/gio/stable/glib-compile-schemas.html

Vala へのインストール中に GSettings スキーマを作成する方法はありますか?

4

1 に答える 1