在the GTK+ book中运行第10章的教程代码,我遇到了glade和解释输出之间的以下不一致。它看起来像我的工具栏(它是垂直对齐框中的第一个元素)设置为展开,但我特别禁用了它,而是为GtkTreeView
启用了它,这是第3个元素。同样的vbox。
沼地:
应用:
这是相关的Glade XML
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
[...]
<object class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">123</property>
<property name="toolbar_style">both</property>
<property name="show_arrow">False</property>
<property name="icon_size">2</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
[...]
</interface>
这个简单的main()
加载了哪个:
void on_back_clicked(GtkToolButton *button);
void on_forward_clicked(GtkToolButton *button);
void on_up_clicked(GtkToolButton *button);
void on_refresh_clicked(GtkToolButton *button);
void on_home_clicked(GtkToolButton *button);
void on_delete_clicked(GtkToolButton *button);
void on_information_clicked(GtkToolButton *button);
void on_go_clicked(GtkToolButton *button);
void on_location_activate(GtkEntry *entry);
void on_row_activated(GtkTreeView *treeview, GtkTreePath *treepath, GtkTreeViewColumn *column);
int main(int argc, char *argv[])
{
GtkWidget *window;
GtkBuilder *builder;
gtk_init(&argc, &argv);
builder = gtk_builder_new_from_file("browser.glade");
window = GTK_WIDGET(gtk_builder_get_object(builder, "applicationwindow1"));
gtk_builder_connect_signals(builder, NULL);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
运行应用程序时,我也收到以下错误:
(browser:4672): Gtk-CRITICAL **: gtk_application_get_menubar: assertion 'GTK_IS_APPLICATION (application)' failed
任何暗示这里发生了什么?