我正在尝试使用 GtkAda 创建一个应用程序,并且需要用户从他的 PC 中选择一个文件。但是,我发现没有办法在不导致此错误的情况下创建文件选择器:引发 PROGRAM_ERROR : unhandled signal。
使用 Glade 3.22.1
我尝试创建一个文件选择器按钮并将其链接到文件选择器对话框。它会导致同样的错误。
没有林间空地
我尝试在 GPS 中创建文件选择器对话框和文件选择器按钮,但同样的错误。
然后我找到了 Gtkada.File_Selection 包。它的描述说它自己处理信号并且只需要一个功能。可悲的是,它导致了同样的致命错误。
我正在开发 Fedora 29。GtkAda 2018 版、GPS 2018 和 GNAT 8.3.1。
Log_Filter_Handlers.ads
with Gtkada.File_Selection; use Gtkada.File_Selection;
package Log_Filter_Handlers is
Retour : Unbounded_String;
procedure Button_Select_File_Clicked
(Self : access Gtk_Button_Record'Class);
end Log_Filter_Handlers;
Log_Filter_Handlers.adb
procedure Button_Select_File_Clicked
(Self : access Gtk_Button_Record'Class) is
begin
Retour := To_Unbounded_String
(File_Selection_Dialog (Title => "Select your file",
Default_Dir => "",
Dir_Only => False,
Must_Exist => True) );
end Button_Select_File_Clicked;
Gtkada-File_Selection.ads
package Gtkada.File_Selection is
function File_Selection_Dialog
(Title : Glib.UTF8_String := "Select File";
Default_Dir : String := "";
Dir_Only : Boolean := False;
Must_Exist : Boolean := False) return String;
end Gtkada.File_Selection;
一旦应用程序创建了文件选择器小部件(无论是对话框还是按钮),在这种情况下通过调用 Button_Select_File_Clicked。它立即导致此错误:
raised PROGRAM_ERROR : unhandled signal
我也有一些警告
Gtk-Message: 10:43:33.615: Failed to load module "pk-gtk-module"
Gtk-Message: 10:43:33.615: Failed to load module "canberra-gtk-module"
Gtk-Message: 10:43:33.616: Failed to load module "pk-gtk-module"
Gtk-Message: 10:43:33.616: Failed to load module "canberra-gtk-module"
Fontconfig warning: "/home/bob/Applications/Gnat_IDE/Gnat-community/etc/fonts/fonts.conf", line 86: unknown element "blank"
(log_filter_main:24417): Gtk-WARNING **: 10:43:33.841: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
谢谢你。