[Glade-users] Problem with GtkTextView and GtkTextBuffer

On Tue, Jan 24, 2012 at 9:29 PM, Manuel Ferrero <mferrero at reer.it> wrote:
Il 24/01/2012 12.54, Tristan Van Berkom ha scritto:

typedef struct _ChData ChData;
struct _ChData
? ?GtkWidget *window;
? ?GtkWidget *connect_button;
? ?GtkWidget *serial_data;

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

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

serial_buffer_ptr =

I think what you need is data->serial_data, i.e. you dont pass the
structure to the callbacks but a pointer to a structure.

No, serial_data is a pointer to a GtkWidget.
If I use the -> operator I get an error in compilation:
error: invalid type argument of '->' (have 'ChData')

Start with:

ChData *data = g_slice_new (...);

... you have a pointer to a ChData struct ...

Then, pass the pointer to gtk_builder_connect_signals (builder, data);
its a pointer that you must pass ...

Then, of course you need to prototype your callback correctly
(look up the documentation to know what is the signature for
the exact signal you are connecting to):

static void
on_something_in_the_gui_happened (GtkSomething *something,
                                                              ChData *data);

The trailing user data argument must be typed as a *pointer*, you cannot pass
structs as user data, you need to pass the pointer reference to
and take a pointer reference as the user data pointer.

So then you must access the members with 'data->struct_member'


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
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.

Glade-users maillist ?- ?Glade-users at lists.ximian.com

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