2017-03-28 16 views
1

GRaSourceからメインアプリケーションウィンドウのリソースを読み込む、Vala(非動作ソースツリーhere)で書かれた非常に基本的なGTKアプリケーションがあります。複合テンプレート用のリソースを読み込めません

リソースファイルを作成し、glib-compile-resourcesでコンパイルし、VALAFLAGS--gresources=$(top_srcdir)/data/gauthenticator.gresource.xmlと追加しました。

データファイルの関連部分は次のようになります。

<gresource prefix="/eu/polonkai/gergely/gauthenticator"> 
    <file preprocess="xml-stripblanks">gauth-window.ui</file> 
</gresource> 

と私はこのようにそれを使用します。

[GtkTemplate (ui = "/eu/polonkai/gergely/gauthenticator/gauth-window.ui")] 
class Window : Gtk.ApplicationWindow { 
    [GtkChild] 
    private Gtk.ProgressBar countdown; 
} 

Makefile.amの関連部分:

gresource_file = $(top_srcdir)/data/gauthenticator.gresource.xml 
gauthenticator_VALAFLAGS = --pkg gtk+-3.0 --target-glib=2.38 --gresources $(gresource_file) 

コンパイル中はすべて正常ですが、実行時にこのエラーが発生します:

(gauthenticator:16501): Gtk-CRITICAL **: Unable to load resource for composite template for type 'GAuthenticatorWindow': The resource at '/eu/polonkai/gergely/gauthenticator/gauth-window.ui' does not exist 

(gauthenticator:16501): Gtk-CRITICAL **: gtk_widget_class_bind_template_child_full: assertion 'widget_class->priv->template != NULL' failed 

(gauthenticator:16501): Gtk-CRITICAL **: gtk_widget_init_template: assertion 'template != NULL' failed 

ほとんどのリソース関連の行はGNOME Boxesリポジトリからコピーされましたが、明らかに何かが見つかりませんでした。

答えて

4

glib-compile-resourcesでリソースをどのようにコンパイルしていますか?私はCファイルにコンパイル推薦:

glib-compile-resources --sourcedir data --generate-source --target my_build_dir/resources/resources.c data/gauthenticator.gresource.xml

それはあなたのValaのソースと一緒にコンパイルされるので、次に、あなたの_SOURCESmy_build_dir/resources/resources.cを追加します。 valac--gresourcesオプションは、ValaのGTK +複合テンプレートサポートのタイプチェックのみ行います。

私は、Vala to Cの一環としてGResource Cファイルをコンパイルしてから、バイナリコンパイルプロセスにCをコンパイルしようとしませんでした。現時点では、コンパイルプロセス全体にちょうどvalacを使用しているようです。

関連する問題