在 Gtk 中,什么时候使用 Glade/GtkBuilder 比使用原生代码更好?
Glade 帮助我快速开始一个项目,但我发现从长远来看很难维护,我正在考虑将其全部切换到本机代码。在什么情况下你会选择glade,什么时候你会使用原生代码?
Glade helped me get started on a project quickly, but I've found it harder to maintain in the long run, and I'm thinking about switching it all to native code. In what circumstances would you choose glade, and when would you use native code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
出于性能原因,我个人只会使用本机代码。我发现使用 gtkbuilder 更容易工作。你用过glade或者gtkbuilder吗?在 Glade 3 中,gtkbuilder 格式易于使用且易于布局和设计。此外,gtkbuilder 比 Glade 更容易加载小部件。
I would personally only use native code for performance reasons. I find it much easier to work with gtkbuilder. Have you used glade or gtkbuilder? With Glade 3, gtkbuilder format is easy to use and easy to layout and design. Also, gtkbuilder is easier to load widgets from than glade was.
如果通过本机代码您的意思是“直接 GTK 调用来构建 ui”,那么我会出于以下几个原因切换到它:
upd 的向后兼容性:而且我仍在使用有代码生成功能的glade2.x(对其进行修补以针对最新的 gtk2 进行编译)。它确实有助于快速入门“从代码构建 gui”,并且适用于旧的和新的 GTK 版本。虽然我担心移植到 gtk3 时会遇到一些麻烦:)
而且我从不选择 gtkbuilder 而不是其他替代品,因为它在(仍然广泛的)较旧的 GTK 版本中不可用.. 不知道我是否会切换到它。也许当gtk3出来的时候。
if by native code you mean "direct GTK calls to build ui", then i'd switch to it for several reasons:
upd: also i'm still using glade2.x which has code generation (patched it to compile against latest gtk2). it really helps to get quickstart on "gui build from code", and works with both ancient and newer GTK versions. though i'm afraid i will have some troubles porting to gtk3 :)
and i never choose gtkbuilder over other alternatives, 'cause it is not available in (still widespread) older GTK versions.. dunno if i'll ever switch to it.. maybe when gtk3 comes out.