我怎样才能让 GTK 识别我创建的模板?
How can I get GTK to recognize the template I have created?
存储库在这里:https://gitlab.com/tristan957/tllt-cp
程序编译顺利。我有一些未使用的变量,但没关系。在 运行 时,我看到以下警告,并且我 运行 的 GUI 与我提供的模板不同。
(tllt-cp:28723): Gtk-CRITICAL **: 22:18:00.249: Unable to load resource for composite template for type 'TlltCpWindow': The resource at “/com/gitlab/tristan957/TlltCp/tllt-cp-window.ui” does not exist
(tllt-cp:28723): Gtk-CRITICAL **: 22:18:00.249: gtk_widget_class_bind_template_child_full: assertion 'widget_class->priv->template != NULL' failed
(tllt-cp:28723): Gtk-CRITICAL **: 22:18:00.249: gtk_widget_class_bind_template_child_full: assertion 'widget_class->priv->template != NULL' failed
Initializing object
(tllt-cp:28723): Gtk-CRITICAL **: 22:18:00.249: gtk_widget_init_template: assertion 'template != NULL' failed
我不确定我错过了什么。
我需要添加以下功能
static void
tllt_cp_application_startup(GApplication *self)
{
g_resources_register(tllt_cp_get_resource());
g_application_set_resource_base_path(self, "/com/gitlab/tristan957/TlltCp");
G_APPLICATION_CLASS(tllt_cp_application_parent_class)->startup(self);
}
存储库在这里:https://gitlab.com/tristan957/tllt-cp
程序编译顺利。我有一些未使用的变量,但没关系。在 运行 时,我看到以下警告,并且我 运行 的 GUI 与我提供的模板不同。
(tllt-cp:28723): Gtk-CRITICAL **: 22:18:00.249: Unable to load resource for composite template for type 'TlltCpWindow': The resource at “/com/gitlab/tristan957/TlltCp/tllt-cp-window.ui” does not exist
(tllt-cp:28723): Gtk-CRITICAL **: 22:18:00.249: gtk_widget_class_bind_template_child_full: assertion 'widget_class->priv->template != NULL' failed
(tllt-cp:28723): Gtk-CRITICAL **: 22:18:00.249: gtk_widget_class_bind_template_child_full: assertion 'widget_class->priv->template != NULL' failed
Initializing object
(tllt-cp:28723): Gtk-CRITICAL **: 22:18:00.249: gtk_widget_init_template: assertion 'template != NULL' failed
我不确定我错过了什么。
我需要添加以下功能
static void
tllt_cp_application_startup(GApplication *self)
{
g_resources_register(tllt_cp_get_resource());
g_application_set_resource_base_path(self, "/com/gitlab/tristan957/TlltCp");
G_APPLICATION_CLASS(tllt_cp_application_parent_class)->startup(self);
}