Reputation: 1107
Running through chapter 10's tutorial code in the GTK+ book, I've run into the following inconsistency between glade and the interpreted output. What it looks like to me is that the toolbar (which is the 1st element in a vertically aligned box) is set to expand, but I specifically disabled that and instead enabled it for the GtkTreeView
, which is the 3rd element in that same vbox.
Glade:
App:
This is the relevant 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>
Which is being loaded by this simple 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;
}
I also get the following error when the application is run:
(browser:4672): Gtk-CRITICAL **: gtk_application_get_menubar: assertion 'GTK_IS_APPLICATION (application)' failed
Any hints as to what's going on here on either one?
Upvotes: 0
Views: 449
Reputation: 1107
Well, that was silly. As anyone reading now can probably see, I managed to add a 123 pixel bottom margin without noticing somehow. This was my first time using Glade and I was a little tired, so I was quick to panic.
Anyway, thanks to ptomato and drahnr for pointing me in the right directions.
Upvotes: 1