[Glade-users] Problem with GtkTextView and GtkTextBuffer



I have a problem managing the GtkTextView widget in an application I 
built with Glade3.

// I define a structure with all the data I'll need in my callback 
functions:

typedef struct _ChData ChData;
struct _ChData
{
     GtkWidget *window;
     GtkWidget *connect_button;
     GtkWidget *serial_data;
};


// In my main I allocate the struct data and I get the objects from the 
glade file:
[...]
ChData *data;
GtkBuilder *builder_handler;

data = g_slice_new(ChData);

builder_handler = gtk_builder_new();
gtk_builder_add_from_file(builder_handler, GUI_XML_FILENAME, NULL);

data->window = GTK_WIDGET(gtk_builder_get_object(builder_handler, 
"window"));
data->connect_button = 
GTK_WIDGET(gtk_builder_get_object(builder_handler, "connect_button"));
data->serial_data = GTK_WIDGET(gtk_builder_get_object(builder_handler, 
"serial_data"));


// Then I connect the signals, show the UI and go in the main loop

gtk_builder_connect_signals(builder_handler, data);

gtk_widget_show(data->window);

gtk_main();



// Now, in one callback function I'd like to write some text in the text 
area

// I get the buffer from the GtkTextView widget
GtkTextBuffer *serial_buffer_ptr;

serial_buffer_ptr = 
gtk_text_view_get_buffer(GTK_TEXT_VIEW(data.serial_data));


// but this line triggers the following error:
GLib-GObject-WARNING **: invalid uninstantiatable type `<unknown>' in 
cast to `GtkTextView'

Where am I doing wrong?
-- 
Regards,
Manuel Ferrero
R&D department

Reer SpA        
Tel.  +39 011 2482215
Fax. +39 011 859867

L'utilizzo non autorizzato del presente messaggio e' vietato e potrebbe costituire reato.
Se il presente messaggio non e' a Lei indirizzato, il suo contenuto non deve essere considerato
come trasmesso o autorizzato dalla Reer SpA; in tale caso Le saremmo grati se, via e-mail,
ce ne comunicasse l'errata ricezione.

The unauthorized use of this e-mail is prohibited and could constitute an offence.
If you are not the intended recipient of this message its contents shall be understood as neither
given nor endorsed by Reer SpA. Please notify Reer SpA by e-mail immediately in that case.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]