I have already a GTK+ application. There are a few widgets: GtkWindow, GtkTreeView, GtkListStore. All user interface was created in Glade.
int main( int argc, char **argv )
{
GtkBuilder *builder;
GtkWidget *topWindow;
GtkTreeView *treeView;
GtkListStore *treeStore;
GError *error = NULL;
gtk_init( &argc, &argv );
builder = gtk_builder_new();
if( ! gtk_builder_add_from_file( builder, UI_FILE, &error ) )
{
g_warning( "%s", error->message );
g_free( error );
return( 1 );
}
topWindow = GTK_WIDGET(gtk_builder_get_object(builder, "topWindow"));
treeStore = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststore"));
treeView = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview"));
entry1 = GTK_ENTRY(gtk_builder_get_object(builder, "entry1"));
entry2 = GTK_ENTRY(gtk_builder_get_object(builder, "entry2"));
entry3 = GTK_ENTRY(gtk_builder_get_object(builder, "entry3"));
gtk_builder_connect_signals (builder, NULL);
g_object_unref( G_OBJECT( builder ) );
gtk_widget_show( topWindow );
gtk_main();
return( 0 );
}
The compilation is successful:
igor@igor-desktop:~/proj/TreeView_example$ make
gcc -Wall -g `pkg-config --cflags gtk+-2.0 gmodule-2.0` -c charter.c
gcc `pkg-config --libs gtk+-2.0 gmodule-2.0` charter.o -o charter
When I run the application, I get some warnings:
(charter:3728): GLib-GObject-WARNING **: value "466" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
(charter:3728): GLib-GObject-WARNING **: value "44" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
(charter:3728): GLib-GObject-WARNING **: value "466" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
(charter:3728): GLib-GObject-WARNING **: value "466" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
(charter:3728): GLib-GObject-WARNING **: value "44" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
(charter:3728): GLib-GObject-WARNING **: value "44" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
(charter:3728): GLib-GObject-WARNING **: value "466" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
(charter:3728): GLib-GObject-WARNING **: value "466" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
(charter:3728): GLib-GObject-WARNING **: value "44" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
(charter:3728): GLib-GObject-WARNING **: value "44" of type `gint' is invalid or out of range for property `xalign' of type `gfloat'
This is a part of Glade XML file, which contains the description of GtkTreeView:
<object class="GtkTreeView" id="treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">liststore</property>
<property name="search_column">2</property>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="title">Имя</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="xalign">0</attribute>
<attribute name="sensitive">0</attribute>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<property name="title">Икс</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<property name="title">Игрек</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes"><b>TreeView</b></property>
<property name="use_markup">True</property>
</object>
</child>
</object>
Can you explain why I get the warnings?