Constructing GtkComboBoxEntry with GtkBuilder
- From: Tadej Borovšak <tadeboro gmail com>
- To: gtk-list <gtk-list gnome org>
- Subject: Constructing GtkComboBoxEntry with GtkBuilder
- Date: Tue, 16 Jun 2009 00:04:39 +0200
Hello everyone.
I noticed that constructing GtkComboBoxEntry from GtkBuilder's UI file
fails miserably. At construction time, my sample application reports
two errors:
(combo.exe:3388): Gtk-CRITICAL **: gtk_tree_model_get_n_columns:
assertion `GTK_IS_TREE_MODEL (tree_model)' failed
(combo.exe:3388): Gtk-CRITICAL **:
gtk_combo_box_entry_set_text_column: assertion `text_column <
gtk_tree_model_get_n_columns (gtk_combo_box_get_model (GTK_COMBO_BOX
(entry_box)))' failed
And when I try to select something, pop-up is blank (the size is
right, but there is no text) and selection a row produces following
error:
(combo.exe:3388): Gtk-CRITICAL **: gtk_entry_set_text: assertion 'text
!= NULL' failed
I tested this on Windows XP and linux with gtk-2.16.1 installed, UI
file has been produced by glade3-3.6.4. Should I report a bug about
this or am I missing something here? If this is a bug, under which
component do I report it - gtk, GtkBuilder, Glade?
Thanks in advance.
---------- combo.c ----------
#include <gtk/gtk.h>
#define GET_WIDGET( builder, name ) \
GTK_WIDGET( gtk_builder_get_object( builder, name ) )
int
main( int argc,
char **argv )
{
GtkBuilder *builder;
GtkWidget *window;
GError *error = NULL;
gtk_init( &argc, &argv );
builder = gtk_builder_new();
if( ! gtk_builder_add_from_file( builder, "combo.builder", &error ) )
{
g_print( "Error: %s\n", error->message );
g_error_free( error );
return( 1 );
}
window = GET_WIDGET( builder, "window1" );
gtk_builder_connect_signals( builder, NULL );
g_object_unref( G_OBJECT( builder ) );
gtk_widget_show_all( window );
gtk_main();
return( 0 );
}
---------- combo.c ----------
---------- combo.builder ----------
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name string -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Line 1</col>
</row>
<row>
<col id="0" translatable="yes">Line 2</col>
</row>
</data>
</object>
<object class="GtkWindow" id="window1">
<property name="border_width">6</property>
<signal name="destroy" handler="gtk_main_quit"/>
<child>
<object class="GtkComboBoxEntry" id="comboboxentry1">
<property name="visible">True</property>
<property name="model">liststore1</property>
<property name="text_column">0</property>
</object>
</child>
</object>
</interface>
---------- combo.builder ----------
--
Tadej Borovšak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]